@overmap-ai/forms 1.0.34 → 1.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/form/builder/list/sectionSerialization.d.ts +6 -0
- package/dist/form/schema/FieldSchema.d.ts +5 -0
- package/dist/forms.js +2920 -2731
- package/dist/forms.umd.cjs +70 -55
- package/package.json +2 -1
package/dist/forms.umd.cjs
CHANGED
|
@@ -1,232 +1,247 @@
|
|
|
1
|
-
(function(I,
|
|
1
|
+
(function(I,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("react/jsx-runtime"),require("@overmap-ai/blocks"),require("class-variance-authority"),require("react"),require("@xyflow/react/dist/style.css"),require("@xyflow/react"),require("formik"),require("graphology-dag"),require("uuid"),require("@hello-pangea/dnd"),require("file-saver"),require("react-zxing"),require("graphology"),require("graphology-traversal"),require("lodash.get"),require("@dagrejs/dagre"),require("lodash.set")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@overmap-ai/blocks","class-variance-authority","react","@xyflow/react/dist/style.css","@xyflow/react","formik","graphology-dag","uuid","@hello-pangea/dnd","file-saver","react-zxing","graphology","graphology-traversal","lodash.get","@dagrejs/dagre","lodash.set"],f):(I=typeof globalThis<"u"?globalThis:I||self,f(I.forms={},I.jsxRuntime,I.blocks,I.classVarianceAuthority,I.React,null,I.react,I.formik,I.graphologyDag,I.uuid,I.dnd,I.fileSaver,I.reactZxing,I.graphology,I.graphologyTraversal,I.get,I.Dagre,I.set))})(this,function(I,f,v,lr,A,_f,de,Re,qi,H,An,Wi,ji,Ds,Ms,En,Yi,Ps){"use strict";var wf=Object.defineProperty;var mf=(I,f,v)=>f in I?wf(I,f,{enumerable:!0,configurable:!0,writable:!0,value:v}):I[f]=v;var b=(I,f,v)=>mf(I,typeof f!="symbol"?f+"":f,v);/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const Fs=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Vs=r=>r.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Zi=r=>{const e=Vs(r);return e.charAt(0).toUpperCase()+e.slice(1)},Ki=(...r)=>r.filter((e,t,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===t).join(" ").trim(),Bs=r=>{for(const e in r)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
|
|
7
7
|
* @license lucide-react v0.542.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/var
|
|
11
|
+
*/var Ls={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
12
12
|
* @license lucide-react v0.542.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/const zs=A.forwardRef(({color:r="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:n,className:i="",children:a,iconNode:o,...s},l)=>A.createElement("svg",{ref:l,...Ls,width:e,height:e,stroke:r,strokeWidth:n?Number(t)*24/Number(e):t,className:Ki("lucide",i),...!a&&!Bs(s)&&{"aria-hidden":"true"},...s},[...o.map(([u,c])=>A.createElement(u,c)),...Array.isArray(a)?a:[a]]));/**
|
|
17
17
|
* @license lucide-react v0.542.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const
|
|
21
|
+
*/const G=(r,e)=>{const t=A.forwardRef(({className:n,...i},a)=>A.createElement(zs,{ref:a,iconNode:e,className:Ki(`lucide-${Fs(Zi(r))}`,`lucide-${r}`,n),...i}));return t.displayName=Zi(r),t};/**
|
|
22
22
|
* @license lucide-react v0.542.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
25
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const
|
|
26
|
+
*/const ks=G("align-justify",[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]);/**
|
|
27
27
|
* @license lucide-react v0.542.0 - ISC
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
30
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const
|
|
31
|
+
*/const Rs=G("arrow-down-up",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);/**
|
|
32
32
|
* @license lucide-react v0.542.0 - ISC
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the ISC license.
|
|
35
35
|
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const
|
|
36
|
+
*/const Us=G("arrow-left-right",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);/**
|
|
37
37
|
* @license lucide-react v0.542.0 - ISC
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the ISC license.
|
|
40
40
|
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const
|
|
41
|
+
*/const Hs=G("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
|
|
42
42
|
* @license lucide-react v0.542.0 - ISC
|
|
43
43
|
*
|
|
44
44
|
* This source code is licensed under the ISC license.
|
|
45
45
|
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const Xe=
|
|
46
|
+
*/const Xe=G("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
47
47
|
* @license lucide-react v0.542.0 - ISC
|
|
48
48
|
*
|
|
49
49
|
* This source code is licensed under the ISC license.
|
|
50
50
|
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const In=
|
|
51
|
+
*/const In=G("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
52
52
|
* @license lucide-react v0.542.0 - ISC
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the ISC license.
|
|
55
55
|
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const
|
|
56
|
+
*/const Gs=G("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
57
57
|
* @license lucide-react v0.542.0 - ISC
|
|
58
58
|
*
|
|
59
59
|
* This source code is licensed under the ISC license.
|
|
60
60
|
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const
|
|
61
|
+
*/const Xs=G("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
|
|
62
62
|
* @license lucide-react v0.542.0 - ISC
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the ISC license.
|
|
65
65
|
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/const
|
|
66
|
+
*/const $s=G("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
67
67
|
* @license lucide-react v0.542.0 - ISC
|
|
68
68
|
*
|
|
69
69
|
* This source code is licensed under the ISC license.
|
|
70
70
|
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/const
|
|
71
|
+
*/const qs=G("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
|
72
72
|
* @license lucide-react v0.542.0 - ISC
|
|
73
73
|
*
|
|
74
74
|
* This source code is licensed under the ISC license.
|
|
75
75
|
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/const
|
|
76
|
+
*/const Qi=G("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
77
77
|
* @license lucide-react v0.542.0 - ISC
|
|
78
78
|
*
|
|
79
79
|
* This source code is licensed under the ISC license.
|
|
80
80
|
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/const
|
|
81
|
+
*/const Ji=G("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]);/**
|
|
82
82
|
* @license lucide-react v0.542.0 - ISC
|
|
83
83
|
*
|
|
84
84
|
* This source code is licensed under the ISC license.
|
|
85
85
|
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const
|
|
86
|
+
*/const Ws=G("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
|
|
87
87
|
* @license lucide-react v0.542.0 - ISC
|
|
88
88
|
*
|
|
89
89
|
* This source code is licensed under the ISC license.
|
|
90
90
|
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/const
|
|
91
|
+
*/const js=G("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]);/**
|
|
92
92
|
* @license lucide-react v0.542.0 - ISC
|
|
93
93
|
*
|
|
94
94
|
* This source code is licensed under the ISC license.
|
|
95
95
|
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/const
|
|
96
|
+
*/const Ys=G("copy-check",[["path",{d:"m12 15 2 2 4-4",key:"2c609p"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
97
97
|
* @license lucide-react v0.542.0 - ISC
|
|
98
98
|
*
|
|
99
99
|
* This source code is licensed under the ISC license.
|
|
100
100
|
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
-
*/const
|
|
101
|
+
*/const Hr=G("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
102
102
|
* @license lucide-react v0.542.0 - ISC
|
|
103
103
|
*
|
|
104
104
|
* This source code is licensed under the ISC license.
|
|
105
105
|
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
-
*/const
|
|
106
|
+
*/const ea=G("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);/**
|
|
107
107
|
* @license lucide-react v0.542.0 - ISC
|
|
108
108
|
*
|
|
109
109
|
* This source code is licensed under the ISC license.
|
|
110
110
|
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
-
*/const
|
|
111
|
+
*/const Zs=G("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
|
|
112
112
|
* @license lucide-react v0.542.0 - ISC
|
|
113
113
|
*
|
|
114
114
|
* This source code is licensed under the ISC license.
|
|
115
115
|
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
-
*/const
|
|
116
|
+
*/const Ks=G("file-question-mark",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/**
|
|
117
117
|
* @license lucide-react v0.542.0 - ISC
|
|
118
118
|
*
|
|
119
119
|
* This source code is licensed under the ISC license.
|
|
120
120
|
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
-
*/const
|
|
121
|
+
*/const Qs=G("file-warning",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
122
122
|
* @license lucide-react v0.542.0 - ISC
|
|
123
123
|
*
|
|
124
124
|
* This source code is licensed under the ISC license.
|
|
125
125
|
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
-
*/const
|
|
126
|
+
*/const ta=G("file",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
|
|
127
127
|
* @license lucide-react v0.542.0 - ISC
|
|
128
128
|
*
|
|
129
129
|
* This source code is licensed under the ISC license.
|
|
130
130
|
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
-
*/const
|
|
131
|
+
*/const Js=G("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
|
|
132
132
|
* @license lucide-react v0.542.0 - ISC
|
|
133
133
|
*
|
|
134
134
|
* This source code is licensed under the ISC license.
|
|
135
135
|
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
-
*/const
|
|
136
|
+
*/const el=G("hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
|
|
137
137
|
* @license lucide-react v0.542.0 - ISC
|
|
138
138
|
*
|
|
139
139
|
* This source code is licensed under the ISC license.
|
|
140
140
|
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
-
*/const
|
|
141
|
+
*/const tl=G("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
|
|
142
142
|
* @license lucide-react v0.542.0 - ISC
|
|
143
143
|
*
|
|
144
144
|
* This source code is licensed under the ISC license.
|
|
145
145
|
* See the LICENSE file in the root directory of this source tree.
|
|
146
|
-
*/const
|
|
146
|
+
*/const rl=G("layout-panel-top",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]]);/**
|
|
147
147
|
* @license lucide-react v0.542.0 - ISC
|
|
148
148
|
*
|
|
149
149
|
* This source code is licensed under the ISC license.
|
|
150
150
|
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
-
*/const
|
|
151
|
+
*/const nl=G("list-checks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
152
152
|
* @license lucide-react v0.542.0 - ISC
|
|
153
153
|
*
|
|
154
154
|
* This source code is licensed under the ISC license.
|
|
155
155
|
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
-
*/const
|
|
156
|
+
*/const il=G("list-todo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
157
157
|
* @license lucide-react v0.542.0 - ISC
|
|
158
158
|
*
|
|
159
159
|
* This source code is licensed under the ISC license.
|
|
160
160
|
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
-
*/const
|
|
161
|
+
*/const al=G("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
|
|
162
162
|
* @license lucide-react v0.542.0 - ISC
|
|
163
163
|
*
|
|
164
164
|
* This source code is licensed under the ISC license.
|
|
165
165
|
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
-
*/const
|
|
166
|
+
*/const ol=G("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/**
|
|
167
167
|
* @license lucide-react v0.542.0 - ISC
|
|
168
168
|
*
|
|
169
169
|
* This source code is licensed under the ISC license.
|
|
170
170
|
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
-
*/const
|
|
171
|
+
*/const Gr=G("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
|
|
172
172
|
* @license lucide-react v0.542.0 - ISC
|
|
173
173
|
*
|
|
174
174
|
* This source code is licensed under the ISC license.
|
|
175
175
|
* See the LICENSE file in the root directory of this source tree.
|
|
176
|
-
*/const
|
|
176
|
+
*/const ra=G("move-down",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/**
|
|
177
177
|
* @license lucide-react v0.542.0 - ISC
|
|
178
178
|
*
|
|
179
179
|
* This source code is licensed under the ISC license.
|
|
180
180
|
* See the LICENSE file in the root directory of this source tree.
|
|
181
|
-
*/const
|
|
181
|
+
*/const na=G("move-up",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/**
|
|
182
182
|
* @license lucide-react v0.542.0 - ISC
|
|
183
183
|
*
|
|
184
184
|
* This source code is licensed under the ISC license.
|
|
185
185
|
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
-
*/const
|
|
186
|
+
*/const Ze=G("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
187
187
|
* @license lucide-react v0.542.0 - ISC
|
|
188
188
|
*
|
|
189
189
|
* This source code is licensed under the ISC license.
|
|
190
190
|
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
-
*/const
|
|
191
|
+
*/const sl=G("rectangle-ellipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/**
|
|
192
192
|
* @license lucide-react v0.542.0 - ISC
|
|
193
193
|
*
|
|
194
194
|
* This source code is licensed under the ISC license.
|
|
195
195
|
* See the LICENSE file in the root directory of this source tree.
|
|
196
|
-
*/const
|
|
196
|
+
*/const ll=G("scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/**
|
|
197
197
|
* @license lucide-react v0.542.0 - ISC
|
|
198
198
|
*
|
|
199
199
|
* This source code is licensed under the ISC license.
|
|
200
200
|
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
-
*/const
|
|
201
|
+
*/const ul=G("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
202
202
|
* @license lucide-react v0.542.0 - ISC
|
|
203
203
|
*
|
|
204
204
|
* This source code is licensed under the ISC license.
|
|
205
205
|
* See the LICENSE file in the root directory of this source tree.
|
|
206
|
-
*/const
|
|
206
|
+
*/const cl=G("square-check",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
207
207
|
* @license lucide-react v0.542.0 - ISC
|
|
208
208
|
*
|
|
209
209
|
* This source code is licensed under the ISC license.
|
|
210
210
|
* See the LICENSE file in the root directory of this source tree.
|
|
211
|
-
*/const
|
|
211
|
+
*/const dl=G("square-dashed",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}]]);/**
|
|
212
212
|
* @license lucide-react v0.542.0 - ISC
|
|
213
213
|
*
|
|
214
214
|
* This source code is licensed under the ISC license.
|
|
215
215
|
* See the LICENSE file in the root directory of this source tree.
|
|
216
|
-
*/const
|
|
216
|
+
*/const ia=G("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
|
|
217
217
|
* @license lucide-react v0.542.0 - ISC
|
|
218
218
|
*
|
|
219
219
|
* This source code is licensed under the ISC license.
|
|
220
220
|
* See the LICENSE file in the root directory of this source tree.
|
|
221
|
-
*/const nt=X("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),On=A.memo(A.forwardRef((r,e)=>{const{file:t,className:n,error:i,rightSlot:a,...o}=r;return d.jsxs(v.Card,{className:sr.cx(n,"flex w-full items-center gap-2 text-sm"),ref:e,...o,children:[i?d.jsx(v.LuIcon,{icon:Ws}):d.jsx(v.LuIcon,{icon:ta,color:"var(--base-a11)"}),i?d.jsx(v.Text,{accentColor:"danger",className:"truncate",children:i}):t?d.jsx(v.Text,{className:"truncate",children:t.name}):d.jsx("div",{className:"flex w-full justify-center",children:d.jsx(v.Spinner,{})}),a]})}));On.displayName="FileCard";const Ot={danger:"danger",warning:"warning",info:"base",success:"success"};function ht(r){return Array.isArray(r)?r.every(e=>typeof e=="string"):!1}class lr{constructor(){b(this,"observers",new Set)}notify(e){for(const t of this.observers)t(e)}observe(e){return this.observers.add(e),()=>{this.observers.delete(e)}}}class bn extends lr{constructor(t){const{identifier:n}=t;super();b(this,"identifier");this.identifier=n}getOptions(){return{identifier:this.identifier}}setOptions(t){this.identifier=t.identifier??this.identifier,this.notify(this)}serialize(){return{type:this.type,identifier:this.identifier}}}class Ve extends bn{constructor(t){const{label:n,description:i=null,required:a,image:o,...s}=t;super(s);b(this,"label");b(this,"description");b(this,"required");b(this,"image");b(this,"onlyValidateAfterTouched",!0);this.label=n,this.description=i,this.required=a,this.image=o}getError(t){if(this.required&&this.isValueBlank(t))return"This field is required.";for(const n of this.getFieldValidators()){const i=n(t);if(i)return i}}serialize(){return{...super.serialize(),label:this.label,description:this.description,required:this.required,image:this.image}}getOptions(){return{...super.getOptions(),label:this.label,description:this.description,required:this.required,image:this.image}}setOptions(t){const{label:n,description:i=null,required:a,image:o,...s}=t;this.label=n??this.label,this.description=i??this.description,this.required=a??this.required,this.image=o??this.image,super.setOptions(s)}isValueBlank(t){return this.areValuesEqual(t,this.blankValue())}getFieldValidators(){return[]}}b(Ve,"fieldTypeName"),b(Ve,"fieldTypeDescription");const Xr=r=>{const{helpText:e,children:t,severity:n}=r,i=n?Ot[n]:"base";return d.jsxs("div",{className:"flex flex-col gap-1",children:[t,!!e&&d.jsx(v.Text,{accentColor:i,size:"xs",children:e})]})},aa=A.createContext(()=>{throw new Error("No ImageViewerProvider found")}),qr=()=>A.useContext(aa),Nn=A.memo(r=>{const{file:e,onClose:t}=r,n=A.useRef(null),i=A.useCallback(()=>{var s;if(!n.current)return;const o=document.createElement("canvas");o.width=n.current.width,o.height=n.current.height,(s=o.getContext("2d"))==null||s.drawImage(n.current,0,0,n.current.width,n.current.height),o.toBlob(l=>{l&&navigator.clipboard.write([new ClipboardItem({"image/png":l})])},"image/png")},[]),a=A.useCallback(()=>{ji.saveAs(e,e.name)},[e]);return d.jsx(v.Overlay.Root,{open:!0,onOpenChange:t,children:d.jsxs(v.Overlay.Content,{onOpenAutoFocus:o=>o.preventDefault(),children:[d.jsxs(v.ButtonGroup,{className:"flex gap-2 items-center top-0 absolute right-0 p-2",accentColor:"base",variant:"ghost",children:[d.jsxs(v.Tooltip.Root,{children:[d.jsx(v.Tooltip.Trigger,{asChild:!0,children:d.jsx(v.IconButton,{onClick:i,"aria-label":"copy to clipboard",children:d.jsx(v.LuIcon,{icon:Hr})})}),d.jsx(v.Tooltip.Content,{size:"sm",children:"Copy"})]}),d.jsxs(v.Tooltip.Root,{children:[d.jsx(v.Tooltip.Trigger,{asChild:!0,children:d.jsx(v.IconButton,{onClick:a,"aria-label":"download",children:d.jsx(v.LuIcon,{icon:ea})})}),d.jsx(v.Tooltip.Content,{size:"sm",children:"Download"})]}),d.jsx(v.Separator,{orientation:"vertical",size:"sm"}),d.jsx(v.Overlay.Close,{asChild:!0,children:d.jsx(v.IconButton,{onClick:t,"aria-label":"close",children:d.jsx(v.LuIcon,{icon:nt})})})]}),d.jsx("figure",{className:"size-full overflow-hidden p-4 flex justify-center items-center",children:d.jsx("img",{ref:n,className:"max-w-full max-h-full",src:URL.createObjectURL(e),alt:e.name})})]})})});Nn.displayName="ImageViewer";const oa=A.memo(r=>{const{children:e}=r,[t,n]=A.useState(null),i=A.useCallback(()=>{n(null)},[]),a=A.useCallback(s=>{n(s(i))},[i]),o=A.useCallback(()=>{t&&(t.onClose&&t.onClose(),i())},[i,t]);return d.jsxs(aa.Provider,{value:a,children:[e,t&&d.jsx(Nn,{file:t.file,onClose:o})]})});oa.displayName="FileViewerProvider";const Se=A.memo(r=>{const{className:e,label:t,children:n,severity:i,inputId:a,labelId:o,image:s}=r,[l,u]=A.useState(void 0),c=qr(),f=i?Ot[i]:"base";A.useEffect(()=>{s instanceof Promise?s.then(u).catch(console.error):u(s)},[s]);const p=l?URL.createObjectURL(l):void 0,h=A.useCallback(()=>{l&&c(()=>({file:l}))},[c,l]);return d.jsxs("div",{className:"flex flex-col gap-1",children:[l&&d.jsx("img",{className:"h-[100px] w-full min-w-[300px] cursor-pointer rounded-md object-cover",src:p,alt:l.name,onClick:h}),!!t&&d.jsx("label",{className:sr.cx(e,"w-max max-w-full"),htmlFor:a,children:d.jsx(v.Text,{accentColor:f,size:"sm",id:o,className:"text-wrap",children:t})}),n]})}),Oe=r=>{const{children:e,...t}=r;return d.jsx(Xr,{...t,children:e})},ul=(r,e)=>A.useMemo(()=>!e||!r?null:r.render(e),[r,e]),ur=(r,e)=>d.jsx("div",{className:"flex flex-col gap-4",children:r.map(t=>d.jsx(A.Fragment,{children:t.render(e)},t.identifier))}),be=r=>{const{field:e,size:t,showInputOnly:n,onValuesChange:i,...a}=r,[o,s,l]=Re.useField(e.identifier),{touched:u}=s,c=s.error??e.description,f=s.error?"danger":void 0,p=e.identifier,h=`${p}-label`,g=e.required?`${e.label} *`:e.label,x=A.useMemo(()=>({...o,onChange:w=>{l.setValue(w,!1),i==null||i(e.identifier,w),(u||!e.onlyValidateAfterTouched)&&l.setError(e.getError(w))},onBlur:w=>{l.setTouched(!0,!1),l.setError(e.getError(w))}}),[e,o,l,i,u]);return[{helpText:c,size:t,severity:f,inputId:p,labelId:h,label:g,showInputOnly:n,fieldProps:x,helpers:l,field:e,touched:u},{...a,"aria-labelledby":h}]},Tn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),f=a?null:s,p=a?"":l,{value:h,name:g,onChange:x,onBlur:C}=u,m=`${e}-droppable`,[w,_]=A.useState(""),[E,O]=A.useState(""),T=E||f,D=A.useCallback(R=>{x(R),C(R)},[x,C]),M=A.useCallback(R=>{h&&h.findIndex(Z=>Z===R.target.value.trim())>=0?O("All options must be unique"):R.target.value?O(""):O("Option cannot be empty"),_(R.target.value)},[_,h]),P=A.useCallback(()=>{if(E)return;if(!w.trim()){O("Option cannot be empty");return}const R=w.trim();D([...h,R]),_("")},[w,E,D,h]),V=A.useCallback(R=>{R.key==="Enter"&&(R.preventDefault(),P())},[P]),W=A.useCallback(R=>{const Z=Array.from(h);Z.splice(R,1),D(Z)},[h,D]),U=A.useCallback(R=>{if(!R.destination)return;const Z=R.source.index,H=R.destination.index,re=Array.from(h),[Fe]=re.splice(Z,1);re.splice(H,0,Fe),D(re)},[D,h]),J=A.useCallback(()=>{C(h)},[C,h]);return d.jsx(An.DragDropContext,{onDragEnd:U,children:d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsx(Oe,{helpText:T,severity:i,children:d.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:p,image:a?void 0:o.image,children:(!c||h.length===0)&&d.jsxs("div",{className:"flex gap-2",children:[d.jsx(v.Input.Root,{className:"grow",accentColor:"base",variant:"surface",size:"sm",children:d.jsx(v.Input.Field,{value:w,onChange:M,onKeyDown:V,id:e,placeholder:o.placeholder,onBlur:J,name:g,disabled:c})}),d.jsx(v.IconButton,{size:"sm",accentColor:"base",variant:"soft",type:"button","aria-label":"Add option",disabled:!!E||c,onClick:P,children:d.jsx(v.LuIcon,{icon:Ye})})]})})}),h.length!==0&&d.jsx(An.Droppable,{droppableId:m,children:R=>d.jsxs("div",{className:"flex flex-col gap-1",...R.droppableProps,ref:R.innerRef,children:[h.map((Z,H)=>d.jsx(An.Draggable,{draggableId:`${Z}-draggable`,index:H,isDragDisabled:c,children:({draggableProps:re,dragHandleProps:Fe,innerRef:Ur})=>d.jsxs(v.Badge,{...Fe,...re,ref:Ur,className:"flex items-center justify-between gap-2",accentColor:"base",size:"sm",variant:"soft",children:[d.jsx("span",{className:"truncate",children:typeof Z=="object"&&"label"in Z?Z.label:Z}),d.jsx(v.IconButton,{size:"xs",variant:"ghost",type:"button","aria-label":"Delete option",accentColor:"base",disabled:c,onClick:()=>{W(H)},children:d.jsx(v.LuIcon,{icon:nt})})]})},`${e}-${Z}-${H}`)),R.placeholder]})})]})})});Tn.displayName="MultiStringInput";const Wt=class Wt extends Ve{constructor(t){const{minimum_length:n,maximum_length:i,placeholder:a,...o}=t;super(o);b(this,"type","multi-string");b(this,"minLength");b(this,"maxLength");b(this,"placeholder");b(this,"onlyValidateAfterTouched",!1);this.minLength=n??0,this.maxLength=i??1/0,this.placeholder=a??"Press enter to add a new option"}render(t){return d.jsx(Tn,{field:this,...t})}serialize(){return{...super.serialize(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}getOptions(){return{...super.getOptions(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}duplicate(t){return new Wt({...this.getOptions(),identifier:t})}setOptions(t){const{minimum_length:n,maximum_length:i,placeholder:a,...o}=t;this.minLength=n??this.minLength,this.maxLength=i??this.maxLength,this.placeholder=a??this.placeholder,super.setOptions(o)}serializeValue(t){return t}deserializeValue(t){return t}getFieldValidators(){const t=super.getFieldValidators();return t.push(n=>{if(Array.isArray(n)&&n.length<this.minLength)return`Must have at least ${this.minLength} options.`}),t.push(n=>{if(Array.isArray(n)&&n.length>this.maxLength)return`Must have at most ${this.maxLength} options.`}),t}static deserialize(t){return new Wt(t)}isSerializedValueValid(t){return ht(t)}isValueValid(t){return ht(t)}blankValue(){return[]}areValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}};b(Wt,"fieldTypeName","Multi-string"),b(Wt,"fieldTypeDescription","Allows the user to provide multiple unique strings.");let bt=Wt;class cr extends Ve{constructor(t){const{options:n,...i}=t;super(i);b(this,"options");b(this,"onlyValidateAfterTouched",!1);this.options=n.map(a=>(typeof a=="string"&&(a={label:a,value:a}),a))}serialize(){return{...super.serialize(),options:this.options}}getOptions(){return{...super.getOptions(),options:this.options}}setOptions(t){const{options:n,...i}=t;this.options=(n==null?void 0:n.map(a=>(typeof a=="string"&&(a={label:a,value:a}),a)))??this.options,super.setOptions(i)}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new bt({label:"Options",description:"List possible options for the user to select from.",required:!0,identifier:`${n}options`,minimum_length:2}),showDirectly:!0}]}}const Dn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),{name:f,onBlur:p,onChange:h,value:g}=u,x=a?null:s,C=a?"":l,m=A.useCallback(_=>{h(!!_),p(!!_)},[p,h]),w=A.useCallback(()=>{p(g)},[p,g]);return d.jsx(Oe,{helpText:x,severity:i,children:d.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:C,image:a?void 0:o.image,className:"items-center flex-row-reverse justify-end gap-2",children:d.jsx(v.Checkbox.Root,{id:e,name:f,checked:g??!1,onCheckedChange:m,onBlur:w,size:"sm",accentColor:"primary",variant:"surface",disabled:c,children:d.jsx(v.Checkbox.Indicator,{children:d.jsx(v.LuIcon,{icon:Xe})})})})})});Dn.displayName="BooleanInput";const jt=class jt extends Ve{constructor(t){super(t);b(this,"type","boolean");b(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}setOptions(t){super.setOptions(t)}duplicate(t){return new jt({...this.getOptions(),identifier:t})}static deserialize(t){return new jt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return d.jsx(Dn,{...t,field:this})}isSerializedValueValid(t){return typeof t=="boolean"}isValueValid(t){return typeof t=="boolean"}blankValue(){return!1}areValuesEqual(t,n){return t===n}};b(jt,"fieldTypeName","Checkbox"),b(jt,"fieldTypeDescription","Perfect for both optional and required yes/no questions.");let Nt=jt;const Mn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:f},{disabled:p}]=be(r),{name:h,onBlur:g,onChange:x,value:C}=u,m=a?null:s,w=a?"":l,[_,E]=A.useState(null);A.useEffect(()=>{E(C)},[C]);const O=A.useCallback(D=>{const M=D.target.valueAsNumber,P=isNaN(M)?null:M;E(P),(c||!o.onlyValidateAfterTouched)&&f.setError(o.getError(P))},[o,f,c]),T=A.useCallback(()=>{x(_),g(_)},[_,g,x]);return d.jsx(Oe,{helpText:m,severity:i,children:d.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:w,image:a?void 0:o.image,children:d.jsx(v.Input.Root,{accentColor:"base",variant:"surface",size:"sm",children:d.jsx(v.Input.Field,{id:e,name:h,onChange:O,onBlur:T,value:_??"",type:"number",min:o.minimum,max:o.maximum,step:o.integers?1:.1,placeholder:o.placeholder??"Enter a number",disabled:p})})})})});Mn.displayName="NumberInput";const ft=class ft extends Ve{constructor(t){const{minimum:n=Number.MIN_SAFE_INTEGER,maximum:i=Number.MAX_SAFE_INTEGER,integers:a=!1,placeholder:o,...s}=t;super(s);b(this,"type","number");b(this,"minimum");b(this,"maximum");b(this,"integers");b(this,"placeholder");this.minimum=n,this.maximum=i,this.integers=a,this.placeholder=o}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new ft({label:"Minimum",description:"Minimum value",integers:!0,required:!1,identifier:`${n}minimum`}),showDirectly:!1},{field:new ft({label:"Maximum",description:"Maximum value",integers:!0,required:!1,identifier:`${n}maximum`}),showDirectly:!1},{field:new Nt({label:"Integers",description:"Whole numbers only",required:!1,identifier:`${n}integers`}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.minimum,i=this.maximum;return typeof n=="number"&&t.push(a=>{if(typeof a=="number"&&a<n)return`Must be at least ${this.minimum}.`}),typeof i=="number"&&t.push(a=>{if(typeof a=="number"&&a>i)return`Must be at most ${this.maximum}.`}),this.integers&&t.push(a=>{if(typeof a=="number"&&!Number.isInteger(a))return"Must be a whole number."}),t}serialize(){return{...super.serialize(),minimum:this.minimum,maximum:this.maximum,integers:this.integers,placeholder:this.placeholder}}getOptions(){return{...super.getOptions(),minimum:this.minimum,maximum:this.maximum,integers:this.integers,placeholder:this.placeholder}}duplicate(t){return new ft({...this.getOptions(),identifier:t})}setOptions(t){const{minimum:n,maximum:i,integers:a,placeholder:o,...s}=t;this.minimum=n??this.minimum,this.maximum=i??this.maximum,this.integers=a??this.integers,this.placeholder=o??this.placeholder,super.setOptions(s)}static deserialize(t){return new ft(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return d.jsx(Mn,{field:this,...t})}isSerializedValueValid(t){return typeof t=="number"||t===null}isValueValid(t){return typeof t=="number"||t===null}areValuesEqual(t,n){return t===n}blankValue(){return null}};b(ft,"fieldTypeName","Number"),b(ft,"fieldTypeDescription","Allows specifying a number within a given range.");let qe=ft;const Tt=1e4;class Pn extends Ve{constructor(t){const{minLength:n,maxLength:i,placeholder:a="",...o}=t;super(o);b(this,"minLength");b(this,"maxLength");b(this,"placeholder");this.minLength=n?Math.max(n,0):void 0,this.maxLength=i?Math.max(i,0):Tt,this.placeholder=a}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new qe({label:"Minimum length",description:"Minimum number of characters",required:!1,identifier:`${n}minimum_length`,minimum:0,maximum:100,integers:!0}),showDirectly:!1},{field:new qe({label:"Maximum length",description:"Maximum number of characters",required:!1,identifier:`${n}maximum_length`,minimum:1,maximum:Tt,integers:!0}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators();return this.minLength&&t.push(n=>{if(this.minLength&&(!n||n.length<this.minLength))return!this.required&&!n?null:`Minimum ${this.minLength} character(s).`}),this.maxLength&&t.push(n=>{if(typeof n=="string"&&this.maxLength&&n.length>this.maxLength)return`Maximum ${this.maxLength} character(s).`}),t}serialize(){return{...super.serialize(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}getOptions(){return{...super.getOptions(),minLength:this.minLength,maxLength:this.maxLength,placeholder:this.placeholder}}setOptions(t){const{minLength:n,maxLength:i,placeholder:a,...o}=t;this.minLength=n,this.maxLength=i??this.maxLength,this.placeholder=a,super.setOptions(o)}serializeValue(t){return t}deserializeValue(t){return t}isSerializedValueValid(t){return typeof t=="string"}isValueValid(t){return typeof t=="string"}blankValue(){return""}areValuesEqual(t,n){return t===n}}const Fn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,field:a,showInputOnly:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),{value:f,name:p,onChange:h,onBlur:g}=u,x=o?null:s,C=o?"":l,m=A.useCallback(w=>{h(w),g(w)},[g,h]);return d.jsx(Oe,{helpText:x,severity:i,children:d.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:C,image:o?void 0:a.image,children:d.jsx(v.CheckboxGroup.Root,{id:e,name:p,className:"flex flex-col gap-1",accentColor:"base",variant:"surface",size:"sm",values:f,onValuesChange:m,disabled:c,children:a.options.map((w,_)=>d.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[d.jsx(v.CheckboxGroup.Item,{value:w.value,children:d.jsx(v.CheckboxGroup.ItemIndicator,{children:d.jsx(v.LuIcon,{icon:Xe})})}),d.jsx(v.Text,{size:"sm",accentColor:"base",className:"truncate",children:w.label})]},`${e}-${w.value}-${_}`))})})})});Fn.displayName="CheckboxListInput";const Yt=class Yt extends cr{constructor(t){super(t);b(this,"type","checkbox-list");b(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new Yt({...this.getOptions(),identifier:t})}static deserialize(t){return new Yt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return d.jsx(Fn,{field:this,...t})}isSerializedValueValid(t){return ht(t)}isValueValid(t){return ht(t)}blankValue(){return[]}areValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}};b(Yt,"fieldTypeName","Checkbox list"),b(Yt,"fieldTypeDescription","Allows the user to select a multiple options from a list.");let Dt=Yt;const Vn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),{value:f,name:p,onChange:h,onBlur:g}=u,[x,C]=A.useState(!1),m=a?null:s,w=a?"":l,_=A.useCallback(O=>{h(O??null),C(!1)},[h]),E=A.useCallback(O=>{C(O),O||g(f)},[g,f]);return d.jsx(Oe,{helpText:m,severity:i,children:d.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:w,image:a?void 0:o.image,children:d.jsxs(v.Popover.Root,{open:x,onOpenChange:E,children:[d.jsx(v.Popover.Trigger,{asChild:!0,children:d.jsxs(v.Button,{id:e,name:p,type:"button",className:"!justify-between",accentColor:"base",variant:"surface",size:"sm",disabled:c,children:[f?f.toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit"}):"yyyy-mm-dd",d.jsx(v.LuIcon,{icon:In})]})}),d.jsx(v.Popover.Content,{align:"start",children:d.jsx(v.DayPicker,{required:!1,mode:"single",variant:"solid",selected:f??void 0,onSelect:_})})]})})})});Vn.displayName="DateInput";const Zt=class Zt extends Ve{constructor(t){super(t);b(this,"type","date");b(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new Zt({...this.getOptions(),identifier:t})}static deserialize(t){return new Zt(t)}setOptions(t){super.setOptions(t)}serializeValue(t){return t?t.toISOString():null}deserializeValue(t){return t?new Date(t):null}render(t){return d.jsx(Vn,{field:this,...t})}isSerializedValueValid(t){return typeof t=="string"||t===null}isValueValid(t){return t instanceof Date||t===null}blankValue(){return null}areValuesEqual(t,n){return!t&&!n?!0:!t||!n?!1:t.getTime()===n.getTime()}};b(Zt,"fieldTypeName","Date"),b(Zt,"fieldTypeDescription","Allows specifying a date.");let fr=Zt;const Bn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),{value:f,name:p,onChange:h,onBlur:g}=u,x=a?null:s,C=a?"":l,m=A.useCallback(_=>{h(_),g(_)},[g,h]),w=A.useCallback(_=>{_||g(f)},[f,g]);return d.jsx(Oe,{helpText:x,severity:i,children:d.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:C,image:a?void 0:o.image,children:d.jsxs(v.Menu.Root,{onOpenChange:w,align:"start",children:[d.jsx(v.Menu.ClickTrigger,{children:d.jsxs(v.Button,{id:e,name:p,className:"!justify-between",variant:"surface",type:"button",size:"sm",accentColor:"base",disabled:c,children:[d.jsx("span",{className:"truncate",children:f&&f.length>0?f.join(", "):o.placeholder??"Select one or more..."}),d.jsx(v.LuIcon,{icon:In})]})}),d.jsx(v.Menu.Content,{children:d.jsx(v.Menu.Scroll,{children:d.jsxs(v.Menu.MultiSelectGroup,{values:f,onValuesChange:m,children:[d.jsxs(v.Menu.SelectAllItem,{children:[d.jsx(v.Menu.CheckboxItemIndicator,{children:_=>_?d.jsx(v.LuIcon,{icon:Gr}):d.jsx(v.LuIcon,{icon:Xe})}),"Select all"]}),o.options.map((_,E)=>d.jsxs(v.Menu.MultiSelectItem,{value:_.value,children:[d.jsx(v.Menu.SelectedIndicator,{children:d.jsx(v.LuIcon,{icon:Xe})}),_.label]},`${e}-${_.value}-${E}`))]})})})]})})})});Bn.displayName="MultiSelectInput";const Kt=class Kt extends cr{constructor(t){const{placeholder:n,...i}=t;super(i);b(this,"type","multi-select");b(this,"placeholder");this.placeholder=n}serialize(){return super.serialize()}getOptions(){return{...super.getOptions(),placeholder:this.placeholder}}duplicate(t){return new Kt({...this.getOptions(),identifier:t})}setOptions(t){const{placeholder:n}=t;this.placeholder=n,super.setOptions(t)}static deserialize(t){return new Kt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return d.jsx(Bn,{field:this,...t})}isSerializedValueValid(t){return ht(t)}isValueValid(t){return ht(t)}blankValue(){return[]}areValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}};b(Kt,"fieldTypeName","Multi-select"),b(Kt,"fieldTypeDescription","Allows the user to select a multiple options from a list of options.");let it=Kt;const Ln=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),{name:f,onChange:p,onBlur:h,value:g}=u,x=a?null:s,C=a?"":l,m=A.useCallback(_=>{p(_??null),h(_??null)},[h,p]),w=A.useMemo(()=>o.options.find(_=>_.value===g),[o.options,g]);return d.jsx(Oe,{helpText:x,severity:i,children:d.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:C,image:a?void 0:o.image,children:d.jsxs(v.Menu.Root,{align:"start",children:[d.jsx(v.Menu.ClickTrigger,{children:d.jsxs(v.Button,{id:e,name:f,className:"!justify-between",accentColor:"base",variant:"surface",type:"button",size:"sm",disabled:c,children:[d.jsx("span",{className:"truncate",children:w?w.label:o.placeholder??"Select one..."}),d.jsx(v.LuIcon,{icon:In})]})}),d.jsx(v.Menu.Content,{children:d.jsx(v.Menu.Scroll,{children:d.jsx(v.Menu.SelectGroup,{required:!1,value:g??void 0,onValueChange:m,children:o.options.map((_,E)=>d.jsxs(v.Menu.SelectItem,{value:_.value,children:[d.jsx(v.Menu.SelectedIndicator,{children:d.jsx(v.LuIcon,{icon:Xe})}),_.label]},`${e}-${_.value}-${E}`))})})})]})})})});Ln.displayName="SelectInput";const Qt=class Qt extends cr{constructor(t){const{placeholder:n,...i}=t;super(i);b(this,"type","select");b(this,"placeholder");this.placeholder=n}serialize(){return super.serialize()}getOptions(){return{...super.getOptions(),placeholder:this.placeholder}}duplicate(t){return new Qt({...this.getOptions(),identifier:t})}setOptions(t){const{placeholder:n}=t;this.placeholder=n,super.setOptions(t)}static deserialize(t){return new Qt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return d.jsx(Ln,{field:this,...t})}isSerializedValueValid(t){return typeof t=="string"||t===null}isValueValid(t){return typeof t=="string"||t===null}blankValue(){return null}areValuesEqual(t,n){return t===n}};b(Qt,"fieldTypeName","Dropdown"),b(Qt,"fieldTypeDescription","Allows the user to select a single option from a list of options.");let pt=Qt;const zn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:f},{formId:p,disabled:h}]=be(r),{name:g,onBlur:x,onChange:C,value:m}=u,w=a?null:s,_=a?"":l,[E,O]=A.useState(""),T=A.useMemo(()=>Array.from({length:o.length},()=>G.v4()),[o.length]);A.useEffect(()=>{O(m)},[m]);const D=A.useCallback(P=>{O(P),(c||!o.onlyValidateAfterTouched)&&f.setError(o.getError(P))},[o,f,c]),M=A.useCallback(()=>{C(E),x(E)},[E,x,C]);return d.jsx(Oe,{helpText:w,severity:i,children:d.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:_,image:a?void 0:o.image,children:d.jsxs(v.OneTimePasswordField.Root,{id:e,name:g,value:E,onValueChange:D,validationType:o.validationType,form:p,disabled:h,orientation:"horizontal",dir:"ltr",type:"text",autoComplete:"off",autoFocus:!1,autoSubmit:!1,className:"flex gap-1 h-max w-full overflow-x-auto p-0.25",accentColor:"base",variant:"surface",size:"sm",onBlur:M,children:[T.map(P=>d.jsx(v.OneTimePasswordField.Input,{id:P},P)),d.jsx(v.OneTimePasswordField.HiddenInput,{})]})})})});zn.displayName="NumberInput";const Jt=class Jt extends Ve{constructor(t){const{length:n,validationType:i,...a}=t;super(a);b(this,"type","otp");b(this,"length");b(this,"validationType");this.length=n,this.validationType=i}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new qe({label:"Length",integers:!0,required:!1,minimum:1,maximum:16,identifier:`${n}length`}),showDirectly:!1},{field:new pt({label:"Type",required:!1,identifier:`${n}validationType`,options:[{value:"none",label:"Any"},{value:"numeric",label:"Numeric"},{value:"alpha",label:"Alpha"},{value:"alphanumeric",label:"Alphanumeric"}]}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.length;return t.push(i=>{if(!this.isValueBlank(i)&&i.length!=n)return`Must be ${n} characters.`}),t}serialize(){return{...super.serialize(),length:this.length,validationType:this.validationType}}getOptions(){return{...super.getOptions(),length:this.length,validationType:this.validationType}}duplicate(t){return new Jt({...this.getOptions(),identifier:t})}setOptions(t){const{length:n,validationType:i,...a}=t;this.length=n??this.length,this.validationType=i??this.validationType,super.setOptions(a)}static deserialize(t){return new Jt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return d.jsx(zn,{field:this,...t})}isSerializedValueValid(t){return typeof t=="string"}isValueValid(t){return typeof t=="string"}blankValue(){return""}areValuesEqual(t,n){return t===n}};b(Jt,"fieldTypeName","OTP"),b(Jt,"fieldTypeDescription","Allows specifying a number within a given range.");let Mt=Jt;const vt={pass:{label:"Pass",icon:Us},fail:{label:"Fail",icon:Xs},na:{label:"N/A",icon:Gs}},Pt=Object.keys(vt);class at extends File{constructor(t,...n){super(...n);b(this,"uuid");this.uuid=t}static from(t,n){return new at(t,[n],n.name,{lastModified:n.lastModified,type:n.type})}}class Ft extends Promise{constructor(t,n){super(t);b(this,"_uuid");this._uuid=n}get uuid(){return this._uuid}set uuid(t){this._uuid=t}static from(t,n){return new Ft((i,a)=>{Promise.resolve(t).then(i).catch(a)},n)}then(t,n){const i=super.then(t,n);return i.uuid=this.uuid,i}catch(t){const n=super.catch(t);return n.uuid=this.uuid,n}finally(t){const n=super.finally(t);return n.uuid=this.uuid,n}}function sa(r){return Array.isArray(r)?r.every(e=>e instanceof Ft||e instanceof at):!1}function $r(r,e){const t=new Set(r.map(({uuid:i})=>i)),n=new Set(e.map(({uuid:i})=>i));return t.size===n.size&&t.isSubsetOf(n)}const la=A.memo(A.forwardRef((r,e)=>{const{file:t,alt:n,error:i,rightSlot:a,className:o,...s}=r;return d.jsxs(v.Card,{className:sr.cx(o,"relative flex h-[200px] w-full flex-col gap-2 overflow-hidden items-center"),ref:e,...s,children:[!t&&!i&&d.jsx("div",{className:"absolute inset-0 grow flex items-center justify-center",children:d.jsx(v.Spinner,{})}),!!t&&!i&&d.jsx(v.Card,{className:"flex max-w-full grow items-center !p-0 justify-center overflow-hidden bg-clip-padding",children:d.jsx("img",{className:"max-w-full object-cover",src:URL.createObjectURL(t),alt:n??t.name})}),(!!t||!!i)&&d.jsxs("div",{className:sr.cx("flex w-full items-center gap-2 self-end",{"bg-transparent":!t}),children:[i?d.jsx(v.LuIcon,{icon:js}):t&&d.jsx(v.LuIcon,{icon:ta}),d.jsx(v.Text,{className:"truncate",size:"sm",children:i??(t==null?void 0:t.name)}),a]})]})})),cl=r=>{const e=["byte","kilobyte","megabyte"];let t=r,n=0;for(;t>1e3&&n<e.length-1;)t/=1e3,n++;return new Intl.NumberFormat([],{maximumFractionDigits:Math.max(0,n-1),style:"unit",unit:e[n]}).format(t)},kn=A.memo(r=>{const{file:e,onRemove:t,disabled:n}=r,[i,a]=A.useState(null),[o,s]=A.useState(null),l=qr(),{url:u,name:c}=A.useMemo(()=>{let x=null,C,m;return i!=null&&i.type.startsWith("image/")&&(x=URL.createObjectURL(i)),i?(C=i.name,m=cl(i.size)):(C="Downloading...",m="..."),{url:x,name:C,size:m}},[i]);A.useEffect(()=>{e instanceof Ft?e.then(x=>{a(x)}).catch(x=>{s(x instanceof Error?x.message:"Unknown error")}):a(e)},[e]);const f=A.useCallback(x=>{if(x.stopPropagation(),!i)throw new Error("Cannot download a file that is not resolved.");const C=new Blob([i]);ji.saveAs(C,c)},[c,i]),p=A.useCallback(x=>{x.stopPropagation(),t()},[t]),h=A.useCallback(()=>{i&&l(x=>({file:i,onDelete:n?void 0:()=>{t(),x()}}))},[n,t,l,i]),g=A.useMemo(()=>d.jsxs(v.ButtonGroup,{className:"flex grow justify-end",variant:"ghost",accentColor:"base",size:"sm",children:[d.jsx(v.IconButton,{"aria-label":`Download ${c}`,type:"button",onClick:f,disabled:!i,children:d.jsx(v.LuIcon,{icon:ea})}),!n&&d.jsx(v.IconButton,{type:"button","aria-label":`Remove ${c}`,disabled:n,onClick:p,children:d.jsx(v.LuIcon,{icon:dt})})]}),[n,p,f,c,i]);return u?d.jsx(la,{className:"cursor-pointer",onClick:h,file:i,error:o??void 0,rightSlot:g}):d.jsx(On,{file:i,error:o??void 0,rightSlot:g})});kn.displayName="DisplayFile";const Rn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:f},{disabled:p}]=be(r),{value:h,onChange:g,onBlur:x,name:C}=u,[m,w]=A.useState(""),_=A.useRef(null),E=a?null:s,O=a?"":l,T=h.status&&o.showNotesAndFilesOn.includes(h.status),D=A.useCallback(H=>{const re=o.cleanValue({...h,status:H});g(re),x(re)},[o,x,g,h]);A.useEffect(()=>{w(h.notes)},[h]);const M=A.useCallback(H=>{const re=H.target.value;w(re),(c||!o.onlyValidateAfterTouched)&&f.setError(o.getError({...h,notes:m}))},[o,f,m,c,h]),P=A.useCallback(()=>{const H={...h,notes:m};g(H),x(H)},[m,x,g,h]),V=A.useCallback(H=>{const re=[...h.files];re.splice(H,1),g({...h,files:re})},[g,h]),W=A.useCallback(()=>{var H;(H=_.current)==null||H.click()},[]),U=A.useCallback(H=>{const re=Array.from(H.target.files??[]).map(Ur=>at.from(G.v4(),Ur)),Fe={...h,files:[...h.files,...re]};g(Fe),x(Fe)},[x,g,h]);A.useEffect(()=>{if(!_.current)return;const H=new AbortController;return _.current.addEventListener("cancel",()=>{x(h)},{signal:H.signal}),()=>{H.abort()}},[x,h]);const J=`${e}-status`,R=`${e}-notes`,Z=`${e}-files`;return d.jsx(Oe,{helpText:E,severity:i,children:d.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:O,image:a?void 0:o.image,children:d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsx(v.RadioGroup.Root,{id:J,className:"flex gap-2",name:C,value:h.status,disabled:p,accentColor:"base",variant:"surface",size:"sm",onValueChange:D,children:Pt.map(H=>{const{label:re}=vt[H];return d.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[d.jsx(v.RadioGroup.Item,{value:H,children:d.jsx(v.RadioGroup.Indicator,{children:d.jsx(v.LuIcon,{icon:Ji,className:"fill-current"})})}),d.jsx(v.Text,{size:"sm",accentColor:"base",className:"truncate",children:re})]},`${e}-${H}`)})}),T&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:d.jsx(v.TextArea,{id:R,value:m,name:C,onChange:M,onBlur:P,className:"field-sizing-content w-full min-h-12",placeholder:"Notes",resize:"vertical",accentColor:"base",variant:"surface",size:"sm",disabled:p})}),d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsxs(v.Button,{className:"w-max",size:"sm",variant:"soft",accentColor:"base",onClick:W,type:"button",disabled:p,children:[d.jsx(v.LuIcon,{icon:Sn}),"Select files"]}),d.jsx("input",{id:Z,name:C,type:"file",ref:_,multiple:!0,className:"hidden",onChange:U,value:""}),h.files.length>0&&d.jsx("div",{className:"flex h-max flex-col gap-2",children:h.files.map((H,re)=>d.jsx(kn,{file:H,onRemove:()=>{V(re)},disabled:p},re))})]})]})]})})})});Rn.displayName="PassFailInput";const Un=r=>typeof r=="string"&&Pt.includes(r),ua=r=>!(r===null||typeof r!="object"||!("status"in r)||!Un(r.status)||!("notes"in r)||typeof r.notes!="string"||!("files"in r)||!(Array.isArray(r.files)&&r.files.length===0)),ca=r=>!(r===null||typeof r!="object"||!("status"in r)||!Un(r.status)||!("notes"in r)||typeof r.notes!="string"||!("files"in r)||!sa(r.files)),fa=r=>({status:r.status,notes:r.notes,files:[]}),da=r=>({status:r.status,notes:r.notes,files:[]}),ha=(r,e)=>!(r.status!==e.status||r.notes!==e.notes||!$r(r.files,e.files)),er=class er extends Ve{constructor(t){const{showNotesAndFilesOn:n,...i}=t;super(i);b(this,"type","pass-fail");b(this,"onlyValidateAfterTouched",!1);b(this,"showNotesAndFilesOn");this.showNotesAndFilesOn=n}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new it({identifier:`${n}showNotesAndFilesOn`,label:"Show notes and files on",description:"Show the notes and files on desired statuses.",options:Pt.map(i=>{const{label:a}=vt[i];return{value:i,label:a}}),required:!1}),showDirectly:!1}]}serialize(){return{...super.serialize(),showNotesAndFilesOn:this.showNotesAndFilesOn}}getOptions(){return{...super.getOptions(),showNotesAndFilesOn:this.showNotesAndFilesOn}}duplicate(t){return new er({...this.getOptions(),identifier:t})}setOptions(t){const{showNotesAndFilesOn:n,...i}=t;this.showNotesAndFilesOn=n??this.showNotesAndFilesOn,super.setOptions(i)}getFieldValidators(){const t=super.getFieldValidators(),n=this.showNotesAndFilesOn,i=this.blankValue();return n.length>0&&(t.push(a=>{if(!(!a.status||!n.includes(a.status))&&i.notes===a.notes)return"Notes is required."}),t.push(a=>{if(!(!a.status||!n.includes(a.status))&&$r(i.files,a.files))return"Files is required."})),t}static deserialize(t){return new er({...t,showNotesAndFilesOn:t.showNotesAndFilesOn??!1})}serializeValue(t){return fa(t)}deserializeValue(t){return da(t)}render(t){return d.jsx(Rn,{field:this,...t})}isSerializedValueValid(t){return ua(t)}isValueValid(t){return ca(t)}areValuesEqual(t,n){return ha(t,n)}blankValue(){return{status:null,notes:"",files:[]}}cleanValue(t){return t.status&&this.showNotesAndFilesOn.includes(t.status)?t:{status:t.status,notes:"",files:[]}}};b(er,"fieldTypeName","Pass - Fail"),b(er,"fieldTypeDescription","Track pass, fail, or N/A outcome.");let Vt=er;const Hn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),{name:f,onChange:p,onBlur:h,value:g}=u,x=a?null:s,C=a?"":l,m=A.useCallback(_=>{p(_),h(_)},[h,p]),w=A.useCallback(()=>{p(null),h(null)},[h,p]);return d.jsx(Oe,{helpText:x,severity:i,children:d.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:C,image:a?void 0:o.image,children:d.jsxs(v.RadioGroup.Root,{id:e,name:f,className:"flex flex-col gap-1",accentColor:"base",variant:"surface",size:"sm",value:g??"",onValueChange:m,disabled:c,children:[o.options.map((_,E)=>d.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[d.jsx(v.RadioGroup.Item,{value:_.value,children:d.jsx(v.RadioGroup.Indicator,{children:d.jsx(v.LuIcon,{icon:Ji,className:"fill-current"})})}),d.jsx(v.Text,{size:"sm",accentColor:"base",className:"truncate",children:_.label})]},`${e}-${_.value}-${E}`)),!!g&&d.jsxs(v.Button,{onClick:w,className:"w-max -mx-2",type:"button",variant:"ghost",accentColor:"base",size:"sm",children:[d.jsx(v.LuIcon,{icon:nt}),"Clear"]})]})})})});Hn.displayName="SelectInput";const tr=class tr extends cr{constructor(t){super(t);b(this,"type","radio");b(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new tr({...this.getOptions(),identifier:t})}setOptions(t){super.setOptions(t)}static deserialize(t){return new tr(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return d.jsx(Hn,{field:this,...t})}isSerializedValueValid(t){return typeof t=="string"||t==="null"}isValueValid(t){return typeof t=="string"||t==="null"}blankValue(){return null}areValuesEqual(t,n){return t===n}};b(tr,"fieldTypeName","Option list"),b(tr,"fieldTypeDescription","Allows the user to select a single option from a list of options.");let Bt=tr;const Gn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),{name:f,onChange:p,onBlur:h,value:g}=u,x=a?null:s,C=a?"":l,m=A.useCallback(E=>{p(E),h(E)},[h,p]),w=A.useCallback(()=>{p(null),h(null)},[h,p]),_=Array.from({length:o.maxRating},(E,O)=>O+1);return d.jsx(Oe,{helpText:x,severity:i,children:d.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:C,image:a?void 0:o.image,children:d.jsxs("div",{className:"flex flex-row gap-1 items-center",children:[d.jsx(v.Rating.Root,{id:e,name:f,className:"flex items-center gap-0.5",value:g,onValueChange:m,disabled:c,children:_.map(E=>d.jsx(v.Rating.Item,{value:E,className:"group size-7 flex cursor-pointer disabled:opacity-50 disabled:pointer-events-none items-center justify-center text-yellow-500 transition-colors",children:d.jsx(v.LuIcon,{icon:ia,className:"group-data-[active=true]:fill-current size-full"})},`${e}-${E}`))}),!c&&g!==null&&d.jsx(v.IconButton,{onClick:w,type:"button",variant:"ghost",accentColor:"base",size:"sm",children:d.jsx(v.LuIcon,{icon:nt})})]})})})});Gn.displayName="RatingInput";const rr=class rr extends Ve{constructor(t){const{maxRating:n,...i}=t;super(i);b(this,"type","rating");b(this,"maxRating");this.maxRating=n}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new qe({label:"Max Rating",description:"Maximum rating value",integers:!0,required:!1,minimum:1,maximum:10,identifier:`${n}maxRating`}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.maxRating;return t.push(i=>{if(typeof i=="number"&&(i<1||i>n))return`Rating must be between 1 and ${n}.`}),t}serialize(){return{...super.serialize(),maxRating:this.maxRating}}getOptions(){return{...super.getOptions(),maxRating:this.maxRating}}duplicate(t){return new rr({...this.getOptions(),identifier:t})}setOptions(t){const{maxRating:n,...i}=t;this.maxRating=n??this.maxRating,super.setOptions(i)}static deserialize(t){return new rr(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return d.jsx(Gn,{field:this,...t})}isSerializedValueValid(t){return typeof t=="number"||t===null}isValueValid(t){return typeof t=="number"||t===null}areValuesEqual(t,n){return t===n}blankValue(){return null}};b(rr,"fieldTypeName","Rating"),b(rr,"fieldTypeDescription","Allows users to select a rating value.");let Lt=rr;const pa=A.createContext(()=>{throw new Error("No ScannerProvider found")}),fl=()=>A.use(pa);function dl(r,e){var t=Object.setPrototypeOf;t?t(r,e):r.__proto__=e}function hl(r,e){e===void 0&&(e=r.constructor);var t=Error.captureStackTrace;t&&t(r,e)}var pl=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),vl=function(r){pl(e,r);function e(t,n){var i=this.constructor,a=r.call(this,t,n)||this;return Object.defineProperty(a,"name",{value:i.name,enumerable:!1,configurable:!0}),dl(a,i.prototype),hl(a),a}return e}(Error),gl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ue=function(r){gl(e,r);function e(t){t===void 0&&(t=void 0);var n=r.call(this,t)||this;return n.message=t,n}return e.prototype.getKind=function(){var t=this.constructor;return t.kind},e.kind="Exception",e}(vl),xl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ze=function(r){xl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ArgumentException",e}(Ue),yl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),k=function(r){yl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IllegalArgumentException",e}(Ue),Cl=function(){function r(e){if(this.binarizer=e,e===null)throw new k("Binarizer must be non-null.")}return r.prototype.getWidth=function(){return this.binarizer.getWidth()},r.prototype.getHeight=function(){return this.binarizer.getHeight()},r.prototype.getBlackRow=function(e,t){return this.binarizer.getBlackRow(e,t)},r.prototype.getBlackMatrix=function(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix},r.prototype.isCropSupported=function(){return this.binarizer.getLuminanceSource().isCropSupported()},r.prototype.crop=function(e,t,n,i){var a=this.binarizer.getLuminanceSource().crop(e,t,n,i);return new r(this.binarizer.createBinarizer(a))},r.prototype.isRotateSupported=function(){return this.binarizer.getLuminanceSource().isRotateSupported()},r.prototype.rotateCounterClockwise=function(){var e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new r(this.binarizer.createBinarizer(e))},r.prototype.rotateCounterClockwise45=function(){var e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new r(this.binarizer.createBinarizer(e))},r.prototype.toString=function(){try{return this.getBlackMatrix().toString()}catch{return""}},r}(),wl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ce=function(r){wl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getChecksumInstance=function(){return new e},e.kind="ChecksumException",e}(Ue),ml=function(){function r(e){this.source=e}return r.prototype.getLuminanceSource=function(){return this.source},r.prototype.getWidth=function(){return this.source.getWidth()},r.prototype.getHeight=function(){return this.source.getHeight()},r}(),se=function(){function r(){}return r.arraycopy=function(e,t,n,i,a){for(;a--;)n[i++]=e[t++]},r.currentTimeMillis=function(){return Date.now()},r}(),_l=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Xn=function(r){_l(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IndexOutOfBoundsException",e}(Ue),Al=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),va=function(r){Al(e,r);function e(t,n){t===void 0&&(t=void 0),n===void 0&&(n=void 0);var i=r.call(this,n)||this;return i.index=t,i.message=n,i}return e.kind="ArrayIndexOutOfBoundsException",e}(Xn),El=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},he=function(){function r(){}return r.fill=function(e,t){for(var n=0,i=e.length;n<i;n++)e[n]=t},r.fillWithin=function(e,t,n,i){r.rangeCheck(e.length,t,n);for(var a=t;a<n;a++)e[a]=i},r.rangeCheck=function(e,t,n){if(t>n)throw new k("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new va(t);if(n>e)throw new va(n)},r.asList=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e},r.create=function(e,t,n){var i=Array.from({length:e});return i.map(function(a){return Array.from({length:t}).fill(n)})},r.createInt32Array=function(e,t,n){var i=Array.from({length:e});return i.map(function(a){return Int32Array.from({length:t}).fill(n)})},r.equals=function(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0},r.hashCode=function(e){var t,n;if(e===null)return 0;var i=1;try{for(var a=El(e),o=a.next();!o.done;o=a.next()){var s=o.value;i=31*i+s}}catch(l){t={error:l}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return i},r.fillUint8Array=function(e,t){for(var n=0;n!==e.length;n++)e[n]=t},r.copyOf=function(e,t){return e.slice(0,t)},r.copyOfUint8Array=function(e,t){if(e.length<=t){var n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)},r.copyOfRange=function(e,t,n){var i=n-t,a=new Int32Array(i);return se.arraycopy(e,t,a,0,i),a},r.binarySearch=function(e,t,n){n===void 0&&(n=r.numberComparator);for(var i=0,a=e.length-1;i<=a;){var o=a+i>>1,s=n(t,e[o]);if(s>0)i=o+1;else if(s<0)a=o-1;else return o}return-i-1},r.numberComparator=function(e,t){return e-t},r}(),$=function(){function r(){}return r.numberOfTrailingZeros=function(e){var t;if(e===0)return 32;var n=31;return t=e<<16,t!==0&&(n-=16,e=t),t=e<<8,t!==0&&(n-=8,e=t),t=e<<4,t!==0&&(n-=4,e=t),t=e<<2,t!==0&&(n-=2,e=t),n-(e<<1>>>31)},r.numberOfLeadingZeros=function(e){if(e===0)return 32;var t=1;return e>>>16||(t+=16,e<<=16),e>>>24||(t+=8,e<<=8),e>>>28||(t+=4,e<<=4),e>>>30||(t+=2,e<<=2),t-=e>>>31,t},r.toHexString=function(e){return e.toString(16)},r.toBinaryString=function(e){return String(parseInt(String(e),2))},r.bitCount=function(e){return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),e=e+(e>>>4)&252645135,e=e+(e>>>8),e=e+(e>>>16),e&63},r.truncDivision=function(e,t){return Math.trunc(e/t)},r.parseInt=function(e,t){return t===void 0&&(t=void 0),parseInt(e,t)},r.MIN_VALUE_32_BITS=-2147483648,r.MAX_VALUE=Number.MAX_SAFE_INTEGER,r}(),we=function(){function r(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=r.makeArray(e):this.bits=t)}return r.prototype.getSize=function(){return this.size},r.prototype.getSizeInBytes=function(){return Math.floor((this.size+7)/8)},r.prototype.ensureCapacity=function(e){if(e>this.bits.length*32){var t=r.makeArray(e);se.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}},r.prototype.get=function(e){return(this.bits[Math.floor(e/32)]&1<<(e&31))!==0},r.prototype.set=function(e){this.bits[Math.floor(e/32)]|=1<<(e&31)},r.prototype.flip=function(e){this.bits[Math.floor(e/32)]^=1<<(e&31)},r.prototype.getNextSet=function(e){var t=this.size;if(e>=t)return t;var n=this.bits,i=Math.floor(e/32),a=n[i];a&=~((1<<(e&31))-1);for(var o=n.length;a===0;){if(++i===o)return t;a=n[i]}var s=i*32+$.numberOfTrailingZeros(a);return s>t?t:s},r.prototype.getNextUnset=function(e){var t=this.size;if(e>=t)return t;var n=this.bits,i=Math.floor(e/32),a=~n[i];a&=~((1<<(e&31))-1);for(var o=n.length;a===0;){if(++i===o)return t;a=~n[i]}var s=i*32+$.numberOfTrailingZeros(a);return s>t?t:s},r.prototype.setBulk=function(e,t){this.bits[Math.floor(e/32)]=t},r.prototype.setRange=function(e,t){if(t<e||e<0||t>this.size)throw new k;if(t!==e){t--;for(var n=Math.floor(e/32),i=Math.floor(t/32),a=this.bits,o=n;o<=i;o++){var s=o>n?0:e&31,l=o<i?31:t&31,u=(2<<l)-(1<<s);a[o]|=u}}},r.prototype.clear=function(){for(var e=this.bits.length,t=this.bits,n=0;n<e;n++)t[n]=0},r.prototype.isRange=function(e,t,n){if(t<e||e<0||t>this.size)throw new k;if(t===e)return!0;t--;for(var i=Math.floor(e/32),a=Math.floor(t/32),o=this.bits,s=i;s<=a;s++){var l=s>i?0:e&31,u=s<a?31:t&31,c=(2<<u)-(1<<l)&4294967295;if((o[s]&c)!==(n?c:0))return!1}return!0},r.prototype.appendBit=function(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++},r.prototype.appendBits=function(e,t){if(t<0||t>32)throw new k("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(var n=t;n>0;n--)this.appendBit((e>>n-1&1)===1)},r.prototype.appendBitArray=function(e){var t=e.size;this.ensureCapacity(this.size+t);for(var n=0;n<t;n++)this.appendBit(e.get(n))},r.prototype.xor=function(e){if(this.size!==e.size)throw new k("Sizes don't match");for(var t=this.bits,n=0,i=t.length;n<i;n++)t[n]^=e.bits[n]},r.prototype.toBytes=function(e,t,n,i){for(var a=0;a<i;a++){for(var o=0,s=0;s<8;s++)this.get(e)&&(o|=1<<7-s),e++;t[n+a]=o}},r.prototype.getBitArray=function(){return this.bits},r.prototype.reverse=function(){for(var e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,i=this.bits,a=0;a<n;a++){var o=i[a];o=o>>1&1431655765|(o&1431655765)<<1,o=o>>2&858993459|(o&858993459)<<2,o=o>>4&252645135|(o&252645135)<<4,o=o>>8&16711935|(o&16711935)<<8,o=o>>16&65535|(o&65535)<<16,e[t-a]=o}if(this.size!==n*32){for(var s=n*32-this.size,l=e[0]>>>s,a=1;a<n;a++){var u=e[a];l|=u<<32-s,e[a-1]=l,l=u>>>s}e[n-1]=l}this.bits=e},r.makeArray=function(e){return new Int32Array(Math.floor((e+31)/32))},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.size===t.size&&he.equals(this.bits,t.bits)},r.prototype.hashCode=function(){return 31*this.size+he.hashCode(this.bits)},r.prototype.toString=function(){for(var e="",t=0,n=this.size;t<n;t++)(t&7)===0&&(e+=" "),e+=this.get(t)?"X":".";return e},r.prototype.clone=function(){return new r(this.size,this.bits.slice())},r.prototype.toArray=function(){for(var e=[],t=0,n=this.size;t<n;t++)e.push(this.get(t));return e},r}(),qn;(function(r){r[r.OTHER=0]="OTHER",r[r.PURE_BARCODE=1]="PURE_BARCODE",r[r.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",r[r.TRY_HARDER=3]="TRY_HARDER",r[r.CHARACTER_SET=4]="CHARACTER_SET",r[r.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",r[r.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",r[r.ASSUME_GS1=7]="ASSUME_GS1",r[r.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",r[r.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",r[r.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(qn||(qn={}));const ce=qn;var Il=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),F=function(r){Il(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getFormatInstance=function(){return new e},e.kind="FormatException",e}(Ue),Sl=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ie;(function(r){r[r.Cp437=0]="Cp437",r[r.ISO8859_1=1]="ISO8859_1",r[r.ISO8859_2=2]="ISO8859_2",r[r.ISO8859_3=3]="ISO8859_3",r[r.ISO8859_4=4]="ISO8859_4",r[r.ISO8859_5=5]="ISO8859_5",r[r.ISO8859_6=6]="ISO8859_6",r[r.ISO8859_7=7]="ISO8859_7",r[r.ISO8859_8=8]="ISO8859_8",r[r.ISO8859_9=9]="ISO8859_9",r[r.ISO8859_10=10]="ISO8859_10",r[r.ISO8859_11=11]="ISO8859_11",r[r.ISO8859_13=12]="ISO8859_13",r[r.ISO8859_14=13]="ISO8859_14",r[r.ISO8859_15=14]="ISO8859_15",r[r.ISO8859_16=15]="ISO8859_16",r[r.SJIS=16]="SJIS",r[r.Cp1250=17]="Cp1250",r[r.Cp1251=18]="Cp1251",r[r.Cp1252=19]="Cp1252",r[r.Cp1256=20]="Cp1256",r[r.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",r[r.UTF8=22]="UTF8",r[r.ASCII=23]="ASCII",r[r.Big5=24]="Big5",r[r.GB18030=25]="GB18030",r[r.EUC_KR=26]="EUC_KR"})(ie||(ie={}));var pe=function(){function r(e,t,n){for(var i,a,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=o,r.VALUE_IDENTIFIER_TO_ECI.set(e,this),r.NAME_TO_ECI.set(n,this);for(var l=this.values,u=0,c=l.length;u!==c;u++){var f=l[u];r.VALUES_TO_ECI.set(f,this)}try{for(var p=Sl(o),h=p.next();!h.done;h=p.next()){var g=h.value;r.NAME_TO_ECI.set(g,this)}}catch(x){i={error:x}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}}return r.prototype.getValueIdentifier=function(){return this.valueIdentifier},r.prototype.getName=function(){return this.name},r.prototype.getValue=function(){return this.values[0]},r.getCharacterSetECIByValue=function(e){if(e<0||e>=900)throw new F("incorect value");var t=r.VALUES_TO_ECI.get(e);if(t===void 0)throw new F("incorect value");return t},r.getCharacterSetECIByName=function(e){var t=r.NAME_TO_ECI.get(e);if(t===void 0)throw new F("incorect value");return t},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.getName()===t.getName()},r.VALUE_IDENTIFIER_TO_ECI=new Map,r.VALUES_TO_ECI=new Map,r.NAME_TO_ECI=new Map,r.Cp437=new r(ie.Cp437,Int32Array.from([0,2]),"Cp437"),r.ISO8859_1=new r(ie.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),r.ISO8859_2=new r(ie.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),r.ISO8859_3=new r(ie.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),r.ISO8859_4=new r(ie.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),r.ISO8859_5=new r(ie.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),r.ISO8859_6=new r(ie.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),r.ISO8859_7=new r(ie.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),r.ISO8859_8=new r(ie.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),r.ISO8859_9=new r(ie.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),r.ISO8859_10=new r(ie.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),r.ISO8859_11=new r(ie.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),r.ISO8859_13=new r(ie.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),r.ISO8859_14=new r(ie.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),r.ISO8859_15=new r(ie.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),r.ISO8859_16=new r(ie.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),r.SJIS=new r(ie.SJIS,20,"SJIS","Shift_JIS"),r.Cp1250=new r(ie.Cp1250,21,"Cp1250","windows-1250"),r.Cp1251=new r(ie.Cp1251,22,"Cp1251","windows-1251"),r.Cp1252=new r(ie.Cp1252,23,"Cp1252","windows-1252"),r.Cp1256=new r(ie.Cp1256,24,"Cp1256","windows-1256"),r.UnicodeBigUnmarked=new r(ie.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),r.UTF8=new r(ie.UTF8,26,"UTF8","UTF-8"),r.ASCII=new r(ie.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),r.Big5=new r(ie.Big5,28,"Big5"),r.GB18030=new r(ie.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),r.EUC_KR=new r(ie.EUC_KR,30,"EUC_KR","EUC-KR"),r}(),Ol=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Wr=function(r){Ol(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="UnsupportedOperationException",e}(Ue),$e=function(){function r(){}return r.decode=function(e,t){var n=this.encodingName(t);return this.customDecoder?this.customDecoder(e,n):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(n)?this.decodeFallback(e,n):new TextDecoder(n).decode(e)},r.shouldDecodeOnFallback=function(e){return!r.isBrowser()&&e==="ISO-8859-1"},r.encode=function(e,t){var n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):typeof TextEncoder>"u"?this.encodeFallback(e):new TextEncoder().encode(e)},r.isBrowser=function(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"},r.encodingName=function(e){return typeof e=="string"?e:e.getName()},r.encodingCharacterSet=function(e){return e instanceof pe?e:pe.getCharacterSetECIByName(e)},r.decodeFallback=function(e,t){var n=this.encodingCharacterSet(t);if(r.isDecodeFallbackSupported(n)){for(var i="",a=0,o=e.length;a<o;a++){var s=e[a].toString(16);s.length<2&&(s="0"+s),i+="%"+s}return decodeURIComponent(i)}if(n.equals(pe.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new Wr("Encoding "+this.encodingName(t)+" not supported by fallback.")},r.isDecodeFallbackSupported=function(e){return e.equals(pe.UTF8)||e.equals(pe.ISO8859_1)||e.equals(pe.ASCII)},r.encodeFallback=function(e){for(var t=btoa(unescape(encodeURIComponent(e))),n=t.split(""),i=[],a=0;a<n.length;a++)i.push(n[a].charCodeAt(0));return new Uint8Array(i)},r}(),Y=function(){function r(){}return r.castAsNonUtf8Char=function(e,t){t===void 0&&(t=null);var n=t?t.getName():this.ISO88591;return $e.decode(new Uint8Array([e]),n)},r.guessEncoding=function(e,t){if(t!=null&&t.get(ce.CHARACTER_SET)!==void 0)return t.get(ce.CHARACTER_SET).toString();for(var n=e.length,i=!0,a=!0,o=!0,s=0,l=0,u=0,c=0,f=0,p=0,h=0,g=0,x=0,C=0,m=0,w=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191,_=0;_<n&&(i||a||o);_++){var E=e[_]&255;o&&(s>0?(E&128)===0?o=!1:s--:(E&128)!==0&&((E&64)===0?o=!1:(s++,(E&32)===0?l++:(s++,(E&16)===0?u++:(s++,(E&8)===0?c++:o=!1))))),i&&(E>127&&E<160?i=!1:E>159&&(E<192||E===215||E===247)&&m++),a&&(f>0?E<64||E===127||E>252?a=!1:f--:E===128||E===160||E>239?a=!1:E>160&&E<224?(p++,g=0,h++,h>x&&(x=h)):E>127?(f++,h=0,g++,g>C&&(C=g)):(h=0,g=0))}return o&&s>0&&(o=!1),a&&f>0&&(a=!1),o&&(w||l+u+c>0)?r.UTF8:a&&(r.ASSUME_SHIFT_JIS||x>=3||C>=3)?r.SHIFT_JIS:i&&a?x===2&&p===2||m*10>=n?r.SHIFT_JIS:r.ISO88591:i?r.ISO88591:a?r.SHIFT_JIS:o?r.UTF8:r.PLATFORM_DEFAULT_ENCODING},r.format=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=-1;function a(s,l,u,c,f,p){if(s==="%%")return"%";if(t[++i]!==void 0){s=c?parseInt(c.substr(1)):void 0;var h=f?parseInt(f.substr(1)):void 0,g;switch(p){case"s":g=t[i];break;case"c":g=t[i][0];break;case"f":g=parseFloat(t[i]).toFixed(s);break;case"p":g=parseFloat(t[i]).toPrecision(s);break;case"e":g=parseFloat(t[i]).toExponential(s);break;case"x":g=parseInt(t[i]).toString(h||16);break;case"d":g=parseFloat(parseInt(t[i],h||10).toPrecision(s)).toFixed(0);break}g=typeof g=="object"?JSON.stringify(g):(+g).toString(h);for(var x=parseInt(u),C=u&&u[0]+""=="0"?"0":" ";g.length<x;)g=l!==void 0?g+C:C+g;return g}}var o=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(o,a)},r.getBytes=function(e,t){return $e.encode(e,t)},r.getCharCode=function(e,t){return t===void 0&&(t=0),e.charCodeAt(t)},r.getCharAt=function(e){return String.fromCharCode(e)},r.SHIFT_JIS=pe.SJIS.getName(),r.GB2312="GB2312",r.ISO88591=pe.ISO8859_1.getName(),r.EUC_JP="EUC_JP",r.UTF8=pe.UTF8.getName(),r.PLATFORM_DEFAULT_ENCODING=r.UTF8,r.ASSUME_SHIFT_JIS=!1,r}(),q=function(){function r(e){e===void 0&&(e=""),this.value=e}return r.prototype.enableDecoding=function(e){return this.encoding=e,this},r.prototype.append=function(e){return typeof e=="string"?this.value+=e.toString():this.encoding?this.value+=Y.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this},r.prototype.appendChars=function(e,t,n){for(var i=t;t<t+n;i++)this.append(e[i]);return this},r.prototype.length=function(){return this.value.length},r.prototype.charAt=function(e){return this.value.charAt(e)},r.prototype.deleteCharAt=function(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)},r.prototype.setCharAt=function(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)},r.prototype.substring=function(e,t){return this.value.substring(e,t)},r.prototype.setLengthToZero=function(){this.value=""},r.prototype.toString=function(){return this.value},r.prototype.insert=function(e,t){this.value=this.value.substring(0,e)+t+this.value.substring(e)},r}(),tt=function(){function r(e,t,n,i){if(this.width=e,this.height=t,this.rowSize=n,this.bits=i,t==null&&(t=e),this.height=t,e<1||t<1)throw new k("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,i==null&&(this.bits=new Int32Array(this.rowSize*this.height))}return r.parseFromBooleanArray=function(e){for(var t=e.length,n=e[0].length,i=new r(n,t),a=0;a<t;a++)for(var o=e[a],s=0;s<n;s++)o[s]&&i.set(s,a);return i},r.parseFromString=function(e,t,n){if(e===null)throw new k("stringRepresentation cannot be null");for(var i=new Array(e.length),a=0,o=0,s=-1,l=0,u=0;u<e.length;)if(e.charAt(u)===`
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
`)}return t.toString()},r}(),Pl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),$n=function(r){Pl(e,r);function e(t){var n=r.call(this,t.getWidth(),t.getHeight())||this;return n.delegate=t,n}return e.prototype.getRow=function(t,n){for(var i=this.delegate.getRow(t,n),a=this.getWidth(),o=0;o<a;o++)i[o]=255-(i[o]&255);return i},e.prototype.getMatrix=function(){for(var t=this.delegate.getMatrix(),n=this.getWidth()*this.getHeight(),i=new Uint8ClampedArray(n),a=0;a<n;a++)i[a]=255-(t[a]&255);return i},e.prototype.isCropSupported=function(){return this.delegate.isCropSupported()},e.prototype.crop=function(t,n,i,a){return new e(this.delegate.crop(t,n,i,a))},e.prototype.isRotateSupported=function(){return this.delegate.isRotateSupported()},e.prototype.invert=function(){return this.delegate},e.prototype.rotateCounterClockwise=function(){return new e(this.delegate.rotateCounterClockwise())},e.prototype.rotateCounterClockwise45=function(){return new e(this.delegate.rotateCounterClockwise45())},e}(jr),Fl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Vl=function(r){Fl(e,r);function e(t){var n=r.call(this,t.width,t.height)||this;return n.canvas=t,n.tempCanvasElement=null,n.buffer=e.makeBufferFromCanvasImageData(t),n}return e.makeBufferFromCanvasImageData=function(t){var n=t.getContext("2d").getImageData(0,0,t.width,t.height);return e.toGrayscaleBuffer(n.data,t.width,t.height)},e.toGrayscaleBuffer=function(t,n,i){var a=new Uint8ClampedArray(n*i);if(e.FRAME_INDEX=!e.FRAME_INDEX,e.FRAME_INDEX)for(var o=0,s=0,l=t.length;o<l;o+=4,s++){var u=void 0,c=t[o+3];if(c===0)u=255;else{var f=t[o],p=t[o+1],h=t[o+2];u=306*f+601*p+117*h+512>>10}a[s]=u}else for(var o=0,s=0,g=t.length;o<g;o+=4,s++){var u=void 0,c=t[o+3];if(c===0)u=255;else{var f=t[o],p=t[o+1],h=t[o+2];u=306*f+601*p+117*h+512>>10}a[s]=255-u}return a},e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new k("Requested row is outside the image: "+t);var i=this.getWidth(),a=t*i;return n===null?n=this.buffer.slice(a,a+i):(n.length<i&&(n=new Uint8ClampedArray(i)),n.set(this.buffer.slice(a,a+i))),n},e.prototype.getMatrix=function(){return this.buffer},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(t,n,i,a){return r.prototype.crop.call(this,t,n,i,a),this},e.prototype.isRotateSupported=function(){return!0},e.prototype.rotateCounterClockwise=function(){return this.rotate(-90),this},e.prototype.rotateCounterClockwise45=function(){return this.rotate(-45),this},e.prototype.getTempCanvasElement=function(){if(this.tempCanvasElement===null){var t=this.canvas.ownerDocument.createElement("canvas");t.width=this.canvas.width,t.height=this.canvas.height,this.tempCanvasElement=t}return this.tempCanvasElement},e.prototype.rotate=function(t){var n=this.getTempCanvasElement(),i=n.getContext("2d"),a=t*e.DEGREE_TO_RADIANS,o=this.canvas.width,s=this.canvas.height,l=Math.ceil(Math.abs(Math.cos(a))*o+Math.abs(Math.sin(a))*s),u=Math.ceil(Math.abs(Math.sin(a))*o+Math.abs(Math.cos(a))*s);return n.width=l,n.height=u,i.translate(l/2,u/2),i.rotate(a),i.drawImage(this.canvas,o/-2,s/-2),this.buffer=e.makeBufferFromCanvasImageData(n),this},e.prototype.invert=function(){return new $n(this)},e.DEGREE_TO_RADIANS=Math.PI/180,e.FRAME_INDEX=!0,e}(jr),Bl=function(){function r(e,t,n){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=n||void 0}return r.prototype.toJSON=function(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}},r}(),Be=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(r,e||[])).next())})},Le=function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(u){return function(c){return l([u,c])}}function l(u){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1],a=u;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(u);break}a[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(c){u=[6,c],i=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},Ll=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},zt=function(){function r(e,t,n){t===void 0&&(t=500),this.reader=e,this.timeBetweenScansMillis=t,this._hints=n,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}return Object.defineProperty(r.prototype,"hasNavigator",{get:function(){return typeof navigator<"u"},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isMediaDevicesSuported",{get:function(){return this.hasNavigator&&!!navigator.mediaDevices},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"canEnumerateDevices",{get:function(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"timeBetweenDecodingAttempts",{get:function(){return this._timeBetweenDecodingAttempts},set:function(e){this._timeBetweenDecodingAttempts=e<0?0:e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"hints",{get:function(){return this._hints},set:function(e){this._hints=e||null},enumerable:!1,configurable:!0}),r.prototype.listVideoInputDevices=function(){return Be(this,void 0,void 0,function(){var e,t,n,i,a,o,s,l,u,c,f,p;return Le(this,function(h){switch(h.label){case 0:if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:e=h.sent(),t=[];try{for(n=Ll(e),i=n.next();!i.done;i=n.next())a=i.value,o=a.kind==="video"?"videoinput":a.kind,o==="videoinput"&&(s=a.deviceId||a.id,l=a.label||"Video device "+(t.length+1),u=a.groupId,c={deviceId:s,label:l,kind:o,groupId:u},t.push(c))}catch(g){f={error:g}}finally{try{i&&!i.done&&(p=n.return)&&p.call(n)}finally{if(f)throw f.error}}return[2,t]}})})},r.prototype.getVideoInputDevices=function(){return Be(this,void 0,void 0,function(){var e;return Le(this,function(t){switch(t.label){case 0:return[4,this.listVideoInputDevices()];case 1:return e=t.sent(),[2,e.map(function(n){return new Bl(n.deviceId,n.label)})]}})})},r.prototype.findDeviceById=function(e){return Be(this,void 0,void 0,function(){var t;return Le(this,function(n){switch(n.label){case 0:return[4,this.listVideoInputDevices()];case 1:return t=n.sent(),t?[2,t.find(function(i){return i.deviceId===e})]:[2,null]}})})},r.prototype.decodeFromInputVideoDevice=function(e,t){return Be(this,void 0,void 0,function(){return Le(this,function(n){switch(n.label){case 0:return[4,this.decodeOnceFromVideoDevice(e,t)];case 1:return[2,n.sent()]}})})},r.prototype.decodeOnceFromVideoDevice=function(e,t){return Be(this,void 0,void 0,function(){var n,i;return Le(this,function(a){switch(a.label){case 0:return this.reset(),e?n={deviceId:{exact:e}}:n={facingMode:"environment"},i={video:n},[4,this.decodeOnceFromConstraints(i,t)];case 1:return[2,a.sent()]}})})},r.prototype.decodeOnceFromConstraints=function(e,t){return Be(this,void 0,void 0,function(){var n;return Le(this,function(i){switch(i.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return n=i.sent(),[4,this.decodeOnceFromStream(n,t)];case 2:return[2,i.sent()]}})})},r.prototype.decodeOnceFromStream=function(e,t){return Be(this,void 0,void 0,function(){var n,i;return Le(this,function(a){switch(a.label){case 0:return this.reset(),[4,this.attachStreamToVideo(e,t)];case 1:return n=a.sent(),[4,this.decodeOnce(n)];case 2:return i=a.sent(),[2,i]}})})},r.prototype.decodeFromInputVideoDeviceContinuously=function(e,t,n){return Be(this,void 0,void 0,function(){return Le(this,function(i){switch(i.label){case 0:return[4,this.decodeFromVideoDevice(e,t,n)];case 1:return[2,i.sent()]}})})},r.prototype.decodeFromVideoDevice=function(e,t,n){return Be(this,void 0,void 0,function(){var i,a;return Le(this,function(o){switch(o.label){case 0:return e?i={deviceId:{exact:e}}:i={facingMode:"environment"},a={video:i},[4,this.decodeFromConstraints(a,t,n)];case 1:return[2,o.sent()]}})})},r.prototype.decodeFromConstraints=function(e,t,n){return Be(this,void 0,void 0,function(){var i;return Le(this,function(a){switch(a.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return i=a.sent(),[4,this.decodeFromStream(i,t,n)];case 2:return[2,a.sent()]}})})},r.prototype.decodeFromStream=function(e,t,n){return Be(this,void 0,void 0,function(){var i;return Le(this,function(a){switch(a.label){case 0:return this.reset(),[4,this.attachStreamToVideo(e,t)];case 1:return i=a.sent(),[4,this.decodeContinuously(i,n)];case 2:return[2,a.sent()]}})})},r.prototype.stopAsyncDecode=function(){this._stopAsyncDecode=!0},r.prototype.stopContinuousDecode=function(){this._stopContinuousDecode=!0},r.prototype.attachStreamToVideo=function(e,t){return Be(this,void 0,void 0,function(){var n;return Le(this,function(i){switch(i.label){case 0:return n=this.prepareVideoElement(t),this.addVideoSource(n,e),this.videoElement=n,this.stream=e,[4,this.playVideoOnLoadAsync(n)];case 1:return i.sent(),[2,n]}})})},r.prototype.playVideoOnLoadAsync=function(e){var t=this;return new Promise(function(n,i){return t.playVideoOnLoad(e,function(){return n()})})},r.prototype.playVideoOnLoad=function(e,t){var n=this;this.videoEndedListener=function(){return n.stopStreams()},this.videoCanPlayListener=function(){return n.tryPlayVideo(e)},e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)},r.prototype.isVideoPlaying=function(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2},r.prototype.tryPlayVideo=function(e){return Be(this,void 0,void 0,function(){return Le(this,function(t){switch(t.label){case 0:if(this.isVideoPlaying(e))return console.warn("Trying to play video that is already playing."),[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,e.play()];case 2:return t.sent(),[3,4];case 3:return t.sent(),console.warn("It was not possible to play the video."),[3,4];case 4:return[2]}})})},r.prototype.getMediaElement=function(e,t){var n=document.getElementById(e);if(!n)throw new Ze("element with id '"+e+"' not found");if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new Ze("element with id '"+e+"' must be an "+t+" element");return n},r.prototype.decodeFromImage=function(e,t){if(!e&&!t)throw new Ze("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)},r.prototype.decodeFromVideo=function(e,t){if(!e&&!t)throw new Ze("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)},r.prototype.decodeFromVideoContinuously=function(e,t,n){if(e===void 0&&t===void 0)throw new Ze("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,n):this.decodeFromVideoElementContinuously(e,n)},r.prototype.decodeFromImageElement=function(e){if(!e)throw new Ze("An image element must be provided.");this.reset();var t=this.prepareImageElement(e);this.imageElement=t;var n;return this.isImageLoaded(t)?n=this.decodeOnce(t,!1,!0):n=this._decodeOnLoadImage(t),n},r.prototype.decodeFromVideoElement=function(e){var t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)},r.prototype.decodeFromVideoElementContinuously=function(e,t){var n=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(n,t)},r.prototype._decodeFromVideoElementSetup=function(e){if(!e)throw new Ze("A video element must be provided.");this.reset();var t=this.prepareVideoElement(e);return this.videoElement=t,t},r.prototype.decodeFromImageUrl=function(e){if(!e)throw new Ze("An URL must be provided.");this.reset();var t=this.prepareImageElement();this.imageElement=t;var n=this._decodeOnLoadImage(t);return t.src=e,n},r.prototype.decodeFromVideoUrl=function(e){if(!e)throw new Ze("An URL must be provided.");this.reset();var t=this.prepareVideoElement(),n=this.decodeFromVideoElement(t);return t.src=e,n},r.prototype.decodeFromVideoUrlContinuously=function(e,t){if(!e)throw new Ze("An URL must be provided.");this.reset();var n=this.prepareVideoElement(),i=this.decodeFromVideoElementContinuously(n,t);return n.src=e,i},r.prototype._decodeOnLoadImage=function(e){var t=this;return new Promise(function(n,i){t.imageLoadedListener=function(){return t.decodeOnce(e,!1,!0).then(n,i)},e.addEventListener("load",t.imageLoadedListener)})},r.prototype._decodeOnLoadVideo=function(e){return Be(this,void 0,void 0,function(){return Le(this,function(t){switch(t.label){case 0:return[4,this.playVideoOnLoadAsync(e)];case 1:return t.sent(),[4,this.decodeOnce(e)];case 2:return[2,t.sent()]}})})},r.prototype._decodeOnLoadVideoContinuously=function(e,t){return Be(this,void 0,void 0,function(){return Le(this,function(n){switch(n.label){case 0:return[4,this.playVideoOnLoadAsync(e)];case 1:return n.sent(),this.decodeContinuously(e,t),[2]}})})},r.prototype.isImageLoaded=function(e){return!(!e.complete||e.naturalWidth===0)},r.prototype.prepareImageElement=function(e){var t;return typeof e>"u"&&(t=document.createElement("img"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t},r.prototype.prepareVideoElement=function(e){var t;return!e&&typeof document<"u"&&(t=document.createElement("video"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t},r.prototype.decodeOnce=function(e,t,n){var i=this;t===void 0&&(t=!0),n===void 0&&(n=!0),this._stopAsyncDecode=!1;var a=function(o,s){if(i._stopAsyncDecode){s(new N("Video stream has ended before any code could be detected.")),i._stopAsyncDecode=void 0;return}try{var l=i.decode(e);o(l)}catch(p){var u=t&&p instanceof N,c=p instanceof Ce||p instanceof F,f=c&&n;if(u||f)return setTimeout(a,i._timeBetweenDecodingAttempts,o,s);s(p)}};return new Promise(function(o,s){return a(o,s)})},r.prototype.decodeContinuously=function(e,t){var n=this;this._stopContinuousDecode=!1;var i=function(){if(n._stopContinuousDecode){n._stopContinuousDecode=void 0;return}try{var a=n.decode(e);t(a,null),setTimeout(i,n.timeBetweenScansMillis)}catch(l){t(null,l);var o=l instanceof Ce||l instanceof F,s=l instanceof N;(o||s)&&setTimeout(i,n._timeBetweenDecodingAttempts)}};i()},r.prototype.decode=function(e){var t=this.createBinaryBitmap(e);return this.decodeBitmap(t)},r.prototype.createBinaryBitmap=function(e){this.getCaptureCanvasContext(e),e instanceof HTMLVideoElement?this.drawFrameOnCanvas(e):this.drawImageOnCanvas(e);var t=this.getCaptureCanvas(e),n=new Vl(t),i=new Ml(n);return new Cl(i)},r.prototype.getCaptureCanvasContext=function(e){if(!this.captureCanvasContext){var t=this.getCaptureCanvas(e),n=void 0;try{n=t.getContext("2d",{willReadFrequently:!0})}catch{n=t.getContext("2d")}this.captureCanvasContext=n}return this.captureCanvasContext},r.prototype.getCaptureCanvas=function(e){if(!this.captureCanvas){var t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas},r.prototype.drawFrameOnCanvas=function(e,t,n){t===void 0&&(t={sx:0,sy:0,sWidth:e.videoWidth,sHeight:e.videoHeight,dx:0,dy:0,dWidth:e.videoWidth,dHeight:e.videoHeight}),n===void 0&&(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)},r.prototype.drawImageOnCanvas=function(e,t,n){t===void 0&&(t={sx:0,sy:0,sWidth:e.naturalWidth,sHeight:e.naturalHeight,dx:0,dy:0,dWidth:e.naturalWidth,dHeight:e.naturalHeight}),n===void 0&&(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)},r.prototype.decodeBitmap=function(e){return this.reader.decode(e,this._hints)},r.prototype.createCaptureCanvas=function(e){if(typeof document>"u")return this._destroyCaptureCanvas(),null;var t=document.createElement("canvas"),n,i;return typeof e<"u"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,i=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,i=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=i+"px",t.width=n,t.height=i,t},r.prototype.stopStreams=function(){this.stream&&(this.stream.getVideoTracks().forEach(function(e){return e.stop()}),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()},r.prototype.reset=function(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()},r.prototype._destroyVideoElement=function(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)},r.prototype._destroyImageElement=function(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)},r.prototype._destroyCaptureCanvas=function(){this.captureCanvasContext=void 0,this.captureCanvas=void 0},r.prototype.addVideoSource=function(e,t){try{e.srcObject=t}catch{e.src=URL.createObjectURL(t)}},r.prototype.cleanVideoSource=function(e){try{e.srcObject=null}catch{e.src=""}this.videoElement.removeAttribute("src")},r}(),Ne=function(){function r(e,t,n,i,a,o){n===void 0&&(n=t==null?0:8*t.length),o===void 0&&(o=se.currentTimeMillis()),this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=i,this.format=a,this.timestamp=o,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=i,this.format=a,this.resultMetadata=null,o==null?this.timestamp=se.currentTimeMillis():this.timestamp=o}return r.prototype.getText=function(){return this.text},r.prototype.getRawBytes=function(){return this.rawBytes},r.prototype.getNumBits=function(){return this.numBits},r.prototype.getResultPoints=function(){return this.resultPoints},r.prototype.getBarcodeFormat=function(){return this.format},r.prototype.getResultMetadata=function(){return this.resultMetadata},r.prototype.putMetadata=function(e,t){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)},r.prototype.putAllMetadata=function(e){e!==null&&(this.resultMetadata===null?this.resultMetadata=e:this.resultMetadata=new Map(e))},r.prototype.addResultPoints=function(e){var t=this.resultPoints;if(t===null)this.resultPoints=e;else if(e!==null&&e.length>0){var n=new Array(t.length+e.length);se.arraycopy(t,0,n,0,t.length),se.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}},r.prototype.getTimestamp=function(){return this.timestamp},r.prototype.toString=function(){return this.text},r}(),Wn;(function(r){r[r.AZTEC=0]="AZTEC",r[r.CODABAR=1]="CODABAR",r[r.CODE_39=2]="CODE_39",r[r.CODE_93=3]="CODE_93",r[r.CODE_128=4]="CODE_128",r[r.DATA_MATRIX=5]="DATA_MATRIX",r[r.EAN_8=6]="EAN_8",r[r.EAN_13=7]="EAN_13",r[r.ITF=8]="ITF",r[r.MAXICODE=9]="MAXICODE",r[r.PDF_417=10]="PDF_417",r[r.QR_CODE=11]="QR_CODE",r[r.RSS_14=12]="RSS_14",r[r.RSS_EXPANDED=13]="RSS_EXPANDED",r[r.UPC_A=14]="UPC_A",r[r.UPC_E=15]="UPC_E",r[r.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(Wn||(Wn={}));const B=Wn;var jn;(function(r){r[r.OTHER=0]="OTHER",r[r.ORIENTATION=1]="ORIENTATION",r[r.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",r[r.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",r[r.ISSUE_NUMBER=4]="ISSUE_NUMBER",r[r.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",r[r.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",r[r.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",r[r.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",r[r.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",r[r.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(jn||(jn={}));const Ae=jn;var Yr=function(){function r(e,t,n,i,a,o){a===void 0&&(a=-1),o===void 0&&(o=-1),this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=i,this.structuredAppendSequenceNumber=a,this.structuredAppendParity=o,this.numBits=e==null?0:8*e.length}return r.prototype.getRawBytes=function(){return this.rawBytes},r.prototype.getNumBits=function(){return this.numBits},r.prototype.setNumBits=function(e){this.numBits=e},r.prototype.getText=function(){return this.text},r.prototype.getByteSegments=function(){return this.byteSegments},r.prototype.getECLevel=function(){return this.ecLevel},r.prototype.getErrorsCorrected=function(){return this.errorsCorrected},r.prototype.setErrorsCorrected=function(e){this.errorsCorrected=e},r.prototype.getErasures=function(){return this.erasures},r.prototype.setErasures=function(e){this.erasures=e},r.prototype.getOther=function(){return this.other},r.prototype.setOther=function(e){this.other=e},r.prototype.hasStructuredAppend=function(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0},r.prototype.getStructuredAppendParity=function(){return this.structuredAppendParity},r.prototype.getStructuredAppendSequenceNumber=function(){return this.structuredAppendSequenceNumber},r}(),dr=function(){function r(){}return r.prototype.exp=function(e){return this.expTable[e]},r.prototype.log=function(e){if(e===0)throw new k;return this.logTable[e]},r.addOrSubtract=function(e,t){return e^t},r}(),ot=function(){function r(e,t){if(t.length===0)throw new k;this.field=e;var n=t.length;if(n>1&&t[0]===0){for(var i=1;i<n&&t[i]===0;)i++;i===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-i),se.arraycopy(t,i,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}return r.prototype.getCoefficients=function(){return this.coefficients},r.prototype.getDegree=function(){return this.coefficients.length-1},r.prototype.isZero=function(){return this.coefficients[0]===0},r.prototype.getCoefficient=function(e){return this.coefficients[this.coefficients.length-1-e]},r.prototype.evaluateAt=function(e){if(e===0)return this.getCoefficient(0);var t=this.coefficients,n;if(e===1){n=0;for(var i=0,a=t.length;i!==a;i++){var o=t[i];n=dr.addOrSubtract(n,o)}return n}n=t[0];for(var s=t.length,l=this.field,i=1;i<s;i++)n=dr.addOrSubtract(l.multiply(e,n),t[i]);return n},r.prototype.addOrSubtract=function(e){if(!this.field.equals(e.field))throw new k("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;var t=this.coefficients,n=e.coefficients;if(t.length>n.length){var i=t;t=n,n=i}var a=new Int32Array(n.length),o=n.length-t.length;se.arraycopy(n,0,a,0,o);for(var s=o;s<n.length;s++)a[s]=dr.addOrSubtract(t[s-o],n[s]);return new r(this.field,a)},r.prototype.multiply=function(e){if(!this.field.equals(e.field))throw new k("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();for(var t=this.coefficients,n=t.length,i=e.coefficients,a=i.length,o=new Int32Array(n+a-1),s=this.field,l=0;l<n;l++)for(var u=t[l],c=0;c<a;c++)o[l+c]=dr.addOrSubtract(o[l+c],s.multiply(u,i[c]));return new r(s,o)},r.prototype.multiplyScalar=function(e){if(e===0)return this.field.getZero();if(e===1)return this;for(var t=this.coefficients.length,n=this.field,i=new Int32Array(t),a=this.coefficients,o=0;o<t;o++)i[o]=n.multiply(a[o],e);return new r(n,i)},r.prototype.multiplyByMonomial=function(e,t){if(e<0)throw new k;if(t===0)return this.field.getZero();for(var n=this.coefficients,i=n.length,a=new Int32Array(i+e),o=this.field,s=0;s<i;s++)a[s]=o.multiply(n[s],t);return new r(o,a)},r.prototype.divide=function(e){if(!this.field.equals(e.field))throw new k("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new k("Divide by 0");for(var t=this.field,n=t.getZero(),i=this,a=e.getCoefficient(e.getDegree()),o=t.inverse(a);i.getDegree()>=e.getDegree()&&!i.isZero();){var s=i.getDegree()-e.getDegree(),l=t.multiply(i.getCoefficient(i.getDegree()),o),u=e.multiplyByMonomial(s,l),c=t.buildMonomial(s,l);n=n.addOrSubtract(c),i=i.addOrSubtract(u)}return[n,i]},r.prototype.toString=function(){for(var e="",t=this.getDegree();t>=0;t--){var n=this.getCoefficient(t);if(n!==0){if(n<0?(e+=" - ",n=-n):e.length>0&&(e+=" + "),t===0||n!==1){var i=this.field.log(n);i===0?e+="1":i===1?e+="a":(e+="a^",e+=i)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e},r}(),zl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ga=function(r){zl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ArithmeticException",e}(Ue),kl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),He=function(r){kl(e,r);function e(t,n,i){var a=r.call(this)||this;a.primitive=t,a.size=n,a.generatorBase=i;for(var o=new Int32Array(n),s=1,l=0;l<n;l++)o[l]=s,s*=2,s>=n&&(s^=t,s&=n-1);a.expTable=o;for(var u=new Int32Array(n),l=0;l<n-1;l++)u[o[l]]=l;return a.logTable=u,a.zero=new ot(a,Int32Array.from([0])),a.one=new ot(a,Int32Array.from([1])),a}return e.prototype.getZero=function(){return this.zero},e.prototype.getOne=function(){return this.one},e.prototype.buildMonomial=function(t,n){if(t<0)throw new k;if(n===0)return this.zero;var i=new Int32Array(t+1);return i[0]=n,new ot(this,i)},e.prototype.inverse=function(t){if(t===0)throw new ga;return this.expTable[this.size-this.logTable[t]-1]},e.prototype.multiply=function(t,n){return t===0||n===0?0:this.expTable[(this.logTable[t]+this.logTable[n])%(this.size-1)]},e.prototype.getSize=function(){return this.size},e.prototype.getGeneratorBase=function(){return this.generatorBase},e.prototype.toString=function(){return"GF(0x"+$.toHexString(this.primitive)+","+this.size+")"},e.prototype.equals=function(t){return t===this},e.AZTEC_DATA_12=new e(4201,4096,1),e.AZTEC_DATA_10=new e(1033,1024,1),e.AZTEC_DATA_6=new e(67,64,1),e.AZTEC_PARAM=new e(19,16,1),e.QR_CODE_FIELD_256=new e(285,256,0),e.DATA_MATRIX_FIELD_256=new e(301,256,1),e.AZTEC_DATA_8=e.DATA_MATRIX_FIELD_256,e.MAXICODE_FIELD_64=e.AZTEC_DATA_6,e}(dr),Rl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Zr=function(r){Rl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ReedSolomonException",e}(Ue),Ul=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),hr=function(r){Ul(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IllegalStateException",e}(Ue),Kr=function(){function r(e){this.field=e}return r.prototype.decode=function(e,t){for(var n=this.field,i=new ot(n,e),a=new Int32Array(t),o=!0,s=0;s<t;s++){var l=i.evaluateAt(n.exp(s+n.getGeneratorBase()));a[a.length-1-s]=l,l!==0&&(o=!1)}if(!o)for(var u=new ot(n,a),c=this.runEuclideanAlgorithm(n.buildMonomial(t,1),u,t),f=c[0],p=c[1],h=this.findErrorLocations(f),g=this.findErrorMagnitudes(p,h),s=0;s<h.length;s++){var x=e.length-1-n.log(h[s]);if(x<0)throw new Zr("Bad error location");e[x]=He.addOrSubtract(e[x],g[s])}},r.prototype.runEuclideanAlgorithm=function(e,t,n){if(e.getDegree()<t.getDegree()){var i=e;e=t,t=i}for(var a=this.field,o=e,s=t,l=a.getZero(),u=a.getOne();s.getDegree()>=(n/2|0);){var c=o,f=l;if(o=s,l=u,o.isZero())throw new Zr("r_{i-1} was zero");s=c;for(var p=a.getZero(),h=o.getCoefficient(o.getDegree()),g=a.inverse(h);s.getDegree()>=o.getDegree()&&!s.isZero();){var x=s.getDegree()-o.getDegree(),C=a.multiply(s.getCoefficient(s.getDegree()),g);p=p.addOrSubtract(a.buildMonomial(x,C)),s=s.addOrSubtract(o.multiplyByMonomial(x,C))}if(u=p.multiply(l).addOrSubtract(f),s.getDegree()>=o.getDegree())throw new hr("Division algorithm failed to reduce polynomial?")}var m=u.getCoefficient(0);if(m===0)throw new Zr("sigmaTilde(0) was zero");var w=a.inverse(m),_=u.multiplyScalar(w),E=s.multiplyScalar(w);return[_,E]},r.prototype.findErrorLocations=function(e){var t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);for(var n=new Int32Array(t),i=0,a=this.field,o=1;o<a.getSize()&&i<t;o++)e.evaluateAt(o)===0&&(n[i]=a.inverse(o),i++);if(i!==t)throw new Zr("Error locator degree does not match number of roots");return n},r.prototype.findErrorMagnitudes=function(e,t){for(var n=t.length,i=new Int32Array(n),a=this.field,o=0;o<n;o++){for(var s=a.inverse(t[o]),l=1,u=0;u<n;u++)if(o!==u){var c=a.multiply(t[u],s),f=(c&1)===0?c|1:c&-2;l=a.multiply(l,f)}i[o]=a.multiply(e.evaluateAt(s),a.inverse(l)),a.getGeneratorBase()!==0&&(i[o]=a.multiply(i[o],s))}return i},r}(),Ee;(function(r){r[r.UPPER=0]="UPPER",r[r.LOWER=1]="LOWER",r[r.MIXED=2]="MIXED",r[r.DIGIT=3]="DIGIT",r[r.PUNCT=4]="PUNCT",r[r.BINARY=5]="BINARY"})(Ee||(Ee={}));var xa=function(){function r(){}return r.prototype.decode=function(e){this.ddata=e;var t=e.getBits(),n=this.extractBits(t),i=this.correctBits(n),a=r.convertBoolArrayToByteArray(i),o=r.getEncodedData(i),s=new Yr(a,o,null,null);return s.setNumBits(i.length),s},r.highLevelDecode=function(e){return this.getEncodedData(e)},r.getEncodedData=function(e){for(var t=e.length,n=Ee.UPPER,i=Ee.UPPER,a="",o=0;o<t;)if(i===Ee.BINARY){if(t-o<5)break;var s=r.readCode(e,o,5);if(o+=5,s===0){if(t-o<11)break;s=r.readCode(e,o,11)+31,o+=11}for(var l=0;l<s;l++){if(t-o<8){o=t;break}var u=r.readCode(e,o,8);a+=Y.castAsNonUtf8Char(u),o+=8}i=n}else{var c=i===Ee.DIGIT?4:5;if(t-o<c)break;var u=r.readCode(e,o,c);o+=c;var f=r.getCharacter(i,u);f.startsWith("CTRL_")?(n=i,i=r.getTable(f.charAt(5)),f.charAt(6)==="L"&&(n=i)):(a+=f,i=n)}return a},r.getTable=function(e){switch(e){case"L":return Ee.LOWER;case"P":return Ee.PUNCT;case"M":return Ee.MIXED;case"D":return Ee.DIGIT;case"B":return Ee.BINARY;case"U":default:return Ee.UPPER}},r.getCharacter=function(e,t){switch(e){case Ee.UPPER:return r.UPPER_TABLE[t];case Ee.LOWER:return r.LOWER_TABLE[t];case Ee.MIXED:return r.MIXED_TABLE[t];case Ee.PUNCT:return r.PUNCT_TABLE[t];case Ee.DIGIT:return r.DIGIT_TABLE[t];default:throw new hr("Bad table")}},r.prototype.correctBits=function(e){var t,n;this.ddata.getNbLayers()<=2?(n=6,t=He.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=He.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=He.AZTEC_DATA_10):(n=12,t=He.AZTEC_DATA_12);var i=this.ddata.getNbDatablocks(),a=e.length/n;if(a<i)throw new F;for(var o=e.length%n,s=new Int32Array(a),l=0;l<a;l++,o+=n)s[l]=r.readCode(e,o,n);try{var u=new Kr(t);u.decode(s,a-i)}catch(C){throw new F(C)}for(var c=(1<<n)-1,f=0,l=0;l<i;l++){var p=s[l];if(p===0||p===c)throw new F;(p===1||p===c-1)&&f++}for(var h=new Array(i*n-f),g=0,l=0;l<i;l++){var p=s[l];if(p===1||p===c-1)h.fill(p>1,g,g+n-1),g+=n-1;else for(var x=n-1;x>=0;--x)h[g++]=(p&1<<x)!==0}return h},r.prototype.extractBits=function(e){var t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),i=(t?11:14)+n*4,a=new Int32Array(i),o=new Array(this.totalBitsInLayer(n,t));if(t)for(var s=0;s<a.length;s++)a[s]=s;else for(var l=i+1+2*$.truncDivision($.truncDivision(i,2)-1,15),u=i/2,c=$.truncDivision(l,2),s=0;s<u;s++){var f=s+$.truncDivision(s,15);a[u-s-1]=c-f-1,a[u+s]=c+f+1}for(var s=0,p=0;s<n;s++){for(var h=(n-s)*4+(t?9:12),g=s*2,x=i-1-g,C=0;C<h;C++)for(var m=C*2,w=0;w<2;w++)o[p+m+w]=e.get(a[g+w],a[g+C]),o[p+2*h+m+w]=e.get(a[g+C],a[x-w]),o[p+4*h+m+w]=e.get(a[x-w],a[x-C]),o[p+6*h+m+w]=e.get(a[x-C],a[g+w]);p+=h*8}return o},r.readCode=function(e,t,n){for(var i=0,a=t;a<t+n;a++)i<<=1,e[a]&&(i|=1);return i},r.readByte=function(e,t){var n=e.length-t;return n>=8?r.readCode(e,t,8):r.readCode(e,t,n)<<8-n},r.convertBoolArrayToByteArray=function(e){for(var t=new Uint8Array((e.length+7)/8),n=0;n<t.length;n++)t[n]=r.readByte(e,8*n);return t},r.prototype.totalBitsInLayer=function(e,t){return((t?88:112)+16*e)*e},r.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],r.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],r.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
|
|
221
|
+
*/const fl=G("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]);/**
|
|
222
|
+
* @license lucide-react v0.542.0 - ISC
|
|
223
|
+
*
|
|
224
|
+
* This source code is licensed under the ISC license.
|
|
225
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
226
|
+
*/const ht=G("trash",[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);/**
|
|
227
|
+
* @license lucide-react v0.542.0 - ISC
|
|
228
|
+
*
|
|
229
|
+
* This source code is licensed under the ISC license.
|
|
230
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
231
|
+
*/const Sn=G("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);/**
|
|
232
|
+
* @license lucide-react v0.542.0 - ISC
|
|
233
|
+
*
|
|
234
|
+
* This source code is licensed under the ISC license.
|
|
235
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
236
|
+
*/const nt=G("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),On=A.memo(A.forwardRef((r,e)=>{const{file:t,className:n,error:i,rightSlot:a,...o}=r;return f.jsxs(v.Card,{className:lr.cx(n,"flex w-full items-center gap-2 text-sm"),ref:e,...o,children:[i?f.jsx(v.LuIcon,{icon:Ks}):f.jsx(v.LuIcon,{icon:ta,color:"var(--base-a11)"}),i?f.jsx(v.Text,{accentColor:"danger",className:"truncate",children:i}):t?f.jsx(v.Text,{className:"truncate",children:t.name}):f.jsx("div",{className:"flex w-full justify-center",children:f.jsx(v.Spinner,{})}),a]})}));On.displayName="FileCard";const bt={danger:"danger",warning:"warning",info:"base",success:"success"};function pt(r){return Array.isArray(r)?r.every(e=>typeof e=="string"):!1}class ur{constructor(){b(this,"observers",new Set)}notify(e){for(const t of this.observers)t(e)}observe(e){return this.observers.add(e),()=>{this.observers.delete(e)}}}class bn extends ur{constructor(t){const{identifier:n}=t;super();b(this,"identifier");this.identifier=n}getOptions(){return{identifier:this.identifier}}setOptions(t){this.identifier=t.identifier??this.identifier,this.notify(this)}serialize(){return{type:this.type,identifier:this.identifier}}}class Ve extends bn{constructor(t){const{label:n,description:i=null,required:a,image:o,...s}=t;super(s);b(this,"label");b(this,"description");b(this,"required");b(this,"image");b(this,"onlyValidateAfterTouched",!0);this.label=n,this.description=i,this.required=a,this.image=o}getError(t){if(this.required&&this.isValueBlank(t))return"This field is required.";for(const n of this.getFieldValidators()){const i=n(t);if(i)return i}}serialize(){return{...super.serialize(),label:this.label,description:this.description,required:this.required,image:this.image}}getOptions(){return{...super.getOptions(),label:this.label,description:this.description,required:this.required,image:this.image}}setOptions(t){const{label:n,description:i=null,required:a,image:o,...s}=t;this.label=n??this.label,this.description=i??this.description,this.required=a??this.required,this.image=o??this.image,super.setOptions(s)}isValueBlank(t){return this.areValuesEqual(t,this.blankValue())}getFieldValidators(){return[]}}b(Ve,"fieldTypeName"),b(Ve,"fieldTypeDescription");const Xr=r=>{const{helpText:e,children:t,severity:n}=r,i=n?bt[n]:"base";return f.jsxs("div",{className:"flex flex-col gap-1",children:[t,!!e&&f.jsx(v.Text,{accentColor:i,size:"xs",children:e})]})},aa=A.createContext(()=>{throw new Error("No ImageViewerProvider found")}),$r=()=>A.useContext(aa),Nn=A.memo(r=>{const{file:e,onClose:t}=r,n=A.useRef(null),i=A.useCallback(()=>{var s;if(!n.current)return;const o=document.createElement("canvas");o.width=n.current.width,o.height=n.current.height,(s=o.getContext("2d"))==null||s.drawImage(n.current,0,0,n.current.width,n.current.height),o.toBlob(l=>{l&&navigator.clipboard.write([new ClipboardItem({"image/png":l})])},"image/png")},[]),a=A.useCallback(()=>{Wi.saveAs(e,e.name)},[e]);return f.jsx(v.Overlay.Root,{open:!0,onOpenChange:t,children:f.jsxs(v.Overlay.Content,{onOpenAutoFocus:o=>o.preventDefault(),children:[f.jsxs(v.ButtonGroup,{className:"flex gap-2 items-center top-0 absolute right-0 p-2",accentColor:"base",variant:"ghost",children:[f.jsxs(v.Tooltip.Root,{children:[f.jsx(v.Tooltip.Trigger,{asChild:!0,children:f.jsx(v.IconButton,{onClick:i,"aria-label":"copy to clipboard",children:f.jsx(v.LuIcon,{icon:Hr})})}),f.jsx(v.Tooltip.Content,{size:"sm",children:"Copy"})]}),f.jsxs(v.Tooltip.Root,{children:[f.jsx(v.Tooltip.Trigger,{asChild:!0,children:f.jsx(v.IconButton,{onClick:a,"aria-label":"download",children:f.jsx(v.LuIcon,{icon:ea})})}),f.jsx(v.Tooltip.Content,{size:"sm",children:"Download"})]}),f.jsx(v.Separator,{orientation:"vertical",size:"sm"}),f.jsx(v.Overlay.Close,{asChild:!0,children:f.jsx(v.IconButton,{onClick:t,"aria-label":"close",children:f.jsx(v.LuIcon,{icon:nt})})})]}),f.jsx("figure",{className:"size-full overflow-hidden p-4 flex justify-center items-center",children:f.jsx("img",{ref:n,className:"max-w-full max-h-full",src:URL.createObjectURL(e),alt:e.name})})]})})});Nn.displayName="ImageViewer";const oa=A.memo(r=>{const{children:e}=r,[t,n]=A.useState(null),i=A.useCallback(()=>{n(null)},[]),a=A.useCallback(s=>{n(s(i))},[i]),o=A.useCallback(()=>{t&&(t.onClose&&t.onClose(),i())},[i,t]);return f.jsxs(aa.Provider,{value:a,children:[e,t&&f.jsx(Nn,{file:t.file,onClose:o})]})});oa.displayName="FileViewerProvider";const Se=A.memo(r=>{const{className:e,label:t,children:n,severity:i,inputId:a,labelId:o,image:s}=r,[l,u]=A.useState(void 0),c=$r(),d=i?bt[i]:"base";A.useEffect(()=>{s instanceof Promise?s.then(u).catch(console.error):u(s)},[s]);const p=l?URL.createObjectURL(l):void 0,h=A.useCallback(()=>{l&&c(()=>({file:l}))},[c,l]);return f.jsxs("div",{className:"flex flex-col gap-1",children:[l&&f.jsx("img",{className:"h-[100px] w-full min-w-[300px] cursor-pointer rounded-md object-cover",src:p,alt:l.name,onClick:h}),!!t&&f.jsx("label",{className:lr.cx(e,"w-max max-w-full"),htmlFor:a,children:f.jsx(v.Text,{accentColor:d,size:"sm",id:o,className:"text-wrap",children:t})}),n]})}),Oe=r=>{const{children:e,...t}=r;return f.jsx(Xr,{...t,children:e})},hl=(r,e)=>A.useMemo(()=>!e||!r?null:r.render(e),[r,e]),cr=(r,e)=>f.jsx("div",{className:"flex flex-col gap-4",children:r.map(t=>f.jsx(A.Fragment,{children:t.render(e)},t.identifier))}),be=r=>{const{field:e,size:t,showInputOnly:n,onValuesChange:i,...a}=r,[o,s,l]=Re.useField(e.identifier),{touched:u}=s,c=s.error??e.description,d=s.error?"danger":void 0,p=e.identifier,h=`${p}-label`,g=e.required?`${e.label} *`:e.label,x=A.useMemo(()=>({...o,onChange:m=>{l.setValue(m,!1),i==null||i(e.identifier,m),(u||!e.onlyValidateAfterTouched)&&l.setError(e.getError(m))},onBlur:m=>{l.setTouched(!0,!1),l.setError(e.getError(m))}}),[e,o,l,i,u]);return[{helpText:c,size:t,severity:d,inputId:p,labelId:h,label:g,showInputOnly:n,fieldProps:x,helpers:l,field:e,touched:u},{...a,"aria-labelledby":h}]},Tn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),d=a?null:s,p=a?"":l,{value:h,name:g,onChange:x,onBlur:C}=u,w=`${e}-droppable`,[m,_]=A.useState(""),[E,S]=A.useState(""),T=E||d,D=A.useCallback(R=>{x(R),C(R)},[x,C]),M=A.useCallback(R=>{h&&h.findIndex(K=>K===R.target.value.trim())>=0?S("All options must be unique"):R.target.value?S(""):S("Option cannot be empty"),_(R.target.value)},[_,h]),P=A.useCallback(()=>{if(E)return;if(!m.trim()){S("Option cannot be empty");return}const R=m.trim();D([...h,R]),_("")},[m,E,D,h]),V=A.useCallback(R=>{R.key==="Enter"&&(R.preventDefault(),P())},[P]),W=A.useCallback(R=>{const K=Array.from(h);K.splice(R,1),D(K)},[h,D]),U=A.useCallback(R=>{if(!R.destination)return;const K=R.source.index,X=R.destination.index,ae=Array.from(h),[Fe]=ae.splice(K,1);ae.splice(X,0,Fe),D(ae)},[D,h]),J=A.useCallback(()=>{C(h)},[C,h]);return f.jsx(An.DragDropContext,{onDragEnd:U,children:f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx(Oe,{helpText:T,severity:i,children:f.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:p,image:a?void 0:o.image,children:(!c||h.length===0)&&f.jsxs("div",{className:"flex gap-2",children:[f.jsx(v.Input.Root,{className:"grow",accentColor:"base",variant:"surface",size:"sm",children:f.jsx(v.Input.Field,{value:m,onChange:M,onKeyDown:V,id:e,placeholder:o.placeholder,onBlur:J,name:g,disabled:c})}),f.jsx(v.IconButton,{size:"sm",accentColor:"base",variant:"soft",type:"button","aria-label":"Add option",disabled:!!E||c,onClick:P,children:f.jsx(v.LuIcon,{icon:Ze})})]})})}),h.length!==0&&f.jsx(An.Droppable,{droppableId:w,children:R=>f.jsxs("div",{className:"flex flex-col gap-1",...R.droppableProps,ref:R.innerRef,children:[h.map((K,X)=>f.jsx(An.Draggable,{draggableId:`${K}-draggable`,index:X,isDragDisabled:c,children:({draggableProps:ae,dragHandleProps:Fe,innerRef:Ur})=>f.jsxs(v.Badge,{...Fe,...ae,ref:Ur,className:"flex items-center justify-between gap-2",accentColor:"base",size:"sm",variant:"soft",children:[f.jsx("span",{className:"truncate",children:typeof K=="object"&&"label"in K?K.label:K}),f.jsx(v.IconButton,{size:"xs",variant:"ghost",type:"button","aria-label":"Delete option",accentColor:"base",disabled:c,onClick:()=>{W(X)},children:f.jsx(v.LuIcon,{icon:nt})})]})},`${e}-${K}-${X}`)),R.placeholder]})})]})})});Tn.displayName="MultiStringInput";const jt=class jt extends Ve{constructor(t){const{minimum_length:n,maximum_length:i,placeholder:a,...o}=t;super(o);b(this,"type","multi-string");b(this,"minLength");b(this,"maxLength");b(this,"placeholder");b(this,"onlyValidateAfterTouched",!1);this.minLength=n??0,this.maxLength=i??1/0,this.placeholder=a??"Press enter to add a new option"}render(t){return f.jsx(Tn,{field:this,...t})}serialize(){return{...super.serialize(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}getOptions(){return{...super.getOptions(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}duplicate(t){return new jt({...this.getOptions(),identifier:t})}setOptions(t){const{minimum_length:n,maximum_length:i,placeholder:a,...o}=t;this.minLength=n??this.minLength,this.maxLength=i??this.maxLength,this.placeholder=a??this.placeholder,super.setOptions(o)}serializeValue(t){return t}deserializeValue(t){return t}getFieldValidators(){const t=super.getFieldValidators();return t.push(n=>{if(Array.isArray(n)&&n.length<this.minLength)return`Must have at least ${this.minLength} options.`}),t.push(n=>{if(Array.isArray(n)&&n.length>this.maxLength)return`Must have at most ${this.maxLength} options.`}),t}static deserialize(t){return new jt(t)}isSerializedValueValid(t){return pt(t)}isValueValid(t){return pt(t)}blankValue(){return[]}areValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}};b(jt,"fieldTypeName","Multi-string"),b(jt,"fieldTypeDescription","Allows the user to provide multiple unique strings.");let Nt=jt;class dr extends Ve{constructor(t){const{options:n,...i}=t;super(i);b(this,"options");b(this,"onlyValidateAfterTouched",!1);this.options=n.map(a=>(typeof a=="string"&&(a={label:a,value:a}),a))}serialize(){return{...super.serialize(),options:this.options}}getOptions(){return{...super.getOptions(),options:this.options}}setOptions(t){const{options:n,...i}=t;this.options=(n==null?void 0:n.map(a=>(typeof a=="string"&&(a={label:a,value:a}),a)))??this.options,super.setOptions(i)}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new Nt({label:"Options",description:"List possible options for the user to select from.",required:!0,identifier:`${n}options`,minimum_length:2}),showDirectly:!0}]}}const Dn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),{name:d,onBlur:p,onChange:h,value:g}=u,x=a?null:s,C=a?"":l,w=A.useCallback(_=>{h(!!_),p(!!_)},[p,h]),m=A.useCallback(()=>{p(g)},[p,g]);return f.jsx(Oe,{helpText:x,severity:i,children:f.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:C,image:a?void 0:o.image,className:"items-center flex-row-reverse justify-end gap-2",children:f.jsx(v.Checkbox.Root,{id:e,name:d,checked:g??!1,onCheckedChange:w,onBlur:m,size:"sm",accentColor:"primary",variant:"surface",disabled:c,children:f.jsx(v.Checkbox.Indicator,{children:f.jsx(v.LuIcon,{icon:Xe})})})})})});Dn.displayName="BooleanInput";const Yt=class Yt extends Ve{constructor(t){super(t);b(this,"type","boolean");b(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}setOptions(t){super.setOptions(t)}duplicate(t){return new Yt({...this.getOptions(),identifier:t})}static deserialize(t){return new Yt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Dn,{...t,field:this})}isSerializedValueValid(t){return typeof t=="boolean"}isValueValid(t){return typeof t=="boolean"}blankValue(){return!1}areValuesEqual(t,n){return t===n}};b(Yt,"fieldTypeName","Checkbox"),b(Yt,"fieldTypeDescription","Perfect for both optional and required yes/no questions.");let Tt=Yt;const Mn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:d},{disabled:p}]=be(r),{name:h,onBlur:g,onChange:x,value:C}=u,w=a?null:s,m=a?"":l,[_,E]=A.useState(null);A.useEffect(()=>{E(C)},[C]);const S=A.useCallback(D=>{const M=D.target.valueAsNumber,P=isNaN(M)?null:M;E(P),(c||!o.onlyValidateAfterTouched)&&d.setError(o.getError(P))},[o,d,c]),T=A.useCallback(()=>{x(_),g(_)},[_,g,x]);return f.jsx(Oe,{helpText:w,severity:i,children:f.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:m,image:a?void 0:o.image,children:f.jsx(v.Input.Root,{accentColor:"base",variant:"surface",size:"sm",children:f.jsx(v.Input.Field,{id:e,name:h,onChange:S,onBlur:T,value:_??"",type:"number",min:o.minimum,max:o.maximum,step:o.integers?1:.1,placeholder:o.placeholder??"Enter a number",disabled:p})})})})});Mn.displayName="NumberInput";const ft=class ft extends Ve{constructor(t){const{minimum:n=Number.MIN_SAFE_INTEGER,maximum:i=Number.MAX_SAFE_INTEGER,integers:a=!1,placeholder:o,...s}=t;super(s);b(this,"type","number");b(this,"minimum");b(this,"maximum");b(this,"integers");b(this,"placeholder");this.minimum=n,this.maximum=i,this.integers=a,this.placeholder=o}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new ft({label:"Minimum",description:"Minimum value",integers:!0,required:!1,identifier:`${n}minimum`}),showDirectly:!1},{field:new ft({label:"Maximum",description:"Maximum value",integers:!0,required:!1,identifier:`${n}maximum`}),showDirectly:!1},{field:new Tt({label:"Integers",description:"Whole numbers only",required:!1,identifier:`${n}integers`}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.minimum,i=this.maximum;return typeof n=="number"&&t.push(a=>{if(typeof a=="number"&&a<n)return`Must be at least ${this.minimum}.`}),typeof i=="number"&&t.push(a=>{if(typeof a=="number"&&a>i)return`Must be at most ${this.maximum}.`}),this.integers&&t.push(a=>{if(typeof a=="number"&&!Number.isInteger(a))return"Must be a whole number."}),t}serialize(){return{...super.serialize(),minimum:this.minimum,maximum:this.maximum,integers:this.integers,placeholder:this.placeholder}}getOptions(){return{...super.getOptions(),minimum:this.minimum,maximum:this.maximum,integers:this.integers,placeholder:this.placeholder}}duplicate(t){return new ft({...this.getOptions(),identifier:t})}setOptions(t){const{minimum:n,maximum:i,integers:a,placeholder:o,...s}=t;this.minimum=n??this.minimum,this.maximum=i??this.maximum,this.integers=a??this.integers,this.placeholder=o??this.placeholder,super.setOptions(s)}static deserialize(t){return new ft(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Mn,{field:this,...t})}isSerializedValueValid(t){return typeof t=="number"||t===null}isValueValid(t){return typeof t=="number"||t===null}areValuesEqual(t,n){return t===n}blankValue(){return null}};b(ft,"fieldTypeName","Number"),b(ft,"fieldTypeDescription","Allows specifying a number within a given range.");let $e=ft;const Dt=1e4;class Pn extends Ve{constructor(t){const{minLength:n,maxLength:i,placeholder:a="",...o}=t;super(o);b(this,"minLength");b(this,"maxLength");b(this,"placeholder");this.minLength=n?Math.max(n,0):void 0,this.maxLength=i?Math.max(i,0):Dt,this.placeholder=a}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new $e({label:"Minimum length",description:"Minimum number of characters",required:!1,identifier:`${n}minimum_length`,minimum:0,maximum:100,integers:!0}),showDirectly:!1},{field:new $e({label:"Maximum length",description:"Maximum number of characters",required:!1,identifier:`${n}maximum_length`,minimum:1,maximum:Dt,integers:!0}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators();return this.minLength&&t.push(n=>{if(this.minLength&&(!n||n.length<this.minLength))return!this.required&&!n?null:`Minimum ${this.minLength} character(s).`}),this.maxLength&&t.push(n=>{if(typeof n=="string"&&this.maxLength&&n.length>this.maxLength)return`Maximum ${this.maxLength} character(s).`}),t}serialize(){return{...super.serialize(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}getOptions(){return{...super.getOptions(),minLength:this.minLength,maxLength:this.maxLength,placeholder:this.placeholder}}setOptions(t){const{minLength:n,maxLength:i,placeholder:a,...o}=t;this.minLength=n,this.maxLength=i??this.maxLength,this.placeholder=a,super.setOptions(o)}serializeValue(t){return t}deserializeValue(t){return t}isSerializedValueValid(t){return typeof t=="string"}isValueValid(t){return typeof t=="string"}blankValue(){return""}areValuesEqual(t,n){return t===n}}const Fn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,field:a,showInputOnly:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),{value:d,name:p,onChange:h,onBlur:g}=u,x=o?null:s,C=o?"":l,w=A.useCallback(m=>{h(m),g(m)},[g,h]);return f.jsx(Oe,{helpText:x,severity:i,children:f.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:C,image:o?void 0:a.image,children:f.jsx(v.CheckboxGroup.Root,{id:e,name:p,className:"flex flex-col gap-1",accentColor:"base",variant:"surface",size:"sm",values:d,onValuesChange:w,disabled:c,children:a.options.map((m,_)=>f.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[f.jsx(v.CheckboxGroup.Item,{value:m.value,children:f.jsx(v.CheckboxGroup.ItemIndicator,{children:f.jsx(v.LuIcon,{icon:Xe})})}),f.jsx(v.Text,{size:"sm",accentColor:"base",className:"truncate",children:m.label})]},`${e}-${m.value}-${_}`))})})})});Fn.displayName="CheckboxListInput";const Zt=class Zt extends dr{constructor(t){super(t);b(this,"type","checkbox-list");b(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new Zt({...this.getOptions(),identifier:t})}static deserialize(t){return new Zt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Fn,{field:this,...t})}isSerializedValueValid(t){return pt(t)}isValueValid(t){return pt(t)}blankValue(){return[]}areValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}};b(Zt,"fieldTypeName","Checkbox list"),b(Zt,"fieldTypeDescription","Allows the user to select a multiple options from a list.");let Mt=Zt;const Vn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),{value:d,name:p,onChange:h,onBlur:g}=u,[x,C]=A.useState(!1),w=a?null:s,m=a?"":l,_=A.useCallback(S=>{h(S??null),C(!1)},[h]),E=A.useCallback(S=>{C(S),S||g(d)},[g,d]);return f.jsx(Oe,{helpText:w,severity:i,children:f.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:m,image:a?void 0:o.image,children:f.jsxs(v.Popover.Root,{open:x,onOpenChange:E,children:[f.jsx(v.Popover.Trigger,{asChild:!0,children:f.jsxs(v.Button,{id:e,name:p,type:"button",className:"!justify-between",accentColor:"base",variant:"surface",size:"sm",disabled:c,children:[d?d.toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit"}):"yyyy-mm-dd",f.jsx(v.LuIcon,{icon:In})]})}),f.jsx(v.Popover.Content,{align:"start",children:f.jsx(v.DayPicker,{required:!1,mode:"single",variant:"solid",selected:d??void 0,onSelect:_})})]})})})});Vn.displayName="DateInput";const Kt=class Kt extends Ve{constructor(t){super(t);b(this,"type","date");b(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new Kt({...this.getOptions(),identifier:t})}static deserialize(t){return new Kt(t)}setOptions(t){super.setOptions(t)}serializeValue(t){return t?t.toISOString():null}deserializeValue(t){return t?new Date(t):null}render(t){return f.jsx(Vn,{field:this,...t})}isSerializedValueValid(t){return typeof t=="string"||t===null}isValueValid(t){return t instanceof Date||t===null}blankValue(){return null}areValuesEqual(t,n){return!t&&!n?!0:!t||!n?!1:t.getTime()===n.getTime()}};b(Kt,"fieldTypeName","Date"),b(Kt,"fieldTypeDescription","Allows specifying a date.");let fr=Kt;const Bn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),{value:d,name:p,onChange:h,onBlur:g}=u,x=a?null:s,C=a?"":l,w=A.useCallback(_=>{h(_),g(_)},[g,h]),m=A.useCallback(_=>{_||g(d)},[d,g]);return f.jsx(Oe,{helpText:x,severity:i,children:f.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:C,image:a?void 0:o.image,children:f.jsxs(v.Menu.Root,{onOpenChange:m,align:"start",children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsxs(v.Button,{id:e,name:p,className:"!justify-between",variant:"surface",type:"button",size:"sm",accentColor:"base",disabled:c,children:[f.jsx("span",{className:"truncate",children:d&&d.length>0?d.join(", "):o.placeholder??"Select one or more..."}),f.jsx(v.LuIcon,{icon:In})]})}),f.jsx(v.Menu.Content,{children:f.jsx(v.Menu.Scroll,{children:f.jsxs(v.Menu.MultiSelectGroup,{values:d,onValuesChange:w,children:[f.jsxs(v.Menu.SelectAllItem,{children:[f.jsx(v.Menu.CheckboxItemIndicator,{children:_=>_?f.jsx(v.LuIcon,{icon:Gr}):f.jsx(v.LuIcon,{icon:Xe})}),"Select all"]}),o.options.map((_,E)=>f.jsxs(v.Menu.MultiSelectItem,{value:_.value,children:[f.jsx(v.Menu.SelectedIndicator,{children:f.jsx(v.LuIcon,{icon:Xe})}),_.label]},`${e}-${_.value}-${E}`))]})})})]})})})});Bn.displayName="MultiSelectInput";const Qt=class Qt extends dr{constructor(t){const{placeholder:n,...i}=t;super(i);b(this,"type","multi-select");b(this,"placeholder");this.placeholder=n}serialize(){return super.serialize()}getOptions(){return{...super.getOptions(),placeholder:this.placeholder}}duplicate(t){return new Qt({...this.getOptions(),identifier:t})}setOptions(t){const{placeholder:n}=t;this.placeholder=n,super.setOptions(t)}static deserialize(t){return new Qt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Bn,{field:this,...t})}isSerializedValueValid(t){return pt(t)}isValueValid(t){return pt(t)}blankValue(){return[]}areValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}};b(Qt,"fieldTypeName","Multi-select"),b(Qt,"fieldTypeDescription","Allows the user to select a multiple options from a list of options.");let it=Qt;const Ln=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),{name:d,onChange:p,onBlur:h,value:g}=u,x=a?null:s,C=a?"":l,w=A.useCallback(_=>{p(_??null),h(_??null)},[h,p]),m=A.useMemo(()=>o.options.find(_=>_.value===g),[o.options,g]);return f.jsx(Oe,{helpText:x,severity:i,children:f.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:C,image:a?void 0:o.image,children:f.jsxs(v.Menu.Root,{align:"start",children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsxs(v.Button,{id:e,name:d,className:"!justify-between",accentColor:"base",variant:"surface",type:"button",size:"sm",disabled:c,children:[f.jsx("span",{className:"truncate",children:m?m.label:o.placeholder??"Select one..."}),f.jsx(v.LuIcon,{icon:In})]})}),f.jsx(v.Menu.Content,{children:f.jsx(v.Menu.Scroll,{children:f.jsx(v.Menu.SelectGroup,{required:!1,value:g??void 0,onValueChange:w,children:o.options.map((_,E)=>f.jsxs(v.Menu.SelectItem,{value:_.value,children:[f.jsx(v.Menu.SelectedIndicator,{children:f.jsx(v.LuIcon,{icon:Xe})}),_.label]},`${e}-${_.value}-${E}`))})})})]})})})});Ln.displayName="SelectInput";const Jt=class Jt extends dr{constructor(t){const{placeholder:n,...i}=t;super(i);b(this,"type","select");b(this,"placeholder");this.placeholder=n}serialize(){return super.serialize()}getOptions(){return{...super.getOptions(),placeholder:this.placeholder}}duplicate(t){return new Jt({...this.getOptions(),identifier:t})}setOptions(t){const{placeholder:n}=t;this.placeholder=n,super.setOptions(t)}static deserialize(t){return new Jt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Ln,{field:this,...t})}isSerializedValueValid(t){return typeof t=="string"||t===null}isValueValid(t){return typeof t=="string"||t===null}blankValue(){return null}areValuesEqual(t,n){return t===n}};b(Jt,"fieldTypeName","Dropdown"),b(Jt,"fieldTypeDescription","Allows the user to select a single option from a list of options.");let vt=Jt;const zn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:d},{formId:p,disabled:h}]=be(r),{name:g,onBlur:x,onChange:C,value:w}=u,m=a?null:s,_=a?"":l,[E,S]=A.useState(""),T=A.useMemo(()=>Array.from({length:o.length},()=>H.v4()),[o.length]);A.useEffect(()=>{S(w)},[w]);const D=A.useCallback(P=>{S(P),(c||!o.onlyValidateAfterTouched)&&d.setError(o.getError(P))},[o,d,c]),M=A.useCallback(()=>{C(E),x(E)},[E,x,C]);return f.jsx(Oe,{helpText:m,severity:i,children:f.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:_,image:a?void 0:o.image,children:f.jsxs(v.OneTimePasswordField.Root,{id:e,name:g,value:E,onValueChange:D,validationType:o.validationType,form:p,disabled:h,orientation:"horizontal",dir:"ltr",type:"text",autoComplete:"off",autoFocus:!1,autoSubmit:!1,className:"flex gap-1 h-max w-full overflow-x-auto p-0.25",accentColor:"base",variant:"surface",size:"sm",onBlur:M,children:[T.map(P=>f.jsx(v.OneTimePasswordField.Input,{id:P},P)),f.jsx(v.OneTimePasswordField.HiddenInput,{})]})})})});zn.displayName="NumberInput";const er=class er extends Ve{constructor(t){const{length:n,validationType:i,...a}=t;super(a);b(this,"type","otp");b(this,"length");b(this,"validationType");this.length=n,this.validationType=i}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new $e({label:"Length",integers:!0,required:!1,minimum:1,maximum:16,identifier:`${n}length`}),showDirectly:!1},{field:new vt({label:"Type",required:!1,identifier:`${n}validationType`,options:[{value:"none",label:"Any"},{value:"numeric",label:"Numeric"},{value:"alpha",label:"Alpha"},{value:"alphanumeric",label:"Alphanumeric"}]}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.length;return t.push(i=>{if(!this.isValueBlank(i)&&i.length!=n)return`Must be ${n} characters.`}),t}serialize(){return{...super.serialize(),length:this.length,validationType:this.validationType}}getOptions(){return{...super.getOptions(),length:this.length,validationType:this.validationType}}duplicate(t){return new er({...this.getOptions(),identifier:t})}setOptions(t){const{length:n,validationType:i,...a}=t;this.length=n??this.length,this.validationType=i??this.validationType,super.setOptions(a)}static deserialize(t){return new er(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(zn,{field:this,...t})}isSerializedValueValid(t){return typeof t=="string"}isValueValid(t){return typeof t=="string"}blankValue(){return""}areValuesEqual(t,n){return t===n}};b(er,"fieldTypeName","OTP"),b(er,"fieldTypeDescription","Allows specifying a number within a given range.");let Pt=er;const gt={pass:{label:"Pass",icon:Gs},fail:{label:"Fail",icon:qs},na:{label:"N/A",icon:$s}},Ft=Object.keys(gt);class at extends File{constructor(t,...n){super(...n);b(this,"uuid");this.uuid=t}static from(t,n){return new at(t,[n],n.name,{lastModified:n.lastModified,type:n.type})}}class Vt extends Promise{constructor(t,n){super(t);b(this,"_uuid");this._uuid=n}get uuid(){return this._uuid}set uuid(t){this._uuid=t}static from(t,n){return new Vt((i,a)=>{Promise.resolve(t).then(i).catch(a)},n)}then(t,n){const i=super.then(t,n);return i.uuid=this.uuid,i}catch(t){const n=super.catch(t);return n.uuid=this.uuid,n}finally(t){const n=super.finally(t);return n.uuid=this.uuid,n}}function sa(r){return Array.isArray(r)?r.every(e=>e instanceof Vt||e instanceof at):!1}function qr(r,e){const t=new Set(r.map(({uuid:i})=>i)),n=new Set(e.map(({uuid:i})=>i));return t.size===n.size&&t.isSubsetOf(n)}const la=A.memo(A.forwardRef((r,e)=>{const{file:t,alt:n,error:i,rightSlot:a,className:o,...s}=r;return f.jsxs(v.Card,{className:lr.cx(o,"relative flex h-[200px] w-full flex-col gap-2 overflow-hidden items-center"),ref:e,...s,children:[!t&&!i&&f.jsx("div",{className:"absolute inset-0 grow flex items-center justify-center",children:f.jsx(v.Spinner,{})}),!!t&&!i&&f.jsx(v.Card,{className:"flex max-w-full grow items-center !p-0 justify-center overflow-hidden bg-clip-padding",children:f.jsx("img",{className:"max-w-full object-cover",src:URL.createObjectURL(t),alt:n??t.name})}),(!!t||!!i)&&f.jsxs("div",{className:lr.cx("flex w-full items-center gap-2 self-end",{"bg-transparent":!t}),children:[i?f.jsx(v.LuIcon,{icon:Qs}):t&&f.jsx(v.LuIcon,{icon:ta}),f.jsx(v.Text,{className:"truncate",size:"sm",children:i??(t==null?void 0:t.name)}),a]})]})})),pl=r=>{const e=["byte","kilobyte","megabyte"];let t=r,n=0;for(;t>1e3&&n<e.length-1;)t/=1e3,n++;return new Intl.NumberFormat([],{maximumFractionDigits:Math.max(0,n-1),style:"unit",unit:e[n]}).format(t)},kn=A.memo(r=>{const{file:e,onRemove:t,disabled:n}=r,[i,a]=A.useState(null),[o,s]=A.useState(null),l=$r(),{url:u,name:c}=A.useMemo(()=>{let x=null,C,w;return i!=null&&i.type.startsWith("image/")&&(x=URL.createObjectURL(i)),i?(C=i.name,w=pl(i.size)):(C="Downloading...",w="..."),{url:x,name:C,size:w}},[i]);A.useEffect(()=>{e instanceof Vt?e.then(x=>{a(x)}).catch(x=>{s(x instanceof Error?x.message:"Unknown error")}):a(e)},[e]);const d=A.useCallback(x=>{if(x.stopPropagation(),!i)throw new Error("Cannot download a file that is not resolved.");const C=new Blob([i]);Wi.saveAs(C,c)},[c,i]),p=A.useCallback(x=>{x.stopPropagation(),t()},[t]),h=A.useCallback(()=>{i&&l(x=>({file:i,onDelete:n?void 0:()=>{t(),x()}}))},[n,t,l,i]),g=A.useMemo(()=>f.jsxs(v.ButtonGroup,{className:"flex grow justify-end",variant:"ghost",accentColor:"base",size:"sm",children:[f.jsx(v.IconButton,{"aria-label":`Download ${c}`,type:"button",onClick:d,disabled:!i,children:f.jsx(v.LuIcon,{icon:ea})}),!n&&f.jsx(v.IconButton,{type:"button","aria-label":`Remove ${c}`,disabled:n,onClick:p,children:f.jsx(v.LuIcon,{icon:ht})})]}),[n,p,d,c,i]);return u?f.jsx(la,{className:"cursor-pointer",onClick:h,file:i,error:o??void 0,rightSlot:g}):f.jsx(On,{file:i,error:o??void 0,rightSlot:g})});kn.displayName="DisplayFile";const Rn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:d},{disabled:p}]=be(r),{value:h,onChange:g,onBlur:x,name:C}=u,[w,m]=A.useState(""),_=A.useRef(null),E=a?null:s,S=a?"":l,T=h.status&&o.showNotesAndFilesOn.includes(h.status),D=A.useCallback(X=>{const ae=o.cleanValue({...h,status:X});g(ae),x(ae)},[o,x,g,h]);A.useEffect(()=>{m(h.notes)},[h]);const M=A.useCallback(X=>{const ae=X.target.value;m(ae),(c||!o.onlyValidateAfterTouched)&&d.setError(o.getError({...h,notes:w}))},[o,d,w,c,h]),P=A.useCallback(()=>{const X={...h,notes:w};g(X),x(X)},[w,x,g,h]),V=A.useCallback(X=>{const ae=[...h.files];ae.splice(X,1),g({...h,files:ae})},[g,h]),W=A.useCallback(()=>{var X;(X=_.current)==null||X.click()},[]),U=A.useCallback(X=>{const ae=Array.from(X.target.files??[]).map(Ur=>at.from(H.v4(),Ur)),Fe={...h,files:[...h.files,...ae]};g(Fe),x(Fe)},[x,g,h]);A.useEffect(()=>{if(!_.current)return;const X=new AbortController;return _.current.addEventListener("cancel",()=>{x(h)},{signal:X.signal}),()=>{X.abort()}},[x,h]);const J=`${e}-status`,R=`${e}-notes`,K=`${e}-files`;return f.jsx(Oe,{helpText:E,severity:i,children:f.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:S,image:a?void 0:o.image,children:f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx(v.RadioGroup.Root,{id:J,className:"flex gap-2",name:C,value:h.status,disabled:p,accentColor:"base",variant:"surface",size:"sm",onValueChange:D,children:Ft.map(X=>{const{label:ae}=gt[X];return f.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[f.jsx(v.RadioGroup.Item,{value:X,children:f.jsx(v.RadioGroup.Indicator,{children:f.jsx(v.LuIcon,{icon:Qi,className:"fill-current"})})}),f.jsx(v.Text,{size:"sm",accentColor:"base",className:"truncate",children:ae})]},`${e}-${X}`)})}),T&&f.jsxs(f.Fragment,{children:[f.jsx("div",{children:f.jsx(v.TextArea,{id:R,value:w,name:C,onChange:M,onBlur:P,className:"field-sizing-content w-full min-h-12",placeholder:"Notes",resize:"vertical",accentColor:"base",variant:"surface",size:"sm",disabled:p})}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsxs(v.Button,{className:"w-max",size:"sm",variant:"soft",accentColor:"base",onClick:W,type:"button",disabled:p,children:[f.jsx(v.LuIcon,{icon:Sn}),"Select files"]}),f.jsx("input",{id:K,name:C,type:"file",ref:_,multiple:!0,className:"hidden",onChange:U,value:""}),h.files.length>0&&f.jsx("div",{className:"flex h-max flex-col gap-2",children:h.files.map((X,ae)=>f.jsx(kn,{file:X,onRemove:()=>{V(ae)},disabled:p},ae))})]})]})]})})})});Rn.displayName="PassFailInput";const Un=r=>typeof r=="string"&&Ft.includes(r),ua=r=>!(r===null||typeof r!="object"||!("status"in r)||!Un(r.status)||!("notes"in r)||typeof r.notes!="string"||!("files"in r)||!(Array.isArray(r.files)&&r.files.length===0)),ca=r=>!(r===null||typeof r!="object"||!("status"in r)||!Un(r.status)||!("notes"in r)||typeof r.notes!="string"||!("files"in r)||!sa(r.files)),da=r=>({status:r.status,notes:r.notes,files:[]}),fa=r=>({status:r.status,notes:r.notes,files:[]}),ha=(r,e)=>!(r.status!==e.status||r.notes!==e.notes||!qr(r.files,e.files)),tr=class tr extends Ve{constructor(t){const{showNotesAndFilesOn:n,...i}=t;super(i);b(this,"type","pass-fail");b(this,"onlyValidateAfterTouched",!1);b(this,"showNotesAndFilesOn");this.showNotesAndFilesOn=n}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new it({identifier:`${n}showNotesAndFilesOn`,label:"Show notes and files on",description:"Show the notes and files on desired statuses.",options:Ft.map(i=>{const{label:a}=gt[i];return{value:i,label:a}}),required:!1}),showDirectly:!1}]}serialize(){return{...super.serialize(),showNotesAndFilesOn:this.showNotesAndFilesOn}}getOptions(){return{...super.getOptions(),showNotesAndFilesOn:this.showNotesAndFilesOn}}duplicate(t){return new tr({...this.getOptions(),identifier:t})}setOptions(t){const{showNotesAndFilesOn:n,...i}=t;this.showNotesAndFilesOn=n??this.showNotesAndFilesOn,super.setOptions(i)}getFieldValidators(){const t=super.getFieldValidators(),n=this.showNotesAndFilesOn,i=this.blankValue();return n.length>0&&(t.push(a=>{if(!(!a.status||!n.includes(a.status))&&i.notes===a.notes)return"Notes is required."}),t.push(a=>{if(!(!a.status||!n.includes(a.status))&&qr(i.files,a.files))return"Files is required."})),t}static deserialize(t){return new tr({...t,showNotesAndFilesOn:t.showNotesAndFilesOn??!1})}serializeValue(t){return da(t)}deserializeValue(t){return fa(t)}render(t){return f.jsx(Rn,{field:this,...t})}isSerializedValueValid(t){return ua(t)}isValueValid(t){return ca(t)}areValuesEqual(t,n){return ha(t,n)}blankValue(){return{status:null,notes:"",files:[]}}cleanValue(t){return t.status&&this.showNotesAndFilesOn.includes(t.status)?t:{status:t.status,notes:"",files:[]}}};b(tr,"fieldTypeName","Pass - Fail"),b(tr,"fieldTypeDescription","Track pass, fail, or N/A outcome.");let Bt=tr;const Hn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),{name:d,onChange:p,onBlur:h,value:g}=u,x=a?null:s,C=a?"":l,w=A.useCallback(_=>{p(_),h(_)},[h,p]),m=A.useCallback(()=>{p(null),h(null)},[h,p]);return f.jsx(Oe,{helpText:x,severity:i,children:f.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:C,image:a?void 0:o.image,children:f.jsxs(v.RadioGroup.Root,{id:e,name:d,className:"flex flex-col gap-1",accentColor:"base",variant:"surface",size:"sm",value:g??"",onValueChange:w,disabled:c,children:[o.options.map((_,E)=>f.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[f.jsx(v.RadioGroup.Item,{value:_.value,children:f.jsx(v.RadioGroup.Indicator,{children:f.jsx(v.LuIcon,{icon:Qi,className:"fill-current"})})}),f.jsx(v.Text,{size:"sm",accentColor:"base",className:"truncate",children:_.label})]},`${e}-${_.value}-${E}`)),!!g&&f.jsxs(v.Button,{onClick:m,className:"w-max -mx-2",type:"button",variant:"ghost",accentColor:"base",size:"sm",children:[f.jsx(v.LuIcon,{icon:nt}),"Clear"]})]})})})});Hn.displayName="SelectInput";const rr=class rr extends dr{constructor(t){super(t);b(this,"type","radio");b(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new rr({...this.getOptions(),identifier:t})}setOptions(t){super.setOptions(t)}static deserialize(t){return new rr(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Hn,{field:this,...t})}isSerializedValueValid(t){return typeof t=="string"||t==="null"}isValueValid(t){return typeof t=="string"||t==="null"}blankValue(){return null}areValuesEqual(t,n){return t===n}};b(rr,"fieldTypeName","Option list"),b(rr,"fieldTypeDescription","Allows the user to select a single option from a list of options.");let Lt=rr;const Gn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=be(r),{name:d,onChange:p,onBlur:h,value:g}=u,x=a?null:s,C=a?"":l,w=A.useCallback(E=>{p(E),h(E)},[h,p]),m=A.useCallback(()=>{p(null),h(null)},[h,p]),_=Array.from({length:o.maxRating},(E,S)=>S+1);return f.jsx(Oe,{helpText:x,severity:i,children:f.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:C,image:a?void 0:o.image,children:f.jsxs("div",{className:"flex flex-row gap-1 items-center",children:[f.jsx(v.Rating.Root,{id:e,name:d,className:"flex items-center gap-0.5",value:g,onValueChange:w,disabled:c,children:_.map(E=>f.jsx(v.Rating.Item,{value:E,className:"group size-7 flex cursor-pointer disabled:opacity-50 disabled:pointer-events-none items-center justify-center text-yellow-500 transition-colors",children:f.jsx(v.LuIcon,{icon:ia,className:"group-data-[active=true]:fill-current size-full"})},`${e}-${E}`))}),!c&&g!==null&&f.jsx(v.IconButton,{onClick:m,type:"button",variant:"ghost",accentColor:"base",size:"sm",children:f.jsx(v.LuIcon,{icon:nt})})]})})})});Gn.displayName="RatingInput";const nr=class nr extends Ve{constructor(t){const{maxRating:n,...i}=t;super(i);b(this,"type","rating");b(this,"maxRating");this.maxRating=n}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new $e({label:"Max Rating",description:"Maximum rating value",integers:!0,required:!1,minimum:1,maximum:10,identifier:`${n}maxRating`}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.maxRating;return t.push(i=>{if(typeof i=="number"&&(i<1||i>n))return`Rating must be between 1 and ${n}.`}),t}serialize(){return{...super.serialize(),maxRating:this.maxRating}}getOptions(){return{...super.getOptions(),maxRating:this.maxRating}}duplicate(t){return new nr({...this.getOptions(),identifier:t})}setOptions(t){const{maxRating:n,...i}=t;this.maxRating=n??this.maxRating,super.setOptions(i)}static deserialize(t){return new nr(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Gn,{field:this,...t})}isSerializedValueValid(t){return typeof t=="number"||t===null}isValueValid(t){return typeof t=="number"||t===null}areValuesEqual(t,n){return t===n}blankValue(){return null}};b(nr,"fieldTypeName","Rating"),b(nr,"fieldTypeDescription","Allows users to select a rating value.");let zt=nr;const pa=A.createContext(()=>{throw new Error("No ScannerProvider found")}),vl=()=>A.use(pa);function gl(r,e){var t=Object.setPrototypeOf;t?t(r,e):r.__proto__=e}function xl(r,e){e===void 0&&(e=r.constructor);var t=Error.captureStackTrace;t&&t(r,e)}var yl=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Cl=function(r){yl(e,r);function e(t,n){var i=this.constructor,a=r.call(this,t,n)||this;return Object.defineProperty(a,"name",{value:i.name,enumerable:!1,configurable:!0}),gl(a,i.prototype),xl(a),a}return e}(Error),wl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ue=function(r){wl(e,r);function e(t){t===void 0&&(t=void 0);var n=r.call(this,t)||this;return n.message=t,n}return e.prototype.getKind=function(){var t=this.constructor;return t.kind},e.kind="Exception",e}(Cl),ml=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ke=function(r){ml(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ArgumentException",e}(Ue),_l=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),k=function(r){_l(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IllegalArgumentException",e}(Ue),Al=function(){function r(e){if(this.binarizer=e,e===null)throw new k("Binarizer must be non-null.")}return r.prototype.getWidth=function(){return this.binarizer.getWidth()},r.prototype.getHeight=function(){return this.binarizer.getHeight()},r.prototype.getBlackRow=function(e,t){return this.binarizer.getBlackRow(e,t)},r.prototype.getBlackMatrix=function(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix},r.prototype.isCropSupported=function(){return this.binarizer.getLuminanceSource().isCropSupported()},r.prototype.crop=function(e,t,n,i){var a=this.binarizer.getLuminanceSource().crop(e,t,n,i);return new r(this.binarizer.createBinarizer(a))},r.prototype.isRotateSupported=function(){return this.binarizer.getLuminanceSource().isRotateSupported()},r.prototype.rotateCounterClockwise=function(){var e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new r(this.binarizer.createBinarizer(e))},r.prototype.rotateCounterClockwise45=function(){var e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new r(this.binarizer.createBinarizer(e))},r.prototype.toString=function(){try{return this.getBlackMatrix().toString()}catch{return""}},r}(),El=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ce=function(r){El(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getChecksumInstance=function(){return new e},e.kind="ChecksumException",e}(Ue),Il=function(){function r(e){this.source=e}return r.prototype.getLuminanceSource=function(){return this.source},r.prototype.getWidth=function(){return this.source.getWidth()},r.prototype.getHeight=function(){return this.source.getHeight()},r}(),se=function(){function r(){}return r.arraycopy=function(e,t,n,i,a){for(;a--;)n[i++]=e[t++]},r.currentTimeMillis=function(){return Date.now()},r}(),Sl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Xn=function(r){Sl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IndexOutOfBoundsException",e}(Ue),Ol=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),va=function(r){Ol(e,r);function e(t,n){t===void 0&&(t=void 0),n===void 0&&(n=void 0);var i=r.call(this,n)||this;return i.index=t,i.message=n,i}return e.kind="ArrayIndexOutOfBoundsException",e}(Xn),bl=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},he=function(){function r(){}return r.fill=function(e,t){for(var n=0,i=e.length;n<i;n++)e[n]=t},r.fillWithin=function(e,t,n,i){r.rangeCheck(e.length,t,n);for(var a=t;a<n;a++)e[a]=i},r.rangeCheck=function(e,t,n){if(t>n)throw new k("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new va(t);if(n>e)throw new va(n)},r.asList=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e},r.create=function(e,t,n){var i=Array.from({length:e});return i.map(function(a){return Array.from({length:t}).fill(n)})},r.createInt32Array=function(e,t,n){var i=Array.from({length:e});return i.map(function(a){return Int32Array.from({length:t}).fill(n)})},r.equals=function(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0},r.hashCode=function(e){var t,n;if(e===null)return 0;var i=1;try{for(var a=bl(e),o=a.next();!o.done;o=a.next()){var s=o.value;i=31*i+s}}catch(l){t={error:l}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return i},r.fillUint8Array=function(e,t){for(var n=0;n!==e.length;n++)e[n]=t},r.copyOf=function(e,t){return e.slice(0,t)},r.copyOfUint8Array=function(e,t){if(e.length<=t){var n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)},r.copyOfRange=function(e,t,n){var i=n-t,a=new Int32Array(i);return se.arraycopy(e,t,a,0,i),a},r.binarySearch=function(e,t,n){n===void 0&&(n=r.numberComparator);for(var i=0,a=e.length-1;i<=a;){var o=a+i>>1,s=n(t,e[o]);if(s>0)i=o+1;else if(s<0)a=o-1;else return o}return-i-1},r.numberComparator=function(e,t){return e-t},r}(),q=function(){function r(){}return r.numberOfTrailingZeros=function(e){var t;if(e===0)return 32;var n=31;return t=e<<16,t!==0&&(n-=16,e=t),t=e<<8,t!==0&&(n-=8,e=t),t=e<<4,t!==0&&(n-=4,e=t),t=e<<2,t!==0&&(n-=2,e=t),n-(e<<1>>>31)},r.numberOfLeadingZeros=function(e){if(e===0)return 32;var t=1;return e>>>16||(t+=16,e<<=16),e>>>24||(t+=8,e<<=8),e>>>28||(t+=4,e<<=4),e>>>30||(t+=2,e<<=2),t-=e>>>31,t},r.toHexString=function(e){return e.toString(16)},r.toBinaryString=function(e){return String(parseInt(String(e),2))},r.bitCount=function(e){return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),e=e+(e>>>4)&252645135,e=e+(e>>>8),e=e+(e>>>16),e&63},r.truncDivision=function(e,t){return Math.trunc(e/t)},r.parseInt=function(e,t){return t===void 0&&(t=void 0),parseInt(e,t)},r.MIN_VALUE_32_BITS=-2147483648,r.MAX_VALUE=Number.MAX_SAFE_INTEGER,r}(),we=function(){function r(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=r.makeArray(e):this.bits=t)}return r.prototype.getSize=function(){return this.size},r.prototype.getSizeInBytes=function(){return Math.floor((this.size+7)/8)},r.prototype.ensureCapacity=function(e){if(e>this.bits.length*32){var t=r.makeArray(e);se.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}},r.prototype.get=function(e){return(this.bits[Math.floor(e/32)]&1<<(e&31))!==0},r.prototype.set=function(e){this.bits[Math.floor(e/32)]|=1<<(e&31)},r.prototype.flip=function(e){this.bits[Math.floor(e/32)]^=1<<(e&31)},r.prototype.getNextSet=function(e){var t=this.size;if(e>=t)return t;var n=this.bits,i=Math.floor(e/32),a=n[i];a&=~((1<<(e&31))-1);for(var o=n.length;a===0;){if(++i===o)return t;a=n[i]}var s=i*32+q.numberOfTrailingZeros(a);return s>t?t:s},r.prototype.getNextUnset=function(e){var t=this.size;if(e>=t)return t;var n=this.bits,i=Math.floor(e/32),a=~n[i];a&=~((1<<(e&31))-1);for(var o=n.length;a===0;){if(++i===o)return t;a=~n[i]}var s=i*32+q.numberOfTrailingZeros(a);return s>t?t:s},r.prototype.setBulk=function(e,t){this.bits[Math.floor(e/32)]=t},r.prototype.setRange=function(e,t){if(t<e||e<0||t>this.size)throw new k;if(t!==e){t--;for(var n=Math.floor(e/32),i=Math.floor(t/32),a=this.bits,o=n;o<=i;o++){var s=o>n?0:e&31,l=o<i?31:t&31,u=(2<<l)-(1<<s);a[o]|=u}}},r.prototype.clear=function(){for(var e=this.bits.length,t=this.bits,n=0;n<e;n++)t[n]=0},r.prototype.isRange=function(e,t,n){if(t<e||e<0||t>this.size)throw new k;if(t===e)return!0;t--;for(var i=Math.floor(e/32),a=Math.floor(t/32),o=this.bits,s=i;s<=a;s++){var l=s>i?0:e&31,u=s<a?31:t&31,c=(2<<u)-(1<<l)&4294967295;if((o[s]&c)!==(n?c:0))return!1}return!0},r.prototype.appendBit=function(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++},r.prototype.appendBits=function(e,t){if(t<0||t>32)throw new k("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(var n=t;n>0;n--)this.appendBit((e>>n-1&1)===1)},r.prototype.appendBitArray=function(e){var t=e.size;this.ensureCapacity(this.size+t);for(var n=0;n<t;n++)this.appendBit(e.get(n))},r.prototype.xor=function(e){if(this.size!==e.size)throw new k("Sizes don't match");for(var t=this.bits,n=0,i=t.length;n<i;n++)t[n]^=e.bits[n]},r.prototype.toBytes=function(e,t,n,i){for(var a=0;a<i;a++){for(var o=0,s=0;s<8;s++)this.get(e)&&(o|=1<<7-s),e++;t[n+a]=o}},r.prototype.getBitArray=function(){return this.bits},r.prototype.reverse=function(){for(var e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,i=this.bits,a=0;a<n;a++){var o=i[a];o=o>>1&1431655765|(o&1431655765)<<1,o=o>>2&858993459|(o&858993459)<<2,o=o>>4&252645135|(o&252645135)<<4,o=o>>8&16711935|(o&16711935)<<8,o=o>>16&65535|(o&65535)<<16,e[t-a]=o}if(this.size!==n*32){for(var s=n*32-this.size,l=e[0]>>>s,a=1;a<n;a++){var u=e[a];l|=u<<32-s,e[a-1]=l,l=u>>>s}e[n-1]=l}this.bits=e},r.makeArray=function(e){return new Int32Array(Math.floor((e+31)/32))},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.size===t.size&&he.equals(this.bits,t.bits)},r.prototype.hashCode=function(){return 31*this.size+he.hashCode(this.bits)},r.prototype.toString=function(){for(var e="",t=0,n=this.size;t<n;t++)(t&7)===0&&(e+=" "),e+=this.get(t)?"X":".";return e},r.prototype.clone=function(){return new r(this.size,this.bits.slice())},r.prototype.toArray=function(){for(var e=[],t=0,n=this.size;t<n;t++)e.push(this.get(t));return e},r}(),$n;(function(r){r[r.OTHER=0]="OTHER",r[r.PURE_BARCODE=1]="PURE_BARCODE",r[r.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",r[r.TRY_HARDER=3]="TRY_HARDER",r[r.CHARACTER_SET=4]="CHARACTER_SET",r[r.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",r[r.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",r[r.ASSUME_GS1=7]="ASSUME_GS1",r[r.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",r[r.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",r[r.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})($n||($n={}));const ce=$n;var Nl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),F=function(r){Nl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getFormatInstance=function(){return new e},e.kind="FormatException",e}(Ue),Tl=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ne;(function(r){r[r.Cp437=0]="Cp437",r[r.ISO8859_1=1]="ISO8859_1",r[r.ISO8859_2=2]="ISO8859_2",r[r.ISO8859_3=3]="ISO8859_3",r[r.ISO8859_4=4]="ISO8859_4",r[r.ISO8859_5=5]="ISO8859_5",r[r.ISO8859_6=6]="ISO8859_6",r[r.ISO8859_7=7]="ISO8859_7",r[r.ISO8859_8=8]="ISO8859_8",r[r.ISO8859_9=9]="ISO8859_9",r[r.ISO8859_10=10]="ISO8859_10",r[r.ISO8859_11=11]="ISO8859_11",r[r.ISO8859_13=12]="ISO8859_13",r[r.ISO8859_14=13]="ISO8859_14",r[r.ISO8859_15=14]="ISO8859_15",r[r.ISO8859_16=15]="ISO8859_16",r[r.SJIS=16]="SJIS",r[r.Cp1250=17]="Cp1250",r[r.Cp1251=18]="Cp1251",r[r.Cp1252=19]="Cp1252",r[r.Cp1256=20]="Cp1256",r[r.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",r[r.UTF8=22]="UTF8",r[r.ASCII=23]="ASCII",r[r.Big5=24]="Big5",r[r.GB18030=25]="GB18030",r[r.EUC_KR=26]="EUC_KR"})(ne||(ne={}));var pe=function(){function r(e,t,n){for(var i,a,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=o,r.VALUE_IDENTIFIER_TO_ECI.set(e,this),r.NAME_TO_ECI.set(n,this);for(var l=this.values,u=0,c=l.length;u!==c;u++){var d=l[u];r.VALUES_TO_ECI.set(d,this)}try{for(var p=Tl(o),h=p.next();!h.done;h=p.next()){var g=h.value;r.NAME_TO_ECI.set(g,this)}}catch(x){i={error:x}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}}return r.prototype.getValueIdentifier=function(){return this.valueIdentifier},r.prototype.getName=function(){return this.name},r.prototype.getValue=function(){return this.values[0]},r.getCharacterSetECIByValue=function(e){if(e<0||e>=900)throw new F("incorect value");var t=r.VALUES_TO_ECI.get(e);if(t===void 0)throw new F("incorect value");return t},r.getCharacterSetECIByName=function(e){var t=r.NAME_TO_ECI.get(e);if(t===void 0)throw new F("incorect value");return t},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.getName()===t.getName()},r.VALUE_IDENTIFIER_TO_ECI=new Map,r.VALUES_TO_ECI=new Map,r.NAME_TO_ECI=new Map,r.Cp437=new r(ne.Cp437,Int32Array.from([0,2]),"Cp437"),r.ISO8859_1=new r(ne.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),r.ISO8859_2=new r(ne.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),r.ISO8859_3=new r(ne.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),r.ISO8859_4=new r(ne.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),r.ISO8859_5=new r(ne.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),r.ISO8859_6=new r(ne.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),r.ISO8859_7=new r(ne.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),r.ISO8859_8=new r(ne.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),r.ISO8859_9=new r(ne.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),r.ISO8859_10=new r(ne.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),r.ISO8859_11=new r(ne.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),r.ISO8859_13=new r(ne.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),r.ISO8859_14=new r(ne.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),r.ISO8859_15=new r(ne.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),r.ISO8859_16=new r(ne.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),r.SJIS=new r(ne.SJIS,20,"SJIS","Shift_JIS"),r.Cp1250=new r(ne.Cp1250,21,"Cp1250","windows-1250"),r.Cp1251=new r(ne.Cp1251,22,"Cp1251","windows-1251"),r.Cp1252=new r(ne.Cp1252,23,"Cp1252","windows-1252"),r.Cp1256=new r(ne.Cp1256,24,"Cp1256","windows-1256"),r.UnicodeBigUnmarked=new r(ne.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),r.UTF8=new r(ne.UTF8,26,"UTF8","UTF-8"),r.ASCII=new r(ne.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),r.Big5=new r(ne.Big5,28,"Big5"),r.GB18030=new r(ne.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),r.EUC_KR=new r(ne.EUC_KR,30,"EUC_KR","EUC-KR"),r}(),Dl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Wr=function(r){Dl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="UnsupportedOperationException",e}(Ue),qe=function(){function r(){}return r.decode=function(e,t){var n=this.encodingName(t);return this.customDecoder?this.customDecoder(e,n):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(n)?this.decodeFallback(e,n):new TextDecoder(n).decode(e)},r.shouldDecodeOnFallback=function(e){return!r.isBrowser()&&e==="ISO-8859-1"},r.encode=function(e,t){var n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):typeof TextEncoder>"u"?this.encodeFallback(e):new TextEncoder().encode(e)},r.isBrowser=function(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"},r.encodingName=function(e){return typeof e=="string"?e:e.getName()},r.encodingCharacterSet=function(e){return e instanceof pe?e:pe.getCharacterSetECIByName(e)},r.decodeFallback=function(e,t){var n=this.encodingCharacterSet(t);if(r.isDecodeFallbackSupported(n)){for(var i="",a=0,o=e.length;a<o;a++){var s=e[a].toString(16);s.length<2&&(s="0"+s),i+="%"+s}return decodeURIComponent(i)}if(n.equals(pe.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new Wr("Encoding "+this.encodingName(t)+" not supported by fallback.")},r.isDecodeFallbackSupported=function(e){return e.equals(pe.UTF8)||e.equals(pe.ISO8859_1)||e.equals(pe.ASCII)},r.encodeFallback=function(e){for(var t=btoa(unescape(encodeURIComponent(e))),n=t.split(""),i=[],a=0;a<n.length;a++)i.push(n[a].charCodeAt(0));return new Uint8Array(i)},r}(),Y=function(){function r(){}return r.castAsNonUtf8Char=function(e,t){t===void 0&&(t=null);var n=t?t.getName():this.ISO88591;return qe.decode(new Uint8Array([e]),n)},r.guessEncoding=function(e,t){if(t!=null&&t.get(ce.CHARACTER_SET)!==void 0)return t.get(ce.CHARACTER_SET).toString();for(var n=e.length,i=!0,a=!0,o=!0,s=0,l=0,u=0,c=0,d=0,p=0,h=0,g=0,x=0,C=0,w=0,m=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191,_=0;_<n&&(i||a||o);_++){var E=e[_]&255;o&&(s>0?(E&128)===0?o=!1:s--:(E&128)!==0&&((E&64)===0?o=!1:(s++,(E&32)===0?l++:(s++,(E&16)===0?u++:(s++,(E&8)===0?c++:o=!1))))),i&&(E>127&&E<160?i=!1:E>159&&(E<192||E===215||E===247)&&w++),a&&(d>0?E<64||E===127||E>252?a=!1:d--:E===128||E===160||E>239?a=!1:E>160&&E<224?(p++,g=0,h++,h>x&&(x=h)):E>127?(d++,h=0,g++,g>C&&(C=g)):(h=0,g=0))}return o&&s>0&&(o=!1),a&&d>0&&(a=!1),o&&(m||l+u+c>0)?r.UTF8:a&&(r.ASSUME_SHIFT_JIS||x>=3||C>=3)?r.SHIFT_JIS:i&&a?x===2&&p===2||w*10>=n?r.SHIFT_JIS:r.ISO88591:i?r.ISO88591:a?r.SHIFT_JIS:o?r.UTF8:r.PLATFORM_DEFAULT_ENCODING},r.format=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=-1;function a(s,l,u,c,d,p){if(s==="%%")return"%";if(t[++i]!==void 0){s=c?parseInt(c.substr(1)):void 0;var h=d?parseInt(d.substr(1)):void 0,g;switch(p){case"s":g=t[i];break;case"c":g=t[i][0];break;case"f":g=parseFloat(t[i]).toFixed(s);break;case"p":g=parseFloat(t[i]).toPrecision(s);break;case"e":g=parseFloat(t[i]).toExponential(s);break;case"x":g=parseInt(t[i]).toString(h||16);break;case"d":g=parseFloat(parseInt(t[i],h||10).toPrecision(s)).toFixed(0);break}g=typeof g=="object"?JSON.stringify(g):(+g).toString(h);for(var x=parseInt(u),C=u&&u[0]+""=="0"?"0":" ";g.length<x;)g=l!==void 0?g+C:C+g;return g}}var o=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(o,a)},r.getBytes=function(e,t){return qe.encode(e,t)},r.getCharCode=function(e,t){return t===void 0&&(t=0),e.charCodeAt(t)},r.getCharAt=function(e){return String.fromCharCode(e)},r.SHIFT_JIS=pe.SJIS.getName(),r.GB2312="GB2312",r.ISO88591=pe.ISO8859_1.getName(),r.EUC_JP="EUC_JP",r.UTF8=pe.UTF8.getName(),r.PLATFORM_DEFAULT_ENCODING=r.UTF8,r.ASSUME_SHIFT_JIS=!1,r}(),$=function(){function r(e){e===void 0&&(e=""),this.value=e}return r.prototype.enableDecoding=function(e){return this.encoding=e,this},r.prototype.append=function(e){return typeof e=="string"?this.value+=e.toString():this.encoding?this.value+=Y.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this},r.prototype.appendChars=function(e,t,n){for(var i=t;t<t+n;i++)this.append(e[i]);return this},r.prototype.length=function(){return this.value.length},r.prototype.charAt=function(e){return this.value.charAt(e)},r.prototype.deleteCharAt=function(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)},r.prototype.setCharAt=function(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)},r.prototype.substring=function(e,t){return this.value.substring(e,t)},r.prototype.setLengthToZero=function(){this.value=""},r.prototype.toString=function(){return this.value},r.prototype.insert=function(e,t){this.value=this.value.substring(0,e)+t+this.value.substring(e)},r}(),tt=function(){function r(e,t,n,i){if(this.width=e,this.height=t,this.rowSize=n,this.bits=i,t==null&&(t=e),this.height=t,e<1||t<1)throw new k("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,i==null&&(this.bits=new Int32Array(this.rowSize*this.height))}return r.parseFromBooleanArray=function(e){for(var t=e.length,n=e[0].length,i=new r(n,t),a=0;a<t;a++)for(var o=e[a],s=0;s<n;s++)o[s]&&i.set(s,a);return i},r.parseFromString=function(e,t,n){if(e===null)throw new k("stringRepresentation cannot be null");for(var i=new Array(e.length),a=0,o=0,s=-1,l=0,u=0;u<e.length;)if(e.charAt(u)===`
|
|
237
|
+
`||e.charAt(u)==="\r"){if(a>o){if(s===-1)s=a-o;else if(a-o!==s)throw new k("row lengths do not match");o=a,l++}u++}else if(e.substring(u,u+t.length)===t)u+=t.length,i[a]=!0,a++;else if(e.substring(u,u+n.length)===n)u+=n.length,i[a]=!1,a++;else throw new k("illegal character encountered: "+e.substring(u));if(a>o){if(s===-1)s=a-o;else if(a-o!==s)throw new k("row lengths do not match");l++}for(var c=new r(s,l),d=0;d<a;d++)i[d]&&c.set(Math.floor(d%s),Math.floor(d/s));return c},r.prototype.get=function(e,t){var n=t*this.rowSize+Math.floor(e/32);return(this.bits[n]>>>(e&31)&1)!==0},r.prototype.set=function(e,t){var n=t*this.rowSize+Math.floor(e/32);this.bits[n]|=1<<(e&31)&4294967295},r.prototype.unset=function(e,t){var n=t*this.rowSize+Math.floor(e/32);this.bits[n]&=~(1<<(e&31)&4294967295)},r.prototype.flip=function(e,t){var n=t*this.rowSize+Math.floor(e/32);this.bits[n]^=1<<(e&31)&4294967295},r.prototype.xor=function(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new k("input matrix dimensions do not match");for(var t=new we(Math.floor(this.width/32)+1),n=this.rowSize,i=this.bits,a=0,o=this.height;a<o;a++)for(var s=a*n,l=e.getRow(a,t).getBitArray(),u=0;u<n;u++)i[s+u]^=l[u]},r.prototype.clear=function(){for(var e=this.bits,t=e.length,n=0;n<t;n++)e[n]=0},r.prototype.setRegion=function(e,t,n,i){if(t<0||e<0)throw new k("Left and top must be nonnegative");if(i<1||n<1)throw new k("Height and width must be at least 1");var a=e+n,o=t+i;if(o>this.height||a>this.width)throw new k("The region must fit inside the matrix");for(var s=this.rowSize,l=this.bits,u=t;u<o;u++)for(var c=u*s,d=e;d<a;d++)l[c+Math.floor(d/32)]|=1<<(d&31)&4294967295},r.prototype.getRow=function(e,t){t==null||t.getSize()<this.width?t=new we(this.width):t.clear();for(var n=this.rowSize,i=this.bits,a=e*n,o=0;o<n;o++)t.setBulk(o*32,i[a+o]);return t},r.prototype.setRow=function(e,t){se.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)},r.prototype.rotate180=function(){for(var e=this.getWidth(),t=this.getHeight(),n=new we(e),i=new we(e),a=0,o=Math.floor((t+1)/2);a<o;a++)n=this.getRow(a,n),i=this.getRow(t-1-a,i),n.reverse(),i.reverse(),this.setRow(a,i),this.setRow(t-1-a,n)},r.prototype.getEnclosingRectangle=function(){for(var e=this.width,t=this.height,n=this.rowSize,i=this.bits,a=e,o=t,s=-1,l=-1,u=0;u<t;u++)for(var c=0;c<n;c++){var d=i[u*n+c];if(d!==0){if(u<o&&(o=u),u>l&&(l=u),c*32<a){for(var p=0;(d<<31-p&4294967295)===0;)p++;c*32+p<a&&(a=c*32+p)}if(c*32+31>s){for(var p=31;!(d>>>p);)p--;c*32+p>s&&(s=c*32+p)}}}return s<a||l<o?null:Int32Array.from([a,o,s-a+1,l-o+1])},r.prototype.getTopLeftOnBit=function(){for(var e=this.rowSize,t=this.bits,n=0;n<t.length&&t[n]===0;)n++;if(n===t.length)return null;for(var i=n/e,a=n%e*32,o=t[n],s=0;(o<<31-s&4294967295)===0;)s++;return a+=s,Int32Array.from([a,i])},r.prototype.getBottomRightOnBit=function(){for(var e=this.rowSize,t=this.bits,n=t.length-1;n>=0&&t[n]===0;)n--;if(n<0)return null;for(var i=Math.floor(n/e),a=Math.floor(n%e)*32,o=t[n],s=31;!(o>>>s);)s--;return a+=s,Int32Array.from([a,i])},r.prototype.getWidth=function(){return this.width},r.prototype.getHeight=function(){return this.height},r.prototype.getRowSize=function(){return this.rowSize},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&he.equals(this.bits,t.bits)},r.prototype.hashCode=function(){var e=this.width;return e=31*e+this.width,e=31*e+this.height,e=31*e+this.rowSize,e=31*e+he.hashCode(this.bits),e},r.prototype.toString=function(e,t,n){return e===void 0&&(e="X "),t===void 0&&(t=" "),n===void 0&&(n=`
|
|
238
|
+
`),this.buildToString(e,t,n)},r.prototype.buildToString=function(e,t,n){for(var i=new $,a=0,o=this.height;a<o;a++){for(var s=0,l=this.width;s<l;s++)i.append(this.get(s,a)?e:t);i.append(n)}return i.toString()},r.prototype.clone=function(){return new r(this.width,this.height,this.rowSize,this.bits.slice())},r}(),Ml=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),N=function(r){Ml(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getNotFoundInstance=function(){return new e},e.kind="NotFoundException",e}(Ue),Pl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Fl=function(r){Pl(e,r);function e(t){var n=r.call(this,t)||this;return n.luminances=e.EMPTY,n.buckets=new Int32Array(e.LUMINANCE_BUCKETS),n}return e.prototype.getBlackRow=function(t,n){var i=this.getLuminanceSource(),a=i.getWidth();n==null||n.getSize()<a?n=new we(a):n.clear(),this.initArrays(a);for(var o=i.getRow(t,this.luminances),s=this.buckets,l=0;l<a;l++)s[(o[l]&255)>>e.LUMINANCE_SHIFT]++;var u=e.estimateBlackPoint(s);if(a<3)for(var l=0;l<a;l++)(o[l]&255)<u&&n.set(l);else for(var c=o[0]&255,d=o[1]&255,l=1;l<a-1;l++){var p=o[l+1]&255;(d*4-c-p)/2<u&&n.set(l),c=d,d=p}return n},e.prototype.getBlackMatrix=function(){var t=this.getLuminanceSource(),n=t.getWidth(),i=t.getHeight(),a=new tt(n,i);this.initArrays(n);for(var o=this.buckets,s=1;s<5;s++)for(var l=Math.floor(i*s/5),u=t.getRow(l,this.luminances),c=Math.floor(n*4/5),d=Math.floor(n/5);d<c;d++){var p=u[d]&255;o[p>>e.LUMINANCE_SHIFT]++}for(var h=e.estimateBlackPoint(o),g=t.getMatrix(),s=0;s<i;s++)for(var x=s*n,d=0;d<n;d++){var p=g[x+d]&255;p<h&&a.set(d,s)}return a},e.prototype.createBinarizer=function(t){return new e(t)},e.prototype.initArrays=function(t){this.luminances.length<t&&(this.luminances=new Uint8ClampedArray(t));for(var n=this.buckets,i=0;i<e.LUMINANCE_BUCKETS;i++)n[i]=0},e.estimateBlackPoint=function(t){for(var n=t.length,i=0,a=0,o=0,s=0;s<n;s++)t[s]>o&&(a=s,o=t[s]),t[s]>i&&(i=t[s]);for(var l=0,u=0,s=0;s<n;s++){var c=s-a,d=t[s]*c*c;d>u&&(l=s,u=d)}if(a>l){var p=a;a=l,l=p}if(l-a<=n/16)throw new N;for(var h=l-1,g=-1,s=l-1;s>a;s--){var x=s-a,d=x*x*(l-s)*(i-t[s]);d>g&&(h=s,g=d)}return h<<e.LUMINANCE_SHIFT},e.LUMINANCE_BITS=5,e.LUMINANCE_SHIFT=8-e.LUMINANCE_BITS,e.LUMINANCE_BUCKETS=1<<e.LUMINANCE_BITS,e.EMPTY=Uint8ClampedArray.from([0]),e}(Il),Vl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Bl=function(r){Vl(e,r);function e(t){var n=r.call(this,t)||this;return n.matrix=null,n}return e.prototype.getBlackMatrix=function(){if(this.matrix!==null)return this.matrix;var t=this.getLuminanceSource(),n=t.getWidth(),i=t.getHeight();if(n>=e.MINIMUM_DIMENSION&&i>=e.MINIMUM_DIMENSION){var a=t.getMatrix(),o=n>>e.BLOCK_SIZE_POWER;(n&e.BLOCK_SIZE_MASK)!==0&&o++;var s=i>>e.BLOCK_SIZE_POWER;(i&e.BLOCK_SIZE_MASK)!==0&&s++;var l=e.calculateBlackPoints(a,o,s,n,i),u=new tt(n,i);e.calculateThresholdForBlock(a,o,s,n,i,l,u),this.matrix=u}else this.matrix=r.prototype.getBlackMatrix.call(this);return this.matrix},e.prototype.createBinarizer=function(t){return new e(t)},e.calculateThresholdForBlock=function(t,n,i,a,o,s,l){for(var u=o-e.BLOCK_SIZE,c=a-e.BLOCK_SIZE,d=0;d<i;d++){var p=d<<e.BLOCK_SIZE_POWER;p>u&&(p=u);for(var h=e.cap(d,2,i-3),g=0;g<n;g++){var x=g<<e.BLOCK_SIZE_POWER;x>c&&(x=c);for(var C=e.cap(g,2,n-3),w=0,m=-2;m<=2;m++){var _=s[h+m];w+=_[C-2]+_[C-1]+_[C]+_[C+1]+_[C+2]}var E=w/25;e.thresholdBlock(t,x,p,E,a,l)}}},e.cap=function(t,n,i){return t<n?n:t>i?i:t},e.thresholdBlock=function(t,n,i,a,o,s){for(var l=0,u=i*o+n;l<e.BLOCK_SIZE;l++,u+=o)for(var c=0;c<e.BLOCK_SIZE;c++)(t[u+c]&255)<=a&&s.set(n+c,i+l)},e.calculateBlackPoints=function(t,n,i,a,o){for(var s=o-e.BLOCK_SIZE,l=a-e.BLOCK_SIZE,u=new Array(i),c=0;c<i;c++){u[c]=new Int32Array(n);var d=c<<e.BLOCK_SIZE_POWER;d>s&&(d=s);for(var p=0;p<n;p++){var h=p<<e.BLOCK_SIZE_POWER;h>l&&(h=l);for(var g=0,x=255,C=0,w=0,m=d*a+h;w<e.BLOCK_SIZE;w++,m+=a){for(var _=0;_<e.BLOCK_SIZE;_++){var E=t[m+_]&255;g+=E,E<x&&(x=E),E>C&&(C=E)}if(C-x>e.MIN_DYNAMIC_RANGE)for(w++,m+=a;w<e.BLOCK_SIZE;w++,m+=a)for(var _=0;_<e.BLOCK_SIZE;_++)g+=t[m+_]&255}var S=g>>e.BLOCK_SIZE_POWER*2;if(C-x<=e.MIN_DYNAMIC_RANGE&&(S=x/2,c>0&&p>0)){var T=(u[c-1][p]+2*u[c][p-1]+u[c-1][p-1])/4;x<T&&(S=T)}u[c][p]=S}}return u},e.BLOCK_SIZE_POWER=3,e.BLOCK_SIZE=1<<e.BLOCK_SIZE_POWER,e.BLOCK_SIZE_MASK=e.BLOCK_SIZE-1,e.MINIMUM_DIMENSION=e.BLOCK_SIZE*5,e.MIN_DYNAMIC_RANGE=24,e}(Fl),jr=function(){function r(e,t){this.width=e,this.height=t}return r.prototype.getWidth=function(){return this.width},r.prototype.getHeight=function(){return this.height},r.prototype.isCropSupported=function(){return!1},r.prototype.crop=function(e,t,n,i){throw new Wr("This luminance source does not support cropping.")},r.prototype.isRotateSupported=function(){return!1},r.prototype.rotateCounterClockwise=function(){throw new Wr("This luminance source does not support rotation by 90 degrees.")},r.prototype.rotateCounterClockwise45=function(){throw new Wr("This luminance source does not support rotation by 45 degrees.")},r.prototype.toString=function(){for(var e=new Uint8ClampedArray(this.width),t=new $,n=0;n<this.height;n++){for(var i=this.getRow(n,e),a=0;a<this.width;a++){var o=i[a]&255,s=void 0;o<64?s="#":o<128?s="+":o<192?s=".":s=" ",t.append(s)}t.append(`
|
|
239
|
+
`)}return t.toString()},r}(),Ll=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),qn=function(r){Ll(e,r);function e(t){var n=r.call(this,t.getWidth(),t.getHeight())||this;return n.delegate=t,n}return e.prototype.getRow=function(t,n){for(var i=this.delegate.getRow(t,n),a=this.getWidth(),o=0;o<a;o++)i[o]=255-(i[o]&255);return i},e.prototype.getMatrix=function(){for(var t=this.delegate.getMatrix(),n=this.getWidth()*this.getHeight(),i=new Uint8ClampedArray(n),a=0;a<n;a++)i[a]=255-(t[a]&255);return i},e.prototype.isCropSupported=function(){return this.delegate.isCropSupported()},e.prototype.crop=function(t,n,i,a){return new e(this.delegate.crop(t,n,i,a))},e.prototype.isRotateSupported=function(){return this.delegate.isRotateSupported()},e.prototype.invert=function(){return this.delegate},e.prototype.rotateCounterClockwise=function(){return new e(this.delegate.rotateCounterClockwise())},e.prototype.rotateCounterClockwise45=function(){return new e(this.delegate.rotateCounterClockwise45())},e}(jr),zl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),kl=function(r){zl(e,r);function e(t){var n=r.call(this,t.width,t.height)||this;return n.canvas=t,n.tempCanvasElement=null,n.buffer=e.makeBufferFromCanvasImageData(t),n}return e.makeBufferFromCanvasImageData=function(t){var n=t.getContext("2d").getImageData(0,0,t.width,t.height);return e.toGrayscaleBuffer(n.data,t.width,t.height)},e.toGrayscaleBuffer=function(t,n,i){var a=new Uint8ClampedArray(n*i);if(e.FRAME_INDEX=!e.FRAME_INDEX,e.FRAME_INDEX)for(var o=0,s=0,l=t.length;o<l;o+=4,s++){var u=void 0,c=t[o+3];if(c===0)u=255;else{var d=t[o],p=t[o+1],h=t[o+2];u=306*d+601*p+117*h+512>>10}a[s]=u}else for(var o=0,s=0,g=t.length;o<g;o+=4,s++){var u=void 0,c=t[o+3];if(c===0)u=255;else{var d=t[o],p=t[o+1],h=t[o+2];u=306*d+601*p+117*h+512>>10}a[s]=255-u}return a},e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new k("Requested row is outside the image: "+t);var i=this.getWidth(),a=t*i;return n===null?n=this.buffer.slice(a,a+i):(n.length<i&&(n=new Uint8ClampedArray(i)),n.set(this.buffer.slice(a,a+i))),n},e.prototype.getMatrix=function(){return this.buffer},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(t,n,i,a){return r.prototype.crop.call(this,t,n,i,a),this},e.prototype.isRotateSupported=function(){return!0},e.prototype.rotateCounterClockwise=function(){return this.rotate(-90),this},e.prototype.rotateCounterClockwise45=function(){return this.rotate(-45),this},e.prototype.getTempCanvasElement=function(){if(this.tempCanvasElement===null){var t=this.canvas.ownerDocument.createElement("canvas");t.width=this.canvas.width,t.height=this.canvas.height,this.tempCanvasElement=t}return this.tempCanvasElement},e.prototype.rotate=function(t){var n=this.getTempCanvasElement(),i=n.getContext("2d"),a=t*e.DEGREE_TO_RADIANS,o=this.canvas.width,s=this.canvas.height,l=Math.ceil(Math.abs(Math.cos(a))*o+Math.abs(Math.sin(a))*s),u=Math.ceil(Math.abs(Math.sin(a))*o+Math.abs(Math.cos(a))*s);return n.width=l,n.height=u,i.translate(l/2,u/2),i.rotate(a),i.drawImage(this.canvas,o/-2,s/-2),this.buffer=e.makeBufferFromCanvasImageData(n),this},e.prototype.invert=function(){return new qn(this)},e.DEGREE_TO_RADIANS=Math.PI/180,e.FRAME_INDEX=!0,e}(jr),Rl=function(){function r(e,t,n){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=n||void 0}return r.prototype.toJSON=function(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}},r}(),Be=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(d){o(d)}}function l(c){try{u(n.throw(c))}catch(d){o(d)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(r,e||[])).next())})},Le=function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(u){return function(c){return l([u,c])}}function l(u){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1],a=u;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(u);break}a[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(c){u=[6,c],i=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},Ul=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},kt=function(){function r(e,t,n){t===void 0&&(t=500),this.reader=e,this.timeBetweenScansMillis=t,this._hints=n,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}return Object.defineProperty(r.prototype,"hasNavigator",{get:function(){return typeof navigator<"u"},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isMediaDevicesSuported",{get:function(){return this.hasNavigator&&!!navigator.mediaDevices},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"canEnumerateDevices",{get:function(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"timeBetweenDecodingAttempts",{get:function(){return this._timeBetweenDecodingAttempts},set:function(e){this._timeBetweenDecodingAttempts=e<0?0:e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"hints",{get:function(){return this._hints},set:function(e){this._hints=e||null},enumerable:!1,configurable:!0}),r.prototype.listVideoInputDevices=function(){return Be(this,void 0,void 0,function(){var e,t,n,i,a,o,s,l,u,c,d,p;return Le(this,function(h){switch(h.label){case 0:if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:e=h.sent(),t=[];try{for(n=Ul(e),i=n.next();!i.done;i=n.next())a=i.value,o=a.kind==="video"?"videoinput":a.kind,o==="videoinput"&&(s=a.deviceId||a.id,l=a.label||"Video device "+(t.length+1),u=a.groupId,c={deviceId:s,label:l,kind:o,groupId:u},t.push(c))}catch(g){d={error:g}}finally{try{i&&!i.done&&(p=n.return)&&p.call(n)}finally{if(d)throw d.error}}return[2,t]}})})},r.prototype.getVideoInputDevices=function(){return Be(this,void 0,void 0,function(){var e;return Le(this,function(t){switch(t.label){case 0:return[4,this.listVideoInputDevices()];case 1:return e=t.sent(),[2,e.map(function(n){return new Rl(n.deviceId,n.label)})]}})})},r.prototype.findDeviceById=function(e){return Be(this,void 0,void 0,function(){var t;return Le(this,function(n){switch(n.label){case 0:return[4,this.listVideoInputDevices()];case 1:return t=n.sent(),t?[2,t.find(function(i){return i.deviceId===e})]:[2,null]}})})},r.prototype.decodeFromInputVideoDevice=function(e,t){return Be(this,void 0,void 0,function(){return Le(this,function(n){switch(n.label){case 0:return[4,this.decodeOnceFromVideoDevice(e,t)];case 1:return[2,n.sent()]}})})},r.prototype.decodeOnceFromVideoDevice=function(e,t){return Be(this,void 0,void 0,function(){var n,i;return Le(this,function(a){switch(a.label){case 0:return this.reset(),e?n={deviceId:{exact:e}}:n={facingMode:"environment"},i={video:n},[4,this.decodeOnceFromConstraints(i,t)];case 1:return[2,a.sent()]}})})},r.prototype.decodeOnceFromConstraints=function(e,t){return Be(this,void 0,void 0,function(){var n;return Le(this,function(i){switch(i.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return n=i.sent(),[4,this.decodeOnceFromStream(n,t)];case 2:return[2,i.sent()]}})})},r.prototype.decodeOnceFromStream=function(e,t){return Be(this,void 0,void 0,function(){var n,i;return Le(this,function(a){switch(a.label){case 0:return this.reset(),[4,this.attachStreamToVideo(e,t)];case 1:return n=a.sent(),[4,this.decodeOnce(n)];case 2:return i=a.sent(),[2,i]}})})},r.prototype.decodeFromInputVideoDeviceContinuously=function(e,t,n){return Be(this,void 0,void 0,function(){return Le(this,function(i){switch(i.label){case 0:return[4,this.decodeFromVideoDevice(e,t,n)];case 1:return[2,i.sent()]}})})},r.prototype.decodeFromVideoDevice=function(e,t,n){return Be(this,void 0,void 0,function(){var i,a;return Le(this,function(o){switch(o.label){case 0:return e?i={deviceId:{exact:e}}:i={facingMode:"environment"},a={video:i},[4,this.decodeFromConstraints(a,t,n)];case 1:return[2,o.sent()]}})})},r.prototype.decodeFromConstraints=function(e,t,n){return Be(this,void 0,void 0,function(){var i;return Le(this,function(a){switch(a.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return i=a.sent(),[4,this.decodeFromStream(i,t,n)];case 2:return[2,a.sent()]}})})},r.prototype.decodeFromStream=function(e,t,n){return Be(this,void 0,void 0,function(){var i;return Le(this,function(a){switch(a.label){case 0:return this.reset(),[4,this.attachStreamToVideo(e,t)];case 1:return i=a.sent(),[4,this.decodeContinuously(i,n)];case 2:return[2,a.sent()]}})})},r.prototype.stopAsyncDecode=function(){this._stopAsyncDecode=!0},r.prototype.stopContinuousDecode=function(){this._stopContinuousDecode=!0},r.prototype.attachStreamToVideo=function(e,t){return Be(this,void 0,void 0,function(){var n;return Le(this,function(i){switch(i.label){case 0:return n=this.prepareVideoElement(t),this.addVideoSource(n,e),this.videoElement=n,this.stream=e,[4,this.playVideoOnLoadAsync(n)];case 1:return i.sent(),[2,n]}})})},r.prototype.playVideoOnLoadAsync=function(e){var t=this;return new Promise(function(n,i){return t.playVideoOnLoad(e,function(){return n()})})},r.prototype.playVideoOnLoad=function(e,t){var n=this;this.videoEndedListener=function(){return n.stopStreams()},this.videoCanPlayListener=function(){return n.tryPlayVideo(e)},e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)},r.prototype.isVideoPlaying=function(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2},r.prototype.tryPlayVideo=function(e){return Be(this,void 0,void 0,function(){return Le(this,function(t){switch(t.label){case 0:if(this.isVideoPlaying(e))return console.warn("Trying to play video that is already playing."),[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,e.play()];case 2:return t.sent(),[3,4];case 3:return t.sent(),console.warn("It was not possible to play the video."),[3,4];case 4:return[2]}})})},r.prototype.getMediaElement=function(e,t){var n=document.getElementById(e);if(!n)throw new Ke("element with id '"+e+"' not found");if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new Ke("element with id '"+e+"' must be an "+t+" element");return n},r.prototype.decodeFromImage=function(e,t){if(!e&&!t)throw new Ke("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)},r.prototype.decodeFromVideo=function(e,t){if(!e&&!t)throw new Ke("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)},r.prototype.decodeFromVideoContinuously=function(e,t,n){if(e===void 0&&t===void 0)throw new Ke("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,n):this.decodeFromVideoElementContinuously(e,n)},r.prototype.decodeFromImageElement=function(e){if(!e)throw new Ke("An image element must be provided.");this.reset();var t=this.prepareImageElement(e);this.imageElement=t;var n;return this.isImageLoaded(t)?n=this.decodeOnce(t,!1,!0):n=this._decodeOnLoadImage(t),n},r.prototype.decodeFromVideoElement=function(e){var t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)},r.prototype.decodeFromVideoElementContinuously=function(e,t){var n=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(n,t)},r.prototype._decodeFromVideoElementSetup=function(e){if(!e)throw new Ke("A video element must be provided.");this.reset();var t=this.prepareVideoElement(e);return this.videoElement=t,t},r.prototype.decodeFromImageUrl=function(e){if(!e)throw new Ke("An URL must be provided.");this.reset();var t=this.prepareImageElement();this.imageElement=t;var n=this._decodeOnLoadImage(t);return t.src=e,n},r.prototype.decodeFromVideoUrl=function(e){if(!e)throw new Ke("An URL must be provided.");this.reset();var t=this.prepareVideoElement(),n=this.decodeFromVideoElement(t);return t.src=e,n},r.prototype.decodeFromVideoUrlContinuously=function(e,t){if(!e)throw new Ke("An URL must be provided.");this.reset();var n=this.prepareVideoElement(),i=this.decodeFromVideoElementContinuously(n,t);return n.src=e,i},r.prototype._decodeOnLoadImage=function(e){var t=this;return new Promise(function(n,i){t.imageLoadedListener=function(){return t.decodeOnce(e,!1,!0).then(n,i)},e.addEventListener("load",t.imageLoadedListener)})},r.prototype._decodeOnLoadVideo=function(e){return Be(this,void 0,void 0,function(){return Le(this,function(t){switch(t.label){case 0:return[4,this.playVideoOnLoadAsync(e)];case 1:return t.sent(),[4,this.decodeOnce(e)];case 2:return[2,t.sent()]}})})},r.prototype._decodeOnLoadVideoContinuously=function(e,t){return Be(this,void 0,void 0,function(){return Le(this,function(n){switch(n.label){case 0:return[4,this.playVideoOnLoadAsync(e)];case 1:return n.sent(),this.decodeContinuously(e,t),[2]}})})},r.prototype.isImageLoaded=function(e){return!(!e.complete||e.naturalWidth===0)},r.prototype.prepareImageElement=function(e){var t;return typeof e>"u"&&(t=document.createElement("img"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t},r.prototype.prepareVideoElement=function(e){var t;return!e&&typeof document<"u"&&(t=document.createElement("video"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t},r.prototype.decodeOnce=function(e,t,n){var i=this;t===void 0&&(t=!0),n===void 0&&(n=!0),this._stopAsyncDecode=!1;var a=function(o,s){if(i._stopAsyncDecode){s(new N("Video stream has ended before any code could be detected.")),i._stopAsyncDecode=void 0;return}try{var l=i.decode(e);o(l)}catch(p){var u=t&&p instanceof N,c=p instanceof Ce||p instanceof F,d=c&&n;if(u||d)return setTimeout(a,i._timeBetweenDecodingAttempts,o,s);s(p)}};return new Promise(function(o,s){return a(o,s)})},r.prototype.decodeContinuously=function(e,t){var n=this;this._stopContinuousDecode=!1;var i=function(){if(n._stopContinuousDecode){n._stopContinuousDecode=void 0;return}try{var a=n.decode(e);t(a,null),setTimeout(i,n.timeBetweenScansMillis)}catch(l){t(null,l);var o=l instanceof Ce||l instanceof F,s=l instanceof N;(o||s)&&setTimeout(i,n._timeBetweenDecodingAttempts)}};i()},r.prototype.decode=function(e){var t=this.createBinaryBitmap(e);return this.decodeBitmap(t)},r.prototype.createBinaryBitmap=function(e){this.getCaptureCanvasContext(e),e instanceof HTMLVideoElement?this.drawFrameOnCanvas(e):this.drawImageOnCanvas(e);var t=this.getCaptureCanvas(e),n=new kl(t),i=new Bl(n);return new Al(i)},r.prototype.getCaptureCanvasContext=function(e){if(!this.captureCanvasContext){var t=this.getCaptureCanvas(e),n=void 0;try{n=t.getContext("2d",{willReadFrequently:!0})}catch{n=t.getContext("2d")}this.captureCanvasContext=n}return this.captureCanvasContext},r.prototype.getCaptureCanvas=function(e){if(!this.captureCanvas){var t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas},r.prototype.drawFrameOnCanvas=function(e,t,n){t===void 0&&(t={sx:0,sy:0,sWidth:e.videoWidth,sHeight:e.videoHeight,dx:0,dy:0,dWidth:e.videoWidth,dHeight:e.videoHeight}),n===void 0&&(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)},r.prototype.drawImageOnCanvas=function(e,t,n){t===void 0&&(t={sx:0,sy:0,sWidth:e.naturalWidth,sHeight:e.naturalHeight,dx:0,dy:0,dWidth:e.naturalWidth,dHeight:e.naturalHeight}),n===void 0&&(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)},r.prototype.decodeBitmap=function(e){return this.reader.decode(e,this._hints)},r.prototype.createCaptureCanvas=function(e){if(typeof document>"u")return this._destroyCaptureCanvas(),null;var t=document.createElement("canvas"),n,i;return typeof e<"u"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,i=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,i=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=i+"px",t.width=n,t.height=i,t},r.prototype.stopStreams=function(){this.stream&&(this.stream.getVideoTracks().forEach(function(e){return e.stop()}),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()},r.prototype.reset=function(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()},r.prototype._destroyVideoElement=function(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)},r.prototype._destroyImageElement=function(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)},r.prototype._destroyCaptureCanvas=function(){this.captureCanvasContext=void 0,this.captureCanvas=void 0},r.prototype.addVideoSource=function(e,t){try{e.srcObject=t}catch{e.src=URL.createObjectURL(t)}},r.prototype.cleanVideoSource=function(e){try{e.srcObject=null}catch{e.src=""}this.videoElement.removeAttribute("src")},r}(),Ne=function(){function r(e,t,n,i,a,o){n===void 0&&(n=t==null?0:8*t.length),o===void 0&&(o=se.currentTimeMillis()),this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=i,this.format=a,this.timestamp=o,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=i,this.format=a,this.resultMetadata=null,o==null?this.timestamp=se.currentTimeMillis():this.timestamp=o}return r.prototype.getText=function(){return this.text},r.prototype.getRawBytes=function(){return this.rawBytes},r.prototype.getNumBits=function(){return this.numBits},r.prototype.getResultPoints=function(){return this.resultPoints},r.prototype.getBarcodeFormat=function(){return this.format},r.prototype.getResultMetadata=function(){return this.resultMetadata},r.prototype.putMetadata=function(e,t){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)},r.prototype.putAllMetadata=function(e){e!==null&&(this.resultMetadata===null?this.resultMetadata=e:this.resultMetadata=new Map(e))},r.prototype.addResultPoints=function(e){var t=this.resultPoints;if(t===null)this.resultPoints=e;else if(e!==null&&e.length>0){var n=new Array(t.length+e.length);se.arraycopy(t,0,n,0,t.length),se.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}},r.prototype.getTimestamp=function(){return this.timestamp},r.prototype.toString=function(){return this.text},r}(),Wn;(function(r){r[r.AZTEC=0]="AZTEC",r[r.CODABAR=1]="CODABAR",r[r.CODE_39=2]="CODE_39",r[r.CODE_93=3]="CODE_93",r[r.CODE_128=4]="CODE_128",r[r.DATA_MATRIX=5]="DATA_MATRIX",r[r.EAN_8=6]="EAN_8",r[r.EAN_13=7]="EAN_13",r[r.ITF=8]="ITF",r[r.MAXICODE=9]="MAXICODE",r[r.PDF_417=10]="PDF_417",r[r.QR_CODE=11]="QR_CODE",r[r.RSS_14=12]="RSS_14",r[r.RSS_EXPANDED=13]="RSS_EXPANDED",r[r.UPC_A=14]="UPC_A",r[r.UPC_E=15]="UPC_E",r[r.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(Wn||(Wn={}));const B=Wn;var jn;(function(r){r[r.OTHER=0]="OTHER",r[r.ORIENTATION=1]="ORIENTATION",r[r.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",r[r.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",r[r.ISSUE_NUMBER=4]="ISSUE_NUMBER",r[r.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",r[r.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",r[r.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",r[r.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",r[r.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",r[r.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(jn||(jn={}));const Ae=jn;var Yr=function(){function r(e,t,n,i,a,o){a===void 0&&(a=-1),o===void 0&&(o=-1),this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=i,this.structuredAppendSequenceNumber=a,this.structuredAppendParity=o,this.numBits=e==null?0:8*e.length}return r.prototype.getRawBytes=function(){return this.rawBytes},r.prototype.getNumBits=function(){return this.numBits},r.prototype.setNumBits=function(e){this.numBits=e},r.prototype.getText=function(){return this.text},r.prototype.getByteSegments=function(){return this.byteSegments},r.prototype.getECLevel=function(){return this.ecLevel},r.prototype.getErrorsCorrected=function(){return this.errorsCorrected},r.prototype.setErrorsCorrected=function(e){this.errorsCorrected=e},r.prototype.getErasures=function(){return this.erasures},r.prototype.setErasures=function(e){this.erasures=e},r.prototype.getOther=function(){return this.other},r.prototype.setOther=function(e){this.other=e},r.prototype.hasStructuredAppend=function(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0},r.prototype.getStructuredAppendParity=function(){return this.structuredAppendParity},r.prototype.getStructuredAppendSequenceNumber=function(){return this.structuredAppendSequenceNumber},r}(),hr=function(){function r(){}return r.prototype.exp=function(e){return this.expTable[e]},r.prototype.log=function(e){if(e===0)throw new k;return this.logTable[e]},r.addOrSubtract=function(e,t){return e^t},r}(),ot=function(){function r(e,t){if(t.length===0)throw new k;this.field=e;var n=t.length;if(n>1&&t[0]===0){for(var i=1;i<n&&t[i]===0;)i++;i===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-i),se.arraycopy(t,i,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}return r.prototype.getCoefficients=function(){return this.coefficients},r.prototype.getDegree=function(){return this.coefficients.length-1},r.prototype.isZero=function(){return this.coefficients[0]===0},r.prototype.getCoefficient=function(e){return this.coefficients[this.coefficients.length-1-e]},r.prototype.evaluateAt=function(e){if(e===0)return this.getCoefficient(0);var t=this.coefficients,n;if(e===1){n=0;for(var i=0,a=t.length;i!==a;i++){var o=t[i];n=hr.addOrSubtract(n,o)}return n}n=t[0];for(var s=t.length,l=this.field,i=1;i<s;i++)n=hr.addOrSubtract(l.multiply(e,n),t[i]);return n},r.prototype.addOrSubtract=function(e){if(!this.field.equals(e.field))throw new k("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;var t=this.coefficients,n=e.coefficients;if(t.length>n.length){var i=t;t=n,n=i}var a=new Int32Array(n.length),o=n.length-t.length;se.arraycopy(n,0,a,0,o);for(var s=o;s<n.length;s++)a[s]=hr.addOrSubtract(t[s-o],n[s]);return new r(this.field,a)},r.prototype.multiply=function(e){if(!this.field.equals(e.field))throw new k("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();for(var t=this.coefficients,n=t.length,i=e.coefficients,a=i.length,o=new Int32Array(n+a-1),s=this.field,l=0;l<n;l++)for(var u=t[l],c=0;c<a;c++)o[l+c]=hr.addOrSubtract(o[l+c],s.multiply(u,i[c]));return new r(s,o)},r.prototype.multiplyScalar=function(e){if(e===0)return this.field.getZero();if(e===1)return this;for(var t=this.coefficients.length,n=this.field,i=new Int32Array(t),a=this.coefficients,o=0;o<t;o++)i[o]=n.multiply(a[o],e);return new r(n,i)},r.prototype.multiplyByMonomial=function(e,t){if(e<0)throw new k;if(t===0)return this.field.getZero();for(var n=this.coefficients,i=n.length,a=new Int32Array(i+e),o=this.field,s=0;s<i;s++)a[s]=o.multiply(n[s],t);return new r(o,a)},r.prototype.divide=function(e){if(!this.field.equals(e.field))throw new k("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new k("Divide by 0");for(var t=this.field,n=t.getZero(),i=this,a=e.getCoefficient(e.getDegree()),o=t.inverse(a);i.getDegree()>=e.getDegree()&&!i.isZero();){var s=i.getDegree()-e.getDegree(),l=t.multiply(i.getCoefficient(i.getDegree()),o),u=e.multiplyByMonomial(s,l),c=t.buildMonomial(s,l);n=n.addOrSubtract(c),i=i.addOrSubtract(u)}return[n,i]},r.prototype.toString=function(){for(var e="",t=this.getDegree();t>=0;t--){var n=this.getCoefficient(t);if(n!==0){if(n<0?(e+=" - ",n=-n):e.length>0&&(e+=" + "),t===0||n!==1){var i=this.field.log(n);i===0?e+="1":i===1?e+="a":(e+="a^",e+=i)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e},r}(),Hl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ga=function(r){Hl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ArithmeticException",e}(Ue),Gl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),He=function(r){Gl(e,r);function e(t,n,i){var a=r.call(this)||this;a.primitive=t,a.size=n,a.generatorBase=i;for(var o=new Int32Array(n),s=1,l=0;l<n;l++)o[l]=s,s*=2,s>=n&&(s^=t,s&=n-1);a.expTable=o;for(var u=new Int32Array(n),l=0;l<n-1;l++)u[o[l]]=l;return a.logTable=u,a.zero=new ot(a,Int32Array.from([0])),a.one=new ot(a,Int32Array.from([1])),a}return e.prototype.getZero=function(){return this.zero},e.prototype.getOne=function(){return this.one},e.prototype.buildMonomial=function(t,n){if(t<0)throw new k;if(n===0)return this.zero;var i=new Int32Array(t+1);return i[0]=n,new ot(this,i)},e.prototype.inverse=function(t){if(t===0)throw new ga;return this.expTable[this.size-this.logTable[t]-1]},e.prototype.multiply=function(t,n){return t===0||n===0?0:this.expTable[(this.logTable[t]+this.logTable[n])%(this.size-1)]},e.prototype.getSize=function(){return this.size},e.prototype.getGeneratorBase=function(){return this.generatorBase},e.prototype.toString=function(){return"GF(0x"+q.toHexString(this.primitive)+","+this.size+")"},e.prototype.equals=function(t){return t===this},e.AZTEC_DATA_12=new e(4201,4096,1),e.AZTEC_DATA_10=new e(1033,1024,1),e.AZTEC_DATA_6=new e(67,64,1),e.AZTEC_PARAM=new e(19,16,1),e.QR_CODE_FIELD_256=new e(285,256,0),e.DATA_MATRIX_FIELD_256=new e(301,256,1),e.AZTEC_DATA_8=e.DATA_MATRIX_FIELD_256,e.MAXICODE_FIELD_64=e.AZTEC_DATA_6,e}(hr),Xl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Zr=function(r){Xl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ReedSolomonException",e}(Ue),$l=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),pr=function(r){$l(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IllegalStateException",e}(Ue),Kr=function(){function r(e){this.field=e}return r.prototype.decode=function(e,t){for(var n=this.field,i=new ot(n,e),a=new Int32Array(t),o=!0,s=0;s<t;s++){var l=i.evaluateAt(n.exp(s+n.getGeneratorBase()));a[a.length-1-s]=l,l!==0&&(o=!1)}if(!o)for(var u=new ot(n,a),c=this.runEuclideanAlgorithm(n.buildMonomial(t,1),u,t),d=c[0],p=c[1],h=this.findErrorLocations(d),g=this.findErrorMagnitudes(p,h),s=0;s<h.length;s++){var x=e.length-1-n.log(h[s]);if(x<0)throw new Zr("Bad error location");e[x]=He.addOrSubtract(e[x],g[s])}},r.prototype.runEuclideanAlgorithm=function(e,t,n){if(e.getDegree()<t.getDegree()){var i=e;e=t,t=i}for(var a=this.field,o=e,s=t,l=a.getZero(),u=a.getOne();s.getDegree()>=(n/2|0);){var c=o,d=l;if(o=s,l=u,o.isZero())throw new Zr("r_{i-1} was zero");s=c;for(var p=a.getZero(),h=o.getCoefficient(o.getDegree()),g=a.inverse(h);s.getDegree()>=o.getDegree()&&!s.isZero();){var x=s.getDegree()-o.getDegree(),C=a.multiply(s.getCoefficient(s.getDegree()),g);p=p.addOrSubtract(a.buildMonomial(x,C)),s=s.addOrSubtract(o.multiplyByMonomial(x,C))}if(u=p.multiply(l).addOrSubtract(d),s.getDegree()>=o.getDegree())throw new pr("Division algorithm failed to reduce polynomial?")}var w=u.getCoefficient(0);if(w===0)throw new Zr("sigmaTilde(0) was zero");var m=a.inverse(w),_=u.multiplyScalar(m),E=s.multiplyScalar(m);return[_,E]},r.prototype.findErrorLocations=function(e){var t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);for(var n=new Int32Array(t),i=0,a=this.field,o=1;o<a.getSize()&&i<t;o++)e.evaluateAt(o)===0&&(n[i]=a.inverse(o),i++);if(i!==t)throw new Zr("Error locator degree does not match number of roots");return n},r.prototype.findErrorMagnitudes=function(e,t){for(var n=t.length,i=new Int32Array(n),a=this.field,o=0;o<n;o++){for(var s=a.inverse(t[o]),l=1,u=0;u<n;u++)if(o!==u){var c=a.multiply(t[u],s),d=(c&1)===0?c|1:c&-2;l=a.multiply(l,d)}i[o]=a.multiply(e.evaluateAt(s),a.inverse(l)),a.getGeneratorBase()!==0&&(i[o]=a.multiply(i[o],s))}return i},r}(),Ee;(function(r){r[r.UPPER=0]="UPPER",r[r.LOWER=1]="LOWER",r[r.MIXED=2]="MIXED",r[r.DIGIT=3]="DIGIT",r[r.PUNCT=4]="PUNCT",r[r.BINARY=5]="BINARY"})(Ee||(Ee={}));var xa=function(){function r(){}return r.prototype.decode=function(e){this.ddata=e;var t=e.getBits(),n=this.extractBits(t),i=this.correctBits(n),a=r.convertBoolArrayToByteArray(i),o=r.getEncodedData(i),s=new Yr(a,o,null,null);return s.setNumBits(i.length),s},r.highLevelDecode=function(e){return this.getEncodedData(e)},r.getEncodedData=function(e){for(var t=e.length,n=Ee.UPPER,i=Ee.UPPER,a="",o=0;o<t;)if(i===Ee.BINARY){if(t-o<5)break;var s=r.readCode(e,o,5);if(o+=5,s===0){if(t-o<11)break;s=r.readCode(e,o,11)+31,o+=11}for(var l=0;l<s;l++){if(t-o<8){o=t;break}var u=r.readCode(e,o,8);a+=Y.castAsNonUtf8Char(u),o+=8}i=n}else{var c=i===Ee.DIGIT?4:5;if(t-o<c)break;var u=r.readCode(e,o,c);o+=c;var d=r.getCharacter(i,u);d.startsWith("CTRL_")?(n=i,i=r.getTable(d.charAt(5)),d.charAt(6)==="L"&&(n=i)):(a+=d,i=n)}return a},r.getTable=function(e){switch(e){case"L":return Ee.LOWER;case"P":return Ee.PUNCT;case"M":return Ee.MIXED;case"D":return Ee.DIGIT;case"B":return Ee.BINARY;case"U":default:return Ee.UPPER}},r.getCharacter=function(e,t){switch(e){case Ee.UPPER:return r.UPPER_TABLE[t];case Ee.LOWER:return r.LOWER_TABLE[t];case Ee.MIXED:return r.MIXED_TABLE[t];case Ee.PUNCT:return r.PUNCT_TABLE[t];case Ee.DIGIT:return r.DIGIT_TABLE[t];default:throw new pr("Bad table")}},r.prototype.correctBits=function(e){var t,n;this.ddata.getNbLayers()<=2?(n=6,t=He.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=He.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=He.AZTEC_DATA_10):(n=12,t=He.AZTEC_DATA_12);var i=this.ddata.getNbDatablocks(),a=e.length/n;if(a<i)throw new F;for(var o=e.length%n,s=new Int32Array(a),l=0;l<a;l++,o+=n)s[l]=r.readCode(e,o,n);try{var u=new Kr(t);u.decode(s,a-i)}catch(C){throw new F(C)}for(var c=(1<<n)-1,d=0,l=0;l<i;l++){var p=s[l];if(p===0||p===c)throw new F;(p===1||p===c-1)&&d++}for(var h=new Array(i*n-d),g=0,l=0;l<i;l++){var p=s[l];if(p===1||p===c-1)h.fill(p>1,g,g+n-1),g+=n-1;else for(var x=n-1;x>=0;--x)h[g++]=(p&1<<x)!==0}return h},r.prototype.extractBits=function(e){var t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),i=(t?11:14)+n*4,a=new Int32Array(i),o=new Array(this.totalBitsInLayer(n,t));if(t)for(var s=0;s<a.length;s++)a[s]=s;else for(var l=i+1+2*q.truncDivision(q.truncDivision(i,2)-1,15),u=i/2,c=q.truncDivision(l,2),s=0;s<u;s++){var d=s+q.truncDivision(s,15);a[u-s-1]=c-d-1,a[u+s]=c+d+1}for(var s=0,p=0;s<n;s++){for(var h=(n-s)*4+(t?9:12),g=s*2,x=i-1-g,C=0;C<h;C++)for(var w=C*2,m=0;m<2;m++)o[p+w+m]=e.get(a[g+m],a[g+C]),o[p+2*h+w+m]=e.get(a[g+C],a[x-m]),o[p+4*h+w+m]=e.get(a[x-m],a[x-C]),o[p+6*h+w+m]=e.get(a[x-C],a[g+m]);p+=h*8}return o},r.readCode=function(e,t,n){for(var i=0,a=t;a<t+n;a++)i<<=1,e[a]&&(i|=1);return i},r.readByte=function(e,t){var n=e.length-t;return n>=8?r.readCode(e,t,8):r.readCode(e,t,n)<<8-n},r.convertBoolArrayToByteArray=function(e){for(var t=new Uint8Array((e.length+7)/8),n=0;n<t.length;n++)t[n]=r.readByte(e,8*n);return t},r.prototype.totalBitsInLayer=function(e,t){return((t?88:112)+16*e)*e},r.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],r.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],r.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
|
|
225
240
|
`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],r.PUNCT_TABLE=["","\r",`\r
|
|
226
|
-
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],r.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"],r}(),Q=function(){function r(){}return r.round=function(e){return isNaN(e)?0:e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0},r.distance=function(e,t,n,i){var a=e-n,o=t-i;return Math.sqrt(a*a+o*o)},r.sum=function(e){for(var t=0,n=0,i=e.length;n!==i;n++){var a=e[n];t+=a}return t},r}(),Yn=function(){function r(){}return r.floatToIntBits=function(e){return e},r.MAX_VALUE=Number.MAX_SAFE_INTEGER,r}(),z=function(){function r(e,t){this.x=e,this.y=t}return r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.equals=function(e){if(e instanceof r){var t=e;return this.x===t.x&&this.y===t.y}return!1},r.prototype.hashCode=function(){return 31*Yn.floatToIntBits(this.x)+Yn.floatToIntBits(this.y)},r.prototype.toString=function(){return"("+this.x+","+this.y+")"},r.orderBestPatterns=function(e){var t=this.distance(e[0],e[1]),n=this.distance(e[1],e[2]),i=this.distance(e[0],e[2]),a,o,s;if(n>=t&&n>=i?(o=e[0],a=e[1],s=e[2]):i>=n&&i>=t?(o=e[1],a=e[0],s=e[2]):(o=e[2],a=e[0],s=e[1]),this.crossProductZ(a,o,s)<0){var l=a;a=s,s=l}e[0]=a,e[1]=o,e[2]=s},r.distance=function(e,t){return Q.distance(e.x,e.y,t.x,t.y)},r.crossProductZ=function(e,t,n){var i=t.x,a=t.y;return(n.x-i)*(e.y-a)-(n.y-a)*(e.x-i)},r}(),Zn=function(){function r(e,t){this.bits=e,this.points=t}return r.prototype.getBits=function(){return this.bits},r.prototype.getPoints=function(){return this.points},r}(),Hl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Gl=function(r){Hl(e,r);function e(t,n,i,a,o){var s=r.call(this,t,n)||this;return s.compact=i,s.nbDatablocks=a,s.nbLayers=o,s}return e.prototype.getNbLayers=function(){return this.nbLayers},e.prototype.getNbDatablocks=function(){return this.nbDatablocks},e.prototype.isCompact=function(){return this.compact},e}(Zn),Kn=function(){function r(e,t,n,i){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=r.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),i==null&&(i=e.getHeight()/2|0);var a=t/2|0;if(this.leftInit=n-a,this.rightInit=n+a,this.upInit=i-a,this.downInit=i+a,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new N}return r.prototype.detect=function(){for(var e=this.leftInit,t=this.rightInit,n=this.upInit,i=this.downInit,a=!1,o=!0,s=!1,l=!1,u=!1,c=!1,f=!1,p=this.width,h=this.height;o;){o=!1;for(var g=!0;(g||!l)&&t<p;)g=this.containsBlackPoint(n,i,t,!1),g?(t++,o=!0,l=!0):l||t++;if(t>=p){a=!0;break}for(var x=!0;(x||!u)&&i<h;)x=this.containsBlackPoint(e,t,i,!0),x?(i++,o=!0,u=!0):u||i++;if(i>=h){a=!0;break}for(var C=!0;(C||!c)&&e>=0;)C=this.containsBlackPoint(n,i,e,!1),C?(e--,o=!0,c=!0):c||e--;if(e<0){a=!0;break}for(var m=!0;(m||!f)&&n>=0;)m=this.containsBlackPoint(e,t,n,!0),m?(n--,o=!0,f=!0):f||n--;if(n<0){a=!0;break}o&&(s=!0)}if(!a&&s){for(var w=t-e,_=null,E=1;_===null&&E<w;E++)_=this.getBlackPointOnSegment(e,i-E,e+E,i);if(_==null)throw new N;for(var O=null,E=1;O===null&&E<w;E++)O=this.getBlackPointOnSegment(e,n+E,e+E,n);if(O==null)throw new N;for(var T=null,E=1;T===null&&E<w;E++)T=this.getBlackPointOnSegment(t,n+E,t-E,n);if(T==null)throw new N;for(var D=null,E=1;D===null&&E<w;E++)D=this.getBlackPointOnSegment(t,i-E,t-E,i);if(D==null)throw new N;return this.centerEdges(D,_,T,O)}else throw new N},r.prototype.getBlackPointOnSegment=function(e,t,n,i){for(var a=Q.round(Q.distance(e,t,n,i)),o=(n-e)/a,s=(i-t)/a,l=this.image,u=0;u<a;u++){var c=Q.round(e+u*o),f=Q.round(t+u*s);if(l.get(c,f))return new z(c,f)}return null},r.prototype.centerEdges=function(e,t,n,i){var a=e.getX(),o=e.getY(),s=t.getX(),l=t.getY(),u=n.getX(),c=n.getY(),f=i.getX(),p=i.getY(),h=r.CORR;return a<this.width/2?[new z(f-h,p+h),new z(s+h,l+h),new z(u-h,c-h),new z(a+h,o-h)]:[new z(f+h,p+h),new z(s+h,l-h),new z(u-h,c+h),new z(a-h,o-h)]},r.prototype.containsBlackPoint=function(e,t,n,i){var a=this.image;if(i){for(var o=e;o<=t;o++)if(a.get(o,n))return!0}else for(var s=e;s<=t;s++)if(a.get(n,s))return!0;return!1},r.INIT_SIZE=10,r.CORR=1,r}(),ya=function(){function r(){}return r.checkAndNudgePoints=function(e,t){for(var n=e.getWidth(),i=e.getHeight(),a=!0,o=0;o<t.length&&a;o+=2){var s=Math.floor(t[o]),l=Math.floor(t[o+1]);if(s<-1||s>n||l<-1||l>i)throw new N;a=!1,s===-1?(t[o]=0,a=!0):s===n&&(t[o]=n-1,a=!0),l===-1?(t[o+1]=0,a=!0):l===i&&(t[o+1]=i-1,a=!0)}a=!0;for(var o=t.length-2;o>=0&&a;o-=2){var s=Math.floor(t[o]),l=Math.floor(t[o+1]);if(s<-1||s>n||l<-1||l>i)throw new N;a=!1,s===-1?(t[o]=0,a=!0):s===n&&(t[o]=n-1,a=!0),l===-1?(t[o+1]=0,a=!0):l===i&&(t[o+1]=i-1,a=!0)}},r}(),Ca=function(){function r(e,t,n,i,a,o,s,l,u){this.a11=e,this.a21=t,this.a31=n,this.a12=i,this.a22=a,this.a32=o,this.a13=s,this.a23=l,this.a33=u}return r.quadrilateralToQuadrilateral=function(e,t,n,i,a,o,s,l,u,c,f,p,h,g,x,C){var m=r.quadrilateralToSquare(e,t,n,i,a,o,s,l),w=r.squareToQuadrilateral(u,c,f,p,h,g,x,C);return w.times(m)},r.prototype.transformPoints=function(e){for(var t=e.length,n=this.a11,i=this.a12,a=this.a13,o=this.a21,s=this.a22,l=this.a23,u=this.a31,c=this.a32,f=this.a33,p=0;p<t;p+=2){var h=e[p],g=e[p+1],x=a*h+l*g+f;e[p]=(n*h+o*g+u)/x,e[p+1]=(i*h+s*g+c)/x}},r.prototype.transformPointsWithValues=function(e,t){for(var n=this.a11,i=this.a12,a=this.a13,o=this.a21,s=this.a22,l=this.a23,u=this.a31,c=this.a32,f=this.a33,p=e.length,h=0;h<p;h++){var g=e[h],x=t[h],C=a*g+l*x+f;e[h]=(n*g+o*x+u)/C,t[h]=(i*g+s*x+c)/C}},r.squareToQuadrilateral=function(e,t,n,i,a,o,s,l){var u=e-n+a-s,c=t-i+o-l;if(u===0&&c===0)return new r(n-e,a-n,e,i-t,o-i,t,0,0,1);var f=n-a,p=s-a,h=i-o,g=l-o,x=f*g-p*h,C=(u*g-p*c)/x,m=(f*c-u*h)/x;return new r(n-e+C*n,s-e+m*s,e,i-t+C*i,l-t+m*l,t,C,m,1)},r.quadrilateralToSquare=function(e,t,n,i,a,o,s,l){return r.squareToQuadrilateral(e,t,n,i,a,o,s,l).buildAdjoint()},r.prototype.buildAdjoint=function(){return new r(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)},r.prototype.times=function(e){return new r(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)},r}(),Xl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ql=function(r){Xl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.sampleGrid=function(t,n,i,a,o,s,l,u,c,f,p,h,g,x,C,m,w,_,E){var O=Ca.quadrilateralToQuadrilateral(a,o,s,l,u,c,f,p,h,g,x,C,m,w,_,E);return this.sampleGridWithTransform(t,n,i,O)},e.prototype.sampleGridWithTransform=function(t,n,i,a){if(n<=0||i<=0)throw new N;for(var o=new tt(n,i),s=new Float32Array(2*n),l=0;l<i;l++){for(var u=s.length,c=l+.5,f=0;f<u;f+=2)s[f]=f/2+.5,s[f+1]=c;a.transformPoints(s),ya.checkAndNudgePoints(t,s);try{for(var f=0;f<u;f+=2)t.get(Math.floor(s[f]),Math.floor(s[f+1]))&&o.set(f/2,l)}catch{throw new N}}return o},e}(ya),Qn=function(){function r(){}return r.setGridSampler=function(e){r.gridSampler=e},r.getInstance=function(){return r.gridSampler},r.gridSampler=new ql,r}(),Ge=function(){function r(e,t){this.x=e,this.y=t}return r.prototype.toResultPoint=function(){return new z(this.getX(),this.getY())},r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r}(),$l=function(){function r(e){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=e}return r.prototype.detect=function(){return this.detectMirror(!1)},r.prototype.detectMirror=function(e){var t=this.getMatrixCenter(),n=this.getBullsEyeCorners(t);if(e){var i=n[0];n[0]=n[2],n[2]=i}this.extractParameters(n);var a=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),o=this.getMatrixCornerPoints(n);return new Gl(a,o,this.compact,this.nbDataBlocks,this.nbLayers)},r.prototype.extractParameters=function(e){if(!this.isValidPoint(e[0])||!this.isValidPoint(e[1])||!this.isValidPoint(e[2])||!this.isValidPoint(e[3]))throw new N;var t=2*this.nbCenterLayers,n=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(n,t);for(var i=0,a=0;a<4;a++){var o=n[(this.shift+a)%4];this.compact?(i<<=7,i+=o>>1&127):(i<<=10,i+=(o>>2&992)+(o>>1&31))}var s=this.getCorrectedParameterData(i,this.compact);this.compact?(this.nbLayers=(s>>6)+1,this.nbDataBlocks=(s&63)+1):(this.nbLayers=(s>>11)+1,this.nbDataBlocks=(s&2047)+1)},r.prototype.getRotation=function(e,t){var n=0;e.forEach(function(a,o,s){var l=(a>>t-2<<1)+(a&1);n=(n<<3)+l}),n=((n&1)<<11)+(n>>1);for(var i=0;i<4;i++)if($.bitCount(n^this.EXPECTED_CORNER_BITS[i])<=2)return i;throw new N},r.prototype.getCorrectedParameterData=function(e,t){var n,i;t?(n=7,i=2):(n=10,i=4);for(var a=n-i,o=new Int32Array(n),s=n-1;s>=0;--s)o[s]=e&15,e>>=4;try{var l=new Kr(He.AZTEC_PARAM);l.decode(o,a)}catch{throw new N}for(var u=0,s=0;s<i;s++)u=(u<<4)+o[s];return u},r.prototype.getBullsEyeCorners=function(e){var t=e,n=e,i=e,a=e,o=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){var s=this.getFirstDifferent(t,o,1,-1),l=this.getFirstDifferent(n,o,1,1),u=this.getFirstDifferent(i,o,-1,1),c=this.getFirstDifferent(a,o,-1,-1);if(this.nbCenterLayers>2){var f=this.distancePoint(c,s)*this.nbCenterLayers/(this.distancePoint(a,t)*(this.nbCenterLayers+2));if(f<.75||f>1.25||!this.isWhiteOrBlackRectangle(s,l,u,c))break}t=s,n=l,i=u,a=c,o=!o}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new N;this.compact=this.nbCenterLayers===5;var p=new z(t.getX()+.5,t.getY()-.5),h=new z(n.getX()+.5,n.getY()+.5),g=new z(i.getX()-.5,i.getY()+.5),x=new z(a.getX()-.5,a.getY()-.5);return this.expandSquare([p,h,g,x],2*this.nbCenterLayers-3,2*this.nbCenterLayers)},r.prototype.getMatrixCenter=function(){var e,t,n,i;try{var a=new Kn(this.image).detect();e=a[0],t=a[1],n=a[2],i=a[3]}catch{var o=this.image.getWidth()/2,s=this.image.getHeight()/2;e=this.getFirstDifferent(new Ge(o+7,s-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ge(o+7,s+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ge(o-7,s+7),!1,-1,1).toResultPoint(),i=this.getFirstDifferent(new Ge(o-7,s-7),!1,-1,-1).toResultPoint()}var l=Q.round((e.getX()+i.getX()+t.getX()+n.getX())/4),u=Q.round((e.getY()+i.getY()+t.getY()+n.getY())/4);try{var a=new Kn(this.image,15,l,u).detect();e=a[0],t=a[1],n=a[2],i=a[3]}catch{e=this.getFirstDifferent(new Ge(l+7,u-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ge(l+7,u+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ge(l-7,u+7),!1,-1,1).toResultPoint(),i=this.getFirstDifferent(new Ge(l-7,u-7),!1,-1,-1).toResultPoint()}return l=Q.round((e.getX()+i.getX()+t.getX()+n.getX())/4),u=Q.round((e.getY()+i.getY()+t.getY()+n.getY())/4),new Ge(l,u)},r.prototype.getMatrixCornerPoints=function(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())},r.prototype.sampleGrid=function(e,t,n,i,a){var o=Qn.getInstance(),s=this.getDimension(),l=s/2-this.nbCenterLayers,u=s/2+this.nbCenterLayers;return o.sampleGrid(e,s,s,l,l,u,l,u,u,l,u,t.getX(),t.getY(),n.getX(),n.getY(),i.getX(),i.getY(),a.getX(),a.getY())},r.prototype.sampleLine=function(e,t,n){for(var i=0,a=this.distanceResultPoint(e,t),o=a/n,s=e.getX(),l=e.getY(),u=o*(t.getX()-e.getX())/a,c=o*(t.getY()-e.getY())/a,f=0;f<n;f++)this.image.get(Q.round(s+f*u),Q.round(l+f*c))&&(i|=1<<n-f-1);return i},r.prototype.isWhiteOrBlackRectangle=function(e,t,n,i){var a=3;e=new Ge(e.getX()-a,e.getY()+a),t=new Ge(t.getX()-a,t.getY()-a),n=new Ge(n.getX()+a,n.getY()-a),i=new Ge(i.getX()+a,i.getY()+a);var o=this.getColor(i,e);if(o===0)return!1;var s=this.getColor(e,t);return s!==o||(s=this.getColor(t,n),s!==o)?!1:(s=this.getColor(n,i),s===o)},r.prototype.getColor=function(e,t){for(var n=this.distancePoint(e,t),i=(t.getX()-e.getX())/n,a=(t.getY()-e.getY())/n,o=0,s=e.getX(),l=e.getY(),u=this.image.get(e.getX(),e.getY()),c=Math.ceil(n),f=0;f<c;f++)s+=i,l+=a,this.image.get(Q.round(s),Q.round(l))!==u&&o++;var p=o/n;return p>.1&&p<.9?0:p<=.1===u?1:-1},r.prototype.getFirstDifferent=function(e,t,n,i){for(var a=e.getX()+n,o=e.getY()+i;this.isValid(a,o)&&this.image.get(a,o)===t;)a+=n,o+=i;for(a-=n,o-=i;this.isValid(a,o)&&this.image.get(a,o)===t;)a+=n;for(a-=n;this.isValid(a,o)&&this.image.get(a,o)===t;)o+=i;return o-=i,new Ge(a,o)},r.prototype.expandSquare=function(e,t,n){var i=n/(2*t),a=e[0].getX()-e[2].getX(),o=e[0].getY()-e[2].getY(),s=(e[0].getX()+e[2].getX())/2,l=(e[0].getY()+e[2].getY())/2,u=new z(s+i*a,l+i*o),c=new z(s-i*a,l-i*o);a=e[1].getX()-e[3].getX(),o=e[1].getY()-e[3].getY(),s=(e[1].getX()+e[3].getX())/2,l=(e[1].getY()+e[3].getY())/2;var f=new z(s+i*a,l+i*o),p=new z(s-i*a,l-i*o),h=[u,f,c,p];return h},r.prototype.isValid=function(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()},r.prototype.isValidPoint=function(e){var t=Q.round(e.getX()),n=Q.round(e.getY());return this.isValid(t,n)},r.prototype.distancePoint=function(e,t){return Q.distance(e.getX(),e.getY(),t.getX(),t.getY())},r.prototype.distanceResultPoint=function(e,t){return Q.distance(e.getX(),e.getY(),t.getX(),t.getY())},r.prototype.getDimension=function(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*($.truncDivision(this.nbLayers-4,8)+1)+15},r}(),Jn=function(){function r(){}return r.prototype.decode=function(e,t){t===void 0&&(t=null);var n=null,i=new $l(e.getBlackMatrix()),a=null,o=null;try{var s=i.detectMirror(!1);a=s.getPoints(),this.reportFoundResultPoints(t,a),o=new xa().decode(s)}catch(f){n=f}if(o==null)try{var s=i.detectMirror(!0);a=s.getPoints(),this.reportFoundResultPoints(t,a),o=new xa().decode(s)}catch(f){throw n??f}var l=new Ne(o.getText(),o.getRawBytes(),o.getNumBits(),a,B.AZTEC,se.currentTimeMillis()),u=o.getByteSegments();u!=null&&l.putMetadata(Ae.BYTE_SEGMENTS,u);var c=o.getECLevel();return c!=null&&l.putMetadata(Ae.ERROR_CORRECTION_LEVEL,c),l},r.prototype.reportFoundResultPoints=function(e,t){if(e!=null){var n=e.get(ce.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach(function(i,a,o){n.foundPossibleResultPoint(i)})}},r.prototype.reset=function(){},r}(),Wl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){Wl(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new Jn,t)||this}return e})(zt);var ve=function(){function r(){}return r.prototype.decode=function(e,t){try{return this.doDecode(e,t)}catch{var n=t&&t.get(ce.TRY_HARDER)===!0;if(n&&e.isRotateSupported()){var i=e.rotateCounterClockwise(),a=this.doDecode(i,t),o=a.getResultMetadata(),s=270;o!==null&&o.get(Ae.ORIENTATION)===!0&&(s=s+o.get(Ae.ORIENTATION)%360),a.putMetadata(Ae.ORIENTATION,s);var l=a.getResultPoints();if(l!==null)for(var u=i.getHeight(),c=0;c<l.length;c++)l[c]=new z(u-l[c].getY()-1,l[c].getX());return a}else throw new N}},r.prototype.reset=function(){},r.prototype.doDecode=function(e,t){var n=e.getWidth(),i=e.getHeight(),a=new we(n),o=t&&t.get(ce.TRY_HARDER)===!0,s=Math.max(1,i>>(o?8:5)),l;o?l=i:l=15;for(var u=Math.trunc(i/2),c=0;c<l;c++){var f=Math.trunc((c+1)/2),p=(c&1)===0,h=u+s*(p?f:-f);if(h<0||h>=i)break;try{a=e.getBlackRow(h,a)}catch{continue}for(var g=function(w){if(w===1&&(a.reverse(),t&&t.get(ce.NEED_RESULT_POINT_CALLBACK)===!0)){var _=new Map;t.forEach(function(T,D){return _.set(D,T)}),_.delete(ce.NEED_RESULT_POINT_CALLBACK),t=_}try{var E=x.decodeRow(h,a,t);if(w===1){E.putMetadata(Ae.ORIENTATION,180);var O=E.getResultPoints();O!==null&&(O[0]=new z(n-O[0].getX()-1,O[0].getY()),O[1]=new z(n-O[1].getX()-1,O[1].getY()))}return{value:E}}catch{}},x=this,C=0;C<2;C++){var m=g(C);if(typeof m=="object")return m.value}}throw new N},r.recordPattern=function(e,t,n){for(var i=n.length,a=0;a<i;a++)n[a]=0;var o=e.getSize();if(t>=o)throw new N;for(var s=!e.get(t),l=0,u=t;u<o;){if(e.get(u)!==s)n[l]++;else{if(++l===i)break;n[l]=1,s=!s}u++}if(!(l===i||l===i-1&&u===o))throw new N},r.recordPatternInReverse=function(e,t,n){for(var i=n.length,a=e.get(t);t>0&&i>=0;)e.get(--t)!==a&&(i--,a=!a);if(i>=0)throw new N;r.recordPattern(e,t+1,n)},r.patternMatchVariance=function(e,t,n){for(var i=e.length,a=0,o=0,s=0;s<i;s++)a+=e[s],o+=t[s];if(a<o)return Number.POSITIVE_INFINITY;var l=a/o;n*=l;for(var u=0,c=0;c<i;c++){var f=e[c],p=t[c]*l,h=f>p?f-p:p-f;if(h>n)return Number.POSITIVE_INFINITY;u+=h}return u/a},r}(),jl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),wa=function(r){jl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.findStartPattern=function(t){for(var n=t.getSize(),i=t.getNextSet(0),a=0,o=Int32Array.from([0,0,0,0,0,0]),s=i,l=!1,u=6,c=i;c<n;c++)if(t.get(c)!==l)o[a]++;else{if(a===u-1){for(var f=e.MAX_AVG_VARIANCE,p=-1,h=e.CODE_START_A;h<=e.CODE_START_C;h++){var g=ve.patternMatchVariance(o,e.CODE_PATTERNS[h],e.MAX_INDIVIDUAL_VARIANCE);g<f&&(f=g,p=h)}if(p>=0&&t.isRange(Math.max(0,s-(c-s)/2),s,!1))return Int32Array.from([s,c,p]);s+=o[0]+o[1],o=o.slice(2,o.length-1),o[a-1]=0,o[a]=0,a--}else a++;o[a]=1,l=!l}throw new N},e.decodeCode=function(t,n,i){ve.recordPattern(t,i,n);for(var a=e.MAX_AVG_VARIANCE,o=-1,s=0;s<e.CODE_PATTERNS.length;s++){var l=e.CODE_PATTERNS[s],u=this.patternMatchVariance(n,l,e.MAX_INDIVIDUAL_VARIANCE);u<a&&(a=u,o=s)}if(o>=0)return o;throw new N},e.prototype.decodeRow=function(t,n,i){var a=i&&i.get(ce.ASSUME_GS1)===!0,o=e.findStartPattern(n),s=o[2],l=0,u=new Uint8Array(20);u[l++]=s;var c;switch(s){case e.CODE_START_A:c=e.CODE_CODE_A;break;case e.CODE_START_B:c=e.CODE_CODE_B;break;case e.CODE_START_C:c=e.CODE_CODE_C;break;default:throw new F}for(var f=!1,p=!1,h="",g=o[0],x=o[1],C=Int32Array.from([0,0,0,0,0,0]),m=0,w=0,_=s,E=0,O=!0,T=!1,D=!1;!f;){var M=p;switch(p=!1,m=w,w=e.decodeCode(n,C,x),u[l++]=w,w!==e.CODE_STOP&&(O=!0),w!==e.CODE_STOP&&(E++,_+=E*w),g=x,x+=C.reduce(function(re,Fe){return re+Fe},0),w){case e.CODE_START_A:case e.CODE_START_B:case e.CODE_START_C:throw new F}switch(c){case e.CODE_CODE_A:if(w<64)D===T?h+=String.fromCharCode(32+w):h+=String.fromCharCode(32+w+128),D=!1;else if(w<96)D===T?h+=String.fromCharCode(w-64):h+=String.fromCharCode(w+64),D=!1;else switch(w!==e.CODE_STOP&&(O=!1),w){case e.CODE_FNC_1:a&&(h.length===0?h+="]C1":h+="");break;case e.CODE_FNC_2:case e.CODE_FNC_3:break;case e.CODE_FNC_4_A:!T&&D?(T=!0,D=!1):T&&D?(T=!1,D=!1):D=!0;break;case e.CODE_SHIFT:p=!0,c=e.CODE_CODE_B;break;case e.CODE_CODE_B:c=e.CODE_CODE_B;break;case e.CODE_CODE_C:c=e.CODE_CODE_C;break;case e.CODE_STOP:f=!0;break}break;case e.CODE_CODE_B:if(w<96)D===T?h+=String.fromCharCode(32+w):h+=String.fromCharCode(32+w+128),D=!1;else switch(w!==e.CODE_STOP&&(O=!1),w){case e.CODE_FNC_1:a&&(h.length===0?h+="]C1":h+="");break;case e.CODE_FNC_2:case e.CODE_FNC_3:break;case e.CODE_FNC_4_B:!T&&D?(T=!0,D=!1):T&&D?(T=!1,D=!1):D=!0;break;case e.CODE_SHIFT:p=!0,c=e.CODE_CODE_A;break;case e.CODE_CODE_A:c=e.CODE_CODE_A;break;case e.CODE_CODE_C:c=e.CODE_CODE_C;break;case e.CODE_STOP:f=!0;break}break;case e.CODE_CODE_C:if(w<100)w<10&&(h+="0"),h+=w;else switch(w!==e.CODE_STOP&&(O=!1),w){case e.CODE_FNC_1:a&&(h.length===0?h+="]C1":h+="");break;case e.CODE_CODE_A:c=e.CODE_CODE_A;break;case e.CODE_CODE_B:c=e.CODE_CODE_B;break;case e.CODE_STOP:f=!0;break}break}M&&(c=c===e.CODE_CODE_A?e.CODE_CODE_B:e.CODE_CODE_A)}var P=x-g;if(x=n.getNextUnset(x),!n.isRange(x,Math.min(n.getSize(),x+(x-g)/2),!1))throw new N;if(_-=E*m,_%103!==m)throw new Ce;var V=h.length;if(V===0)throw new N;V>0&&O&&(c===e.CODE_CODE_C?h=h.substring(0,V-2):h=h.substring(0,V-1));for(var W=(o[1]+o[0])/2,U=g+P/2,J=u.length,R=new Uint8Array(J),Z=0;Z<J;Z++)R[Z]=u[Z];var H=[new z(W,t),new z(U,t)];return new Ne(h,R,0,H,B.CODE_128,new Date().getTime())},e.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],e.MAX_AVG_VARIANCE=.25,e.MAX_INDIVIDUAL_VARIANCE=.7,e.CODE_SHIFT=98,e.CODE_CODE_C=99,e.CODE_CODE_B=100,e.CODE_CODE_A=101,e.CODE_FNC_1=102,e.CODE_FNC_2=97,e.CODE_FNC_3=96,e.CODE_FNC_4_A=101,e.CODE_FNC_4_B=100,e.CODE_START_A=103,e.CODE_START_B=104,e.CODE_START_C=105,e.CODE_STOP=106,e}(ve),Yl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ei=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ma=function(r){Yl(e,r);function e(t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var i=r.call(this)||this;return i.usingCheckDigit=t,i.extendedMode=n,i.decodeRowResult="",i.counters=new Int32Array(9),i}return e.prototype.decodeRow=function(t,n,i){var a,o,s,l,u=this.counters;u.fill(0),this.decodeRowResult="";var c=e.findAsteriskPattern(n,u),f=n.getNextSet(c[1]),p=n.getSize(),h,g;do{e.recordPattern(n,f,u);var x=e.toNarrowWidePattern(u);if(x<0)throw new N;h=e.patternToChar(x),this.decodeRowResult+=h,g=f;try{for(var C=(a=void 0,ei(u)),m=C.next();!m.done;m=C.next()){var w=m.value;f+=w}}catch(J){a={error:J}}finally{try{m&&!m.done&&(o=C.return)&&o.call(C)}finally{if(a)throw a.error}}f=n.getNextSet(f)}while(h!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);var _=0;try{for(var E=ei(u),O=E.next();!O.done;O=E.next()){var w=O.value;_+=w}}catch(J){s={error:J}}finally{try{O&&!O.done&&(l=E.return)&&l.call(E)}finally{if(s)throw s.error}}var T=f-g-_;if(f!==p&&T*2<_)throw new N;if(this.usingCheckDigit){for(var D=this.decodeRowResult.length-1,M=0,P=0;P<D;P++)M+=e.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(P));if(this.decodeRowResult.charAt(D)!==e.ALPHABET_STRING.charAt(M%43))throw new Ce;this.decodeRowResult=this.decodeRowResult.substring(0,D)}if(this.decodeRowResult.length===0)throw new N;var V;this.extendedMode?V=e.decodeExtended(this.decodeRowResult):V=this.decodeRowResult;var W=(c[1]+c[0])/2,U=g+_/2;return new Ne(V,null,0,[new z(W,t),new z(U,t)],B.CODE_39,new Date().getTime())},e.findAsteriskPattern=function(t,n){for(var i=t.getSize(),a=t.getNextSet(0),o=0,s=a,l=!1,u=n.length,c=a;c<i;c++)if(t.get(c)!==l)n[o]++;else{if(o===u-1){if(this.toNarrowWidePattern(n)===e.ASTERISK_ENCODING&&t.isRange(Math.max(0,s-Math.floor((c-s)/2)),s,!1))return[s,c];s+=n[0]+n[1],n.copyWithin(0,2,2+o-1),n[o-1]=0,n[o]=0,o--}else o++;n[o]=1,l=!l}throw new N},e.toNarrowWidePattern=function(t){var n,i,a=t.length,o=0,s;do{var l=2147483647;try{for(var u=(n=void 0,ei(t)),c=u.next();!c.done;c=u.next()){var f=c.value;f<l&&f>o&&(l=f)}}catch(x){n={error:x}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}o=l,s=0;for(var p=0,h=0,g=0;g<a;g++){var f=t[g];f>o&&(h|=1<<a-1-g,s++,p+=f)}if(s===3){for(var g=0;g<a&&s>0;g++){var f=t[g];if(f>o&&(s--,f*2>=p))return-1}return h}}while(s>3);return-1},e.patternToChar=function(t){for(var n=0;n<e.CHARACTER_ENCODINGS.length;n++)if(e.CHARACTER_ENCODINGS[n]===t)return e.ALPHABET_STRING.charAt(n);if(t===e.ASTERISK_ENCODING)return"*";throw new N},e.decodeExtended=function(t){for(var n=t.length,i="",a=0;a<n;a++){var o=t.charAt(a);if(o==="+"||o==="$"||o==="%"||o==="/"){var s=t.charAt(a+1),l="\0";switch(o){case"+":if(s>="A"&&s<="Z")l=String.fromCharCode(s.charCodeAt(0)+32);else throw new F;break;case"$":if(s>="A"&&s<="Z")l=String.fromCharCode(s.charCodeAt(0)-64);else throw new F;break;case"%":if(s>="A"&&s<="E")l=String.fromCharCode(s.charCodeAt(0)-38);else if(s>="F"&&s<="J")l=String.fromCharCode(s.charCodeAt(0)-11);else if(s>="K"&&s<="O")l=String.fromCharCode(s.charCodeAt(0)+16);else if(s>="P"&&s<="T")l=String.fromCharCode(s.charCodeAt(0)+43);else if(s==="U")l="\0";else if(s==="V")l="@";else if(s==="W")l="`";else if(s==="X"||s==="Y"||s==="Z")l="";else throw new F;break;case"/":if(s>="A"&&s<="O")l=String.fromCharCode(s.charCodeAt(0)-32);else if(s==="Z")l=":";else throw new F;break}i+=l,a++}else i+=o}return i},e.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",e.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],e.ASTERISK_ENCODING=148,e}(ve),Zl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ti=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},_a=function(r){Zl(e,r);function e(){var t=r.call(this)||this;return t.decodeRowResult="",t.counters=new Int32Array(6),t}return e.prototype.decodeRow=function(t,n,i){var a,o,s,l,u=this.findAsteriskPattern(n),c=n.getNextSet(u[1]),f=n.getSize(),p=this.counters;p.fill(0),this.decodeRowResult="";var h,g;do{e.recordPattern(n,c,p);var x=this.toPattern(p);if(x<0)throw new N;h=this.patternToChar(x),this.decodeRowResult+=h,g=c;try{for(var C=(a=void 0,ti(p)),m=C.next();!m.done;m=C.next()){var w=m.value;c+=w}}catch(P){a={error:P}}finally{try{m&&!m.done&&(o=C.return)&&o.call(C)}finally{if(a)throw a.error}}c=n.getNextSet(c)}while(h!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);var _=0;try{for(var E=ti(p),O=E.next();!O.done;O=E.next()){var w=O.value;_+=w}}catch(P){s={error:P}}finally{try{O&&!O.done&&(l=E.return)&&l.call(E)}finally{if(s)throw s.error}}if(c===f||!n.get(c))throw new N;if(this.decodeRowResult.length<2)throw new N;this.checkChecksums(this.decodeRowResult),this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-2);var T=this.decodeExtended(this.decodeRowResult),D=(u[1]+u[0])/2,M=g+_/2;return new Ne(T,null,0,[new z(D,t),new z(M,t)],B.CODE_93,new Date().getTime())},e.prototype.findAsteriskPattern=function(t){var n=t.getSize(),i=t.getNextSet(0);this.counters.fill(0);for(var a=this.counters,o=i,s=!1,l=a.length,u=0,c=i;c<n;c++)if(t.get(c)!==s)a[u]++;else{if(u===l-1){if(this.toPattern(a)===e.ASTERISK_ENCODING)return new Int32Array([o,c]);o+=a[0]+a[1],a.copyWithin(0,2,2+u-1),a[u-1]=0,a[u]=0,u--}else u++;a[u]=1,s=!s}throw new N},e.prototype.toPattern=function(t){var n,i,a=0;try{for(var o=ti(t),s=o.next();!s.done;s=o.next()){var l=s.value;a+=l}}catch(g){n={error:g}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}for(var u=0,c=t.length,f=0;f<c;f++){var p=Math.round(t[f]*9/a);if(p<1||p>4)return-1;if((f&1)===0)for(var h=0;h<p;h++)u=u<<1|1;else u<<=p}return u},e.prototype.patternToChar=function(t){for(var n=0;n<e.CHARACTER_ENCODINGS.length;n++)if(e.CHARACTER_ENCODINGS[n]===t)return e.ALPHABET_STRING.charAt(n);throw new N},e.prototype.decodeExtended=function(t){for(var n=t.length,i="",a=0;a<n;a++){var o=t.charAt(a);if(o>="a"&&o<="d"){if(a>=n-1)throw new F;var s=t.charAt(a+1),l="\0";switch(o){case"d":if(s>="A"&&s<="Z")l=String.fromCharCode(s.charCodeAt(0)+32);else throw new F;break;case"a":if(s>="A"&&s<="Z")l=String.fromCharCode(s.charCodeAt(0)-64);else throw new F;break;case"b":if(s>="A"&&s<="E")l=String.fromCharCode(s.charCodeAt(0)-38);else if(s>="F"&&s<="J")l=String.fromCharCode(s.charCodeAt(0)-11);else if(s>="K"&&s<="O")l=String.fromCharCode(s.charCodeAt(0)+16);else if(s>="P"&&s<="T")l=String.fromCharCode(s.charCodeAt(0)+43);else if(s==="U")l="\0";else if(s==="V")l="@";else if(s==="W")l="`";else if(s>="X"&&s<="Z")l="";else throw new F;break;case"c":if(s>="A"&&s<="O")l=String.fromCharCode(s.charCodeAt(0)-32);else if(s==="Z")l=":";else throw new F;break}i+=l,a++}else i+=o}return i},e.prototype.checkChecksums=function(t){var n=t.length;this.checkOneChecksum(t,n-2,20),this.checkOneChecksum(t,n-1,15)},e.prototype.checkOneChecksum=function(t,n,i){for(var a=1,o=0,s=n-1;s>=0;s--)o+=a*e.ALPHABET_STRING.indexOf(t.charAt(s)),++a>i&&(a=1);if(t.charAt(n)!==e.ALPHABET_STRING[o%47])throw new Ce},e.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*",e.CHARACTER_ENCODINGS=[276,328,324,322,296,292,290,336,274,266,424,420,418,404,402,394,360,356,354,308,282,344,332,326,300,278,436,434,428,422,406,410,364,358,310,314,302,468,466,458,366,374,430,294,474,470,306,350],e.ASTERISK_ENCODING=e.CHARACTER_ENCODINGS[47],e}(ve),Kl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ql=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Aa=function(r){Kl(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.narrowLineWidth=-1,t}return e.prototype.decodeRow=function(t,n,i){var a,o,s=this.decodeStart(n),l=this.decodeEnd(n),u=new q;e.decodeMiddle(n,s[1],l[0],u);var c=u.toString(),f=null;i!=null&&(f=i.get(ce.ALLOWED_LENGTHS)),f==null&&(f=e.DEFAULT_ALLOWED_LENGTHS);var p=c.length,h=!1,g=0;try{for(var x=Ql(f),C=x.next();!C.done;C=x.next()){var m=C.value;if(p===m){h=!0;break}m>g&&(g=m)}}catch(E){a={error:E}}finally{try{C&&!C.done&&(o=x.return)&&o.call(x)}finally{if(a)throw a.error}}if(!h&&p>g&&(h=!0),!h)throw new F;var w=[new z(s[1],t),new z(l[0],t)],_=new Ne(c,null,0,w,B.ITF,new Date().getTime());return _},e.decodeMiddle=function(t,n,i,a){var o=new Int32Array(10),s=new Int32Array(5),l=new Int32Array(5);for(o.fill(0),s.fill(0),l.fill(0);n<i;){ve.recordPattern(t,n,o);for(var u=0;u<5;u++){var c=2*u;s[u]=o[c],l[u]=o[c+1]}var f=e.decodeDigit(s);a.append(f.toString()),f=this.decodeDigit(l),a.append(f.toString()),o.forEach(function(p){n+=p})}},e.prototype.decodeStart=function(t){var n=e.skipWhiteSpace(t),i=e.findGuardPattern(t,n,e.START_PATTERN);return this.narrowLineWidth=(i[1]-i[0])/4,this.validateQuietZone(t,i[0]),i},e.prototype.validateQuietZone=function(t,n){var i=this.narrowLineWidth*10;i=i<n?i:n;for(var a=n-1;i>0&&a>=0&&!t.get(a);a--)i--;if(i!==0)throw new N},e.skipWhiteSpace=function(t){var n=t.getSize(),i=t.getNextSet(0);if(i===n)throw new N;return i},e.prototype.decodeEnd=function(t){t.reverse();try{var n=e.skipWhiteSpace(t),i=void 0;try{i=e.findGuardPattern(t,n,e.END_PATTERN_REVERSED[0])}catch(o){o instanceof N&&(i=e.findGuardPattern(t,n,e.END_PATTERN_REVERSED[1]))}this.validateQuietZone(t,i[0]);var a=i[0];return i[0]=t.getSize()-i[1],i[1]=t.getSize()-a,i}finally{t.reverse()}},e.findGuardPattern=function(t,n,i){var a=i.length,o=new Int32Array(a),s=t.getSize(),l=!1,u=0,c=n;o.fill(0);for(var f=n;f<s;f++)if(t.get(f)!==l)o[u]++;else{if(u===a-1){if(ve.patternMatchVariance(o,i,e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return[c,f];c+=o[0]+o[1],se.arraycopy(o,2,o,0,u-1),o[u-1]=0,o[u]=0,u--}else u++;o[u]=1,l=!l}throw new N},e.decodeDigit=function(t){for(var n=e.MAX_AVG_VARIANCE,i=-1,a=e.PATTERNS.length,o=0;o<a;o++){var s=e.PATTERNS[o],l=ve.patternMatchVariance(t,s,e.MAX_INDIVIDUAL_VARIANCE);l<n?(n=l,i=o):l===n&&(i=-1)}if(i>=0)return i%10;throw new N},e.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],e.MAX_AVG_VARIANCE=.38,e.MAX_INDIVIDUAL_VARIANCE=.5,e.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],e.START_PATTERN=Int32Array.from([1,1,1,1]),e.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])],e}(ve),Jl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),kt=function(r){Jl(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.decodeRowStringBuffer="",t}return e.findStartGuardPattern=function(t){for(var n=!1,i,a=0,o=Int32Array.from([0,0,0]);!n;){o=Int32Array.from([0,0,0]),i=e.findGuardPattern(t,a,!1,this.START_END_PATTERN,o);var s=i[0];a=i[1];var l=s-(a-s);l>=0&&(n=t.isRange(l,s,!1))}return i},e.checkChecksum=function(t){return e.checkStandardUPCEANChecksum(t)},e.checkStandardUPCEANChecksum=function(t){var n=t.length;if(n===0)return!1;var i=parseInt(t.charAt(n-1),10);return e.getStandardUPCEANChecksum(t.substring(0,n-1))===i},e.getStandardUPCEANChecksum=function(t){for(var n=t.length,i=0,a=n-1;a>=0;a-=2){var o=t.charAt(a).charCodeAt(0)-48;if(o<0||o>9)throw new F;i+=o}i*=3;for(var a=n-2;a>=0;a-=2){var o=t.charAt(a).charCodeAt(0)-48;if(o<0||o>9)throw new F;i+=o}return(1e3-i)%10},e.decodeEnd=function(t,n){return e.findGuardPattern(t,n,!1,e.START_END_PATTERN,new Int32Array(e.START_END_PATTERN.length).fill(0))},e.findGuardPatternWithoutCounters=function(t,n,i,a){return this.findGuardPattern(t,n,i,a,new Int32Array(a.length))},e.findGuardPattern=function(t,n,i,a,o){var s=t.getSize();n=i?t.getNextUnset(n):t.getNextSet(n);for(var l=0,u=n,c=a.length,f=i,p=n;p<s;p++)if(t.get(p)!==f)o[l]++;else{if(l===c-1){if(ve.patternMatchVariance(o,a,e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return Int32Array.from([u,p]);u+=o[0]+o[1];for(var h=o.slice(2,o.length),g=0;g<l-1;g++)o[g]=h[g];o[l-1]=0,o[l]=0,l--}else l++;o[l]=1,f=!f}throw new N},e.decodeDigit=function(t,n,i,a){this.recordPattern(t,i,n);for(var o=this.MAX_AVG_VARIANCE,s=-1,l=a.length,u=0;u<l;u++){var c=a[u],f=ve.patternMatchVariance(n,c,e.MAX_INDIVIDUAL_VARIANCE);f<o&&(o=f,s=u)}if(s>=0)return s;throw new N},e.MAX_AVG_VARIANCE=.48,e.MAX_INDIVIDUAL_VARIANCE=.7,e.START_END_PATTERN=Int32Array.from([1,1,1]),e.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),e.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),e.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])],e}(ve),eu=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},tu=function(){function r(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}return r.prototype.decodeRow=function(e,t,n){var i=this.decodeRowStringBuffer,a=this.decodeMiddle(t,n,i),o=i.toString(),s=r.parseExtensionString(o),l=[new z((n[0]+n[1])/2,e),new z(a,e)],u=new Ne(o,null,0,l,B.UPC_EAN_EXTENSION,new Date().getTime());return s!=null&&u.putAllMetadata(s),u},r.prototype.decodeMiddle=function(e,t,n){var i,a,o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;for(var s=e.getSize(),l=t[1],u=0,c=0;c<5&&l<s;c++){var f=kt.decodeDigit(e,o,l,kt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+f%10);try{for(var p=(i=void 0,eu(o)),h=p.next();!h.done;h=p.next()){var g=h.value;l+=g}}catch(C){i={error:C}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}f>=10&&(u|=1<<4-c),c!==4&&(l=e.getNextSet(l),l=e.getNextUnset(l))}if(n.length!==5)throw new N;var x=this.determineCheckDigit(u);if(r.extensionChecksum(n.toString())!==x)throw new N;return l},r.extensionChecksum=function(e){for(var t=e.length,n=0,i=t-2;i>=0;i-=2)n+=e.charAt(i).charCodeAt(0)-48;n*=3;for(var i=t-1;i>=0;i-=2)n+=e.charAt(i).charCodeAt(0)-48;return n*=3,n%10},r.prototype.determineCheckDigit=function(e){for(var t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new N},r.parseExtensionString=function(e){if(e.length!==5)return null;var t=r.parseExtension5String(e);return t==null?null:new Map([[Ae.SUGGESTED_PRICE,t]])},r.parseExtension5String=function(e){var t;switch(e.charAt(0)){case"0":t="£";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t="";break}var n=parseInt(e.substring(1)),i=(n/100).toString(),a=n%100,o=a<10?"0"+a:a.toString();return t+i+"."+o},r}(),ru=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},nu=function(){function r(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}return r.prototype.decodeRow=function(e,t,n){var i=this.decodeRowStringBuffer,a=this.decodeMiddle(t,n,i),o=i.toString(),s=r.parseExtensionString(o),l=[new z((n[0]+n[1])/2,e),new z(a,e)],u=new Ne(o,null,0,l,B.UPC_EAN_EXTENSION,new Date().getTime());return s!=null&&u.putAllMetadata(s),u},r.prototype.decodeMiddle=function(e,t,n){var i,a,o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;for(var s=e.getSize(),l=t[1],u=0,c=0;c<2&&l<s;c++){var f=kt.decodeDigit(e,o,l,kt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+f%10);try{for(var p=(i=void 0,ru(o)),h=p.next();!h.done;h=p.next()){var g=h.value;l+=g}}catch(x){i={error:x}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}f>=10&&(u|=1<<1-c),c!==1&&(l=e.getNextSet(l),l=e.getNextUnset(l))}if(n.length!==2)throw new N;if(parseInt(n.toString())%4!==u)throw new N;return l},r.parseExtensionString=function(e){return e.length!==2?null:new Map([[Ae.ISSUE_NUMBER,parseInt(e)]])},r}(),iu=function(){function r(){}return r.decodeRow=function(e,t,n){var i=kt.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{var a=new tu;return a.decodeRow(e,t,i)}catch{var o=new nu;return o.decodeRow(e,t,i)}},r.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]),r}(),au=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ge=function(r){au(e,r);function e(){var t=r.call(this)||this;t.decodeRowStringBuffer="",e.L_AND_G_PATTERNS=e.L_PATTERNS.map(function(s){return Int32Array.from(s)});for(var n=10;n<20;n++){for(var i=e.L_PATTERNS[n-10],a=new Int32Array(i.length),o=0;o<i.length;o++)a[o]=i[i.length-o-1];e.L_AND_G_PATTERNS[n]=a}return t}return e.prototype.decodeRow=function(t,n,i){var a=e.findStartGuardPattern(n),o=i==null?null:i.get(ce.NEED_RESULT_POINT_CALLBACK);if(o!=null){var s=new z((a[0]+a[1])/2,t);o.foundPossibleResultPoint(s)}var l=this.decodeMiddle(n,a,this.decodeRowStringBuffer),u=l.rowOffset,c=l.resultString;if(o!=null){var f=new z(u,t);o.foundPossibleResultPoint(f)}var p=e.decodeEnd(n,u);if(o!=null){var h=new z((p[0]+p[1])/2,t);o.foundPossibleResultPoint(h)}var g=p[1],x=g+(g-p[0]);if(x>=n.getSize()||!n.isRange(g,x,!1))throw new N;var C=c.toString();if(C.length<8)throw new F;if(!e.checkChecksum(C))throw new Ce;var m=(a[1]+a[0])/2,w=(p[1]+p[0])/2,_=this.getBarcodeFormat(),E=[new z(m,t),new z(w,t)],O=new Ne(C,null,0,E,_,new Date().getTime()),T=0;try{var D=iu.decodeRow(t,n,p[1]);O.putMetadata(Ae.UPC_EAN_EXTENSION,D.getText()),O.putAllMetadata(D.getResultMetadata()),O.addResultPoints(D.getResultPoints()),T=D.getText().length}catch{}var M=i==null?null:i.get(ce.ALLOWED_EAN_EXTENSIONS);if(M!=null){var P=!1;for(var V in M)if(T.toString()===V){P=!0;break}if(!P)throw new N}return _===B.EAN_13||B.UPC_A,O},e.checkChecksum=function(t){return e.checkStandardUPCEANChecksum(t)},e.checkStandardUPCEANChecksum=function(t){var n=t.length;if(n===0)return!1;var i=parseInt(t.charAt(n-1),10);return e.getStandardUPCEANChecksum(t.substring(0,n-1))===i},e.getStandardUPCEANChecksum=function(t){for(var n=t.length,i=0,a=n-1;a>=0;a-=2){var o=t.charAt(a).charCodeAt(0)-48;if(o<0||o>9)throw new F;i+=o}i*=3;for(var a=n-2;a>=0;a-=2){var o=t.charAt(a).charCodeAt(0)-48;if(o<0||o>9)throw new F;i+=o}return(1e3-i)%10},e.decodeEnd=function(t,n){return e.findGuardPattern(t,n,!1,e.START_END_PATTERN,new Int32Array(e.START_END_PATTERN.length).fill(0))},e}(kt),ou=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ea=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ri=function(r){ou(e,r);function e(){var t=r.call(this)||this;return t.decodeMiddleCounters=Int32Array.from([0,0,0,0]),t}return e.prototype.decodeMiddle=function(t,n,i){var a,o,s,l,u=this.decodeMiddleCounters;u[0]=0,u[1]=0,u[2]=0,u[3]=0;for(var c=t.getSize(),f=n[1],p=0,h=0;h<6&&f<c;h++){var g=ge.decodeDigit(t,u,f,ge.L_AND_G_PATTERNS);i+=String.fromCharCode(48+g%10);try{for(var x=(a=void 0,Ea(u)),C=x.next();!C.done;C=x.next()){var m=C.value;f+=m}}catch(O){a={error:O}}finally{try{C&&!C.done&&(o=x.return)&&o.call(x)}finally{if(a)throw a.error}}g>=10&&(p|=1<<5-h)}i=e.determineFirstDigit(i,p);var w=ge.findGuardPattern(t,f,!0,ge.MIDDLE_PATTERN,new Int32Array(ge.MIDDLE_PATTERN.length).fill(0));f=w[1];for(var h=0;h<6&&f<c;h++){var g=ge.decodeDigit(t,u,f,ge.L_PATTERNS);i+=String.fromCharCode(48+g);try{for(var _=(s=void 0,Ea(u)),E=_.next();!E.done;E=_.next()){var m=E.value;f+=m}}catch(D){s={error:D}}finally{try{E&&!E.done&&(l=_.return)&&l.call(_)}finally{if(s)throw s.error}}}return{rowOffset:f,resultString:i}},e.prototype.getBarcodeFormat=function(){return B.EAN_13},e.determineFirstDigit=function(t,n){for(var i=0;i<10;i++)if(n===this.FIRST_DIGIT_ENCODINGS[i])return t=String.fromCharCode(48+i)+t,t;throw new N},e.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26],e}(ge),su=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ia=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Sa=function(r){su(e,r);function e(){var t=r.call(this)||this;return t.decodeMiddleCounters=Int32Array.from([0,0,0,0]),t}return e.prototype.decodeMiddle=function(t,n,i){var a,o,s,l,u=this.decodeMiddleCounters;u[0]=0,u[1]=0,u[2]=0,u[3]=0;for(var c=t.getSize(),f=n[1],p=0;p<4&&f<c;p++){var h=ge.decodeDigit(t,u,f,ge.L_PATTERNS);i+=String.fromCharCode(48+h);try{for(var g=(a=void 0,Ia(u)),x=g.next();!x.done;x=g.next()){var C=x.value;f+=C}}catch(E){a={error:E}}finally{try{x&&!x.done&&(o=g.return)&&o.call(g)}finally{if(a)throw a.error}}}var m=ge.findGuardPattern(t,f,!0,ge.MIDDLE_PATTERN,new Int32Array(ge.MIDDLE_PATTERN.length).fill(0));f=m[1];for(var p=0;p<4&&f<c;p++){var h=ge.decodeDigit(t,u,f,ge.L_PATTERNS);i+=String.fromCharCode(48+h);try{for(var w=(s=void 0,Ia(u)),_=w.next();!_.done;_=w.next()){var C=_.value;f+=C}}catch(T){s={error:T}}finally{try{_&&!_.done&&(l=w.return)&&l.call(w)}finally{if(s)throw s.error}}}return{rowOffset:f,resultString:i}},e.prototype.getBarcodeFormat=function(){return B.EAN_8},e}(ge),lu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Oa=function(r){lu(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.ean13Reader=new ri,t}return e.prototype.getBarcodeFormat=function(){return B.UPC_A},e.prototype.decode=function(t,n){return this.maybeReturnResult(this.ean13Reader.decode(t))},e.prototype.decodeRow=function(t,n,i){return this.maybeReturnResult(this.ean13Reader.decodeRow(t,n,i))},e.prototype.decodeMiddle=function(t,n,i){return this.ean13Reader.decodeMiddle(t,n,i)},e.prototype.maybeReturnResult=function(t){var n=t.getText();if(n.charAt(0)==="0"){var i=new Ne(n.substring(1),null,null,t.getResultPoints(),B.UPC_A);return t.getResultMetadata()!=null&&i.putAllMetadata(t.getResultMetadata()),i}else throw new N},e.prototype.reset=function(){this.ean13Reader.reset()},e}(ge),uu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),cu=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ba=function(r){uu(e,r);function e(){var t=r.call(this)||this;return t.decodeMiddleCounters=new Int32Array(4),t}return e.prototype.decodeMiddle=function(t,n,i){var a,o,s=this.decodeMiddleCounters.map(function(C){return C});s[0]=0,s[1]=0,s[2]=0,s[3]=0;for(var l=t.getSize(),u=n[1],c=0,f=0;f<6&&u<l;f++){var p=e.decodeDigit(t,s,u,e.L_AND_G_PATTERNS);i+=String.fromCharCode(48+p%10);try{for(var h=(a=void 0,cu(s)),g=h.next();!g.done;g=h.next()){var x=g.value;u+=x}}catch(C){a={error:C}}finally{try{g&&!g.done&&(o=h.return)&&o.call(h)}finally{if(a)throw a.error}}p>=10&&(c|=1<<5-f)}return e.determineNumSysAndCheckDigit(new q(i),c),u},e.prototype.decodeEnd=function(t,n){return e.findGuardPatternWithoutCounters(t,n,!0,e.MIDDLE_END_PATTERN)},e.prototype.checkChecksum=function(t){return ge.checkChecksum(e.convertUPCEtoUPCA(t))},e.determineNumSysAndCheckDigit=function(t,n){for(var i=0;i<=1;i++)for(var a=0;a<10;a++)if(n===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[i][a]){t.insert(0,"0"+i),t.append("0"+a);return}throw N.getNotFoundInstance()},e.prototype.getBarcodeFormat=function(){return B.UPC_E},e.convertUPCEtoUPCA=function(t){var n=t.slice(1,7).split("").map(function(o){return o.charCodeAt(0)}),i=new q;i.append(t.charAt(0));var a=n[5];switch(a){case 0:case 1:case 2:i.appendChars(n,0,2),i.append(a),i.append("0000"),i.appendChars(n,2,3);break;case 3:i.appendChars(n,0,3),i.append("00000"),i.appendChars(n,3,2);break;case 4:i.appendChars(n,0,4),i.append("00000"),i.append(n[4]);break;default:i.appendChars(n,0,5),i.append("0000"),i.append(a);break}return t.length>=8&&i.append(t.charAt(7)),i.toString()},e.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),e.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,1])],e}(ge),fu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Na=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ni=function(r){fu(e,r);function e(t){var n=r.call(this)||this,i=t==null?null:t.get(ce.POSSIBLE_FORMATS),a=[];return i!=null&&(i.indexOf(B.EAN_13)>-1&&a.push(new ri),i.indexOf(B.UPC_A)>-1&&a.push(new Oa),i.indexOf(B.EAN_8)>-1&&a.push(new Sa),i.indexOf(B.UPC_E)>-1&&a.push(new ba)),a.length===0&&(a.push(new ri),a.push(new Oa),a.push(new Sa),a.push(new ba)),n.readers=a,n}return e.prototype.decodeRow=function(t,n,i){var a,o;try{for(var s=Na(this.readers),l=s.next();!l.done;l=s.next()){var u=l.value;try{var c=u.decodeRow(t,n,i),f=c.getBarcodeFormat()===B.EAN_13&&c.getText().charAt(0)==="0",p=i==null?null:i.get(ce.POSSIBLE_FORMATS),h=p==null||p.includes(B.UPC_A);if(f&&h){var g=c.getRawBytes(),x=new Ne(c.getText().substring(1),g,g?g.length:null,c.getResultPoints(),B.UPC_A);return x.putAllMetadata(c.getResultMetadata()),x}return c}catch{}}}catch(C){a={error:C}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(a)throw a.error}}throw new N},e.prototype.reset=function(){var t,n;try{for(var i=Na(this.readers),a=i.next();!a.done;a=i.next()){var o=a.value;o.reset()}}catch(s){t={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},e}(ve),du=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),hu=function(r){du(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.CODA_BAR_CHAR_SET={nnnnnww:"0",nnnnwwn:"1",nnnwnnw:"2",wwnnnnn:"3",nnwnnwn:"4",wnnnnwn:"5",nwnnnnw:"6",nwnnwnn:"7",nwwnnnn:"8",wnnwnnn:"9",nnnwwnn:"-",nnwwnnn:"$",wnnnwnw:":",wnwnnnw:"/",wnwnwnn:".",nnwwwww:"+",nnwwnwn:"A",nwnwnnw:"B",nnnwnww:"C",nnnwwwn:"D"},t}return e.prototype.decodeRow=function(t,n,i){var a=this.getValidRowData(n);if(!a)throw new N;var o=this.codaBarDecodeRow(a.row);if(!o)throw new N;return new Ne(o,null,0,[new z(a.left,t),new z(a.right,t)],B.CODABAR,new Date().getTime())},e.prototype.getValidRowData=function(t){var n=t.toArray(),i=n.indexOf(!0);if(i===-1)return null;var a=n.lastIndexOf(!0);if(a<=i)return null;n=n.slice(i,a+1);for(var o=[],s=n[0],l=1,u=1;u<n.length;u++)n[u]===s?l++:(s=n[u],o.push(l),l=1);return o.push(l),o.length<23&&(o.length+1)%8!==0?null:{row:o,left:i,right:a}},e.prototype.codaBarDecodeRow=function(t){for(var n=[],i=Math.ceil(t.reduce(function(l,u){return(l+u)/2},0));t.length>0;){var a=t.splice(0,8).splice(0,7),o=a.map(function(l){return l<i?"n":"w"}).join("");if(this.CODA_BAR_CHAR_SET[o]===void 0)return null;n.push(this.CODA_BAR_CHAR_SET[o])}var s=n.join("");return this.validCodaBarString(s)?s:null},e.prototype.validCodaBarString=function(t){var n=/^[A-D].{1,}[A-D]$/;return n.test(t)},e}(ve),pu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),vu=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},gt=function(r){pu(e,r);function e(){var t=r.call(this)||this;return t.decodeFinderCounters=new Int32Array(4),t.dataCharacterCounters=new Int32Array(8),t.oddRoundingErrors=new Array(4),t.evenRoundingErrors=new Array(4),t.oddCounts=new Array(t.dataCharacterCounters.length/2),t.evenCounts=new Array(t.dataCharacterCounters.length/2),t}return e.prototype.getDecodeFinderCounters=function(){return this.decodeFinderCounters},e.prototype.getDataCharacterCounters=function(){return this.dataCharacterCounters},e.prototype.getOddRoundingErrors=function(){return this.oddRoundingErrors},e.prototype.getEvenRoundingErrors=function(){return this.evenRoundingErrors},e.prototype.getOddCounts=function(){return this.oddCounts},e.prototype.getEvenCounts=function(){return this.evenCounts},e.prototype.parseFinderValue=function(t,n){for(var i=0;i<n.length;i++)if(ve.patternMatchVariance(t,n[i],e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return i;throw new N},e.count=function(t){return Q.sum(new Int32Array(t))},e.increment=function(t,n){for(var i=0,a=n[0],o=1;o<t.length;o++)n[o]>a&&(a=n[o],i=o);t[i]++},e.decrement=function(t,n){for(var i=0,a=n[0],o=1;o<t.length;o++)n[o]<a&&(a=n[o],i=o);t[i]--},e.isFinderPattern=function(t){var n,i,a=t[0]+t[1],o=a+t[2]+t[3],s=a/o;if(s>=e.MIN_FINDER_PATTERN_RATIO&&s<=e.MAX_FINDER_PATTERN_RATIO){var l=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER;try{for(var c=vu(t),f=c.next();!f.done;f=c.next()){var p=f.value;p>u&&(u=p),p<l&&(l=p)}}catch(h){n={error:h}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}return u<10*l}return!1},e.MAX_AVG_VARIANCE=.2,e.MAX_INDIVIDUAL_VARIANCE=.45,e.MIN_FINDER_PATTERN_RATIO=9.5/12,e.MAX_FINDER_PATTERN_RATIO=12.5/14,e}(ve),Qr=function(){function r(e,t){this.value=e,this.checksumPortion=t}return r.prototype.getValue=function(){return this.value},r.prototype.getChecksumPortion=function(){return this.checksumPortion},r.prototype.toString=function(){return this.value+"("+this.checksumPortion+")"},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion},r.prototype.hashCode=function(){return this.value^this.checksumPortion},r}(),Ta=function(){function r(e,t,n,i,a){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new z(n,a)),this.resultPoints.push(new z(i,a))}return r.prototype.getValue=function(){return this.value},r.prototype.getStartEnd=function(){return this.startEnd},r.prototype.getResultPoints=function(){return this.resultPoints},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value},r.prototype.hashCode=function(){return this.value},r}(),gu=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Rt=function(){function r(){}return r.getRSSvalue=function(e,t,n){var i,a,o=0;try{for(var s=gu(e),l=s.next();!l.done;l=s.next()){var u=l.value;o+=u}}catch(w){i={error:w}}finally{try{l&&!l.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}for(var c=0,f=0,p=e.length,h=0;h<p-1;h++){var g=void 0;for(g=1,f|=1<<h;g<e[h];g++,f&=~(1<<h)){var x=r.combins(o-g-1,p-h-2);if(n&&f===0&&o-g-(p-h-1)>=p-h-1&&(x-=r.combins(o-g-(p-h),p-h-2)),p-h-1>1){for(var C=0,m=o-g-(p-h-2);m>t;m--)C+=r.combins(o-g-m-1,p-h-3);x-=C*(p-1-h)}else o-g>t&&x--;c+=x}o-=g}return c},r.combins=function(e,t){var n,i;e-t>t?(i=t,n=e-t):(i=e-t,n=t);for(var a=1,o=1,s=e;s>n;s--)a*=s,o<=i&&(a/=o,o++);for(;o<=i;)a/=o,o++;return a},r}(),xu=function(){function r(){}return r.buildBitArray=function(e){var t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);for(var n=12*t,i=new we(n),a=0,o=e[0],s=o.getRightChar().getValue(),l=11;l>=0;--l)(s&1<<l)!==0&&i.set(a),a++;for(var l=1;l<e.length;++l){for(var u=e[l],c=u.getLeftChar().getValue(),f=11;f>=0;--f)(c&1<<f)!==0&&i.set(a),a++;if(u.getRightChar()!==null)for(var p=u.getRightChar().getValue(),f=11;f>=0;--f)(p&1<<f)!==0&&i.set(a),a++}return i},r}(),xt=function(){function r(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}return r.prototype.getDecodedInformation=function(){return this.decodedInformation},r.prototype.isFinished=function(){return this.finished},r}(),ii=function(){function r(e){this.newPosition=e}return r.prototype.getNewPosition=function(){return this.newPosition},r}(),yu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ke=function(r){yu(e,r);function e(t,n){var i=r.call(this,t)||this;return i.value=n,i}return e.prototype.getValue=function(){return this.value},e.prototype.isFNC1=function(){return this.value===e.FNC1},e.FNC1="$",e}(ii),Cu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),yt=function(r){Cu(e,r);function e(t,n,i){var a=r.call(this,t)||this;return i?(a.remaining=!0,a.remainingValue=a.remainingValue):(a.remaining=!1,a.remainingValue=0),a.newString=n,a}return e.prototype.getNewString=function(){return this.newString},e.prototype.isRemaining=function(){return this.remaining},e.prototype.getRemainingValue=function(){return this.remainingValue},e}(ii),wu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ut=function(r){wu(e,r);function e(t,n,i){var a=r.call(this,t)||this;if(n<0||n>10||i<0||i>10)throw new F;return a.firstDigit=n,a.secondDigit=i,a}return e.prototype.getFirstDigit=function(){return this.firstDigit},e.prototype.getSecondDigit=function(){return this.secondDigit},e.prototype.getValue=function(){return this.firstDigit*10+this.secondDigit},e.prototype.isFirstDigitFNC1=function(){return this.firstDigit===e.FNC1},e.prototype.isSecondDigitFNC1=function(){return this.secondDigit===e.FNC1},e.prototype.isAnyFNC1=function(){return this.firstDigit===e.FNC1||this.secondDigit===e.FNC1},e.FNC1=10,e}(ii),Jr=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},mu=function(){function r(){}return r.parseFieldsInGeneralPurpose=function(e){var t,n,i,a,o,s,l,u;if(!e)return null;if(e.length<2)throw new N;var c=e.substring(0,2);try{for(var f=Jr(r.TWO_DIGIT_DATA_LENGTH),p=f.next();!p.done;p=f.next()){var h=p.value;if(h[0]===c)return h[1]===r.VARIABLE_LENGTH?r.processVariableAI(2,h[2],e):r.processFixedAI(2,h[1],e)}}catch(T){t={error:T}}finally{try{p&&!p.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}if(e.length<3)throw new N;var g=e.substring(0,3);try{for(var x=Jr(r.THREE_DIGIT_DATA_LENGTH),C=x.next();!C.done;C=x.next()){var h=C.value;if(h[0]===g)return h[1]===r.VARIABLE_LENGTH?r.processVariableAI(3,h[2],e):r.processFixedAI(3,h[1],e)}}catch(T){i={error:T}}finally{try{C&&!C.done&&(a=x.return)&&a.call(x)}finally{if(i)throw i.error}}try{for(var m=Jr(r.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH),w=m.next();!w.done;w=m.next()){var h=w.value;if(h[0]===g)return h[1]===r.VARIABLE_LENGTH?r.processVariableAI(4,h[2],e):r.processFixedAI(4,h[1],e)}}catch(T){o={error:T}}finally{try{w&&!w.done&&(s=m.return)&&s.call(m)}finally{if(o)throw o.error}}if(e.length<4)throw new N;var _=e.substring(0,4);try{for(var E=Jr(r.FOUR_DIGIT_DATA_LENGTH),O=E.next();!O.done;O=E.next()){var h=O.value;if(h[0]===_)return h[1]===r.VARIABLE_LENGTH?r.processVariableAI(4,h[2],e):r.processFixedAI(4,h[1],e)}}catch(T){l={error:T}}finally{try{O&&!O.done&&(u=E.return)&&u.call(E)}finally{if(l)throw l.error}}throw new N},r.processFixedAI=function(e,t,n){if(n.length<e)throw new N;var i=n.substring(0,e);if(n.length<e+t)throw new N;var a=n.substring(e,e+t),o=n.substring(e+t),s="("+i+")"+a,l=r.parseFieldsInGeneralPurpose(o);return l==null?s:s+l},r.processVariableAI=function(e,t,n){var i=n.substring(0,e),a;n.length<e+t?a=n.length:a=e+t;var o=n.substring(e,a),s=n.substring(a),l="("+i+")"+o,u=r.parseFieldsInGeneralPurpose(s);return u==null?l:l+u},r.VARIABLE_LENGTH=[],r.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",r.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",r.VARIABLE_LENGTH,20],["22",r.VARIABLE_LENGTH,29],["30",r.VARIABLE_LENGTH,8],["37",r.VARIABLE_LENGTH,8],["90",r.VARIABLE_LENGTH,30],["91",r.VARIABLE_LENGTH,30],["92",r.VARIABLE_LENGTH,30],["93",r.VARIABLE_LENGTH,30],["94",r.VARIABLE_LENGTH,30],["95",r.VARIABLE_LENGTH,30],["96",r.VARIABLE_LENGTH,30],["97",r.VARIABLE_LENGTH,3],["98",r.VARIABLE_LENGTH,30],["99",r.VARIABLE_LENGTH,30]],r.THREE_DIGIT_DATA_LENGTH=[["240",r.VARIABLE_LENGTH,30],["241",r.VARIABLE_LENGTH,30],["242",r.VARIABLE_LENGTH,6],["250",r.VARIABLE_LENGTH,30],["251",r.VARIABLE_LENGTH,30],["253",r.VARIABLE_LENGTH,17],["254",r.VARIABLE_LENGTH,20],["400",r.VARIABLE_LENGTH,30],["401",r.VARIABLE_LENGTH,30],["402",17],["403",r.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",r.VARIABLE_LENGTH,20],["421",r.VARIABLE_LENGTH,15],["422",3],["423",r.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],r.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",r.VARIABLE_LENGTH,15],["391",r.VARIABLE_LENGTH,18],["392",r.VARIABLE_LENGTH,15],["393",r.VARIABLE_LENGTH,18],["703",r.VARIABLE_LENGTH,30]],r.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",r.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",r.VARIABLE_LENGTH,20],["8003",r.VARIABLE_LENGTH,30],["8004",r.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",r.VARIABLE_LENGTH,30],["8008",r.VARIABLE_LENGTH,12],["8018",18],["8020",r.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",r.VARIABLE_LENGTH,70],["8200",r.VARIABLE_LENGTH,70]],r}(),en=function(){function r(e){this.buffer=new q,this.information=e}return r.prototype.decodeAllCodes=function(e,t){var n=t,i=null;do{var a=this.decodeGeneralPurposeField(n,i),o=mu.parseFieldsInGeneralPurpose(a.getNewString());if(o!=null&&e.append(o),a.isRemaining()?i=""+a.getRemainingValue():i=null,n===a.getNewPosition())break;n=a.getNewPosition()}while(!0);return e.toString()},r.prototype.isStillNumeric=function(e){if(e+7>this.information.getSize())return e+4<=this.information.getSize();for(var t=e;t<e+3;++t)if(this.information.get(t))return!0;return this.information.get(e+3)},r.prototype.decodeNumeric=function(e){if(e+7>this.information.getSize()){var t=this.extractNumericValueFromBitArray(e,4);return t===0?new Ut(this.information.getSize(),Ut.FNC1,Ut.FNC1):new Ut(this.information.getSize(),t-1,Ut.FNC1)}var n=this.extractNumericValueFromBitArray(e,7),i=(n-8)/11,a=(n-8)%11;return new Ut(e+7,i,a)},r.prototype.extractNumericValueFromBitArray=function(e,t){return r.extractNumericValueFromBitArray(this.information,e,t)},r.extractNumericValueFromBitArray=function(e,t,n){for(var i=0,a=0;a<n;++a)e.get(t+a)&&(i|=1<<n-a-1);return i},r.prototype.decodeGeneralPurposeField=function(e,t){this.buffer.setLengthToZero(),t!=null&&this.buffer.append(t),this.current.setPosition(e);var n=this.parseBlocks();return n!=null&&n.isRemaining()?new yt(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new yt(this.current.getPosition(),this.buffer.toString())},r.prototype.parseBlocks=function(){var e,t;do{var n=this.current.getPosition();this.current.isAlpha()?(t=this.parseAlphaBlock(),e=t.isFinished()):this.current.isIsoIec646()?(t=this.parseIsoIec646Block(),e=t.isFinished()):(t=this.parseNumericBlock(),e=t.isFinished());var i=n!==this.current.getPosition();if(!i&&!e)break}while(!e);return t.getDecodedInformation()},r.prototype.parseNumericBlock=function(){for(;this.isStillNumeric(this.current.getPosition());){var e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1()){var t=void 0;return e.isSecondDigitFNC1()?t=new yt(this.current.getPosition(),this.buffer.toString()):t=new yt(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new xt(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){var t=new yt(this.current.getPosition(),this.buffer.toString());return new xt(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new xt(!1)},r.prototype.parseIsoIec646Block=function(){for(;this.isStillIsoIec646(this.current.getPosition());){var e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){var t=new yt(this.current.getPosition(),this.buffer.toString());return new xt(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new xt(!1)},r.prototype.parseAlphaBlock=function(){for(;this.isStillAlpha(this.current.getPosition());){var e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){var t=new yt(this.current.getPosition(),this.buffer.toString());return new xt(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new xt(!1)},r.prototype.isStillIsoIec646=function(e){if(e+5>this.information.getSize())return!1;var t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;var n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<116)return!0;if(e+8>this.information.getSize())return!1;var i=this.extractNumericValueFromBitArray(e,8);return i>=232&&i<253},r.prototype.decodeIsoIec646=function(e){var t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Ke(e+5,Ke.FNC1);if(t>=5&&t<15)return new Ke(e+5,"0"+(t-5));var n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new Ke(e+7,""+(n+1));if(n>=90&&n<116)return new Ke(e+7,""+(n+7));var i=this.extractNumericValueFromBitArray(e,8),a;switch(i){case 232:a="!";break;case 233:a='"';break;case 234:a="%";break;case 235:a="&";break;case 236:a="'";break;case 237:a="(";break;case 238:a=")";break;case 239:a="*";break;case 240:a="+";break;case 241:a=",";break;case 242:a="-";break;case 243:a=".";break;case 244:a="/";break;case 245:a=":";break;case 246:a=";";break;case 247:a="<";break;case 248:a="=";break;case 249:a=">";break;case 250:a="?";break;case 251:a="_";break;case 252:a=" ";break;default:throw new F}return new Ke(e+8,a)},r.prototype.isStillAlpha=function(e){if(e+5>this.information.getSize())return!1;var t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;var n=this.extractNumericValueFromBitArray(e,6);return n>=16&&n<63},r.prototype.decodeAlphanumeric=function(e){var t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Ke(e+5,Ke.FNC1);if(t>=5&&t<15)return new Ke(e+5,"0"+(t-5));var n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new Ke(e+6,""+(n+33));var i;switch(n){case 58:i="*";break;case 59:i=",";break;case 60:i="-";break;case 61:i=".";break;case 62:i="/";break;default:throw new hr("Decoding invalid alphanumeric value: "+n)}return new Ke(e+6,i)},r.prototype.isAlphaTo646ToAlphaLatch=function(e){if(e+1>this.information.getSize())return!1;for(var t=0;t<5&&t+e<this.information.getSize();++t)if(t===2){if(!this.information.get(e+2))return!1}else if(this.information.get(e+t))return!1;return!0},r.prototype.isAlphaOr646ToNumericLatch=function(e){if(e+3>this.information.getSize())return!1;for(var t=e;t<e+3;++t)if(this.information.get(t))return!1;return!0},r.prototype.isNumericToAlphaNumericLatch=function(e){if(e+1>this.information.getSize())return!1;for(var t=0;t<4&&t+e<this.information.getSize();++t)if(this.information.get(e+t))return!1;return!0},r}(),Da=function(){function r(e){this.information=e,this.generalDecoder=new en(e)}return r.prototype.getInformation=function(){return this.information},r.prototype.getGeneralDecoder=function(){return this.generalDecoder},r}(),_u=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Qe=function(r){_u(e,r);function e(t){return r.call(this,t)||this}return e.prototype.encodeCompressedGtin=function(t,n){t.append("(01)");var i=t.length();t.append("9"),this.encodeCompressedGtinWithoutAI(t,n,i)},e.prototype.encodeCompressedGtinWithoutAI=function(t,n,i){for(var a=0;a<4;++a){var o=this.getGeneralDecoder().extractNumericValueFromBitArray(n+10*a,10);o/100===0&&t.append("0"),o/10===0&&t.append("0"),t.append(o)}e.appendCheckDigit(t,i)},e.appendCheckDigit=function(t,n){for(var i=0,a=0;a<13;a++){var o=t.charAt(a+n).charCodeAt(0)-48;i+=(a&1)===0?3*o:o}i=10-i%10,i===10&&(i=0),t.append(i)},e.GTIN_SIZE=40,e}(Da),Au=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Eu=function(r){Au(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){var t=new q;t.append("(01)");var n=t.length(),i=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE,4);return t.append(i),this.encodeCompressedGtinWithoutAI(t,e.HEADER_SIZE+4,n),this.getGeneralDecoder().decodeAllCodes(t,e.HEADER_SIZE+44)},e.HEADER_SIZE=4,e}(Qe),Iu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Su=function(r){Iu(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){var t=new q;return this.getGeneralDecoder().decodeAllCodes(t,e.HEADER_SIZE)},e.HEADER_SIZE=5,e}(Da),Ou=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),tn=function(r){Ou(e,r);function e(t){return r.call(this,t)||this}return e.prototype.encodeCompressedWeight=function(t,n,i){var a=this.getGeneralDecoder().extractNumericValueFromBitArray(n,i);this.addWeightCode(t,a);for(var o=this.checkWeight(a),s=1e5,l=0;l<5;++l)o/s===0&&t.append("0"),s/=10;t.append(o)},e}(Qe),bu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ma=function(r){bu(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()!==e.HEADER_SIZE+tn.GTIN_SIZE+e.WEIGHT_SIZE)throw new N;var t=new q;return this.encodeCompressedGtin(t,e.HEADER_SIZE),this.encodeCompressedWeight(t,e.HEADER_SIZE+tn.GTIN_SIZE,e.WEIGHT_SIZE),t.toString()},e.HEADER_SIZE=5,e.WEIGHT_SIZE=15,e}(tn),Nu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Tu=function(r){Nu(e,r);function e(t){return r.call(this,t)||this}return e.prototype.addWeightCode=function(t,n){t.append("(3103)")},e.prototype.checkWeight=function(t){return t},e}(Ma),Du=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Mu=function(r){Du(e,r);function e(t){return r.call(this,t)||this}return e.prototype.addWeightCode=function(t,n){n<1e4?t.append("(3202)"):t.append("(3203)")},e.prototype.checkWeight=function(t){return t<1e4?t:t-1e4},e}(Ma),Pu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Fu=function(r){Pu(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()<e.HEADER_SIZE+Qe.GTIN_SIZE)throw new N;var t=new q;this.encodeCompressedGtin(t,e.HEADER_SIZE);var n=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE+Qe.GTIN_SIZE,e.LAST_DIGIT_SIZE);t.append("(392"),t.append(n),t.append(")");var i=this.getGeneralDecoder().decodeGeneralPurposeField(e.HEADER_SIZE+Qe.GTIN_SIZE+e.LAST_DIGIT_SIZE,null);return t.append(i.getNewString()),t.toString()},e.HEADER_SIZE=8,e.LAST_DIGIT_SIZE=2,e}(Qe),Vu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Bu=function(r){Vu(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()<e.HEADER_SIZE+Qe.GTIN_SIZE)throw new N;var t=new q;this.encodeCompressedGtin(t,e.HEADER_SIZE);var n=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE+Qe.GTIN_SIZE,e.LAST_DIGIT_SIZE);t.append("(393"),t.append(n),t.append(")");var i=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE+Qe.GTIN_SIZE+e.LAST_DIGIT_SIZE,e.FIRST_THREE_DIGITS_SIZE);i/100===0&&t.append("0"),i/10===0&&t.append("0"),t.append(i);var a=this.getGeneralDecoder().decodeGeneralPurposeField(e.HEADER_SIZE+Qe.GTIN_SIZE+e.LAST_DIGIT_SIZE+e.FIRST_THREE_DIGITS_SIZE,null);return t.append(a.getNewString()),t.toString()},e.HEADER_SIZE=8,e.LAST_DIGIT_SIZE=2,e.FIRST_THREE_DIGITS_SIZE=10,e}(Qe),Lu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),st=function(r){Lu(e,r);function e(t,n,i){var a=r.call(this,t)||this;return a.dateCode=i,a.firstAIdigits=n,a}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()!==e.HEADER_SIZE+e.GTIN_SIZE+e.WEIGHT_SIZE+e.DATE_SIZE)throw new N;var t=new q;return this.encodeCompressedGtin(t,e.HEADER_SIZE),this.encodeCompressedWeight(t,e.HEADER_SIZE+e.GTIN_SIZE,e.WEIGHT_SIZE),this.encodeCompressedDate(t,e.HEADER_SIZE+e.GTIN_SIZE+e.WEIGHT_SIZE),t.toString()},e.prototype.encodeCompressedDate=function(t,n){var i=this.getGeneralDecoder().extractNumericValueFromBitArray(n,e.DATE_SIZE);if(i!==38400){t.append("("),t.append(this.dateCode),t.append(")");var a=i%32;i/=32;var o=i%12+1;i/=12;var s=i;s/10===0&&t.append("0"),t.append(s),o/10===0&&t.append("0"),t.append(o),a/10===0&&t.append("0"),t.append(a)}},e.prototype.addWeightCode=function(t,n){t.append("("),t.append(this.firstAIdigits),t.append(n/1e5),t.append(")")},e.prototype.checkWeight=function(t){return t%1e5},e.HEADER_SIZE=8,e.WEIGHT_SIZE=20,e.DATE_SIZE=16,e}(tn);function zu(r){try{if(r.get(1))return new Eu(r);if(!r.get(2))return new Su(r);var e=en.extractNumericValueFromBitArray(r,1,4);switch(e){case 4:return new Tu(r);case 5:return new Mu(r)}var t=en.extractNumericValueFromBitArray(r,1,5);switch(t){case 12:return new Fu(r);case 13:return new Bu(r)}var n=en.extractNumericValueFromBitArray(r,1,7);switch(n){case 56:return new st(r,"310","11");case 57:return new st(r,"320","11");case 58:return new st(r,"310","13");case 59:return new st(r,"320","13");case 60:return new st(r,"310","15");case 61:return new st(r,"320","15");case 62:return new st(r,"310","17");case 63:return new st(r,"320","17")}}catch(i){throw console.log(i),new hr("unknown decoder: "+r)}}var Pa=function(){function r(e,t,n,i){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=i}return r.prototype.mayBeLast=function(){return this.maybeLast},r.prototype.getLeftChar=function(){return this.leftchar},r.prototype.getRightChar=function(){return this.rightchar},r.prototype.getFinderPattern=function(){return this.finderpattern},r.prototype.mustBeLast=function(){return this.rightchar==null},r.prototype.toString=function(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"},r.equals=function(e,t){return e instanceof r?r.equalsOrNull(e.leftchar,t.leftchar)&&r.equalsOrNull(e.rightchar,t.rightchar)&&r.equalsOrNull(e.finderpattern,t.finderpattern):!1},r.equalsOrNull=function(e,t){return e===null?t===null:r.equals(e,t)},r.prototype.hashCode=function(){var e=this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue();return e},r}(),ku=function(){function r(e,t,n){this.pairs=e,this.rowNumber=t,this.wasReversed=n}return r.prototype.getPairs=function(){return this.pairs},r.prototype.getRowNumber=function(){return this.rowNumber},r.prototype.isReversed=function(){return this.wasReversed},r.prototype.isEquivalent=function(e){return this.checkEqualitity(this,e)},r.prototype.toString=function(){return"{ "+this.pairs+" }"},r.prototype.equals=function(e,t){return e instanceof r?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1},r.prototype.checkEqualitity=function(e,t){if(!(!e||!t)){var n;return e.forEach(function(i,a){t.forEach(function(o){i.getLeftChar().getValue()===o.getLeftChar().getValue()&&i.getRightChar().getValue()===o.getRightChar().getValue()&&i.getFinderPatter().getValue()===o.getFinderPatter().getValue()&&(n=!0)})}),n}},r}(),Ru=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),lt=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Uu=function(r){Ru(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.pairs=new Array(e.MAX_PAIRS),t.rows=new Array,t.startEnd=[2],t}return e.prototype.decodeRow=function(t,n,i){this.pairs.length=0,this.startFromEven=!1;try{return e.constructResult(this.decodeRow2pairs(t,n))}catch{}return this.pairs.length=0,this.startFromEven=!0,e.constructResult(this.decodeRow2pairs(t,n))},e.prototype.reset=function(){this.pairs.length=0,this.rows.length=0},e.prototype.decodeRow2pairs=function(t,n){for(var i=!1;!i;)try{this.pairs.push(this.retrieveNextPair(n,this.pairs,t))}catch(s){if(s instanceof N){if(!this.pairs.length)throw new N;i=!0}}if(this.checkChecksum())return this.pairs;var a;if(this.rows.length?a=!0:a=!1,this.storeRow(t,!1),a){var o=this.checkRowsBoolean(!1);if(o!=null||(o=this.checkRowsBoolean(!0),o!=null))return o}throw new N},e.prototype.checkRowsBoolean=function(t){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,t&&(this.rows=this.rows.reverse());var n=null;try{n=this.checkRows(new Array,0)}catch(i){console.log(i)}return t&&(this.rows=this.rows.reverse()),n},e.prototype.checkRows=function(t,n){for(var i,a,o=n;o<this.rows.length;o++){var s=this.rows[o];this.pairs.length=0;try{for(var l=(i=void 0,lt(t)),u=l.next();!u.done;u=l.next()){var c=u.value;this.pairs.push(c.getPairs())}}catch(p){i={error:p}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(i)throw i.error}}if(this.pairs.push(s.getPairs()),!!e.isValidSequence(this.pairs)){if(this.checkChecksum())return this.pairs;var f=new Array(t);f.push(s);try{return this.checkRows(f,o+1)}catch(p){console.log(p)}}}throw new N},e.isValidSequence=function(t){var n,i;try{for(var a=lt(e.FINDER_PATTERN_SEQUENCES),o=a.next();!o.done;o=a.next()){var s=o.value;if(!(t.length>s.length)){for(var l=!0,u=0;u<t.length;u++)if(t[u].getFinderPattern().getValue()!==s[u]){l=!1;break}if(l)return!0}}}catch(c){n={error:c}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return!1},e.prototype.storeRow=function(t,n){for(var i=0,a=!1,o=!1;i<this.rows.length;){var s=this.rows[i];if(s.getRowNumber()>t){o=s.isEquivalent(this.pairs);break}a=s.isEquivalent(this.pairs),i++}o||a||e.isPartialRow(this.pairs,this.rows)||(this.rows.push(i,new ku(this.pairs,t,n)),this.removePartialRows(this.pairs,this.rows))},e.prototype.removePartialRows=function(t,n){var i,a,o,s,l,u;try{for(var c=lt(n),f=c.next();!f.done;f=c.next()){var p=f.value;if(p.getPairs().length!==t.length){var h=!0;try{for(var g=(o=void 0,lt(p.getPairs())),x=g.next();!x.done;x=g.next()){var C=x.value,m=!1;try{for(var w=(l=void 0,lt(t)),_=w.next();!_.done;_=w.next()){var E=_.value;if(Pa.equals(C,E)){m=!0;break}}}catch(O){l={error:O}}finally{try{_&&!_.done&&(u=w.return)&&u.call(w)}finally{if(l)throw l.error}}m||(h=!1)}}catch(O){o={error:O}}finally{try{x&&!x.done&&(s=g.return)&&s.call(g)}finally{if(o)throw o.error}}}}}catch(O){i={error:O}}finally{try{f&&!f.done&&(a=c.return)&&a.call(c)}finally{if(i)throw i.error}}},e.isPartialRow=function(t,n){var i,a,o,s,l,u;try{for(var c=lt(n),f=c.next();!f.done;f=c.next()){var p=f.value,h=!0;try{for(var g=(o=void 0,lt(t)),x=g.next();!x.done;x=g.next()){var C=x.value,m=!1;try{for(var w=(l=void 0,lt(p.getPairs())),_=w.next();!_.done;_=w.next()){var E=_.value;if(C.equals(E)){m=!0;break}}}catch(O){l={error:O}}finally{try{_&&!_.done&&(u=w.return)&&u.call(w)}finally{if(l)throw l.error}}if(!m){h=!1;break}}}catch(O){o={error:O}}finally{try{x&&!x.done&&(s=g.return)&&s.call(g)}finally{if(o)throw o.error}}if(h)return!0}}catch(O){i={error:O}}finally{try{f&&!f.done&&(a=c.return)&&a.call(c)}finally{if(i)throw i.error}}return!1},e.prototype.getRows=function(){return this.rows},e.constructResult=function(t){var n=xu.buildBitArray(t),i=zu(n),a=i.parseInformation(),o=t[0].getFinderPattern().getResultPoints(),s=t[t.length-1].getFinderPattern().getResultPoints(),l=[o[0],o[1],s[0],s[1]];return new Ne(a,null,null,l,B.RSS_EXPANDED,null)},e.prototype.checkChecksum=function(){var t=this.pairs.get(0),n=t.getLeftChar(),i=t.getRightChar();if(i===null)return!1;for(var a=i.getChecksumPortion(),o=2,s=1;s<this.pairs.size();++s){var l=this.pairs.get(s);a+=l.getLeftChar().getChecksumPortion(),o++;var u=l.getRightChar();u!=null&&(a+=u.getChecksumPortion(),o++)}a%=211;var c=211*(o-4)+a;return c===n.getValue()},e.getNextSecondBar=function(t,n){var i;return t.get(n)?(i=t.getNextUnset(n),i=t.getNextSet(i)):(i=t.getNextSet(n),i=t.getNextUnset(i)),i},e.prototype.retrieveNextPair=function(t,n,i){var a=n.length%2===0;this.startFromEven&&(a=!a);var o,s=!0,l=-1;do this.findNextPair(t,n,l),o=this.parseFoundFinderPattern(t,i,a),o===null?l=e.getNextSecondBar(t,this.startEnd[0]):s=!1;while(s);var u=this.decodeDataCharacter(t,o,a,!0);if(!this.isEmptyPair(n)&&n[n.length-1].mustBeLast())throw new N;var c;try{c=this.decodeDataCharacter(t,o,a,!1)}catch(f){c=null,console.log(f)}return new Pa(u,c,o,!0)},e.prototype.isEmptyPair=function(t){return t.length===0},e.prototype.findNextPair=function(t,n,i){var a=this.getDecodeFinderCounters();a[0]=0,a[1]=0,a[2]=0,a[3]=0;var o=t.getSize(),s;if(i>=0)s=i;else if(this.isEmptyPair(n))s=0;else{var l=n[n.length-1];s=l.getFinderPattern().getStartEnd()[1]}var u=n.length%2!==0;this.startFromEven&&(u=!u);for(var c=!1;s<o&&(c=!t.get(s),!!c);)s++;for(var f=0,p=s,h=s;h<o;h++)if(t.get(h)!==c)a[f]++;else{if(f===3){if(u&&e.reverseCounters(a),e.isFinderPattern(a)){this.startEnd[0]=p,this.startEnd[1]=h;return}u&&e.reverseCounters(a),p+=a[0]+a[1],a[0]=a[2],a[1]=a[3],a[2]=0,a[3]=0,f--}else f++;a[f]=1,c=!c}throw new N},e.reverseCounters=function(t){for(var n=t.length,i=0;i<n/2;++i){var a=t[i];t[i]=t[n-i-1],t[n-i-1]=a}},e.prototype.parseFoundFinderPattern=function(t,n,i){var a,o,s;if(i){for(var l=this.startEnd[0]-1;l>=0&&!t.get(l);)l--;l++,a=this.startEnd[0]-l,o=l,s=this.startEnd[1]}else o=this.startEnd[0],s=t.getNextUnset(this.startEnd[1]+1),a=s-this.startEnd[1];var u=this.getDecodeFinderCounters();se.arraycopy(u,0,u,1,u.length-1),u[0]=a;var c;try{c=this.parseFinderValue(u,e.FINDER_PATTERNS)}catch{return null}return new Ta(c,[o,s],o,s,n)},e.prototype.decodeDataCharacter=function(t,n,i,a){for(var o=this.getDataCharacterCounters(),s=0;s<o.length;s++)o[s]=0;if(a)e.recordPatternInReverse(t,n.getStartEnd()[0],o);else{e.recordPattern(t,n.getStartEnd()[1],o);for(var l=0,u=o.length-1;l<u;l++,u--){var c=o[l];o[l]=o[u],o[u]=c}}var f=17,p=Q.sum(new Int32Array(o))/f,h=(n.getStartEnd()[1]-n.getStartEnd()[0])/15;if(Math.abs(p-h)/h>.3)throw new N;for(var g=this.getOddCounts(),x=this.getEvenCounts(),C=this.getOddRoundingErrors(),m=this.getEvenRoundingErrors(),l=0;l<o.length;l++){var w=1*o[l]/p,_=w+.5;if(_<1){if(w<.3)throw new N;_=1}else if(_>8){if(w>8.7)throw new N;_=8}var E=l/2;(l&1)===0?(g[E]=_,C[E]=w-_):(x[E]=_,m[E]=w-_)}this.adjustOddEvenCounts(f);for(var O=4*n.getValue()+(i?0:2)+(a?0:1)-1,T=0,D=0,l=g.length-1;l>=0;l--){if(e.isNotA1left(n,i,a)){var M=e.WEIGHTS[O][2*l];D+=g[l]*M}T+=g[l]}for(var P=0,l=x.length-1;l>=0;l--)if(e.isNotA1left(n,i,a)){var M=e.WEIGHTS[O][2*l+1];P+=x[l]*M}var V=D+P;if((T&1)!==0||T>13||T<4)throw new N;var W=(13-T)/2,U=e.SYMBOL_WIDEST[W],J=9-U,R=Rt.getRSSvalue(g,U,!0),Z=Rt.getRSSvalue(x,J,!1),H=e.EVEN_TOTAL_SUBSET[W],re=e.GSUM[W],Fe=R*H+Z+re;return new Qr(Fe,V)},e.isNotA1left=function(t,n,i){return!(t.getValue()===0&&n&&i)},e.prototype.adjustOddEvenCounts=function(t){var n=Q.sum(new Int32Array(this.getOddCounts())),i=Q.sum(new Int32Array(this.getEvenCounts())),a=!1,o=!1;n>13?o=!0:n<4&&(a=!0);var s=!1,l=!1;i>13?l=!0:i<4&&(s=!0);var u=n+i-t,c=(n&1)===1,f=(i&1)===0;if(u===1)if(c){if(f)throw new N;o=!0}else{if(!f)throw new N;l=!0}else if(u===-1)if(c){if(f)throw new N;a=!0}else{if(!f)throw new N;s=!0}else if(u===0){if(c){if(!f)throw new N;n<i?(a=!0,l=!0):(o=!0,s=!0)}else if(f)throw new N}else throw new N;if(a){if(o)throw new N;e.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(o&&e.decrement(this.getOddCounts(),this.getOddRoundingErrors()),s){if(l)throw new N;e.increment(this.getEvenCounts(),this.getOddRoundingErrors())}l&&e.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())},e.SYMBOL_WIDEST=[7,5,4,3,1],e.EVEN_TOTAL_SUBSET=[4,20,52,104,204],e.GSUM=[0,348,1388,2948,3988],e.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],e.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],e.FINDER_PAT_A=0,e.FINDER_PAT_B=1,e.FINDER_PAT_C=2,e.FINDER_PAT_D=3,e.FINDER_PAT_E=4,e.FINDER_PAT_F=5,e.FINDER_PATTERN_SEQUENCES=[[e.FINDER_PAT_A,e.FINDER_PAT_A],[e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B],[e.FINDER_PAT_A,e.FINDER_PAT_C,e.FINDER_PAT_B,e.FINDER_PAT_D],[e.FINDER_PAT_A,e.FINDER_PAT_E,e.FINDER_PAT_B,e.FINDER_PAT_D,e.FINDER_PAT_C],[e.FINDER_PAT_A,e.FINDER_PAT_E,e.FINDER_PAT_B,e.FINDER_PAT_D,e.FINDER_PAT_D,e.FINDER_PAT_F],[e.FINDER_PAT_A,e.FINDER_PAT_E,e.FINDER_PAT_B,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_F,e.FINDER_PAT_F],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_D],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_E],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_F,e.FINDER_PAT_F],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_E,e.FINDER_PAT_F,e.FINDER_PAT_F]],e.MAX_PAIRS=11,e}(gt),Hu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Gu=function(r){Hu(e,r);function e(t,n,i){var a=r.call(this,t,n)||this;return a.count=0,a.finderPattern=i,a}return e.prototype.getFinderPattern=function(){return this.finderPattern},e.prototype.getCount=function(){return this.count},e.prototype.incrementCount=function(){this.count++},e}(Qr),Xu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ai=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Fa=function(r){Xu(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.possibleLeftPairs=[],t.possibleRightPairs=[],t}return e.prototype.decodeRow=function(t,n,i){var a,o,s,l,u=this.decodePair(n,!1,t,i);e.addOrTally(this.possibleLeftPairs,u),n.reverse();var c=this.decodePair(n,!0,t,i);e.addOrTally(this.possibleRightPairs,c),n.reverse();try{for(var f=ai(this.possibleLeftPairs),p=f.next();!p.done;p=f.next()){var h=p.value;if(h.getCount()>1)try{for(var g=(s=void 0,ai(this.possibleRightPairs)),x=g.next();!x.done;x=g.next()){var C=x.value;if(C.getCount()>1&&e.checkChecksum(h,C))return e.constructResult(h,C)}}catch(m){s={error:m}}finally{try{x&&!x.done&&(l=g.return)&&l.call(g)}finally{if(s)throw s.error}}}}catch(m){a={error:m}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(a)throw a.error}}throw new N},e.addOrTally=function(t,n){var i,a;if(n!=null){var o=!1;try{for(var s=ai(t),l=s.next();!l.done;l=s.next()){var u=l.value;if(u.getValue()===n.getValue()){u.incrementCount(),o=!0;break}}}catch(c){i={error:c}}finally{try{l&&!l.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}o||t.push(n)}},e.prototype.reset=function(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0},e.constructResult=function(t,n){for(var i=4537077*t.getValue()+n.getValue(),a=new String(i).toString(),o=new q,s=13-a.length;s>0;s--)o.append("0");o.append(a);for(var l=0,s=0;s<13;s++){var u=o.charAt(s).charCodeAt(0)-48;l+=(s&1)===0?3*u:u}l=10-l%10,l===10&&(l=0),o.append(l.toString());var c=t.getFinderPattern().getResultPoints(),f=n.getFinderPattern().getResultPoints();return new Ne(o.toString(),null,0,[c[0],c[1],f[0],f[1]],B.RSS_14,new Date().getTime())},e.checkChecksum=function(t,n){var i=(t.getChecksumPortion()+16*n.getChecksumPortion())%79,a=9*t.getFinderPattern().getValue()+n.getFinderPattern().getValue();return a>72&&a--,a>8&&a--,i===a},e.prototype.decodePair=function(t,n,i,a){try{var o=this.findFinderPattern(t,n),s=this.parseFoundFinderPattern(t,i,n,o),l=a==null?null:a.get(ce.NEED_RESULT_POINT_CALLBACK);if(l!=null){var u=(o[0]+o[1])/2;n&&(u=t.getSize()-1-u),l.foundPossibleResultPoint(new z(u,i))}var c=this.decodeDataCharacter(t,s,!0),f=this.decodeDataCharacter(t,s,!1);return new Gu(1597*c.getValue()+f.getValue(),c.getChecksumPortion()+4*f.getChecksumPortion(),s)}catch{return null}},e.prototype.decodeDataCharacter=function(t,n,i){for(var a=this.getDataCharacterCounters(),o=0;o<a.length;o++)a[o]=0;if(i)ve.recordPatternInReverse(t,n.getStartEnd()[0],a);else{ve.recordPattern(t,n.getStartEnd()[1]+1,a);for(var s=0,l=a.length-1;s<l;s++,l--){var u=a[s];a[s]=a[l],a[l]=u}}for(var c=i?16:15,f=Q.sum(new Int32Array(a))/c,p=this.getOddCounts(),h=this.getEvenCounts(),g=this.getOddRoundingErrors(),x=this.getEvenRoundingErrors(),s=0;s<a.length;s++){var C=a[s]/f,m=Math.floor(C+.5);m<1?m=1:m>8&&(m=8);var w=Math.floor(s/2);(s&1)===0?(p[w]=m,g[w]=C-m):(h[w]=m,x[w]=C-m)}this.adjustOddEvenCounts(i,c);for(var _=0,E=0,s=p.length-1;s>=0;s--)E*=9,E+=p[s],_+=p[s];for(var O=0,T=0,s=h.length-1;s>=0;s--)O*=9,O+=h[s],T+=h[s];var D=E+3*O;if(i){if((_&1)!==0||_>12||_<4)throw new N;var M=(12-_)/2,P=e.OUTSIDE_ODD_WIDEST[M],V=9-P,W=Rt.getRSSvalue(p,P,!1),U=Rt.getRSSvalue(h,V,!0),J=e.OUTSIDE_EVEN_TOTAL_SUBSET[M],R=e.OUTSIDE_GSUM[M];return new Qr(W*J+U+R,D)}else{if((T&1)!==0||T>10||T<4)throw new N;var M=(10-T)/2,P=e.INSIDE_ODD_WIDEST[M],V=9-P,W=Rt.getRSSvalue(p,P,!0),U=Rt.getRSSvalue(h,V,!1),Z=e.INSIDE_ODD_TOTAL_SUBSET[M],R=e.INSIDE_GSUM[M];return new Qr(U*Z+W+R,D)}},e.prototype.findFinderPattern=function(t,n){var i=this.getDecodeFinderCounters();i[0]=0,i[1]=0,i[2]=0,i[3]=0;for(var a=t.getSize(),o=!1,s=0;s<a&&(o=!t.get(s),n!==o);)s++;for(var l=0,u=s,c=s;c<a;c++)if(t.get(c)!==o)i[l]++;else{if(l===3){if(gt.isFinderPattern(i))return[u,c];u+=i[0]+i[1],i[0]=i[2],i[1]=i[3],i[2]=0,i[3]=0,l--}else l++;i[l]=1,o=!o}throw new N},e.prototype.parseFoundFinderPattern=function(t,n,i,a){for(var o=t.get(a[0]),s=a[0]-1;s>=0&&o!==t.get(s);)s--;s++;var l=a[0]-s,u=this.getDecodeFinderCounters(),c=new Int32Array(u.length);se.arraycopy(u,0,c,1,u.length-1),c[0]=l;var f=this.parseFinderValue(c,e.FINDER_PATTERNS),p=s,h=a[1];return i&&(p=t.getSize()-1-p,h=t.getSize()-1-h),new Ta(f,[s,a[1]],p,h,n)},e.prototype.adjustOddEvenCounts=function(t,n){var i=Q.sum(new Int32Array(this.getOddCounts())),a=Q.sum(new Int32Array(this.getEvenCounts())),o=!1,s=!1,l=!1,u=!1;t?(i>12?s=!0:i<4&&(o=!0),a>12?u=!0:a<4&&(l=!0)):(i>11?s=!0:i<5&&(o=!0),a>10?u=!0:a<4&&(l=!0));var c=i+a-n,f=(i&1)===(t?1:0),p=(a&1)===1;if(c===1)if(f){if(p)throw new N;s=!0}else{if(!p)throw new N;u=!0}else if(c===-1)if(f){if(p)throw new N;o=!0}else{if(!p)throw new N;l=!0}else if(c===0){if(f){if(!p)throw new N;i<a?(o=!0,u=!0):(s=!0,l=!0)}else if(p)throw new N}else throw new N;if(o){if(s)throw new N;gt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(s&>.decrement(this.getOddCounts(),this.getOddRoundingErrors()),l){if(u)throw new N;gt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}u&>.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())},e.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],e.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],e.OUTSIDE_GSUM=[0,161,961,2015,2715],e.INSIDE_GSUM=[0,336,1036,1516],e.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],e.INSIDE_ODD_WIDEST=[2,4,6,8],e.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])],e}(gt),qu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),pr=function(r){qu(e,r);function e(t){var n=r.call(this)||this;n.readers=[];var i=t?t.get(ce.POSSIBLE_FORMATS):null,a=t&&t.get(ce.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;return i&&((i.includes(B.EAN_13)||i.includes(B.UPC_A)||i.includes(B.EAN_8)||i.includes(B.UPC_E))&&n.readers.push(new ni(t)),i.includes(B.CODE_39)&&n.readers.push(new ma(a)),i.includes(B.CODE_93)&&n.readers.push(new _a),i.includes(B.CODE_128)&&n.readers.push(new wa),i.includes(B.ITF)&&n.readers.push(new Aa),i.includes(B.CODABAR)&&n.readers.push(new hu),i.includes(B.RSS_14)&&n.readers.push(new Fa),i.includes(B.RSS_EXPANDED)&&(console.warn("RSS Expanded reader IS NOT ready for production yet! use at your own risk."),n.readers.push(new Uu))),n.readers.length===0&&(n.readers.push(new ni(t)),n.readers.push(new ma),n.readers.push(new _a),n.readers.push(new ni(t)),n.readers.push(new wa),n.readers.push(new Aa),n.readers.push(new Fa)),n}return e.prototype.decodeRow=function(t,n,i){for(var a=0;a<this.readers.length;a++)try{return this.readers[a].decodeRow(t,n,i)}catch{}throw new N},e.prototype.reset=function(){this.readers.forEach(function(t){return t.reset()})},e}(ve),$u=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){$u(e,r);function e(t,n){return t===void 0&&(t=500),r.call(this,new pr(n),t,n)||this}return e})(zt);var Va=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ne=function(){function r(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}return r.prototype.getECCodewords=function(){return this.ecCodewords},r.prototype.getECBlocks=function(){return this.ecBlocks},r}(),ee=function(){function r(e,t){this.count=e,this.dataCodewords=t}return r.prototype.getCount=function(){return this.count},r.prototype.getDataCodewords=function(){return this.dataCodewords},r}(),Wu=function(){function r(e,t,n,i,a,o){var s,l;this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=i,this.dataRegionSizeColumns=a,this.ecBlocks=o;var u=0,c=o.getECCodewords(),f=o.getECBlocks();try{for(var p=Va(f),h=p.next();!h.done;h=p.next()){var g=h.value;u+=g.getCount()*(g.getDataCodewords()+c)}}catch(x){s={error:x}}finally{try{h&&!h.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}this.totalCodewords=u}return r.prototype.getVersionNumber=function(){return this.versionNumber},r.prototype.getSymbolSizeRows=function(){return this.symbolSizeRows},r.prototype.getSymbolSizeColumns=function(){return this.symbolSizeColumns},r.prototype.getDataRegionSizeRows=function(){return this.dataRegionSizeRows},r.prototype.getDataRegionSizeColumns=function(){return this.dataRegionSizeColumns},r.prototype.getTotalCodewords=function(){return this.totalCodewords},r.prototype.getECBlocks=function(){return this.ecBlocks},r.getVersionForDimensions=function(e,t){var n,i;if((e&1)!==0||(t&1)!==0)throw new F;try{for(var a=Va(r.VERSIONS),o=a.next();!o.done;o=a.next()){var s=o.value;if(s.symbolSizeRows===e&&s.symbolSizeColumns===t)return s}}catch(l){n={error:l}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}throw new F},r.prototype.toString=function(){return""+this.versionNumber},r.buildVersions=function(){return[new r(1,10,10,8,8,new ne(5,new ee(1,3))),new r(2,12,12,10,10,new ne(7,new ee(1,5))),new r(3,14,14,12,12,new ne(10,new ee(1,8))),new r(4,16,16,14,14,new ne(12,new ee(1,12))),new r(5,18,18,16,16,new ne(14,new ee(1,18))),new r(6,20,20,18,18,new ne(18,new ee(1,22))),new r(7,22,22,20,20,new ne(20,new ee(1,30))),new r(8,24,24,22,22,new ne(24,new ee(1,36))),new r(9,26,26,24,24,new ne(28,new ee(1,44))),new r(10,32,32,14,14,new ne(36,new ee(1,62))),new r(11,36,36,16,16,new ne(42,new ee(1,86))),new r(12,40,40,18,18,new ne(48,new ee(1,114))),new r(13,44,44,20,20,new ne(56,new ee(1,144))),new r(14,48,48,22,22,new ne(68,new ee(1,174))),new r(15,52,52,24,24,new ne(42,new ee(2,102))),new r(16,64,64,14,14,new ne(56,new ee(2,140))),new r(17,72,72,16,16,new ne(36,new ee(4,92))),new r(18,80,80,18,18,new ne(48,new ee(4,114))),new r(19,88,88,20,20,new ne(56,new ee(4,144))),new r(20,96,96,22,22,new ne(68,new ee(4,174))),new r(21,104,104,24,24,new ne(56,new ee(6,136))),new r(22,120,120,18,18,new ne(68,new ee(6,175))),new r(23,132,132,20,20,new ne(62,new ee(8,163))),new r(24,144,144,22,22,new ne(62,new ee(8,156),new ee(2,155))),new r(25,8,18,6,16,new ne(7,new ee(1,5))),new r(26,8,32,6,14,new ne(11,new ee(1,10))),new r(27,12,26,10,24,new ne(14,new ee(1,16))),new r(28,12,36,10,16,new ne(18,new ee(1,22))),new r(29,16,36,14,16,new ne(24,new ee(1,32))),new r(30,16,48,14,22,new ne(28,new ee(1,49)))]},r.VERSIONS=r.buildVersions(),r}(),ju=function(){function r(e){var t=e.getHeight();if(t<8||t>144||(t&1)!==0)throw new F;this.version=r.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new tt(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}return r.prototype.getVersion=function(){return this.version},r.readVersion=function(e){var t=e.getHeight(),n=e.getWidth();return Wu.getVersionForDimensions(t,n)},r.prototype.readCodewords=function(){var e=new Int8Array(this.version.getTotalCodewords()),t=0,n=4,i=0,a=this.mappingBitMatrix.getHeight(),o=this.mappingBitMatrix.getWidth(),s=!1,l=!1,u=!1,c=!1;do if(n===a&&i===0&&!s)e[t++]=this.readCorner1(a,o)&255,n-=2,i+=2,s=!0;else if(n===a-2&&i===0&&(o&3)!==0&&!l)e[t++]=this.readCorner2(a,o)&255,n-=2,i+=2,l=!0;else if(n===a+4&&i===2&&(o&7)===0&&!u)e[t++]=this.readCorner3(a,o)&255,n-=2,i+=2,u=!0;else if(n===a-2&&i===0&&(o&7)===4&&!c)e[t++]=this.readCorner4(a,o)&255,n-=2,i+=2,c=!0;else{do n<a&&i>=0&&!this.readMappingMatrix.get(i,n)&&(e[t++]=this.readUtah(n,i,a,o)&255),n-=2,i+=2;while(n>=0&&i<o);n+=1,i+=3;do n>=0&&i<o&&!this.readMappingMatrix.get(i,n)&&(e[t++]=this.readUtah(n,i,a,o)&255),n+=2,i-=2;while(n<a&&i>=0);n+=3,i+=1}while(n<a||i<o);if(t!==this.version.getTotalCodewords())throw new F;return e},r.prototype.readModule=function(e,t,n,i){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=i,e+=4-(i+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)},r.prototype.readUtah=function(e,t,n,i){var a=0;return this.readModule(e-2,t-2,n,i)&&(a|=1),a<<=1,this.readModule(e-2,t-1,n,i)&&(a|=1),a<<=1,this.readModule(e-1,t-2,n,i)&&(a|=1),a<<=1,this.readModule(e-1,t-1,n,i)&&(a|=1),a<<=1,this.readModule(e-1,t,n,i)&&(a|=1),a<<=1,this.readModule(e,t-2,n,i)&&(a|=1),a<<=1,this.readModule(e,t-1,n,i)&&(a|=1),a<<=1,this.readModule(e,t,n,i)&&(a|=1),a},r.prototype.readCorner1=function(e,t){var n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,1,e,t)&&(n|=1),n<<=1,this.readModule(e-1,2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n},r.prototype.readCorner2=function(e,t){var n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-4,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n},r.prototype.readCorner3=function(e,t){var n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-3,e,t)&&(n|=1),n<<=1,this.readModule(1,t-2,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n},r.prototype.readCorner4=function(e,t){var n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n},r.prototype.extractDataRegion=function(e){var t=this.version.getSymbolSizeRows(),n=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new k("Dimension of bitMatrix must match the version size");for(var i=this.version.getDataRegionSizeRows(),a=this.version.getDataRegionSizeColumns(),o=t/i|0,s=n/a|0,l=o*i,u=s*a,c=new tt(u,l),f=0;f<o;++f)for(var p=f*i,h=0;h<s;++h)for(var g=h*a,x=0;x<i;++x)for(var C=f*(i+2)+1+x,m=p+x,w=0;w<a;++w){var _=h*(a+2)+1+w;if(e.get(_,C)){var E=g+w;c.set(E,m)}}return c},r}(),Ba=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Yu=function(){function r(e,t){this.numDataCodewords=e,this.codewords=t}return r.getDataBlocks=function(e,t){var n,i,a,o,s=t.getECBlocks(),l=0,u=s.getECBlocks();try{for(var c=Ba(u),f=c.next();!f.done;f=c.next()){var p=f.value;l+=p.getCount()}}catch(R){n={error:R}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}var h=new Array(l),g=0;try{for(var x=Ba(u),C=x.next();!C.done;C=x.next())for(var p=C.value,m=0;m<p.getCount();m++){var w=p.getDataCodewords(),_=s.getECCodewords()+w;h[g++]=new r(w,new Uint8Array(_))}}catch(R){a={error:R}}finally{try{C&&!C.done&&(o=x.return)&&o.call(x)}finally{if(a)throw a.error}}for(var E=h[0].codewords.length,O=E-s.getECCodewords(),T=O-1,D=0,m=0;m<T;m++)for(var M=0;M<g;M++)h[M].codewords[m]=e[D++];for(var P=t.getVersionNumber()===24,V=P?8:g,M=0;M<V;M++)h[M].codewords[O-1]=e[D++];for(var W=h[0].codewords.length,m=O;m<W;m++)for(var M=0;M<g;M++){var U=P?(M+8)%g:M,J=P&&U>7?m-1:m;h[U].codewords[J]=e[D++]}if(D!==e.length)throw new k;return h},r.prototype.getNumDataCodewords=function(){return this.numDataCodewords},r.prototype.getCodewords=function(){return this.codewords},r}(),La=function(){function r(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}return r.prototype.getBitOffset=function(){return this.bitOffset},r.prototype.getByteOffset=function(){return this.byteOffset},r.prototype.readBits=function(e){if(e<1||e>32||e>this.available())throw new k(""+e);var t=0,n=this.bitOffset,i=this.byteOffset,a=this.bytes;if(n>0){var o=8-n,s=e<o?e:o,l=o-s,u=255>>8-s<<l;t=(a[i]&u)>>l,e-=s,n+=s,n===8&&(n=0,i++)}if(e>0){for(;e>=8;)t=t<<8|a[i]&255,i++,e-=8;if(e>0){var l=8-e,u=255>>l<<l;t=t<<e|(a[i]&u)>>l,n+=e}}return this.bitOffset=n,this.byteOffset=i,t},r.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},r}(),xe;(function(r){r[r.PAD_ENCODE=0]="PAD_ENCODE",r[r.ASCII_ENCODE=1]="ASCII_ENCODE",r[r.C40_ENCODE=2]="C40_ENCODE",r[r.TEXT_ENCODE=3]="TEXT_ENCODE",r[r.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",r[r.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",r[r.BASE256_ENCODE=6]="BASE256_ENCODE"})(xe||(xe={}));var Zu=function(){function r(){}return r.decode=function(e){var t=new La(e),n=new q,i=new q,a=new Array,o=xe.ASCII_ENCODE;do if(o===xe.ASCII_ENCODE)o=this.decodeAsciiSegment(t,n,i);else{switch(o){case xe.C40_ENCODE:this.decodeC40Segment(t,n);break;case xe.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case xe.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case xe.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case xe.BASE256_ENCODE:this.decodeBase256Segment(t,n,a);break;default:throw new F}o=xe.ASCII_ENCODE}while(o!==xe.PAD_ENCODE&&t.available()>0);return i.length()>0&&n.append(i.toString()),new Yr(e,n.toString(),a.length===0?null:a,null)},r.decodeAsciiSegment=function(e,t,n){var i=!1;do{var a=e.readBits(8);if(a===0)throw new F;if(a<=128)return i&&(a+=128),t.append(String.fromCharCode(a-1)),xe.ASCII_ENCODE;if(a===129)return xe.PAD_ENCODE;if(a<=229){var o=a-130;o<10&&t.append("0"),t.append(""+o)}else switch(a){case 230:return xe.C40_ENCODE;case 231:return xe.BASE256_ENCODE;case 232:t.append("");break;case 233:case 234:break;case 235:i=!0;break;case 236:t.append("[)>05"),n.insert(0,"");break;case 237:t.append("[)>06"),n.insert(0,"");break;case 238:return xe.ANSIX12_ENCODE;case 239:return xe.TEXT_ENCODE;case 240:return xe.EDIFACT_ENCODE;case 241:break;default:if(a!==254||e.available()!==0)throw new F;break}}while(e.available()>0);return xe.ASCII_ENCODE},r.decodeC40Segment=function(e,t){var n=!1,i=[],a=0;do{if(e.available()===8)return;var o=e.readBits(8);if(o===254)return;this.parseTwoBytes(o,e.readBits(8),i);for(var s=0;s<3;s++){var l=i[s];switch(a){case 0:if(l<3)a=l+1;else if(l<this.C40_BASIC_SET_CHARS.length){var u=this.C40_BASIC_SET_CHARS[l];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else throw new F;break;case 1:n?(t.append(String.fromCharCode(l+128)),n=!1):t.append(String.fromCharCode(l)),a=0;break;case 2:if(l<this.C40_SHIFT2_SET_CHARS.length){var u=this.C40_SHIFT2_SET_CHARS[l];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else switch(l){case 27:t.append("");break;case 30:n=!0;break;default:throw new F}a=0;break;case 3:n?(t.append(String.fromCharCode(l+224)),n=!1):t.append(String.fromCharCode(l+96)),a=0;break;default:throw new F}}}while(e.available()>0)},r.decodeTextSegment=function(e,t){var n=!1,i=[],a=0;do{if(e.available()===8)return;var o=e.readBits(8);if(o===254)return;this.parseTwoBytes(o,e.readBits(8),i);for(var s=0;s<3;s++){var l=i[s];switch(a){case 0:if(l<3)a=l+1;else if(l<this.TEXT_BASIC_SET_CHARS.length){var u=this.TEXT_BASIC_SET_CHARS[l];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else throw new F;break;case 1:n?(t.append(String.fromCharCode(l+128)),n=!1):t.append(String.fromCharCode(l)),a=0;break;case 2:if(l<this.TEXT_SHIFT2_SET_CHARS.length){var u=this.TEXT_SHIFT2_SET_CHARS[l];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else switch(l){case 27:t.append("");break;case 30:n=!0;break;default:throw new F}a=0;break;case 3:if(l<this.TEXT_SHIFT3_SET_CHARS.length){var u=this.TEXT_SHIFT3_SET_CHARS[l];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u),a=0}else throw new F;break;default:throw new F}}}while(e.available()>0)},r.decodeAnsiX12Segment=function(e,t){var n=[];do{if(e.available()===8)return;var i=e.readBits(8);if(i===254)return;this.parseTwoBytes(i,e.readBits(8),n);for(var a=0;a<3;a++){var o=n[a];switch(o){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(o<14)t.append(String.fromCharCode(o+44));else if(o<40)t.append(String.fromCharCode(o+51));else throw new F;break}}}while(e.available()>0)},r.parseTwoBytes=function(e,t,n){var i=(e<<8)+t-1,a=Math.floor(i/1600);n[0]=a,i-=a*1600,a=Math.floor(i/40),n[1]=a,n[2]=i-a*40},r.decodeEdifactSegment=function(e,t){do{if(e.available()<=16)return;for(var n=0;n<4;n++){var i=e.readBits(6);if(i===31){var a=8-e.getBitOffset();a!==8&&e.readBits(a);return}(i&32)===0&&(i|=64),t.append(String.fromCharCode(i))}}while(e.available()>0)},r.decodeBase256Segment=function(e,t,n){var i=1+e.getByteOffset(),a=this.unrandomize255State(e.readBits(8),i++),o;if(a===0?o=e.available()/8|0:a<250?o=a:o=250*(a-249)+this.unrandomize255State(e.readBits(8),i++),o<0)throw new F;for(var s=new Uint8Array(o),l=0;l<o;l++){if(e.available()<8)throw new F;s[l]=this.unrandomize255State(e.readBits(8),i++)}n.push(s);try{t.append($e.decode(s,Y.ISO88591))}catch(u){throw new hr("Platform does not support required encoding: "+u.message)}},r.unrandomize255State=function(e,t){var n=149*t%255+1,i=e-n;return i>=0?i:i+256},r.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],r.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],r.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],r.TEXT_SHIFT2_SET_CHARS=r.C40_SHIFT2_SET_CHARS,r.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""],r}(),Ku=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Qu=function(){function r(){this.rsDecoder=new Kr(He.DATA_MATRIX_FIELD_256)}return r.prototype.decode=function(e){var t,n,i=new ju(e),a=i.getVersion(),o=i.readCodewords(),s=Yu.getDataBlocks(o,a),l=0;try{for(var u=Ku(s),c=u.next();!c.done;c=u.next()){var f=c.value;l+=f.getNumDataCodewords()}}catch(_){t={error:_}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}for(var p=new Uint8Array(l),h=s.length,g=0;g<h;g++){var x=s[g],C=x.getCodewords(),m=x.getNumDataCodewords();this.correctErrors(C,m);for(var w=0;w<m;w++)p[w*h+g]=C[w]}return Zu.decode(p)},r.prototype.correctErrors=function(e,t){var n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new Ce}for(var i=0;i<t;i++)e[i]=n[i]},r}(),Ju=function(){function r(e){this.image=e,this.rectangleDetector=new Kn(this.image)}return r.prototype.detect=function(){var e=this.rectangleDetector.detect(),t=this.detectSolid1(e);if(t=this.detectSolid2(t),t[3]=this.correctTopRight(t),!t[3])throw new N;t=this.shiftToModuleCenter(t);var n=t[0],i=t[1],a=t[2],o=t[3],s=this.transitionsBetween(n,o)+1,l=this.transitionsBetween(a,o)+1;(s&1)===1&&(s+=1),(l&1)===1&&(l+=1),4*s<7*l&&4*l<7*s&&(s=l=Math.max(s,l));var u=r.sampleGrid(this.image,n,i,a,o,s,l);return new Zn(u,[n,i,a,o])},r.shiftPoint=function(e,t,n){var i=(t.getX()-e.getX())/(n+1),a=(t.getY()-e.getY())/(n+1);return new z(e.getX()+i,e.getY()+a)},r.moveAway=function(e,t,n){var i=e.getX(),a=e.getY();return i<t?i-=1:i+=1,a<n?a-=1:a+=1,new z(i,a)},r.prototype.detectSolid1=function(e){var t=e[0],n=e[1],i=e[3],a=e[2],o=this.transitionsBetween(t,n),s=this.transitionsBetween(n,i),l=this.transitionsBetween(i,a),u=this.transitionsBetween(a,t),c=o,f=[a,t,n,i];return c>s&&(c=s,f[0]=t,f[1]=n,f[2]=i,f[3]=a),c>l&&(c=l,f[0]=n,f[1]=i,f[2]=a,f[3]=t),c>u&&(f[0]=i,f[1]=a,f[2]=t,f[3]=n),f},r.prototype.detectSolid2=function(e){var t=e[0],n=e[1],i=e[2],a=e[3],o=this.transitionsBetween(t,a),s=r.shiftPoint(n,i,(o+1)*4),l=r.shiftPoint(i,n,(o+1)*4),u=this.transitionsBetween(s,t),c=this.transitionsBetween(l,a);return u<c?(e[0]=t,e[1]=n,e[2]=i,e[3]=a):(e[0]=n,e[1]=i,e[2]=a,e[3]=t),e},r.prototype.correctTopRight=function(e){var t=e[0],n=e[1],i=e[2],a=e[3],o=this.transitionsBetween(t,a),s=this.transitionsBetween(n,a),l=r.shiftPoint(t,n,(s+1)*4),u=r.shiftPoint(i,n,(o+1)*4);o=this.transitionsBetween(l,a),s=this.transitionsBetween(u,a);var c=new z(a.getX()+(i.getX()-n.getX())/(o+1),a.getY()+(i.getY()-n.getY())/(o+1)),f=new z(a.getX()+(t.getX()-n.getX())/(s+1),a.getY()+(t.getY()-n.getY())/(s+1));if(!this.isValid(c))return this.isValid(f)?f:null;if(!this.isValid(f))return c;var p=this.transitionsBetween(l,c)+this.transitionsBetween(u,c),h=this.transitionsBetween(l,f)+this.transitionsBetween(u,f);return p>h?c:f},r.prototype.shiftToModuleCenter=function(e){var t=e[0],n=e[1],i=e[2],a=e[3],o=this.transitionsBetween(t,a)+1,s=this.transitionsBetween(i,a)+1,l=r.shiftPoint(t,n,s*4),u=r.shiftPoint(i,n,o*4);o=this.transitionsBetween(l,a)+1,s=this.transitionsBetween(u,a)+1,(o&1)===1&&(o+=1),(s&1)===1&&(s+=1);var c=(t.getX()+n.getX()+i.getX()+a.getX())/4,f=(t.getY()+n.getY()+i.getY()+a.getY())/4;t=r.moveAway(t,c,f),n=r.moveAway(n,c,f),i=r.moveAway(i,c,f),a=r.moveAway(a,c,f);var p,h;return l=r.shiftPoint(t,n,s*4),l=r.shiftPoint(l,a,o*4),p=r.shiftPoint(n,t,s*4),p=r.shiftPoint(p,i,o*4),u=r.shiftPoint(i,a,s*4),u=r.shiftPoint(u,n,o*4),h=r.shiftPoint(a,i,s*4),h=r.shiftPoint(h,t,o*4),[l,p,u,h]},r.prototype.isValid=function(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()},r.sampleGrid=function(e,t,n,i,a,o,s){var l=Qn.getInstance();return l.sampleGrid(e,o,s,.5,.5,o-.5,.5,o-.5,s-.5,.5,s-.5,t.getX(),t.getY(),a.getX(),a.getY(),i.getX(),i.getY(),n.getX(),n.getY())},r.prototype.transitionsBetween=function(e,t){var n=Math.trunc(e.getX()),i=Math.trunc(e.getY()),a=Math.trunc(t.getX()),o=Math.trunc(t.getY()),s=Math.abs(o-i)>Math.abs(a-n);if(s){var l=n;n=i,i=l,l=a,a=o,o=l}for(var u=Math.abs(a-n),c=Math.abs(o-i),f=-u/2,p=i<o?1:-1,h=n<a?1:-1,g=0,x=this.image.get(s?i:n,s?n:i),C=n,m=i;C!==a;C+=h){var w=this.image.get(s?m:C,s?C:m);if(w!==x&&(g++,x=w),f+=c,f>0){if(m===o)break;m+=p,f-=u}}return g},r}(),oi=function(){function r(){this.decoder=new Qu}return r.prototype.decode=function(e,t){t===void 0&&(t=null);var n,i;if(t!=null&&t.has(ce.PURE_BARCODE)){var a=r.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(a),i=r.NO_POINTS}else{var o=new Ju(e.getBlackMatrix()).detect();n=this.decoder.decode(o.getBits()),i=o.getPoints()}var s=n.getRawBytes(),l=new Ne(n.getText(),s,8*s.length,i,B.DATA_MATRIX,se.currentTimeMillis()),u=n.getByteSegments();u!=null&&l.putMetadata(Ae.BYTE_SEGMENTS,u);var c=n.getECLevel();return c!=null&&l.putMetadata(Ae.ERROR_CORRECTION_LEVEL,c),l},r.prototype.reset=function(){},r.extractPureBits=function(e){var t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new N;var i=this.moduleSize(t,e),a=t[1],o=n[1],s=t[0],l=n[0],u=(l-s+1)/i,c=(o-a+1)/i;if(u<=0||c<=0)throw new N;var f=i/2;a+=f,s+=f;for(var p=new tt(u,c),h=0;h<c;h++)for(var g=a+h*i,x=0;x<u;x++)e.get(s+x*i,g)&&p.set(x,h);return p},r.moduleSize=function(e,t){for(var n=t.getWidth(),i=e[0],a=e[1];i<n&&t.get(i,a);)i++;if(i===n)throw new N;var o=i-e[0];if(o===0)throw new N;return o},r.NO_POINTS=[],r}(),ec=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){ec(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new oi,t)||this}return e})(zt);var Ht;(function(r){r[r.L=0]="L",r[r.M=1]="M",r[r.Q=2]="Q",r[r.H=3]="H"})(Ht||(Ht={}));var tc=function(){function r(e,t,n){this.value=e,this.stringValue=t,this.bits=n,r.FOR_BITS.set(n,this),r.FOR_VALUE.set(e,this)}return r.prototype.getValue=function(){return this.value},r.prototype.getBits=function(){return this.bits},r.fromString=function(e){switch(e){case"L":return r.L;case"M":return r.M;case"Q":return r.Q;case"H":return r.H;default:throw new Ze(e+"not available")}},r.prototype.toString=function(){return this.stringValue},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value},r.forBits=function(e){if(e<0||e>=r.FOR_BITS.size)throw new k;return r.FOR_BITS.get(e)},r.FOR_BITS=new Map,r.FOR_VALUE=new Map,r.L=new r(Ht.L,"L",1),r.M=new r(Ht.M,"M",0),r.Q=new r(Ht.Q,"Q",3),r.H=new r(Ht.H,"H",2),r}(),rc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},za=function(){function r(e){this.errorCorrectionLevel=tc.forBits(e>>3&3),this.dataMask=e&7}return r.numBitsDiffering=function(e,t){return $.bitCount(e^t)},r.decodeFormatInformation=function(e,t){var n=r.doDecodeFormatInformation(e,t);return n!==null?n:r.doDecodeFormatInformation(e^r.FORMAT_INFO_MASK_QR,t^r.FORMAT_INFO_MASK_QR)},r.doDecodeFormatInformation=function(e,t){var n,i,a=Number.MAX_SAFE_INTEGER,o=0;try{for(var s=rc(r.FORMAT_INFO_DECODE_LOOKUP),l=s.next();!l.done;l=s.next()){var u=l.value,c=u[0];if(c===e||c===t)return new r(u[1]);var f=r.numBitsDiffering(e,c);f<a&&(o=u[1],a=f),e!==t&&(f=r.numBitsDiffering(t,c),f<a&&(o=u[1],a=f))}}catch(p){n={error:p}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return a<=3?new r(o):null},r.prototype.getErrorCorrectionLevel=function(){return this.errorCorrectionLevel},r.prototype.getDataMask=function(){return this.dataMask},r.prototype.hashCode=function(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask},r.FORMAT_INFO_MASK_QR=21522,r.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])],r}(),nc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},S=function(){function r(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.ecCodewordsPerBlock=e,this.ecBlocks=t}return r.prototype.getECCodewordsPerBlock=function(){return this.ecCodewordsPerBlock},r.prototype.getNumBlocks=function(){var e,t,n=0,i=this.ecBlocks;try{for(var a=nc(i),o=a.next();!o.done;o=a.next()){var s=o.value;n+=s.getCount()}}catch(l){e={error:l}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return n},r.prototype.getTotalECCodewords=function(){return this.ecCodewordsPerBlock*this.getNumBlocks()},r.prototype.getECBlocks=function(){return this.ecBlocks},r}(),y=function(){function r(e,t){this.count=e,this.dataCodewords=t}return r.prototype.getCount=function(){return this.count},r.prototype.getDataCodewords=function(){return this.dataCodewords},r}(),ic=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Ct=function(){function r(e,t){for(var n,i,a=[],o=2;o<arguments.length;o++)a[o-2]=arguments[o];this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=a;var s=0,l=a[0].getECCodewordsPerBlock(),u=a[0].getECBlocks();try{for(var c=ic(u),f=c.next();!f.done;f=c.next()){var p=f.value;s+=p.getCount()*(p.getDataCodewords()+l)}}catch(h){n={error:h}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}this.totalCodewords=s}return r.prototype.getVersionNumber=function(){return this.versionNumber},r.prototype.getAlignmentPatternCenters=function(){return this.alignmentPatternCenters},r.prototype.getTotalCodewords=function(){return this.totalCodewords},r.prototype.getDimensionForVersion=function(){return 17+4*this.versionNumber},r.prototype.getECBlocksForLevel=function(e){return this.ecBlocks[e.getValue()]},r.getProvisionalVersionForDimension=function(e){if(e%4!==1)throw new F;try{return this.getVersionForNumber((e-17)/4)}catch{throw new F}},r.getVersionForNumber=function(e){if(e<1||e>40)throw new k;return r.VERSIONS[e-1]},r.decodeVersionInformation=function(e){for(var t=Number.MAX_SAFE_INTEGER,n=0,i=0;i<r.VERSION_DECODE_INFO.length;i++){var a=r.VERSION_DECODE_INFO[i];if(a===e)return r.getVersionForNumber(i+7);var o=za.numBitsDiffering(e,a);o<t&&(n=i+7,t=o)}return t<=3?r.getVersionForNumber(n):null},r.prototype.buildFunctionPattern=function(){var e=this.getDimensionForVersion(),t=new tt(e);t.setRegion(0,0,9,9),t.setRegion(e-8,0,8,9),t.setRegion(0,e-8,9,8);for(var n=this.alignmentPatternCenters.length,i=0;i<n;i++)for(var a=this.alignmentPatternCenters[i]-2,o=0;o<n;o++)i===0&&(o===0||o===n-1)||i===n-1&&o===0||t.setRegion(this.alignmentPatternCenters[o]-2,a,5,5);return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t},r.prototype.toString=function(){return""+this.versionNumber},r.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),r.VERSIONS=[new r(1,new Int32Array(0),new S(7,new y(1,19)),new S(10,new y(1,16)),new S(13,new y(1,13)),new S(17,new y(1,9))),new r(2,Int32Array.from([6,18]),new S(10,new y(1,34)),new S(16,new y(1,28)),new S(22,new y(1,22)),new S(28,new y(1,16))),new r(3,Int32Array.from([6,22]),new S(15,new y(1,55)),new S(26,new y(1,44)),new S(18,new y(2,17)),new S(22,new y(2,13))),new r(4,Int32Array.from([6,26]),new S(20,new y(1,80)),new S(18,new y(2,32)),new S(26,new y(2,24)),new S(16,new y(4,9))),new r(5,Int32Array.from([6,30]),new S(26,new y(1,108)),new S(24,new y(2,43)),new S(18,new y(2,15),new y(2,16)),new S(22,new y(2,11),new y(2,12))),new r(6,Int32Array.from([6,34]),new S(18,new y(2,68)),new S(16,new y(4,27)),new S(24,new y(4,19)),new S(28,new y(4,15))),new r(7,Int32Array.from([6,22,38]),new S(20,new y(2,78)),new S(18,new y(4,31)),new S(18,new y(2,14),new y(4,15)),new S(26,new y(4,13),new y(1,14))),new r(8,Int32Array.from([6,24,42]),new S(24,new y(2,97)),new S(22,new y(2,38),new y(2,39)),new S(22,new y(4,18),new y(2,19)),new S(26,new y(4,14),new y(2,15))),new r(9,Int32Array.from([6,26,46]),new S(30,new y(2,116)),new S(22,new y(3,36),new y(2,37)),new S(20,new y(4,16),new y(4,17)),new S(24,new y(4,12),new y(4,13))),new r(10,Int32Array.from([6,28,50]),new S(18,new y(2,68),new y(2,69)),new S(26,new y(4,43),new y(1,44)),new S(24,new y(6,19),new y(2,20)),new S(28,new y(6,15),new y(2,16))),new r(11,Int32Array.from([6,30,54]),new S(20,new y(4,81)),new S(30,new y(1,50),new y(4,51)),new S(28,new y(4,22),new y(4,23)),new S(24,new y(3,12),new y(8,13))),new r(12,Int32Array.from([6,32,58]),new S(24,new y(2,92),new y(2,93)),new S(22,new y(6,36),new y(2,37)),new S(26,new y(4,20),new y(6,21)),new S(28,new y(7,14),new y(4,15))),new r(13,Int32Array.from([6,34,62]),new S(26,new y(4,107)),new S(22,new y(8,37),new y(1,38)),new S(24,new y(8,20),new y(4,21)),new S(22,new y(12,11),new y(4,12))),new r(14,Int32Array.from([6,26,46,66]),new S(30,new y(3,115),new y(1,116)),new S(24,new y(4,40),new y(5,41)),new S(20,new y(11,16),new y(5,17)),new S(24,new y(11,12),new y(5,13))),new r(15,Int32Array.from([6,26,48,70]),new S(22,new y(5,87),new y(1,88)),new S(24,new y(5,41),new y(5,42)),new S(30,new y(5,24),new y(7,25)),new S(24,new y(11,12),new y(7,13))),new r(16,Int32Array.from([6,26,50,74]),new S(24,new y(5,98),new y(1,99)),new S(28,new y(7,45),new y(3,46)),new S(24,new y(15,19),new y(2,20)),new S(30,new y(3,15),new y(13,16))),new r(17,Int32Array.from([6,30,54,78]),new S(28,new y(1,107),new y(5,108)),new S(28,new y(10,46),new y(1,47)),new S(28,new y(1,22),new y(15,23)),new S(28,new y(2,14),new y(17,15))),new r(18,Int32Array.from([6,30,56,82]),new S(30,new y(5,120),new y(1,121)),new S(26,new y(9,43),new y(4,44)),new S(28,new y(17,22),new y(1,23)),new S(28,new y(2,14),new y(19,15))),new r(19,Int32Array.from([6,30,58,86]),new S(28,new y(3,113),new y(4,114)),new S(26,new y(3,44),new y(11,45)),new S(26,new y(17,21),new y(4,22)),new S(26,new y(9,13),new y(16,14))),new r(20,Int32Array.from([6,34,62,90]),new S(28,new y(3,107),new y(5,108)),new S(26,new y(3,41),new y(13,42)),new S(30,new y(15,24),new y(5,25)),new S(28,new y(15,15),new y(10,16))),new r(21,Int32Array.from([6,28,50,72,94]),new S(28,new y(4,116),new y(4,117)),new S(26,new y(17,42)),new S(28,new y(17,22),new y(6,23)),new S(30,new y(19,16),new y(6,17))),new r(22,Int32Array.from([6,26,50,74,98]),new S(28,new y(2,111),new y(7,112)),new S(28,new y(17,46)),new S(30,new y(7,24),new y(16,25)),new S(24,new y(34,13))),new r(23,Int32Array.from([6,30,54,78,102]),new S(30,new y(4,121),new y(5,122)),new S(28,new y(4,47),new y(14,48)),new S(30,new y(11,24),new y(14,25)),new S(30,new y(16,15),new y(14,16))),new r(24,Int32Array.from([6,28,54,80,106]),new S(30,new y(6,117),new y(4,118)),new S(28,new y(6,45),new y(14,46)),new S(30,new y(11,24),new y(16,25)),new S(30,new y(30,16),new y(2,17))),new r(25,Int32Array.from([6,32,58,84,110]),new S(26,new y(8,106),new y(4,107)),new S(28,new y(8,47),new y(13,48)),new S(30,new y(7,24),new y(22,25)),new S(30,new y(22,15),new y(13,16))),new r(26,Int32Array.from([6,30,58,86,114]),new S(28,new y(10,114),new y(2,115)),new S(28,new y(19,46),new y(4,47)),new S(28,new y(28,22),new y(6,23)),new S(30,new y(33,16),new y(4,17))),new r(27,Int32Array.from([6,34,62,90,118]),new S(30,new y(8,122),new y(4,123)),new S(28,new y(22,45),new y(3,46)),new S(30,new y(8,23),new y(26,24)),new S(30,new y(12,15),new y(28,16))),new r(28,Int32Array.from([6,26,50,74,98,122]),new S(30,new y(3,117),new y(10,118)),new S(28,new y(3,45),new y(23,46)),new S(30,new y(4,24),new y(31,25)),new S(30,new y(11,15),new y(31,16))),new r(29,Int32Array.from([6,30,54,78,102,126]),new S(30,new y(7,116),new y(7,117)),new S(28,new y(21,45),new y(7,46)),new S(30,new y(1,23),new y(37,24)),new S(30,new y(19,15),new y(26,16))),new r(30,Int32Array.from([6,26,52,78,104,130]),new S(30,new y(5,115),new y(10,116)),new S(28,new y(19,47),new y(10,48)),new S(30,new y(15,24),new y(25,25)),new S(30,new y(23,15),new y(25,16))),new r(31,Int32Array.from([6,30,56,82,108,134]),new S(30,new y(13,115),new y(3,116)),new S(28,new y(2,46),new y(29,47)),new S(30,new y(42,24),new y(1,25)),new S(30,new y(23,15),new y(28,16))),new r(32,Int32Array.from([6,34,60,86,112,138]),new S(30,new y(17,115)),new S(28,new y(10,46),new y(23,47)),new S(30,new y(10,24),new y(35,25)),new S(30,new y(19,15),new y(35,16))),new r(33,Int32Array.from([6,30,58,86,114,142]),new S(30,new y(17,115),new y(1,116)),new S(28,new y(14,46),new y(21,47)),new S(30,new y(29,24),new y(19,25)),new S(30,new y(11,15),new y(46,16))),new r(34,Int32Array.from([6,34,62,90,118,146]),new S(30,new y(13,115),new y(6,116)),new S(28,new y(14,46),new y(23,47)),new S(30,new y(44,24),new y(7,25)),new S(30,new y(59,16),new y(1,17))),new r(35,Int32Array.from([6,30,54,78,102,126,150]),new S(30,new y(12,121),new y(7,122)),new S(28,new y(12,47),new y(26,48)),new S(30,new y(39,24),new y(14,25)),new S(30,new y(22,15),new y(41,16))),new r(36,Int32Array.from([6,24,50,76,102,128,154]),new S(30,new y(6,121),new y(14,122)),new S(28,new y(6,47),new y(34,48)),new S(30,new y(46,24),new y(10,25)),new S(30,new y(2,15),new y(64,16))),new r(37,Int32Array.from([6,28,54,80,106,132,158]),new S(30,new y(17,122),new y(4,123)),new S(28,new y(29,46),new y(14,47)),new S(30,new y(49,24),new y(10,25)),new S(30,new y(24,15),new y(46,16))),new r(38,Int32Array.from([6,32,58,84,110,136,162]),new S(30,new y(4,122),new y(18,123)),new S(28,new y(13,46),new y(32,47)),new S(30,new y(48,24),new y(14,25)),new S(30,new y(42,15),new y(32,16))),new r(39,Int32Array.from([6,26,54,82,110,138,166]),new S(30,new y(20,117),new y(4,118)),new S(28,new y(40,47),new y(7,48)),new S(30,new y(43,24),new y(22,25)),new S(30,new y(10,15),new y(67,16))),new r(40,Int32Array.from([6,30,58,86,114,142,170]),new S(30,new y(19,118),new y(6,119)),new S(28,new y(18,47),new y(31,48)),new S(30,new y(34,24),new y(34,25)),new S(30,new y(20,15),new y(61,16)))],r}(),me;(function(r){r[r.DATA_MASK_000=0]="DATA_MASK_000",r[r.DATA_MASK_001=1]="DATA_MASK_001",r[r.DATA_MASK_010=2]="DATA_MASK_010",r[r.DATA_MASK_011=3]="DATA_MASK_011",r[r.DATA_MASK_100=4]="DATA_MASK_100",r[r.DATA_MASK_101=5]="DATA_MASK_101",r[r.DATA_MASK_110=6]="DATA_MASK_110",r[r.DATA_MASK_111=7]="DATA_MASK_111"})(me||(me={}));var ka=function(){function r(e,t){this.value=e,this.isMasked=t}return r.prototype.unmaskBitMatrix=function(e,t){for(var n=0;n<t;n++)for(var i=0;i<t;i++)this.isMasked(n,i)&&e.flip(i,n)},r.values=new Map([[me.DATA_MASK_000,new r(me.DATA_MASK_000,function(e,t){return(e+t&1)===0})],[me.DATA_MASK_001,new r(me.DATA_MASK_001,function(e,t){return(e&1)===0})],[me.DATA_MASK_010,new r(me.DATA_MASK_010,function(e,t){return t%3===0})],[me.DATA_MASK_011,new r(me.DATA_MASK_011,function(e,t){return(e+t)%3===0})],[me.DATA_MASK_100,new r(me.DATA_MASK_100,function(e,t){return(Math.floor(e/2)+Math.floor(t/3)&1)===0})],[me.DATA_MASK_101,new r(me.DATA_MASK_101,function(e,t){return e*t%6===0})],[me.DATA_MASK_110,new r(me.DATA_MASK_110,function(e,t){return e*t%6<3})],[me.DATA_MASK_111,new r(me.DATA_MASK_111,function(e,t){return(e+t+e*t%3&1)===0})]]),r}(),ac=function(){function r(e){var t=e.getHeight();if(t<21||(t&3)!==1)throw new F;this.bitMatrix=e}return r.prototype.readFormatInformation=function(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;for(var e=0,t=0;t<6;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(var n=5;n>=0;n--)e=this.copyBit(8,n,e);for(var i=this.bitMatrix.getHeight(),a=0,o=i-7,n=i-1;n>=o;n--)a=this.copyBit(8,n,a);for(var t=i-8;t<i;t++)a=this.copyBit(t,8,a);if(this.parsedFormatInfo=za.decodeFormatInformation(e,a),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new F},r.prototype.readVersion=function(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;var e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return Ct.getVersionForNumber(t);for(var n=0,i=e-11,a=5;a>=0;a--)for(var o=e-9;o>=i;o--)n=this.copyBit(o,a,n);var s=Ct.decodeVersionInformation(n);if(s!==null&&s.getDimensionForVersion()===e)return this.parsedVersion=s,s;n=0;for(var o=5;o>=0;o--)for(var a=e-9;a>=i;a--)n=this.copyBit(o,a,n);if(s=Ct.decodeVersionInformation(n),s!==null&&s.getDimensionForVersion()===e)return this.parsedVersion=s,s;throw new F},r.prototype.copyBit=function(e,t,n){var i=this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t);return i?n<<1|1:n<<1},r.prototype.readCodewords=function(){var e=this.readFormatInformation(),t=this.readVersion(),n=ka.values.get(e.getDataMask()),i=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,i);for(var a=t.buildFunctionPattern(),o=!0,s=new Uint8Array(t.getTotalCodewords()),l=0,u=0,c=0,f=i-1;f>0;f-=2){f===6&&f--;for(var p=0;p<i;p++)for(var h=o?i-1-p:p,g=0;g<2;g++)a.get(f-g,h)||(c++,u<<=1,this.bitMatrix.get(f-g,h)&&(u|=1),c===8&&(s[l++]=u,c=0,u=0));o=!o}if(l!==t.getTotalCodewords())throw new F;return s},r.prototype.remask=function(){if(this.parsedFormatInfo!==null){var e=ka.values[this.parsedFormatInfo.getDataMask()],t=this.bitMatrix.getHeight();e.unmaskBitMatrix(this.bitMatrix,t)}},r.prototype.setMirror=function(e){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=e},r.prototype.mirror=function(){for(var e=this.bitMatrix,t=0,n=e.getWidth();t<n;t++)for(var i=t+1,a=e.getHeight();i<a;i++)e.get(t,i)!==e.get(i,t)&&(e.flip(i,t),e.flip(t,i))},r}(),Ra=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},oc=function(){function r(e,t){this.numDataCodewords=e,this.codewords=t}return r.getDataBlocks=function(e,t,n){var i,a,o,s;if(e.length!==t.getTotalCodewords())throw new k;var l=t.getECBlocksForLevel(n),u=0,c=l.getECBlocks();try{for(var f=Ra(c),p=f.next();!p.done;p=f.next()){var h=p.value;u+=h.getCount()}}catch(J){i={error:J}}finally{try{p&&!p.done&&(a=f.return)&&a.call(f)}finally{if(i)throw i.error}}var g=new Array(u),x=0;try{for(var C=Ra(c),m=C.next();!m.done;m=C.next())for(var h=m.value,w=0;w<h.getCount();w++){var _=h.getDataCodewords(),E=l.getECCodewordsPerBlock()+_;g[x++]=new r(_,new Uint8Array(E))}}catch(J){o={error:J}}finally{try{m&&!m.done&&(s=C.return)&&s.call(C)}finally{if(o)throw o.error}}for(var O=g[0].codewords.length,T=g.length-1;T>=0;){var D=g[T].codewords.length;if(D===O)break;T--}T++;for(var M=O-l.getECCodewordsPerBlock(),P=0,w=0;w<M;w++)for(var V=0;V<x;V++)g[V].codewords[w]=e[P++];for(var V=T;V<x;V++)g[V].codewords[M]=e[P++];for(var W=g[0].codewords.length,w=M;w<W;w++)for(var V=0;V<x;V++){var U=V<T?w:w+1;g[V].codewords[U]=e[P++]}return g},r.prototype.getNumDataCodewords=function(){return this.numDataCodewords},r.prototype.getCodewords=function(){return this.codewords},r}(),We;(function(r){r[r.TERMINATOR=0]="TERMINATOR",r[r.NUMERIC=1]="NUMERIC",r[r.ALPHANUMERIC=2]="ALPHANUMERIC",r[r.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",r[r.BYTE=4]="BYTE",r[r.ECI=5]="ECI",r[r.KANJI=6]="KANJI",r[r.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",r[r.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",r[r.HANZI=9]="HANZI"})(We||(We={}));var le=function(){function r(e,t,n,i){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=i,r.FOR_BITS.set(i,this),r.FOR_VALUE.set(e,this)}return r.forBits=function(e){var t=r.FOR_BITS.get(e);if(t===void 0)throw new k;return t},r.prototype.getCharacterCountBits=function(e){var t=e.getVersionNumber(),n;return t<=9?n=0:t<=26?n=1:n=2,this.characterCountBitsForVersions[n]},r.prototype.getValue=function(){return this.value},r.prototype.getBits=function(){return this.bits},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value},r.prototype.toString=function(){return this.stringValue},r.FOR_BITS=new Map,r.FOR_VALUE=new Map,r.TERMINATOR=new r(We.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),r.NUMERIC=new r(We.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),r.ALPHANUMERIC=new r(We.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),r.STRUCTURED_APPEND=new r(We.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),r.BYTE=new r(We.BYTE,"BYTE",Int32Array.from([8,16,16]),4),r.ECI=new r(We.ECI,"ECI",Int32Array.from([0,0,0]),7),r.KANJI=new r(We.KANJI,"KANJI",Int32Array.from([8,10,12]),8),r.FNC1_FIRST_POSITION=new r(We.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),r.FNC1_SECOND_POSITION=new r(We.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),r.HANZI=new r(We.HANZI,"HANZI",Int32Array.from([8,10,12]),13),r}(),sc=function(){function r(){}return r.decode=function(e,t,n,i){var a=new La(e),o=new q,s=new Array,l=-1,u=-1;try{var c=null,f=!1,p=void 0;do{if(a.available()<4)p=le.TERMINATOR;else{var h=a.readBits(4);p=le.forBits(h)}switch(p){case le.TERMINATOR:break;case le.FNC1_FIRST_POSITION:case le.FNC1_SECOND_POSITION:f=!0;break;case le.STRUCTURED_APPEND:if(a.available()<16)throw new F;l=a.readBits(8),u=a.readBits(8);break;case le.ECI:var g=r.parseECIValue(a);if(c=pe.getCharacterSetECIByValue(g),c===null)throw new F;break;case le.HANZI:var x=a.readBits(4),C=a.readBits(p.getCharacterCountBits(t));x===r.GB2312_SUBSET&&r.decodeHanziSegment(a,o,C);break;default:var m=a.readBits(p.getCharacterCountBits(t));switch(p){case le.NUMERIC:r.decodeNumericSegment(a,o,m);break;case le.ALPHANUMERIC:r.decodeAlphanumericSegment(a,o,m,f);break;case le.BYTE:r.decodeByteSegment(a,o,m,c,s,i);break;case le.KANJI:r.decodeKanjiSegment(a,o,m);break;default:throw new F}break}}while(p!==le.TERMINATOR)}catch{throw new F}return new Yr(e,o.toString(),s.length===0?null:s,n===null?null:n.toString(),l,u)},r.decodeHanziSegment=function(e,t,n){if(n*13>e.available())throw new F;for(var i=new Uint8Array(2*n),a=0;n>0;){var o=e.readBits(13),s=o/96<<8&4294967295|o%96;s<959?s+=41377:s+=42657,i[a]=s>>8&255,i[a+1]=s&255,a+=2,n--}try{t.append($e.decode(i,Y.GB2312))}catch(l){throw new F(l)}},r.decodeKanjiSegment=function(e,t,n){if(n*13>e.available())throw new F;for(var i=new Uint8Array(2*n),a=0;n>0;){var o=e.readBits(13),s=o/192<<8&4294967295|o%192;s<7936?s+=33088:s+=49472,i[a]=s>>8,i[a+1]=s,a+=2,n--}try{t.append($e.decode(i,Y.SHIFT_JIS))}catch(l){throw new F(l)}},r.decodeByteSegment=function(e,t,n,i,a,o){if(8*n>e.available())throw new F;for(var s=new Uint8Array(n),l=0;l<n;l++)s[l]=e.readBits(8);var u;i===null?u=Y.guessEncoding(s,o):u=i.getName();try{t.append($e.decode(s,u))}catch(c){throw new F(c)}a.push(s)},r.toAlphaNumericChar=function(e){if(e>=r.ALPHANUMERIC_CHARS.length)throw new F;return r.ALPHANUMERIC_CHARS[e]},r.decodeAlphanumericSegment=function(e,t,n,i){for(var a=t.length();n>1;){if(e.available()<11)throw new F;var o=e.readBits(11);t.append(r.toAlphaNumericChar(Math.floor(o/45))),t.append(r.toAlphaNumericChar(o%45)),n-=2}if(n===1){if(e.available()<6)throw new F;t.append(r.toAlphaNumericChar(e.readBits(6)))}if(i)for(var s=a;s<t.length();s++)t.charAt(s)==="%"&&(s<t.length()-1&&t.charAt(s+1)==="%"?t.deleteCharAt(s+1):t.setCharAt(s,""))},r.decodeNumericSegment=function(e,t,n){for(;n>=3;){if(e.available()<10)throw new F;var i=e.readBits(10);if(i>=1e3)throw new F;t.append(r.toAlphaNumericChar(Math.floor(i/100))),t.append(r.toAlphaNumericChar(Math.floor(i/10)%10)),t.append(r.toAlphaNumericChar(i%10)),n-=3}if(n===2){if(e.available()<7)throw new F;var a=e.readBits(7);if(a>=100)throw new F;t.append(r.toAlphaNumericChar(Math.floor(a/10))),t.append(r.toAlphaNumericChar(a%10))}else if(n===1){if(e.available()<4)throw new F;var o=e.readBits(4);if(o>=10)throw new F;t.append(r.toAlphaNumericChar(o))}},r.parseECIValue=function(e){var t=e.readBits(8);if((t&128)===0)return t&127;if((t&192)===128){var n=e.readBits(8);return(t&63)<<8&4294967295|n}if((t&224)===192){var i=e.readBits(16);return(t&31)<<16&4294967295|i}throw new F},r.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",r.GB2312_SUBSET=1,r}(),Ua=function(){function r(e){this.mirrored=e}return r.prototype.isMirrored=function(){return this.mirrored},r.prototype.applyMirroredCorrection=function(e){if(!(!this.mirrored||e===null||e.length<3)){var t=e[0];e[0]=e[2],e[2]=t}},r}(),Ha=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},lc=function(){function r(){this.rsDecoder=new Kr(He.QR_CODE_FIELD_256)}return r.prototype.decodeBooleanArray=function(e,t){return this.decodeBitMatrix(tt.parseFromBooleanArray(e),t)},r.prototype.decodeBitMatrix=function(e,t){var n=new ac(e),i=null;try{return this.decodeBitMatrixParser(n,t)}catch(o){i=o}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();var a=this.decodeBitMatrixParser(n,t);return a.setOther(new Ua(!0)),a}catch(o){throw i!==null?i:o}},r.prototype.decodeBitMatrixParser=function(e,t){var n,i,a,o,s=e.readVersion(),l=e.readFormatInformation().getErrorCorrectionLevel(),u=e.readCodewords(),c=oc.getDataBlocks(u,s,l),f=0;try{for(var p=Ha(c),h=p.next();!h.done;h=p.next()){var g=h.value;f+=g.getNumDataCodewords()}}catch(T){n={error:T}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}var x=new Uint8Array(f),C=0;try{for(var m=Ha(c),w=m.next();!w.done;w=m.next()){var g=w.value,_=g.getCodewords(),E=g.getNumDataCodewords();this.correctErrors(_,E);for(var O=0;O<E;O++)x[C++]=_[O]}}catch(T){a={error:T}}finally{try{w&&!w.done&&(o=m.return)&&o.call(m)}finally{if(a)throw a.error}}return sc.decode(x,s,l,t)},r.prototype.correctErrors=function(e,t){var n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new Ce}for(var i=0;i<t;i++)e[i]=n[i]},r}(),uc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),cc=function(r){uc(e,r);function e(t,n,i){var a=r.call(this,t,n)||this;return a.estimatedModuleSize=i,a}return e.prototype.aboutEquals=function(t,n,i){if(Math.abs(n-this.getY())<=t&&Math.abs(i-this.getX())<=t){var a=Math.abs(t-this.estimatedModuleSize);return a<=1||a<=this.estimatedModuleSize}return!1},e.prototype.combineEstimate=function(t,n,i){var a=(this.getX()+n)/2,o=(this.getY()+t)/2,s=(this.estimatedModuleSize+i)/2;return new e(a,o,s)},e}(z),fc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},dc=function(){function r(e,t,n,i,a,o,s){this.image=e,this.startX=t,this.startY=n,this.width=i,this.height=a,this.moduleSize=o,this.resultPointCallback=s,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}return r.prototype.find=function(){for(var e=this.startX,t=this.height,n=this.width,i=e+n,a=this.startY+t/2,o=new Int32Array(3),s=this.image,l=0;l<t;l++){var u=a+((l&1)===0?Math.floor((l+1)/2):-Math.floor((l+1)/2));o[0]=0,o[1]=0,o[2]=0;for(var c=e;c<i&&!s.get(c,u);)c++;for(var f=0;c<i;){if(s.get(c,u))if(f===1)o[1]++;else if(f===2){if(this.foundPatternCross(o)){var p=this.handlePossibleCenter(o,u,c);if(p!==null)return p}o[0]=o[2],o[1]=1,o[2]=0,f=1}else o[++f]++;else f===1&&f++,o[f]++;c++}if(this.foundPatternCross(o)){var p=this.handlePossibleCenter(o,u,i);if(p!==null)return p}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new N},r.centerFromEnd=function(e,t){return t-e[2]-e[1]/2},r.prototype.foundPatternCross=function(e){for(var t=this.moduleSize,n=t/2,i=0;i<3;i++)if(Math.abs(t-e[i])>=n)return!1;return!0},r.prototype.crossCheckVertical=function(e,t,n,i){var a=this.image,o=a.getHeight(),s=this.crossCheckStateCount;s[0]=0,s[1]=0,s[2]=0;for(var l=e;l>=0&&a.get(t,l)&&s[1]<=n;)s[1]++,l--;if(l<0||s[1]>n)return NaN;for(;l>=0&&!a.get(t,l)&&s[0]<=n;)s[0]++,l--;if(s[0]>n)return NaN;for(l=e+1;l<o&&a.get(t,l)&&s[1]<=n;)s[1]++,l++;if(l===o||s[1]>n)return NaN;for(;l<o&&!a.get(t,l)&&s[2]<=n;)s[2]++,l++;if(s[2]>n)return NaN;var u=s[0]+s[1]+s[2];return 5*Math.abs(u-i)>=2*i?NaN:this.foundPatternCross(s)?r.centerFromEnd(s,l):NaN},r.prototype.handlePossibleCenter=function(e,t,n){var i,a,o=e[0]+e[1]+e[2],s=r.centerFromEnd(e,n),l=this.crossCheckVertical(t,s,2*e[1],o);if(!isNaN(l)){var u=(e[0]+e[1]+e[2])/3;try{for(var c=fc(this.possibleCenters),f=c.next();!f.done;f=c.next()){var p=f.value;if(p.aboutEquals(u,l,s))return p.combineEstimate(l,s,u)}}catch(g){i={error:g}}finally{try{f&&!f.done&&(a=c.return)&&a.call(c)}finally{if(i)throw i.error}}var h=new cc(s,l,u);this.possibleCenters.push(h),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(h)}return null},r}(),hc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),pc=function(r){hc(e,r);function e(t,n,i,a){var o=r.call(this,t,n)||this;return o.estimatedModuleSize=i,o.count=a,a===void 0&&(o.count=1),o}return e.prototype.getEstimatedModuleSize=function(){return this.estimatedModuleSize},e.prototype.getCount=function(){return this.count},e.prototype.aboutEquals=function(t,n,i){if(Math.abs(n-this.getY())<=t&&Math.abs(i-this.getX())<=t){var a=Math.abs(t-this.estimatedModuleSize);return a<=1||a<=this.estimatedModuleSize}return!1},e.prototype.combineEstimate=function(t,n,i){var a=this.count+1,o=(this.count*this.getX()+n)/a,s=(this.count*this.getY()+t)/a,l=(this.count*this.estimatedModuleSize+i)/a;return new e(o,s,l,a)},e}(z),vc=function(){function r(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}return r.prototype.getBottomLeft=function(){return this.bottomLeft},r.prototype.getTopLeft=function(){return this.topLeft},r.prototype.getTopRight=function(){return this.topRight},r}(),vr=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},gc=function(){function r(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}return r.prototype.getImage=function(){return this.image},r.prototype.getPossibleCenters=function(){return this.possibleCenters},r.prototype.find=function(e){var t=e!=null&&e.get(ce.TRY_HARDER)!==void 0,n=e!=null&&e.get(ce.PURE_BARCODE)!==void 0,i=this.image,a=i.getHeight(),o=i.getWidth(),s=Math.floor(3*a/(4*r.MAX_MODULES));(s<r.MIN_SKIP||t)&&(s=r.MIN_SKIP);for(var l=!1,u=new Int32Array(5),c=s-1;c<a&&!l;c+=s){u[0]=0,u[1]=0,u[2]=0,u[3]=0,u[4]=0;for(var f=0,p=0;p<o;p++)if(i.get(p,c))(f&1)===1&&f++,u[f]++;else if((f&1)===0)if(f===4)if(r.foundPatternCross(u)){var h=this.handlePossibleCenter(u,c,p,n);if(h===!0)if(s=2,this.hasSkipped===!0)l=this.haveMultiplyConfirmedCenters();else{var g=this.findRowSkip();g>u[2]&&(c+=g-u[2]-s,p=o-1)}else{u[0]=u[2],u[1]=u[3],u[2]=u[4],u[3]=1,u[4]=0,f=3;continue}f=0,u[0]=0,u[1]=0,u[2]=0,u[3]=0,u[4]=0}else u[0]=u[2],u[1]=u[3],u[2]=u[4],u[3]=1,u[4]=0,f=3;else u[++f]++;else u[f]++;if(r.foundPatternCross(u)){var h=this.handlePossibleCenter(u,c,o,n);h===!0&&(s=u[0],this.hasSkipped&&(l=this.haveMultiplyConfirmedCenters()))}}var x=this.selectBestPatterns();return z.orderBestPatterns(x),new vc(x)},r.centerFromEnd=function(e,t){return t-e[4]-e[3]-e[2]/2},r.foundPatternCross=function(e){for(var t=0,n=0;n<5;n++){var i=e[n];if(i===0)return!1;t+=i}if(t<7)return!1;var a=t/7,o=a/2;return Math.abs(a-e[0])<o&&Math.abs(a-e[1])<o&&Math.abs(3*a-e[2])<3*o&&Math.abs(a-e[3])<o&&Math.abs(a-e[4])<o},r.prototype.getCrossCheckStateCount=function(){var e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e},r.prototype.crossCheckDiagonal=function(e,t,n,i){for(var a=this.getCrossCheckStateCount(),o=0,s=this.image;e>=o&&t>=o&&s.get(t-o,e-o);)a[2]++,o++;if(e<o||t<o)return!1;for(;e>=o&&t>=o&&!s.get(t-o,e-o)&&a[1]<=n;)a[1]++,o++;if(e<o||t<o||a[1]>n)return!1;for(;e>=o&&t>=o&&s.get(t-o,e-o)&&a[0]<=n;)a[0]++,o++;if(a[0]>n)return!1;var l=s.getHeight(),u=s.getWidth();for(o=1;e+o<l&&t+o<u&&s.get(t+o,e+o);)a[2]++,o++;if(e+o>=l||t+o>=u)return!1;for(;e+o<l&&t+o<u&&!s.get(t+o,e+o)&&a[3]<n;)a[3]++,o++;if(e+o>=l||t+o>=u||a[3]>=n)return!1;for(;e+o<l&&t+o<u&&s.get(t+o,e+o)&&a[4]<n;)a[4]++,o++;if(a[4]>=n)return!1;var c=a[0]+a[1]+a[2]+a[3]+a[4];return Math.abs(c-i)<2*i&&r.foundPatternCross(a)},r.prototype.crossCheckVertical=function(e,t,n,i){for(var a=this.image,o=a.getHeight(),s=this.getCrossCheckStateCount(),l=e;l>=0&&a.get(t,l);)s[2]++,l--;if(l<0)return NaN;for(;l>=0&&!a.get(t,l)&&s[1]<=n;)s[1]++,l--;if(l<0||s[1]>n)return NaN;for(;l>=0&&a.get(t,l)&&s[0]<=n;)s[0]++,l--;if(s[0]>n)return NaN;for(l=e+1;l<o&&a.get(t,l);)s[2]++,l++;if(l===o)return NaN;for(;l<o&&!a.get(t,l)&&s[3]<n;)s[3]++,l++;if(l===o||s[3]>=n)return NaN;for(;l<o&&a.get(t,l)&&s[4]<n;)s[4]++,l++;if(s[4]>=n)return NaN;var u=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(u-i)>=2*i?NaN:r.foundPatternCross(s)?r.centerFromEnd(s,l):NaN},r.prototype.crossCheckHorizontal=function(e,t,n,i){for(var a=this.image,o=a.getWidth(),s=this.getCrossCheckStateCount(),l=e;l>=0&&a.get(l,t);)s[2]++,l--;if(l<0)return NaN;for(;l>=0&&!a.get(l,t)&&s[1]<=n;)s[1]++,l--;if(l<0||s[1]>n)return NaN;for(;l>=0&&a.get(l,t)&&s[0]<=n;)s[0]++,l--;if(s[0]>n)return NaN;for(l=e+1;l<o&&a.get(l,t);)s[2]++,l++;if(l===o)return NaN;for(;l<o&&!a.get(l,t)&&s[3]<n;)s[3]++,l++;if(l===o||s[3]>=n)return NaN;for(;l<o&&a.get(l,t)&&s[4]<n;)s[4]++,l++;if(s[4]>=n)return NaN;var u=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(u-i)>=i?NaN:r.foundPatternCross(s)?r.centerFromEnd(s,l):NaN},r.prototype.handlePossibleCenter=function(e,t,n,i){var a=e[0]+e[1]+e[2]+e[3]+e[4],o=r.centerFromEnd(e,n),s=this.crossCheckVertical(t,Math.floor(o),e[2],a);if(!isNaN(s)&&(o=this.crossCheckHorizontal(Math.floor(o),Math.floor(s),e[2],a),!isNaN(o)&&(!i||this.crossCheckDiagonal(Math.floor(s),Math.floor(o),e[2],a)))){for(var l=a/7,u=!1,c=this.possibleCenters,f=0,p=c.length;f<p;f++){var h=c[f];if(h.aboutEquals(l,s,o)){c[f]=h.combineEstimate(s,o,l),u=!0;break}}if(!u){var g=new pc(o,s,l);c.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return!0}return!1},r.prototype.findRowSkip=function(){var e,t,n=this.possibleCenters.length;if(n<=1)return 0;var i=null;try{for(var a=vr(this.possibleCenters),o=a.next();!o.done;o=a.next()){var s=o.value;if(s.getCount()>=r.CENTER_QUORUM)if(i==null)i=s;else return this.hasSkipped=!0,Math.floor((Math.abs(i.getX()-s.getX())-Math.abs(i.getY()-s.getY()))/2)}}catch(l){e={error:l}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return 0},r.prototype.haveMultiplyConfirmedCenters=function(){var e,t,n,i,a=0,o=0,s=this.possibleCenters.length;try{for(var l=vr(this.possibleCenters),u=l.next();!u.done;u=l.next()){var c=u.value;c.getCount()>=r.CENTER_QUORUM&&(a++,o+=c.getEstimatedModuleSize())}}catch(x){e={error:x}}finally{try{u&&!u.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}if(a<3)return!1;var f=o/s,p=0;try{for(var h=vr(this.possibleCenters),g=h.next();!g.done;g=h.next()){var c=g.value;p+=Math.abs(c.getEstimatedModuleSize()-f)}}catch(x){n={error:x}}finally{try{g&&!g.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return p<=.05*o},r.prototype.selectBestPatterns=function(){var e,t,n,i,a=this.possibleCenters.length;if(a<3)throw new N;var o=this.possibleCenters,s;if(a>3){var l=0,u=0;try{for(var c=vr(this.possibleCenters),f=c.next();!f.done;f=c.next()){var p=f.value,h=p.getEstimatedModuleSize();l+=h,u+=h*h}}catch(O){e={error:O}}finally{try{f&&!f.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}s=l/a;var g=Math.sqrt(u/a-s*s);o.sort(function(O,T){var D=Math.abs(T.getEstimatedModuleSize()-s),M=Math.abs(O.getEstimatedModuleSize()-s);return D<M?-1:D>M?1:0});for(var x=Math.max(.2*s,g),C=0;C<o.length&&o.length>3;C++){var m=o[C];Math.abs(m.getEstimatedModuleSize()-s)>x&&(o.splice(C,1),C--)}}if(o.length>3){var l=0;try{for(var w=vr(o),_=w.next();!_.done;_=w.next()){var E=_.value;l+=E.getEstimatedModuleSize()}}catch(T){n={error:T}}finally{try{_&&!_.done&&(i=w.return)&&i.call(w)}finally{if(n)throw n.error}}s=l/o.length,o.sort(function(T,D){if(D.getCount()===T.getCount()){var M=Math.abs(D.getEstimatedModuleSize()-s),P=Math.abs(T.getEstimatedModuleSize()-s);return M<P?1:M>P?-1:0}else return D.getCount()-T.getCount()}),o.splice(3)}return[o[0],o[1],o[2]]},r.CENTER_QUORUM=2,r.MIN_SKIP=3,r.MAX_MODULES=57,r}(),xc=function(){function r(e){this.image=e}return r.prototype.getImage=function(){return this.image},r.prototype.getResultPointCallback=function(){return this.resultPointCallback},r.prototype.detect=function(e){this.resultPointCallback=e==null?null:e.get(ce.NEED_RESULT_POINT_CALLBACK);var t=new gc(this.image,this.resultPointCallback),n=t.find(e);return this.processFinderPatternInfo(n)},r.prototype.processFinderPatternInfo=function(e){var t=e.getTopLeft(),n=e.getTopRight(),i=e.getBottomLeft(),a=this.calculateModuleSize(t,n,i);if(a<1)throw new N("No pattern found in proccess finder.");var o=r.computeDimension(t,n,i,a),s=Ct.getProvisionalVersionForDimension(o),l=s.getDimensionForVersion()-7,u=null;if(s.getAlignmentPatternCenters().length>0)for(var c=n.getX()-t.getX()+i.getX(),f=n.getY()-t.getY()+i.getY(),p=1-3/l,h=Math.floor(t.getX()+p*(c-t.getX())),g=Math.floor(t.getY()+p*(f-t.getY())),x=4;x<=16;x<<=1)try{u=this.findAlignmentInRegion(a,h,g,x);break}catch(_){if(!(_ instanceof N))throw _}var C=r.createTransform(t,n,i,u,o),m=r.sampleGrid(this.image,C,o),w;return u===null?w=[i,t,n]:w=[i,t,n,u],new Zn(m,w)},r.createTransform=function(e,t,n,i,a){var o=a-3.5,s,l,u,c;return i!==null?(s=i.getX(),l=i.getY(),u=o-3,c=u):(s=t.getX()-e.getX()+n.getX(),l=t.getY()-e.getY()+n.getY(),u=o,c=o),Ca.quadrilateralToQuadrilateral(3.5,3.5,o,3.5,u,c,3.5,o,e.getX(),e.getY(),t.getX(),t.getY(),s,l,n.getX(),n.getY())},r.sampleGrid=function(e,t,n){var i=Qn.getInstance();return i.sampleGridWithTransform(e,n,n,t)},r.computeDimension=function(e,t,n,i){var a=Q.round(z.distance(e,t)/i),o=Q.round(z.distance(e,n)/i),s=Math.floor((a+o)/2)+7;switch(s&3){case 0:s++;break;case 2:s--;break;case 3:throw new N("Dimensions could be not found.")}return s},r.prototype.calculateModuleSize=function(e,t,n){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,n))/2},r.prototype.calculateModuleSizeOneWay=function(e,t){var n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),i=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?i/7:isNaN(i)?n/7:(n+i)/14},r.prototype.sizeOfBlackWhiteBlackRunBothWays=function(e,t,n,i){var a=this.sizeOfBlackWhiteBlackRun(e,t,n,i),o=1,s=e-(n-e);s<0?(o=e/(e-s),s=0):s>=this.image.getWidth()&&(o=(this.image.getWidth()-1-e)/(s-e),s=this.image.getWidth()-1);var l=Math.floor(t-(i-t)*o);return o=1,l<0?(o=t/(t-l),l=0):l>=this.image.getHeight()&&(o=(this.image.getHeight()-1-t)/(l-t),l=this.image.getHeight()-1),s=Math.floor(e+(s-e)*o),a+=this.sizeOfBlackWhiteBlackRun(e,t,s,l),a-1},r.prototype.sizeOfBlackWhiteBlackRun=function(e,t,n,i){var a=Math.abs(i-t)>Math.abs(n-e);if(a){var o=e;e=t,t=o,o=n,n=i,i=o}for(var s=Math.abs(n-e),l=Math.abs(i-t),u=-s/2,c=e<n?1:-1,f=t<i?1:-1,p=0,h=n+c,g=e,x=t;g!==h;g+=c){var C=a?x:g,m=a?g:x;if(p===1===this.image.get(C,m)){if(p===2)return Q.distance(g,x,e,t);p++}if(u+=l,u>0){if(x===i)break;x+=f,u-=s}}return p===2?Q.distance(n+c,i,e,t):NaN},r.prototype.findAlignmentInRegion=function(e,t,n,i){var a=Math.floor(i*e),o=Math.max(0,t-a),s=Math.min(this.image.getWidth()-1,t+a);if(s-o<e*3)throw new N("Alignment top exceeds estimated module size.");var l=Math.max(0,n-a),u=Math.min(this.image.getHeight()-1,n+a);if(u-l<e*3)throw new N("Alignment bottom exceeds estimated module size.");var c=new dc(this.image,o,l,s-o,u-l,e,this.resultPointCallback);return c.find()},r}(),si=function(){function r(){this.decoder=new lc}return r.prototype.getDecoder=function(){return this.decoder},r.prototype.decode=function(e,t){var n,i;if(t!=null&&t.get(ce.PURE_BARCODE)!==void 0){var a=r.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(a,t),i=r.NO_POINTS}else{var o=new xc(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(o.getBits(),t),i=o.getPoints()}n.getOther()instanceof Ua&&n.getOther().applyMirroredCorrection(i);var s=new Ne(n.getText(),n.getRawBytes(),void 0,i,B.QR_CODE,void 0),l=n.getByteSegments();l!==null&&s.putMetadata(Ae.BYTE_SEGMENTS,l);var u=n.getECLevel();return u!==null&&s.putMetadata(Ae.ERROR_CORRECTION_LEVEL,u),n.hasStructuredAppend()&&(s.putMetadata(Ae.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),s.putMetadata(Ae.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),s},r.prototype.reset=function(){},r.extractPureBits=function(e){var t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new N;var i=this.moduleSize(t,e),a=t[1],o=n[1],s=t[0],l=n[0];if(s>=l||a>=o)throw new N;if(o-a!==l-s&&(l=s+(o-a),l>=e.getWidth()))throw new N;var u=Math.round((l-s+1)/i),c=Math.round((o-a+1)/i);if(u<=0||c<=0)throw new N;if(c!==u)throw new N;var f=Math.floor(i/2);a+=f,s+=f;var p=s+Math.floor((u-1)*i)-l;if(p>0){if(p>f)throw new N;s-=p}var h=a+Math.floor((c-1)*i)-o;if(h>0){if(h>f)throw new N;a-=h}for(var g=new tt(u,c),x=0;x<c;x++)for(var C=a+Math.floor(x*i),m=0;m<u;m++)e.get(s+Math.floor(m*i),C)&&g.set(m,x);return g},r.moduleSize=function(e,t){for(var n=t.getHeight(),i=t.getWidth(),a=e[0],o=e[1],s=!0,l=0;a<i&&o<n;){if(s!==t.get(a,o)){if(++l===5)break;s=!s}a++,o++}if(a===i||o===n)throw new N;return(a-e[0])/7},r.NO_POINTS=new Array,r}(),yc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},K=function(){function r(){}return r.prototype.PDF417Common=function(){},r.getBitCountSum=function(e){return Q.sum(e)},r.toIntArray=function(e){var t,n;if(e==null||!e.length)return r.EMPTY_INT_ARRAY;var i=new Int32Array(e.length),a=0;try{for(var o=yc(e),s=o.next();!s.done;s=o.next()){var l=s.value;i[a++]=l}}catch(u){t={error:u}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i},r.getCodeword=function(e){var t=he.binarySearch(r.SYMBOL_TABLE,e&262143);return t<0?-1:(r.CODEWORD_TABLE[t]-1)%r.NUMBER_OF_CODEWORDS},r.NUMBER_OF_CODEWORDS=929,r.MAX_CODEWORDS_IN_BARCODE=r.NUMBER_OF_CODEWORDS-1,r.MIN_ROWS_IN_BARCODE=3,r.MAX_ROWS_IN_BARCODE=90,r.MODULES_IN_CODEWORD=17,r.MODULES_IN_STOP_PATTERN=18,r.BARS_IN_MODULE=8,r.EMPTY_INT_ARRAY=new Int32Array([]),r.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),r.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]),r}(),Cc=function(){function r(e,t){this.bits=e,this.points=t}return r.prototype.getBits=function(){return this.bits},r.prototype.getPoints=function(){return this.points},r}(),wc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},mc=function(){function r(){}return r.detectMultiple=function(e,t,n){var i=e.getBlackMatrix(),a=r.detect(n,i);return a.length||(i=i.clone(),i.rotate180(),a=r.detect(n,i)),new Cc(i,a)},r.detect=function(e,t){for(var n,i,a=new Array,o=0,s=0,l=!1;o<t.getHeight();){var u=r.findVertices(t,o,s);if(u[0]==null&&u[3]==null){if(!l)break;l=!1,s=0;try{for(var c=(n=void 0,wc(a)),f=c.next();!f.done;f=c.next()){var p=f.value;p[1]!=null&&(o=Math.trunc(Math.max(o,p[1].getY()))),p[3]!=null&&(o=Math.max(o,Math.trunc(p[3].getY())))}}catch(h){n={error:h}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}o+=r.ROW_STEP;continue}if(l=!0,a.push(u),!e)break;u[2]!=null?(s=Math.trunc(u[2].getX()),o=Math.trunc(u[2].getY())):(s=Math.trunc(u[4].getX()),o=Math.trunc(u[4].getY()))}return a},r.findVertices=function(e,t,n){var i=e.getHeight(),a=e.getWidth(),o=new Array(8);return r.copyToResult(o,r.findRowsWithPattern(e,i,a,t,n,r.START_PATTERN),r.INDEXES_START_PATTERN),o[4]!=null&&(n=Math.trunc(o[4].getX()),t=Math.trunc(o[4].getY())),r.copyToResult(o,r.findRowsWithPattern(e,i,a,t,n,r.STOP_PATTERN),r.INDEXES_STOP_PATTERN),o},r.copyToResult=function(e,t,n){for(var i=0;i<n.length;i++)e[n[i]]=t[i]},r.findRowsWithPattern=function(e,t,n,i,a,o){for(var s=new Array(4),l=!1,u=new Int32Array(o.length);i<t;i+=r.ROW_STEP){var c=r.findGuardPattern(e,a,i,n,!1,o,u);if(c!=null){for(;i>0;){var f=r.findGuardPattern(e,a,--i,n,!1,o,u);if(f!=null)c=f;else{i++;break}}s[0]=new z(c[0],i),s[1]=new z(c[1],i),l=!0;break}}var p=i+1;if(l){for(var h=0,f=Int32Array.from([Math.trunc(s[0].getX()),Math.trunc(s[1].getX())]);p<t;p++){var c=r.findGuardPattern(e,f[0],p,n,!1,o,u);if(c!=null&&Math.abs(f[0]-c[0])<r.MAX_PATTERN_DRIFT&&Math.abs(f[1]-c[1])<r.MAX_PATTERN_DRIFT)f=c,h=0;else{if(h>r.SKIPPED_ROW_COUNT_MAX)break;h++}}p-=h+1,s[2]=new z(f[0],p),s[3]=new z(f[1],p)}return p-i<r.BARCODE_MIN_HEIGHT&&he.fill(s,null),s},r.findGuardPattern=function(e,t,n,i,a,o,s){he.fillWithin(s,0,s.length,0);for(var l=t,u=0;e.get(l,n)&&l>0&&u++<r.MAX_PIXEL_DRIFT;)l--;for(var c=l,f=0,p=o.length,h=a;c<i;c++){var g=e.get(c,n);if(g!==h)s[f]++;else{if(f===p-1){if(r.patternMatchVariance(s,o,r.MAX_INDIVIDUAL_VARIANCE)<r.MAX_AVG_VARIANCE)return new Int32Array([l,c]);l+=s[0]+s[1],se.arraycopy(s,2,s,0,f-1),s[f-1]=0,s[f]=0,f--}else f++;s[f]=1,h=!h}}return f===p-1&&r.patternMatchVariance(s,o,r.MAX_INDIVIDUAL_VARIANCE)<r.MAX_AVG_VARIANCE?new Int32Array([l,c-1]):null},r.patternMatchVariance=function(e,t,n){for(var i=e.length,a=0,o=0,s=0;s<i;s++)a+=e[s],o+=t[s];if(a<o)return 1/0;var l=a/o;n*=l;for(var u=0,c=0;c<i;c++){var f=e[c],p=t[c]*l,h=f>p?f-p:p-f;if(h>n)return 1/0;u+=h}return u/a},r.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),r.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),r.MAX_AVG_VARIANCE=.42,r.MAX_INDIVIDUAL_VARIANCE=.8,r.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),r.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),r.MAX_PIXEL_DRIFT=3,r.MAX_PATTERN_DRIFT=5,r.SKIPPED_ROW_COUNT_MAX=25,r.ROW_STEP=5,r.BARCODE_MIN_HEIGHT=10,r}(),_c=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},wt=function(){function r(e,t){if(t.length===0)throw new k;this.field=e;var n=t.length;if(n>1&&t[0]===0){for(var i=1;i<n&&t[i]===0;)i++;i===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-i),se.arraycopy(t,i,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}return r.prototype.getCoefficients=function(){return this.coefficients},r.prototype.getDegree=function(){return this.coefficients.length-1},r.prototype.isZero=function(){return this.coefficients[0]===0},r.prototype.getCoefficient=function(e){return this.coefficients[this.coefficients.length-1-e]},r.prototype.evaluateAt=function(e){var t,n;if(e===0)return this.getCoefficient(0);if(e===1){var i=0;try{for(var a=_c(this.coefficients),o=a.next();!o.done;o=a.next()){var s=o.value;i=this.field.add(i,s)}}catch(f){t={error:f}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return i}for(var l=this.coefficients[0],u=this.coefficients.length,c=1;c<u;c++)l=this.field.add(this.field.multiply(e,l),this.coefficients[c]);return l},r.prototype.add=function(e){if(!this.field.equals(e.field))throw new k("ModulusPolys do not have same ModulusGF field");if(this.isZero())return e;if(e.isZero())return this;var t=this.coefficients,n=e.coefficients;if(t.length>n.length){var i=t;t=n,n=i}var a=new Int32Array(n.length),o=n.length-t.length;se.arraycopy(n,0,a,0,o);for(var s=o;s<n.length;s++)a[s]=this.field.add(t[s-o],n[s]);return new r(this.field,a)},r.prototype.subtract=function(e){if(!this.field.equals(e.field))throw new k("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())},r.prototype.multiply=function(e){return e instanceof r?this.multiplyOther(e):this.multiplyScalar(e)},r.prototype.multiplyOther=function(e){if(!this.field.equals(e.field))throw new k("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new r(this.field,new Int32Array([0]));for(var t=this.coefficients,n=t.length,i=e.coefficients,a=i.length,o=new Int32Array(n+a-1),s=0;s<n;s++)for(var l=t[s],u=0;u<a;u++)o[s+u]=this.field.add(o[s+u],this.field.multiply(l,i[u]));return new r(this.field,o)},r.prototype.negative=function(){for(var e=this.coefficients.length,t=new Int32Array(e),n=0;n<e;n++)t[n]=this.field.subtract(0,this.coefficients[n]);return new r(this.field,t)},r.prototype.multiplyScalar=function(e){if(e===0)return new r(this.field,new Int32Array([0]));if(e===1)return this;for(var t=this.coefficients.length,n=new Int32Array(t),i=0;i<t;i++)n[i]=this.field.multiply(this.coefficients[i],e);return new r(this.field,n)},r.prototype.multiplyByMonomial=function(e,t){if(e<0)throw new k;if(t===0)return new r(this.field,new Int32Array([0]));for(var n=this.coefficients.length,i=new Int32Array(n+e),a=0;a<n;a++)i[a]=this.field.multiply(this.coefficients[a],t);return new r(this.field,i)},r.prototype.toString=function(){for(var e=new q,t=this.getDegree();t>=0;t--){var n=this.getCoefficient(t);n!==0&&(n<0?(e.append(" - "),n=-n):e.length()>0&&e.append(" + "),(t===0||n!==1)&&e.append(n),t!==0&&(t===1?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()},r}(),Ac=function(){function r(){}return r.prototype.add=function(e,t){return(e+t)%this.modulus},r.prototype.subtract=function(e,t){return(this.modulus+e-t)%this.modulus},r.prototype.exp=function(e){return this.expTable[e]},r.prototype.log=function(e){if(e===0)throw new k;return this.logTable[e]},r.prototype.inverse=function(e){if(e===0)throw new ga;return this.expTable[this.modulus-this.logTable[e]-1]},r.prototype.multiply=function(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]},r.prototype.getSize=function(){return this.modulus},r.prototype.equals=function(e){return e===this},r}(),Ec=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ic=function(r){Ec(e,r);function e(t,n){var i=r.call(this)||this;i.modulus=t,i.expTable=new Int32Array(t),i.logTable=new Int32Array(t);for(var a=1,o=0;o<t;o++)i.expTable[o]=a,a=a*n%t;for(var o=0;o<t-1;o++)i.logTable[i.expTable[o]]=o;return i.zero=new wt(i,new Int32Array([0])),i.one=new wt(i,new Int32Array([1])),i}return e.prototype.getZero=function(){return this.zero},e.prototype.getOne=function(){return this.one},e.prototype.buildMonomial=function(t,n){if(t<0)throw new k;if(n===0)return this.zero;var i=new Int32Array(t+1);return i[0]=n,new wt(this,i)},e.PDF417_GF=new e(K.NUMBER_OF_CODEWORDS,3),e}(Ac),Sc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Oc=function(){function r(){this.field=Ic.PDF417_GF}return r.prototype.decode=function(e,t,n){for(var i,a,o=new wt(this.field,e),s=new Int32Array(t),l=!1,u=t;u>0;u--){var c=o.evaluateAt(this.field.exp(u));s[t-u]=c,c!==0&&(l=!0)}if(!l)return 0;var f=this.field.getOne();if(n!=null)try{for(var p=Sc(n),h=p.next();!h.done;h=p.next()){var g=h.value,x=this.field.exp(e.length-1-g),C=new wt(this.field,new Int32Array([this.field.subtract(0,x),1]));f=f.multiply(C)}}catch(M){i={error:M}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}for(var m=new wt(this.field,s),w=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),m,t),_=w[0],E=w[1],O=this.findErrorLocations(_),T=this.findErrorMagnitudes(E,_,O),u=0;u<O.length;u++){var D=e.length-1-this.field.log(O[u]);if(D<0)throw Ce.getChecksumInstance();e[D]=this.field.subtract(e[D],T[u])}return O.length},r.prototype.runEuclideanAlgorithm=function(e,t,n){if(e.getDegree()<t.getDegree()){var i=e;e=t,t=i}for(var a=e,o=t,s=this.field.getZero(),l=this.field.getOne();o.getDegree()>=Math.round(n/2);){var u=a,c=s;if(a=o,s=l,a.isZero())throw Ce.getChecksumInstance();o=u;for(var f=this.field.getZero(),p=a.getCoefficient(a.getDegree()),h=this.field.inverse(p);o.getDegree()>=a.getDegree()&&!o.isZero();){var g=o.getDegree()-a.getDegree(),x=this.field.multiply(o.getCoefficient(o.getDegree()),h);f=f.add(this.field.buildMonomial(g,x)),o=o.subtract(a.multiplyByMonomial(g,x))}l=f.multiply(s).subtract(c).negative()}var C=l.getCoefficient(0);if(C===0)throw Ce.getChecksumInstance();var m=this.field.inverse(C),w=l.multiply(m),_=o.multiply(m);return[w,_]},r.prototype.findErrorLocations=function(e){for(var t=e.getDegree(),n=new Int32Array(t),i=0,a=1;a<this.field.getSize()&&i<t;a++)e.evaluateAt(a)===0&&(n[i]=this.field.inverse(a),i++);if(i!==t)throw Ce.getChecksumInstance();return n},r.prototype.findErrorMagnitudes=function(e,t,n){for(var i=t.getDegree(),a=new Int32Array(i),o=1;o<=i;o++)a[i-o]=this.field.multiply(o,t.getCoefficient(o));for(var s=new wt(this.field,a),l=n.length,u=new Int32Array(l),o=0;o<l;o++){var c=this.field.inverse(n[o]),f=this.field.subtract(0,e.evaluateAt(c)),p=this.field.inverse(s.evaluateAt(c));u[o]=this.field.multiply(f,p)}return u},r}(),li=function(){function r(e,t,n,i,a){e instanceof r?this.constructor_2(e):this.constructor_1(e,t,n,i,a)}return r.prototype.constructor_1=function(e,t,n,i,a){var o=t==null||n==null,s=i==null||a==null;if(o&&s)throw new N;o?(t=new z(0,i.getY()),n=new z(0,a.getY())):s&&(i=new z(e.getWidth()-1,t.getY()),a=new z(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=i,this.bottomRight=a,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(i.getX(),a.getX())),this.minY=Math.trunc(Math.min(t.getY(),i.getY())),this.maxY=Math.trunc(Math.max(n.getY(),a.getY()))},r.prototype.constructor_2=function(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()},r.merge=function(e,t){return e==null?t:t==null?e:new r(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)},r.prototype.addMissingRows=function(e,t,n){var i=this.topLeft,a=this.bottomLeft,o=this.topRight,s=this.bottomRight;if(e>0){var l=n?this.topLeft:this.topRight,u=Math.trunc(l.getY()-e);u<0&&(u=0);var c=new z(l.getX(),u);n?i=c:o=c}if(t>0){var f=n?this.bottomLeft:this.bottomRight,p=Math.trunc(f.getY()+t);p>=this.image.getHeight()&&(p=this.image.getHeight()-1);var h=new z(f.getX(),p);n?a=h:s=h}return new r(this.image,i,a,o,s)},r.prototype.getMinX=function(){return this.minX},r.prototype.getMaxX=function(){return this.maxX},r.prototype.getMinY=function(){return this.minY},r.prototype.getMaxY=function(){return this.maxY},r.prototype.getTopLeft=function(){return this.topLeft},r.prototype.getTopRight=function(){return this.topRight},r.prototype.getBottomLeft=function(){return this.bottomLeft},r.prototype.getBottomRight=function(){return this.bottomRight},r}(),bc=function(){function r(e,t,n,i){this.columnCount=e,this.errorCorrectionLevel=i,this.rowCountUpperPart=t,this.rowCountLowerPart=n,this.rowCount=t+n}return r.prototype.getColumnCount=function(){return this.columnCount},r.prototype.getErrorCorrectionLevel=function(){return this.errorCorrectionLevel},r.prototype.getRowCount=function(){return this.rowCount},r.prototype.getRowCountUpperPart=function(){return this.rowCountUpperPart},r.prototype.getRowCountLowerPart=function(){return this.rowCountLowerPart},r}(),ui=function(){function r(){this.buffer=""}return r.form=function(e,t){var n=-1;function i(o,s,l,u,c,f){if(o==="%%")return"%";if(t[++n]!==void 0){o=u?parseInt(u.substr(1)):void 0;var p=c?parseInt(c.substr(1)):void 0,h;switch(f){case"s":h=t[n];break;case"c":h=t[n][0];break;case"f":h=parseFloat(t[n]).toFixed(o);break;case"p":h=parseFloat(t[n]).toPrecision(o);break;case"e":h=parseFloat(t[n]).toExponential(o);break;case"x":h=parseInt(t[n]).toString(p||16);break;case"d":h=parseFloat(parseInt(t[n],p||10).toPrecision(o)).toFixed(0);break}h=typeof h=="object"?JSON.stringify(h):(+h).toString(p);for(var g=parseInt(l),x=l&&l[0]+""=="0"?"0":" ";h.length<g;)h=s!==void 0?h+x:x+h;return h}}var a=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(a,i)},r.prototype.format=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.buffer+=r.form(e,t)},r.prototype.toString=function(){return this.buffer},r}(),Nc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Ga=function(){function r(e){this.boundingBox=new li(e),this.codewords=new Array(e.getMaxY()-e.getMinY()+1)}return r.prototype.getCodewordNearby=function(e){var t=this.getCodeword(e);if(t!=null)return t;for(var n=1;n<r.MAX_NEARBY_DISTANCE;n++){var i=this.imageRowToCodewordIndex(e)-n;if(i>=0&&(t=this.codewords[i],t!=null)||(i=this.imageRowToCodewordIndex(e)+n,i<this.codewords.length&&(t=this.codewords[i],t!=null)))return t}return null},r.prototype.imageRowToCodewordIndex=function(e){return e-this.boundingBox.getMinY()},r.prototype.setCodeword=function(e,t){this.codewords[this.imageRowToCodewordIndex(e)]=t},r.prototype.getCodeword=function(e){return this.codewords[this.imageRowToCodewordIndex(e)]},r.prototype.getBoundingBox=function(){return this.boundingBox},r.prototype.getCodewords=function(){return this.codewords},r.prototype.toString=function(){var e,t,n=new ui,i=0;try{for(var a=Nc(this.codewords),o=a.next();!o.done;o=a.next()){var s=o.value;if(s==null){n.format("%3d: | %n",i++);continue}n.format("%3d: %3d|%3d%n",i++,s.getRowNumber(),s.getValue())}}catch(l){e={error:l}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return n.toString()},r.MAX_NEARBY_DISTANCE=5,r}(),Tc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Dc=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return a},gr=function(){function r(){this.values=new Map}return r.prototype.setValue=function(e){e=Math.trunc(e);var t=this.values.get(e);t==null&&(t=0),t++,this.values.set(e,t)},r.prototype.getValue=function(){var e,t,n=-1,i=new Array,a=function(f,p){var h={getKey:function(){return f},getValue:function(){return p}};h.getValue()>n?(n=h.getValue(),i=[],i.push(h.getKey())):h.getValue()===n&&i.push(h.getKey())};try{for(var o=Tc(this.values.entries()),s=o.next();!s.done;s=o.next()){var l=Dc(s.value,2),u=l[0],c=l[1];a(u,c)}}catch(f){e={error:f}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}return K.toIntArray(i)},r.prototype.getConfidence=function(e){return this.values.get(e)},r}(),Mc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ci=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Xa=function(r){Mc(e,r);function e(t,n){var i=r.call(this,t)||this;return i._isLeft=n,i}return e.prototype.setRowNumbers=function(){var t,n;try{for(var i=ci(this.getCodewords()),a=i.next();!a.done;a=i.next()){var o=a.value;o!=null&&o.setRowNumberAsRowIndicatorColumn()}}catch(s){t={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},e.prototype.adjustCompleteIndicatorColumnRowNumbers=function(t){var n=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(n,t);for(var i=this.getBoundingBox(),a=this._isLeft?i.getTopLeft():i.getTopRight(),o=this._isLeft?i.getBottomLeft():i.getBottomRight(),s=this.imageRowToCodewordIndex(Math.trunc(a.getY())),l=this.imageRowToCodewordIndex(Math.trunc(o.getY())),u=-1,c=1,f=0,p=s;p<l;p++)if(n[p]!=null){var h=n[p],g=h.getRowNumber()-u;if(g===0)f++;else if(g===1)c=Math.max(c,f),f=1,u=h.getRowNumber();else if(g<0||h.getRowNumber()>=t.getRowCount()||g>p)n[p]=null;else{var x=void 0;c>2?x=(c-2)*g:x=g;for(var C=x>=p,m=1;m<=x&&!C;m++)C=n[p-m]!=null;C?n[p]=null:(u=h.getRowNumber(),f=1)}}},e.prototype.getRowHeights=function(){var t,n,i=this.getBarcodeMetadata();if(i==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(i);var a=new Int32Array(i.getRowCount());try{for(var o=ci(this.getCodewords()),s=o.next();!s.done;s=o.next()){var l=s.value;if(l!=null){var u=l.getRowNumber();if(u>=a.length)continue;a[u]++}}}catch(c){t={error:c}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return a},e.prototype.adjustIncompleteIndicatorColumnRowNumbers=function(t){for(var n=this.getBoundingBox(),i=this._isLeft?n.getTopLeft():n.getTopRight(),a=this._isLeft?n.getBottomLeft():n.getBottomRight(),o=this.imageRowToCodewordIndex(Math.trunc(i.getY())),s=this.imageRowToCodewordIndex(Math.trunc(a.getY())),l=this.getCodewords(),u=-1,c=o;c<s;c++)if(l[c]!=null){var f=l[c];f.setRowNumberAsRowIndicatorColumn();var p=f.getRowNumber()-u;p===0||(p===1?u=f.getRowNumber():f.getRowNumber()>=t.getRowCount()?l[c]=null:u=f.getRowNumber())}},e.prototype.getBarcodeMetadata=function(){var t,n,i=this.getCodewords(),a=new gr,o=new gr,s=new gr,l=new gr;try{for(var u=ci(i),c=u.next();!c.done;c=u.next()){var f=c.value;if(f!=null){f.setRowNumberAsRowIndicatorColumn();var p=f.getValue()%30,h=f.getRowNumber();switch(this._isLeft||(h+=2),h%3){case 0:o.setValue(p*3+1);break;case 1:l.setValue(p/3),s.setValue(p%3);break;case 2:a.setValue(p+1);break}}}}catch(x){t={error:x}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}if(a.getValue().length===0||o.getValue().length===0||s.getValue().length===0||l.getValue().length===0||a.getValue()[0]<1||o.getValue()[0]+s.getValue()[0]<K.MIN_ROWS_IN_BARCODE||o.getValue()[0]+s.getValue()[0]>K.MAX_ROWS_IN_BARCODE)return null;var g=new bc(a.getValue()[0],o.getValue()[0],s.getValue()[0],l.getValue()[0]);return this.removeIncorrectCodewords(i,g),g},e.prototype.removeIncorrectCodewords=function(t,n){for(var i=0;i<t.length;i++){var a=t[i];if(t[i]!=null){var o=a.getValue()%30,s=a.getRowNumber();if(s>n.getRowCount()){t[i]=null;continue}switch(this._isLeft||(s+=2),s%3){case 0:o*3+1!==n.getRowCountUpperPart()&&(t[i]=null);break;case 1:(Math.trunc(o/3)!==n.getErrorCorrectionLevel()||o%3!==n.getRowCountLowerPart())&&(t[i]=null);break;case 2:o+1!==n.getColumnCount()&&(t[i]=null);break}}}},e.prototype.isLeft=function(){return this._isLeft},e.prototype.toString=function(){return"IsLeft: "+this._isLeft+`
|
|
227
|
-
`+r.prototype.toString.call(this)},e}(Ga),Pc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Fc=function(){function r(e,t){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=e,this.barcodeColumnCount=e.getColumnCount(),this.boundingBox=t,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}return r.prototype.getDetectionResultColumns=function(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);var e=K.MAX_CODEWORDS_IN_BARCODE,t;do t=e,e=this.adjustRowNumbersAndGetCount();while(e>0&&e<t);return this.detectionResultColumns},r.prototype.adjustIndicatorColumnRowNumbers=function(e){e!=null&&e.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)},r.prototype.adjustRowNumbersAndGetCount=function(){var e=this.adjustRowNumbersByRow();if(e===0)return 0;for(var t=1;t<this.barcodeColumnCount+1;t++)for(var n=this.detectionResultColumns[t].getCodewords(),i=0;i<n.length;i++)n[i]!=null&&(n[i].hasValidRowNumber()||this.adjustRowNumbers(t,i,n));return e},r.prototype.adjustRowNumbersByRow=function(){this.adjustRowNumbersFromBothRI();var e=this.adjustRowNumbersFromLRI();return e+this.adjustRowNumbersFromRRI()},r.prototype.adjustRowNumbersFromBothRI=function(){if(!(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)){for(var e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords(),n=0;n<e.length;n++)if(e[n]!=null&&t[n]!=null&&e[n].getRowNumber()===t[n].getRowNumber())for(var i=1;i<=this.barcodeColumnCount;i++){var a=this.detectionResultColumns[i].getCodewords()[n];a!=null&&(a.setRowNumber(e[n].getRowNumber()),a.hasValidRowNumber()||(this.detectionResultColumns[i].getCodewords()[n]=null))}}},r.prototype.adjustRowNumbersFromRRI=function(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;for(var e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords(),n=0;n<t.length;n++)if(t[n]!=null)for(var i=t[n].getRowNumber(),a=0,o=this.barcodeColumnCount+1;o>0&&a<this.ADJUST_ROW_NUMBER_SKIP;o--){var s=this.detectionResultColumns[o].getCodewords()[n];s!=null&&(a=r.adjustRowNumberIfValid(i,a,s),s.hasValidRowNumber()||e++)}return e},r.prototype.adjustRowNumbersFromLRI=function(){if(this.detectionResultColumns[0]==null)return 0;for(var e=0,t=this.detectionResultColumns[0].getCodewords(),n=0;n<t.length;n++)if(t[n]!=null)for(var i=t[n].getRowNumber(),a=0,o=1;o<this.barcodeColumnCount+1&&a<this.ADJUST_ROW_NUMBER_SKIP;o++){var s=this.detectionResultColumns[o].getCodewords()[n];s!=null&&(a=r.adjustRowNumberIfValid(i,a,s),s.hasValidRowNumber()||e++)}return e},r.adjustRowNumberIfValid=function(e,t,n){return n==null||n.hasValidRowNumber()||(n.isValidRowNumber(e)?(n.setRowNumber(e),t=0):++t),t},r.prototype.adjustRowNumbers=function(e,t,n){var i,a;if(this.detectionResultColumns[e-1]!=null){var o=n[t],s=this.detectionResultColumns[e-1].getCodewords(),l=s;this.detectionResultColumns[e+1]!=null&&(l=this.detectionResultColumns[e+1].getCodewords());var u=new Array(14);u[2]=s[t],u[3]=l[t],t>0&&(u[0]=n[t-1],u[4]=s[t-1],u[5]=l[t-1]),t>1&&(u[8]=n[t-2],u[10]=s[t-2],u[11]=l[t-2]),t<n.length-1&&(u[1]=n[t+1],u[6]=s[t+1],u[7]=l[t+1]),t<n.length-2&&(u[9]=n[t+2],u[12]=s[t+2],u[13]=l[t+2]);try{for(var c=Pc(u),f=c.next();!f.done;f=c.next()){var p=f.value;if(r.adjustRowNumber(o,p))return}}catch(h){i={error:h}}finally{try{f&&!f.done&&(a=c.return)&&a.call(c)}finally{if(i)throw i.error}}}},r.adjustRowNumber=function(e,t){return t==null?!1:t.hasValidRowNumber()&&t.getBucket()===e.getBucket()?(e.setRowNumber(t.getRowNumber()),!0):!1},r.prototype.getBarcodeColumnCount=function(){return this.barcodeColumnCount},r.prototype.getBarcodeRowCount=function(){return this.barcodeMetadata.getRowCount()},r.prototype.getBarcodeECLevel=function(){return this.barcodeMetadata.getErrorCorrectionLevel()},r.prototype.setBoundingBox=function(e){this.boundingBox=e},r.prototype.getBoundingBox=function(){return this.boundingBox},r.prototype.setDetectionResultColumn=function(e,t){this.detectionResultColumns[e]=t},r.prototype.getDetectionResultColumn=function(e){return this.detectionResultColumns[e]},r.prototype.toString=function(){var e=this.detectionResultColumns[0];e==null&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);for(var t=new ui,n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(var i=0;i<this.barcodeColumnCount+2;i++){if(this.detectionResultColumns[i]==null){t.format(" | ");continue}var a=this.detectionResultColumns[i].getCodewords()[n];if(a==null){t.format(" | ");continue}t.format(" %3d|%3d",a.getRowNumber(),a.getValue())}t.format("%n")}return t.toString()},r}(),Vc=function(){function r(e,t,n,i){this.rowNumber=r.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(i)}return r.prototype.hasValidRowNumber=function(){return this.isValidRowNumber(this.rowNumber)},r.prototype.isValidRowNumber=function(e){return e!==r.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3},r.prototype.setRowNumberAsRowIndicatorColumn=function(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))},r.prototype.getWidth=function(){return this.endX-this.startX},r.prototype.getStartX=function(){return this.startX},r.prototype.getEndX=function(){return this.endX},r.prototype.getBucket=function(){return this.bucket},r.prototype.getValue=function(){return this.value},r.prototype.getRowNumber=function(){return this.rowNumber},r.prototype.setRowNumber=function(e){this.rowNumber=e},r.prototype.toString=function(){return this.rowNumber+"|"+this.value},r.BARCODE_ROW_UNKNOWN=-1,r}(),Bc=function(){function r(){}return r.initialize=function(){for(var e=0;e<K.SYMBOL_TABLE.length;e++)for(var t=K.SYMBOL_TABLE[e],n=t&1,i=0;i<K.BARS_IN_MODULE;i++){for(var a=0;(t&1)===n;)a+=1,t>>=1;n=t&1,r.RATIOS_TABLE[e]||(r.RATIOS_TABLE[e]=new Array(K.BARS_IN_MODULE)),r.RATIOS_TABLE[e][K.BARS_IN_MODULE-i-1]=Math.fround(a/K.MODULES_IN_CODEWORD)}this.bSymbolTableReady=!0},r.getDecodedValue=function(e){var t=r.getDecodedCodewordValue(r.sampleBitCounts(e));return t!==-1?t:r.getClosestDecodedValue(e)},r.sampleBitCounts=function(e){for(var t=Q.sum(e),n=new Int32Array(K.BARS_IN_MODULE),i=0,a=0,o=0;o<K.MODULES_IN_CODEWORD;o++){var s=t/(2*K.MODULES_IN_CODEWORD)+o*t/K.MODULES_IN_CODEWORD;a+e[i]<=s&&(a+=e[i],i++),n[i]++}return n},r.getDecodedCodewordValue=function(e){var t=r.getBitValue(e);return K.getCodeword(t)===-1?-1:t},r.getBitValue=function(e){for(var t=0,n=0;n<e.length;n++)for(var i=0;i<e[n];i++)t=t<<1|(n%2===0?1:0);return Math.trunc(t)},r.getClosestDecodedValue=function(e){var t=Q.sum(e),n=new Array(K.BARS_IN_MODULE);if(t>1)for(var i=0;i<n.length;i++)n[i]=Math.fround(e[i]/t);var a=Yn.MAX_VALUE,o=-1;this.bSymbolTableReady||r.initialize();for(var s=0;s<r.RATIOS_TABLE.length;s++){for(var l=0,u=r.RATIOS_TABLE[s],c=0;c<K.BARS_IN_MODULE;c++){var f=Math.fround(u[c]-n[c]);if(l+=Math.fround(f*f),l>=a)break}l<a&&(a=l,o=K.SYMBOL_TABLE[s])}return o},r.bSymbolTableReady=!1,r.RATIOS_TABLE=new Array(K.SYMBOL_TABLE.length).map(function(e){return new Array(K.BARS_IN_MODULE)}),r}(),Lc=function(){function r(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}return r.prototype.getSegmentIndex=function(){return this.segmentIndex},r.prototype.setSegmentIndex=function(e){this.segmentIndex=e},r.prototype.getFileId=function(){return this.fileId},r.prototype.setFileId=function(e){this.fileId=e},r.prototype.getOptionalData=function(){return this.optionalData},r.prototype.setOptionalData=function(e){this.optionalData=e},r.prototype.isLastSegment=function(){return this.lastSegment},r.prototype.setLastSegment=function(e){this.lastSegment=e},r.prototype.getSegmentCount=function(){return this.segmentCount},r.prototype.setSegmentCount=function(e){this.segmentCount=e},r.prototype.getSender=function(){return this.sender||null},r.prototype.setSender=function(e){this.sender=e},r.prototype.getAddressee=function(){return this.addressee||null},r.prototype.setAddressee=function(e){this.addressee=e},r.prototype.getFileName=function(){return this.fileName},r.prototype.setFileName=function(e){this.fileName=e},r.prototype.getFileSize=function(){return this.fileSize},r.prototype.setFileSize=function(e){this.fileSize=e},r.prototype.getChecksum=function(){return this.checksum},r.prototype.setChecksum=function(e){this.checksum=e},r.prototype.getTimestamp=function(){return this.timestamp},r.prototype.setTimestamp=function(e){this.timestamp=e},r}(),qa=function(){function r(){}return r.parseLong=function(e,t){return t===void 0&&(t=void 0),parseInt(e,t)},r}(),zc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),kc=function(r){zc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="NullPointerException",e}(Ue),Rc=function(){function r(){}return r.prototype.writeBytes=function(e){this.writeBytesOffset(e,0,e.length)},r.prototype.writeBytesOffset=function(e,t,n){if(e==null)throw new kc;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new Xn;if(n===0)return;for(var i=0;i<n;i++)this.write(e[t+i])},r.prototype.flush=function(){},r.prototype.close=function(){},r}(),Uc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Hc=function(r){Uc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(Ue),Gc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Xc=function(r){Gc(e,r);function e(t){t===void 0&&(t=32);var n=r.call(this)||this;if(n.count=0,t<0)throw new k("Negative initial size: "+t);return n.buf=new Uint8Array(t),n}return e.prototype.ensureCapacity=function(t){t-this.buf.length>0&&this.grow(t)},e.prototype.grow=function(t){var n=this.buf.length,i=n<<1;if(i-t<0&&(i=t),i<0){if(t<0)throw new Hc;i=$.MAX_VALUE}this.buf=he.copyOfUint8Array(this.buf,i)},e.prototype.write=function(t){this.ensureCapacity(this.count+1),this.buf[this.count]=t,this.count+=1},e.prototype.writeBytesOffset=function(t,n,i){if(n<0||n>t.length||i<0||n+i-t.length>0)throw new Xn;this.ensureCapacity(this.count+i),se.arraycopy(t,n,this.buf,this.count,i),this.count+=i},e.prototype.writeTo=function(t){t.writeBytesOffset(this.buf,0,this.count)},e.prototype.reset=function(){this.count=0},e.prototype.toByteArray=function(){return he.copyOfUint8Array(this.buf,this.count)},e.prototype.size=function(){return this.count},e.prototype.toString=function(t){return t?typeof t=="string"?this.toString_string(t):this.toString_number(t):this.toString_void()},e.prototype.toString_void=function(){return new String(this.buf).toString()},e.prototype.toString_string=function(t){return new String(this.buf).toString()},e.prototype.toString_number=function(t){return new String(this.buf).toString()},e.prototype.close=function(){},e}(Rc),oe;(function(r){r[r.ALPHA=0]="ALPHA",r[r.LOWER=1]="LOWER",r[r.MIXED=2]="MIXED",r[r.PUNCT=3]="PUNCT",r[r.ALPHA_SHIFT=4]="ALPHA_SHIFT",r[r.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(oe||(oe={}));function $a(){if(typeof window<"u")return window.BigInt||null;if(typeof global<"u")return global.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}var rn;function ut(r){if(typeof rn>"u"&&(rn=$a()),rn===null)throw new Error("BigInt is not supported!");return rn(r)}function qc(){var r=[];r[0]=ut(1);var e=ut(900);r[1]=e;for(var t=2;t<16;t++)r[t]=r[t-1]*e;return r}var $c=function(){function r(){}return r.decode=function(e,t){var n=new q(""),i=pe.ISO8859_1;n.enableDecoding(i);for(var a=1,o=e[a++],s=new Lc;a<e[0];){switch(o){case r.TEXT_COMPACTION_MODE_LATCH:a=r.textCompaction(e,a,n);break;case r.BYTE_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:a=r.byteCompaction(o,e,i,a,n);break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[a++]);break;case r.NUMERIC_COMPACTION_MODE_LATCH:a=r.numericCompaction(e,a,n);break;case r.ECI_CHARSET:pe.getCharacterSetECIByValue(e[a++]);break;case r.ECI_GENERAL_PURPOSE:a+=2;break;case r.ECI_USER_DEFINED:a++;break;case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:a=r.decodeMacroBlock(e,a,s);break;case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:throw new F;default:a--,a=r.textCompaction(e,a,n);break}if(a<e.length)o=e[a++];else throw F.getFormatInstance()}if(n.length()===0)throw F.getFormatInstance();var l=new Yr(null,n.toString(),null,t);return l.setOther(s),l},r.decodeMacroBlock=function(e,t,n){if(t+r.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw F.getFormatInstance();for(var i=new Int32Array(r.NUMBER_OF_SEQUENCE_CODEWORDS),a=0;a<r.NUMBER_OF_SEQUENCE_CODEWORDS;a++,t++)i[a]=e[t];n.setSegmentIndex($.parseInt(r.decodeBase900toBase10(i,r.NUMBER_OF_SEQUENCE_CODEWORDS)));var o=new q;t=r.textCompaction(e,t,o),n.setFileId(o.toString());var s=-1;for(e[t]===r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(s=t+1);t<e[0];)switch(e[t]){case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case r.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:var l=new q;t=r.textCompaction(e,t+1,l),n.setFileName(l.toString());break;case r.MACRO_PDF417_OPTIONAL_FIELD_SENDER:var u=new q;t=r.textCompaction(e,t+1,u),n.setSender(u.toString());break;case r.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:var c=new q;t=r.textCompaction(e,t+1,c),n.setAddressee(c.toString());break;case r.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:var f=new q;t=r.numericCompaction(e,t+1,f),n.setSegmentCount($.parseInt(f.toString()));break;case r.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:var p=new q;t=r.numericCompaction(e,t+1,p),n.setTimestamp(qa.parseLong(p.toString()));break;case r.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:var h=new q;t=r.numericCompaction(e,t+1,h),n.setChecksum($.parseInt(h.toString()));break;case r.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:var g=new q;t=r.numericCompaction(e,t+1,g),n.setFileSize(qa.parseLong(g.toString()));break;default:throw F.getFormatInstance()}break;case r.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw F.getFormatInstance()}if(s!==-1){var x=t-s;n.isLastSegment()&&x--,n.setOptionalData(he.copyOfRange(e,s,s+x))}return t},r.textCompaction=function(e,t,n){for(var i=new Int32Array((e[0]-t)*2),a=new Int32Array((e[0]-t)*2),o=0,s=!1;t<e[0]&&!s;){var l=e[t++];if(l<r.TEXT_COMPACTION_MODE_LATCH)i[o]=l/30,i[o+1]=l%30,o+=2;else switch(l){case r.TEXT_COMPACTION_MODE_LATCH:i[o++]=r.TEXT_COMPACTION_MODE_LATCH;break;case r.BYTE_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.NUMERIC_COMPACTION_MODE_LATCH:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:t--,s=!0;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i[o]=r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,l=e[t++],a[o]=l,o++;break}}return r.decodeTextCompaction(i,a,o,n),t},r.decodeTextCompaction=function(e,t,n,i){for(var a=oe.ALPHA,o=oe.ALPHA,s=0;s<n;){var l=e[s],u="";switch(a){case oe.ALPHA:if(l<26)u=String.fromCharCode(65+l);else switch(l){case 26:u=" ";break;case r.LL:a=oe.LOWER;break;case r.ML:a=oe.MIXED;break;case r.PS:o=a,a=oe.PUNCT_SHIFT;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:a=oe.ALPHA;break}break;case oe.LOWER:if(l<26)u=String.fromCharCode(97+l);else switch(l){case 26:u=" ";break;case r.AS:o=a,a=oe.ALPHA_SHIFT;break;case r.ML:a=oe.MIXED;break;case r.PS:o=a,a=oe.PUNCT_SHIFT;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:a=oe.ALPHA;break}break;case oe.MIXED:if(l<r.PL)u=r.MIXED_CHARS[l];else switch(l){case r.PL:a=oe.PUNCT;break;case 26:u=" ";break;case r.LL:a=oe.LOWER;break;case r.AL:a=oe.ALPHA;break;case r.PS:o=a,a=oe.PUNCT_SHIFT;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:a=oe.ALPHA;break}break;case oe.PUNCT:if(l<r.PAL)u=r.PUNCT_CHARS[l];else switch(l){case r.PAL:a=oe.ALPHA;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:a=oe.ALPHA;break}break;case oe.ALPHA_SHIFT:if(a=o,l<26)u=String.fromCharCode(65+l);else switch(l){case 26:u=" ";break;case r.TEXT_COMPACTION_MODE_LATCH:a=oe.ALPHA;break}break;case oe.PUNCT_SHIFT:if(a=o,l<r.PAL)u=r.PUNCT_CHARS[l];else switch(l){case r.PAL:a=oe.ALPHA;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:a=oe.ALPHA;break}break}u!==""&&i.append(u),s++}},r.byteCompaction=function(e,t,n,i,a){var o=new Xc,s=0,l=0,u=!1;switch(e){case r.BYTE_COMPACTION_MODE_LATCH:for(var c=new Int32Array(6),f=t[i++];i<t[0]&&!u;)switch(c[s++]=f,l=900*l+f,f=t[i++],f){case r.TEXT_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH:case r.NUMERIC_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:i--,u=!0;break;default:if(s%5===0&&s>0){for(var p=0;p<6;++p)o.write(Number(ut(l)>>ut(8*(5-p))));l=0,s=0}break}i===t[0]&&f<r.TEXT_COMPACTION_MODE_LATCH&&(c[s++]=f);for(var h=0;h<s;h++)o.write(c[h]);break;case r.BYTE_COMPACTION_MODE_LATCH_6:for(;i<t[0]&&!u;){var g=t[i++];if(g<r.TEXT_COMPACTION_MODE_LATCH)s++,l=900*l+g;else switch(g){case r.TEXT_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH:case r.NUMERIC_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:i--,u=!0;break}if(s%5===0&&s>0){for(var p=0;p<6;++p)o.write(Number(ut(l)>>ut(8*(5-p))));l=0,s=0}}break}return a.append($e.decode(o.toByteArray(),n)),i},r.numericCompaction=function(e,t,n){for(var i=0,a=!1,o=new Int32Array(r.MAX_NUMERIC_CODEWORDS);t<e[0]&&!a;){var s=e[t++];if(t===e[0]&&(a=!0),s<r.TEXT_COMPACTION_MODE_LATCH)o[i]=s,i++;else switch(s){case r.TEXT_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:t--,a=!0;break}(i%r.MAX_NUMERIC_CODEWORDS===0||s===r.NUMERIC_COMPACTION_MODE_LATCH||a)&&i>0&&(n.append(r.decodeBase900toBase10(o,i)),i=0)}return t},r.decodeBase900toBase10=function(e,t){for(var n=ut(0),i=0;i<t;i++)n+=r.EXP900[t-i-1]*ut(e[i]);var a=n.toString();if(a.charAt(0)!=="1")throw new F;return a.substring(1)},r.TEXT_COMPACTION_MODE_LATCH=900,r.BYTE_COMPACTION_MODE_LATCH=901,r.NUMERIC_COMPACTION_MODE_LATCH=902,r.BYTE_COMPACTION_MODE_LATCH_6=924,r.ECI_USER_DEFINED=925,r.ECI_GENERAL_PURPOSE=926,r.ECI_CHARSET=927,r.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,r.MACRO_PDF417_TERMINATOR=922,r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,r.MAX_NUMERIC_CODEWORDS=15,r.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,r.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,r.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,r.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,r.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,r.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,r.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,r.PL=25,r.LL=27,r.AS=27,r.ML=28,r.AL=28,r.PS=29,r.PAL=29,r.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
|
|
228
|
-
-.$/"|*()?{}'`,r.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",r.EXP900=$a()?qc():[],r.NUMBER_OF_SEQUENCE_CODEWORDS=2,r}(),xr=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Wc=function(){function r(){}return r.decode=function(e,t,n,i,a,o,s){for(var l=new li(e,t,n,i,a),u=null,c=null,f,p=!0;;p=!1){if(t!=null&&(u=r.getRowIndicatorColumn(e,l,t,!0,o,s)),i!=null&&(c=r.getRowIndicatorColumn(e,l,i,!1,o,s)),f=r.merge(u,c),f==null)throw N.getNotFoundInstance();var h=f.getBoundingBox();if(p&&h!=null&&(h.getMinY()<l.getMinY()||h.getMaxY()>l.getMaxY()))l=h;else break}f.setBoundingBox(l);var g=f.getBarcodeColumnCount()+1;f.setDetectionResultColumn(0,u),f.setDetectionResultColumn(g,c);for(var x=u!=null,C=1;C<=g;C++){var m=x?C:g-C;if(f.getDetectionResultColumn(m)===void 0){var w=void 0;m===0||m===g?w=new Xa(l,m===0):w=new Ga(l),f.setDetectionResultColumn(m,w);for(var _=-1,E=_,O=l.getMinY();O<=l.getMaxY();O++){if(_=r.getStartColumn(f,m,O,x),_<0||_>l.getMaxX()){if(E===-1)continue;_=E}var T=r.detectCodeword(e,l.getMinX(),l.getMaxX(),x,_,O,o,s);T!=null&&(w.setCodeword(O,T),E=_,o=Math.min(o,T.getWidth()),s=Math.max(s,T.getWidth()))}}}return r.createDecoderResult(f)},r.merge=function(e,t){if(e==null&&t==null)return null;var n=r.getBarcodeMetadata(e,t);if(n==null)return null;var i=li.merge(r.adjustBoundingBox(e),r.adjustBoundingBox(t));return new Fc(n,i)},r.adjustBoundingBox=function(e){var t,n;if(e==null)return null;var i=e.getRowHeights();if(i==null)return null;var a=r.getMax(i),o=0;try{for(var s=xr(i),l=s.next();!l.done;l=s.next()){var u=l.value;if(o+=a-u,u>0)break}}catch(h){t={error:h}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}for(var c=e.getCodewords(),f=0;o>0&&c[f]==null;f++)o--;for(var p=0,f=i.length-1;f>=0&&(p+=a-i[f],!(i[f]>0));f--);for(var f=c.length-1;p>0&&c[f]==null;f--)p--;return e.getBoundingBox().addMissingRows(o,p,e.isLeft())},r.getMax=function(e){var t,n,i=-1;try{for(var a=xr(e),o=a.next();!o.done;o=a.next()){var s=o.value;i=Math.max(i,s)}}catch(l){t={error:l}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return i},r.getBarcodeMetadata=function(e,t){var n;if(e==null||(n=e.getBarcodeMetadata())==null)return t==null?null:t.getBarcodeMetadata();var i;return t==null||(i=t.getBarcodeMetadata())==null?n:n.getColumnCount()!==i.getColumnCount()&&n.getErrorCorrectionLevel()!==i.getErrorCorrectionLevel()&&n.getRowCount()!==i.getRowCount()?null:n},r.getRowIndicatorColumn=function(e,t,n,i,a,o){for(var s=new Xa(t,i),l=0;l<2;l++)for(var u=l===0?1:-1,c=Math.trunc(Math.trunc(n.getX())),f=Math.trunc(Math.trunc(n.getY()));f<=t.getMaxY()&&f>=t.getMinY();f+=u){var p=r.detectCodeword(e,0,e.getWidth(),i,c,f,a,o);p!=null&&(s.setCodeword(f,p),i?c=p.getStartX():c=p.getEndX())}return s},r.adjustCodewordCount=function(e,t){var n=t[0][1],i=n.getValue(),a=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-r.getNumberOfECCodeWords(e.getBarcodeECLevel());if(i.length===0){if(a<1||a>K.MAX_CODEWORDS_IN_BARCODE)throw N.getNotFoundInstance();n.setValue(a)}else i[0]!==a&&n.setValue(a)},r.createDecoderResult=function(e){var t=r.createBarcodeMatrix(e);r.adjustCodewordCount(e,t);for(var n=new Array,i=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),a=[],o=new Array,s=0;s<e.getBarcodeRowCount();s++)for(var l=0;l<e.getBarcodeColumnCount();l++){var u=t[s][l+1].getValue(),c=s*e.getBarcodeColumnCount()+l;u.length===0?n.push(c):u.length===1?i[c]=u[0]:(o.push(c),a.push(u))}for(var f=new Array(a.length),p=0;p<f.length;p++)f[p]=a[p];return r.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),i,K.toIntArray(n),K.toIntArray(o),f)},r.createDecoderResultFromAmbiguousValues=function(e,t,n,i,a){for(var o=new Int32Array(i.length),s=100;s-- >0;){for(var l=0;l<o.length;l++)t[i[l]]=a[l][o[l]];try{return r.decodeCodewords(t,e,n)}catch(c){var u=c instanceof Ce;if(!u)throw c}if(o.length===0)throw Ce.getChecksumInstance();for(var l=0;l<o.length;l++)if(o[l]<a[l].length-1){o[l]++;break}else if(o[l]=0,l===o.length-1)throw Ce.getChecksumInstance()}throw Ce.getChecksumInstance()},r.createBarcodeMatrix=function(e){for(var t,n,i,a,o=Array.from({length:e.getBarcodeRowCount()},function(){return new Array(e.getBarcodeColumnCount()+2)}),s=0;s<o.length;s++)for(var l=0;l<o[s].length;l++)o[s][l]=new gr;var u=0;try{for(var c=xr(e.getDetectionResultColumns()),f=c.next();!f.done;f=c.next()){var p=f.value;if(p!=null)try{for(var h=(i=void 0,xr(p.getCodewords())),g=h.next();!g.done;g=h.next()){var x=g.value;if(x!=null){var C=x.getRowNumber();if(C>=0){if(C>=o.length)continue;o[C][u].setValue(x.getValue())}}}}catch(m){i={error:m}}finally{try{g&&!g.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.error}}u++}}catch(m){t={error:m}}finally{try{f&&!f.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return o},r.isValidBarcodeColumn=function(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1},r.getStartColumn=function(e,t,n,i){var a,o,s=i?1:-1,l=null;if(r.isValidBarcodeColumn(e,t-s)&&(l=e.getDetectionResultColumn(t-s).getCodeword(n)),l!=null)return i?l.getEndX():l.getStartX();if(l=e.getDetectionResultColumn(t).getCodewordNearby(n),l!=null)return i?l.getStartX():l.getEndX();if(r.isValidBarcodeColumn(e,t-s)&&(l=e.getDetectionResultColumn(t-s).getCodewordNearby(n)),l!=null)return i?l.getEndX():l.getStartX();for(var u=0;r.isValidBarcodeColumn(e,t-s);){t-=s;try{for(var c=(a=void 0,xr(e.getDetectionResultColumn(t).getCodewords())),f=c.next();!f.done;f=c.next()){var p=f.value;if(p!=null)return(i?p.getEndX():p.getStartX())+s*u*(p.getEndX()-p.getStartX())}}catch(h){a={error:h}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(a)throw a.error}}u++}return i?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()},r.detectCodeword=function(e,t,n,i,a,o,s,l){a=r.adjustCodewordStartColumn(e,t,n,i,a,o);var u=r.getModuleBitCount(e,t,n,i,a,o);if(u==null)return null;var c,f=Q.sum(u);if(i)c=a+f;else{for(var p=0;p<u.length/2;p++){var h=u[p];u[p]=u[u.length-1-p],u[u.length-1-p]=h}c=a,a=c-f}if(!r.checkCodewordSkew(f,s,l))return null;var g=Bc.getDecodedValue(u),x=K.getCodeword(g);return x===-1?null:new Vc(a,c,r.getCodewordBucketNumber(g),x)},r.getModuleBitCount=function(e,t,n,i,a,o){for(var s=a,l=new Int32Array(8),u=0,c=i?1:-1,f=i;(i?s<n:s>=t)&&u<l.length;)e.get(s,o)===f?(l[u]++,s+=c):(u++,f=!f);return u===l.length||s===(i?n:t)&&u===l.length-1?l:null},r.getNumberOfECCodeWords=function(e){return 2<<e},r.adjustCodewordStartColumn=function(e,t,n,i,a,o){for(var s=a,l=i?-1:1,u=0;u<2;u++){for(;(i?s>=t:s<n)&&i===e.get(s,o);){if(Math.abs(a-s)>r.CODEWORD_SKEW_SIZE)return a;s+=l}l=-l,i=!i}return s},r.checkCodewordSkew=function(e,t,n){return t-r.CODEWORD_SKEW_SIZE<=e&&e<=n+r.CODEWORD_SKEW_SIZE},r.decodeCodewords=function(e,t,n){if(e.length===0)throw F.getFormatInstance();var i=1<<t+1,a=r.correctErrors(e,n,i);r.verifyCodewordCount(e,i);var o=$c.decode(e,""+t);return o.setErrorsCorrected(a),o.setErasures(n.length),o},r.correctErrors=function(e,t,n){if(t!=null&&t.length>n/2+r.MAX_ERRORS||n<0||n>r.MAX_EC_CODEWORDS)throw Ce.getChecksumInstance();return r.errorCorrection.decode(e,n,t)},r.verifyCodewordCount=function(e,t){if(e.length<4)throw F.getFormatInstance();var n=e[0];if(n>e.length)throw F.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw F.getFormatInstance()},r.getBitCountForCodeword=function(e){for(var t=new Int32Array(8),n=0,i=t.length-1;!((e&1)!==n&&(n=e&1,i--,i<0));)t[i]++,e>>=1;return t},r.getCodewordBucketNumber=function(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)},r.getCodewordBucketNumber_number=function(e){return r.getCodewordBucketNumber(r.getBitCountForCodeword(e))},r.getCodewordBucketNumber_Int32Array=function(e){return(e[0]-e[2]+e[4]-e[6]+9)%9},r.toString=function(e){for(var t=new ui,n=0;n<e.length;n++){t.format("Row %2d: ",n);for(var i=0;i<e[n].length;i++){var a=e[n][i];a.getValue().length===0?t.format(" ",null):t.format("%4d(%2d)",a.getValue()[0],a.getConfidence(a.getValue()[0]))}t.format("%n")}return t.toString()},r.CODEWORD_SKEW_SIZE=2,r.MAX_ERRORS=3,r.MAX_EC_CODEWORDS=512,r.errorCorrection=new Oc,r}(),jc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},fi=function(){function r(){}return r.prototype.decode=function(e,t){t===void 0&&(t=null);var n=r.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw N.getNotFoundInstance();return n[0]},r.prototype.decodeMultiple=function(e,t){t===void 0&&(t=null);try{return r.decode(e,t,!0)}catch(n){throw n instanceof F||n instanceof Ce?N.getNotFoundInstance():n}},r.decode=function(e,t,n){var i,a,o=new Array,s=mc.detectMultiple(e,t,n);try{for(var l=jc(s.getPoints()),u=l.next();!u.done;u=l.next()){var c=u.value,f=Wc.decode(s.getBits(),c[4],c[5],c[6],c[7],r.getMinCodewordWidth(c),r.getMaxCodewordWidth(c)),p=new Ne(f.getText(),f.getRawBytes(),void 0,c,B.PDF_417);p.putMetadata(Ae.ERROR_CORRECTION_LEVEL,f.getECLevel());var h=f.getOther();h!=null&&p.putMetadata(Ae.PDF417_EXTRA_METADATA,h),o.push(p)}}catch(g){i={error:g}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(i)throw i.error}}return o.map(function(g){return g})},r.getMaxWidth=function(e,t){return e==null||t==null?0:Math.trunc(Math.abs(e.getX()-t.getX()))},r.getMinWidth=function(e,t){return e==null||t==null?$.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))},r.getMaxCodewordWidth=function(e){return Math.floor(Math.max(Math.max(r.getMaxWidth(e[0],e[4]),r.getMaxWidth(e[6],e[2])*K.MODULES_IN_CODEWORD/K.MODULES_IN_STOP_PATTERN),Math.max(r.getMaxWidth(e[1],e[5]),r.getMaxWidth(e[7],e[3])*K.MODULES_IN_CODEWORD/K.MODULES_IN_STOP_PATTERN)))},r.getMinCodewordWidth=function(e){return Math.floor(Math.min(Math.min(r.getMinWidth(e[0],e[4]),r.getMinWidth(e[6],e[2])*K.MODULES_IN_CODEWORD/K.MODULES_IN_STOP_PATTERN),Math.min(r.getMinWidth(e[1],e[5]),r.getMinWidth(e[7],e[3])*K.MODULES_IN_CODEWORD/K.MODULES_IN_STOP_PATTERN)))},r.prototype.reset=function(){},r}(),Yc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Wa=function(r){Yc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ReaderException",e}(Ue),ja=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Zc=function(){function r(){}return r.prototype.decode=function(e,t){return this.setHints(t),this.decodeInternal(e)},r.prototype.decodeWithState=function(e){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(e)},r.prototype.setHints=function(e){this.hints=e;var t=e!=null&&e.get(ce.TRY_HARDER)!==void 0,n=e==null?null:e.get(ce.POSSIBLE_FORMATS),i=new Array;if(n!=null){var a=n.some(function(o){return o===B.UPC_A||o===B.UPC_E||o===B.EAN_13||o===B.EAN_8||o===B.CODABAR||o===B.CODE_39||o===B.CODE_93||o===B.CODE_128||o===B.ITF||o===B.RSS_14||o===B.RSS_EXPANDED});a&&!t&&i.push(new pr(e)),n.includes(B.QR_CODE)&&i.push(new si),n.includes(B.DATA_MATRIX)&&i.push(new oi),n.includes(B.AZTEC)&&i.push(new Jn),n.includes(B.PDF_417)&&i.push(new fi),a&&t&&i.push(new pr(e))}i.length===0&&(t||i.push(new pr(e)),i.push(new si),i.push(new oi),i.push(new Jn),i.push(new fi),t&&i.push(new pr(e))),this.readers=i},r.prototype.reset=function(){var e,t;if(this.readers!==null)try{for(var n=ja(this.readers),i=n.next();!i.done;i=n.next()){var a=i.value;a.reset()}}catch(o){e={error:o}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},r.prototype.decodeInternal=function(e){var t,n;if(this.readers===null)throw new Wa("No readers where selected, nothing can be read.");try{for(var i=ja(this.readers),a=i.next();!a.done;a=i.next()){var o=a.value;try{return o.decode(e,this.hints)}catch(s){if(s instanceof Wa)continue}}}catch(s){t={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}throw new N("No MultiFormat Readers were able to detect the code.")},r}(),Kc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){Kc(e,r);function e(t,n){t===void 0&&(t=null),n===void 0&&(n=500);var i=this,a=new Zc;return a.setHints(t),i=r.call(this,a,n)||this,i}return e.prototype.decodeBitmap=function(t){return this.reader.decodeWithState(t)},e})(zt);var Qc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){Qc(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new fi,t)||this}return e})(zt);var Jc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){Jc(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new si,t)||this}return e})(zt);var di;(function(r){r[r.ERROR_CORRECTION=0]="ERROR_CORRECTION",r[r.CHARACTER_SET=1]="CHARACTER_SET",r[r.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",r[r.DATA_MATRIX_COMPACT=3]="DATA_MATRIX_COMPACT",r[r.MIN_SIZE=4]="MIN_SIZE",r[r.MAX_SIZE=5]="MAX_SIZE",r[r.MARGIN=6]="MARGIN",r[r.PDF417_COMPACT=7]="PDF417_COMPACT",r[r.PDF417_COMPACTION=8]="PDF417_COMPACTION",r[r.PDF417_DIMENSIONS=9]="PDF417_DIMENSIONS",r[r.AZTEC_LAYERS=10]="AZTEC_LAYERS",r[r.QR_VERSION=11]="QR_VERSION",r[r.GS1_FORMAT=12]="GS1_FORMAT",r[r.FORCE_C40=13]="FORCE_C40"})(di||(di={}));const nn=di;var Ya=function(){function r(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new ot(e,Int32Array.from([1])))}return r.prototype.buildGenerator=function(e){var t=this.cachedGenerators;if(e>=t.length)for(var n=t[t.length-1],i=this.field,a=t.length;a<=e;a++){var o=n.multiply(new ot(i,Int32Array.from([1,i.exp(a-1+i.getGeneratorBase())])));t.push(o),n=o}return t[e]},r.prototype.encode=function(e,t){if(t===0)throw new k("No error correction bytes");var n=e.length-t;if(n<=0)throw new k("No data bytes provided");var i=this.buildGenerator(t),a=new Int32Array(n);se.arraycopy(e,0,a,0,n);var o=new ot(this.field,a);o=o.multiplyByMonomial(t,1);for(var s=o.divide(i)[1],l=s.getCoefficients(),u=t-l.length,c=0;c<u;c++)e[n+c]=0;se.arraycopy(l,0,e,n+u,l.length)},r}(),yr=function(){function r(){}return r.applyMaskPenaltyRule1=function(e){return r.applyMaskPenaltyRule1Internal(e,!0)+r.applyMaskPenaltyRule1Internal(e,!1)},r.applyMaskPenaltyRule2=function(e){for(var t=0,n=e.getArray(),i=e.getWidth(),a=e.getHeight(),o=0;o<a-1;o++)for(var s=n[o],l=0;l<i-1;l++){var u=s[l];u===s[l+1]&&u===n[o+1][l]&&u===n[o+1][l+1]&&t++}return r.N2*t},r.applyMaskPenaltyRule3=function(e){for(var t=0,n=e.getArray(),i=e.getWidth(),a=e.getHeight(),o=0;o<a;o++)for(var s=0;s<i;s++){var l=n[o];s+6<i&&l[s]===1&&l[s+1]===0&&l[s+2]===1&&l[s+3]===1&&l[s+4]===1&&l[s+5]===0&&l[s+6]===1&&(r.isWhiteHorizontal(l,s-4,s)||r.isWhiteHorizontal(l,s+7,s+11))&&t++,o+6<a&&n[o][s]===1&&n[o+1][s]===0&&n[o+2][s]===1&&n[o+3][s]===1&&n[o+4][s]===1&&n[o+5][s]===0&&n[o+6][s]===1&&(r.isWhiteVertical(n,s,o-4,o)||r.isWhiteVertical(n,s,o+7,o+11))&&t++}return t*r.N3},r.isWhiteHorizontal=function(e,t,n){t=Math.max(t,0),n=Math.min(n,e.length);for(var i=t;i<n;i++)if(e[i]===1)return!1;return!0},r.isWhiteVertical=function(e,t,n,i){n=Math.max(n,0),i=Math.min(i,e.length);for(var a=n;a<i;a++)if(e[a][t]===1)return!1;return!0},r.applyMaskPenaltyRule4=function(e){for(var t=0,n=e.getArray(),i=e.getWidth(),a=e.getHeight(),o=0;o<a;o++)for(var s=n[o],l=0;l<i;l++)s[l]===1&&t++;var u=e.getHeight()*e.getWidth(),c=Math.floor(Math.abs(t*2-u)*10/u);return c*r.N4},r.getDataMaskBit=function(e,t,n){var i,a;switch(e){case 0:i=n+t&1;break;case 1:i=n&1;break;case 2:i=t%3;break;case 3:i=(n+t)%3;break;case 4:i=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:a=n*t,i=(a&1)+a%3;break;case 6:a=n*t,i=(a&1)+a%3&1;break;case 7:a=n*t,i=a%3+(n+t&1)&1;break;default:throw new k("Invalid mask pattern: "+e)}return i===0},r.applyMaskPenaltyRule1Internal=function(e,t){for(var n=0,i=t?e.getHeight():e.getWidth(),a=t?e.getWidth():e.getHeight(),o=e.getArray(),s=0;s<i;s++){for(var l=0,u=-1,c=0;c<a;c++){var f=t?o[s][c]:o[c][s];f===u?l++:(l>=5&&(n+=r.N1+(l-5)),l=1,u=f)}l>=5&&(n+=r.N1+(l-5))}return n},r.N1=3,r.N2=3,r.N3=40,r.N4=10,r}(),ef=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},tf=function(){function r(e,t){this.width=e,this.height=t;for(var n=new Array(t),i=0;i!==t;i++)n[i]=new Uint8Array(e);this.bytes=n}return r.prototype.getHeight=function(){return this.height},r.prototype.getWidth=function(){return this.width},r.prototype.get=function(e,t){return this.bytes[t][e]},r.prototype.getArray=function(){return this.bytes},r.prototype.setNumber=function(e,t,n){this.bytes[t][e]=n},r.prototype.setBoolean=function(e,t,n){this.bytes[t][e]=n?1:0},r.prototype.clear=function(e){var t,n;try{for(var i=ef(this.bytes),a=i.next();!a.done;a=i.next()){var o=a.value;he.fill(o,e)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;if(this.width!==t.width||this.height!==t.height)return!1;for(var n=0,i=this.height;n<i;++n)for(var a=this.bytes[n],o=t.bytes[n],s=0,l=this.width;s<l;++s)if(a[s]!==o[s])return!1;return!0},r.prototype.toString=function(){for(var e=new q,t=0,n=this.height;t<n;++t){for(var i=this.bytes[t],a=0,o=this.width;a<o;++a)switch(i[a]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(`
|
|
229
|
-
`)}return e.toString()},r}(),hi=function(){function r(){this.maskPattern=-1}return r.prototype.getMode=function(){return this.mode},r.prototype.getECLevel=function(){return this.ecLevel},r.prototype.getVersion=function(){return this.version},r.prototype.getMaskPattern=function(){return this.maskPattern},r.prototype.getMatrix=function(){return this.matrix},r.prototype.toString=function(){var e=new
|
|
241
|
+
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],r.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"],r}(),Q=function(){function r(){}return r.round=function(e){return isNaN(e)?0:e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0},r.distance=function(e,t,n,i){var a=e-n,o=t-i;return Math.sqrt(a*a+o*o)},r.sum=function(e){for(var t=0,n=0,i=e.length;n!==i;n++){var a=e[n];t+=a}return t},r}(),Yn=function(){function r(){}return r.floatToIntBits=function(e){return e},r.MAX_VALUE=Number.MAX_SAFE_INTEGER,r}(),z=function(){function r(e,t){this.x=e,this.y=t}return r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.equals=function(e){if(e instanceof r){var t=e;return this.x===t.x&&this.y===t.y}return!1},r.prototype.hashCode=function(){return 31*Yn.floatToIntBits(this.x)+Yn.floatToIntBits(this.y)},r.prototype.toString=function(){return"("+this.x+","+this.y+")"},r.orderBestPatterns=function(e){var t=this.distance(e[0],e[1]),n=this.distance(e[1],e[2]),i=this.distance(e[0],e[2]),a,o,s;if(n>=t&&n>=i?(o=e[0],a=e[1],s=e[2]):i>=n&&i>=t?(o=e[1],a=e[0],s=e[2]):(o=e[2],a=e[0],s=e[1]),this.crossProductZ(a,o,s)<0){var l=a;a=s,s=l}e[0]=a,e[1]=o,e[2]=s},r.distance=function(e,t){return Q.distance(e.x,e.y,t.x,t.y)},r.crossProductZ=function(e,t,n){var i=t.x,a=t.y;return(n.x-i)*(e.y-a)-(n.y-a)*(e.x-i)},r}(),Zn=function(){function r(e,t){this.bits=e,this.points=t}return r.prototype.getBits=function(){return this.bits},r.prototype.getPoints=function(){return this.points},r}(),ql=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Wl=function(r){ql(e,r);function e(t,n,i,a,o){var s=r.call(this,t,n)||this;return s.compact=i,s.nbDatablocks=a,s.nbLayers=o,s}return e.prototype.getNbLayers=function(){return this.nbLayers},e.prototype.getNbDatablocks=function(){return this.nbDatablocks},e.prototype.isCompact=function(){return this.compact},e}(Zn),Kn=function(){function r(e,t,n,i){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=r.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),i==null&&(i=e.getHeight()/2|0);var a=t/2|0;if(this.leftInit=n-a,this.rightInit=n+a,this.upInit=i-a,this.downInit=i+a,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new N}return r.prototype.detect=function(){for(var e=this.leftInit,t=this.rightInit,n=this.upInit,i=this.downInit,a=!1,o=!0,s=!1,l=!1,u=!1,c=!1,d=!1,p=this.width,h=this.height;o;){o=!1;for(var g=!0;(g||!l)&&t<p;)g=this.containsBlackPoint(n,i,t,!1),g?(t++,o=!0,l=!0):l||t++;if(t>=p){a=!0;break}for(var x=!0;(x||!u)&&i<h;)x=this.containsBlackPoint(e,t,i,!0),x?(i++,o=!0,u=!0):u||i++;if(i>=h){a=!0;break}for(var C=!0;(C||!c)&&e>=0;)C=this.containsBlackPoint(n,i,e,!1),C?(e--,o=!0,c=!0):c||e--;if(e<0){a=!0;break}for(var w=!0;(w||!d)&&n>=0;)w=this.containsBlackPoint(e,t,n,!0),w?(n--,o=!0,d=!0):d||n--;if(n<0){a=!0;break}o&&(s=!0)}if(!a&&s){for(var m=t-e,_=null,E=1;_===null&&E<m;E++)_=this.getBlackPointOnSegment(e,i-E,e+E,i);if(_==null)throw new N;for(var S=null,E=1;S===null&&E<m;E++)S=this.getBlackPointOnSegment(e,n+E,e+E,n);if(S==null)throw new N;for(var T=null,E=1;T===null&&E<m;E++)T=this.getBlackPointOnSegment(t,n+E,t-E,n);if(T==null)throw new N;for(var D=null,E=1;D===null&&E<m;E++)D=this.getBlackPointOnSegment(t,i-E,t-E,i);if(D==null)throw new N;return this.centerEdges(D,_,T,S)}else throw new N},r.prototype.getBlackPointOnSegment=function(e,t,n,i){for(var a=Q.round(Q.distance(e,t,n,i)),o=(n-e)/a,s=(i-t)/a,l=this.image,u=0;u<a;u++){var c=Q.round(e+u*o),d=Q.round(t+u*s);if(l.get(c,d))return new z(c,d)}return null},r.prototype.centerEdges=function(e,t,n,i){var a=e.getX(),o=e.getY(),s=t.getX(),l=t.getY(),u=n.getX(),c=n.getY(),d=i.getX(),p=i.getY(),h=r.CORR;return a<this.width/2?[new z(d-h,p+h),new z(s+h,l+h),new z(u-h,c-h),new z(a+h,o-h)]:[new z(d+h,p+h),new z(s+h,l-h),new z(u-h,c+h),new z(a-h,o-h)]},r.prototype.containsBlackPoint=function(e,t,n,i){var a=this.image;if(i){for(var o=e;o<=t;o++)if(a.get(o,n))return!0}else for(var s=e;s<=t;s++)if(a.get(n,s))return!0;return!1},r.INIT_SIZE=10,r.CORR=1,r}(),ya=function(){function r(){}return r.checkAndNudgePoints=function(e,t){for(var n=e.getWidth(),i=e.getHeight(),a=!0,o=0;o<t.length&&a;o+=2){var s=Math.floor(t[o]),l=Math.floor(t[o+1]);if(s<-1||s>n||l<-1||l>i)throw new N;a=!1,s===-1?(t[o]=0,a=!0):s===n&&(t[o]=n-1,a=!0),l===-1?(t[o+1]=0,a=!0):l===i&&(t[o+1]=i-1,a=!0)}a=!0;for(var o=t.length-2;o>=0&&a;o-=2){var s=Math.floor(t[o]),l=Math.floor(t[o+1]);if(s<-1||s>n||l<-1||l>i)throw new N;a=!1,s===-1?(t[o]=0,a=!0):s===n&&(t[o]=n-1,a=!0),l===-1?(t[o+1]=0,a=!0):l===i&&(t[o+1]=i-1,a=!0)}},r}(),Ca=function(){function r(e,t,n,i,a,o,s,l,u){this.a11=e,this.a21=t,this.a31=n,this.a12=i,this.a22=a,this.a32=o,this.a13=s,this.a23=l,this.a33=u}return r.quadrilateralToQuadrilateral=function(e,t,n,i,a,o,s,l,u,c,d,p,h,g,x,C){var w=r.quadrilateralToSquare(e,t,n,i,a,o,s,l),m=r.squareToQuadrilateral(u,c,d,p,h,g,x,C);return m.times(w)},r.prototype.transformPoints=function(e){for(var t=e.length,n=this.a11,i=this.a12,a=this.a13,o=this.a21,s=this.a22,l=this.a23,u=this.a31,c=this.a32,d=this.a33,p=0;p<t;p+=2){var h=e[p],g=e[p+1],x=a*h+l*g+d;e[p]=(n*h+o*g+u)/x,e[p+1]=(i*h+s*g+c)/x}},r.prototype.transformPointsWithValues=function(e,t){for(var n=this.a11,i=this.a12,a=this.a13,o=this.a21,s=this.a22,l=this.a23,u=this.a31,c=this.a32,d=this.a33,p=e.length,h=0;h<p;h++){var g=e[h],x=t[h],C=a*g+l*x+d;e[h]=(n*g+o*x+u)/C,t[h]=(i*g+s*x+c)/C}},r.squareToQuadrilateral=function(e,t,n,i,a,o,s,l){var u=e-n+a-s,c=t-i+o-l;if(u===0&&c===0)return new r(n-e,a-n,e,i-t,o-i,t,0,0,1);var d=n-a,p=s-a,h=i-o,g=l-o,x=d*g-p*h,C=(u*g-p*c)/x,w=(d*c-u*h)/x;return new r(n-e+C*n,s-e+w*s,e,i-t+C*i,l-t+w*l,t,C,w,1)},r.quadrilateralToSquare=function(e,t,n,i,a,o,s,l){return r.squareToQuadrilateral(e,t,n,i,a,o,s,l).buildAdjoint()},r.prototype.buildAdjoint=function(){return new r(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)},r.prototype.times=function(e){return new r(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)},r}(),jl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Yl=function(r){jl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.sampleGrid=function(t,n,i,a,o,s,l,u,c,d,p,h,g,x,C,w,m,_,E){var S=Ca.quadrilateralToQuadrilateral(a,o,s,l,u,c,d,p,h,g,x,C,w,m,_,E);return this.sampleGridWithTransform(t,n,i,S)},e.prototype.sampleGridWithTransform=function(t,n,i,a){if(n<=0||i<=0)throw new N;for(var o=new tt(n,i),s=new Float32Array(2*n),l=0;l<i;l++){for(var u=s.length,c=l+.5,d=0;d<u;d+=2)s[d]=d/2+.5,s[d+1]=c;a.transformPoints(s),ya.checkAndNudgePoints(t,s);try{for(var d=0;d<u;d+=2)t.get(Math.floor(s[d]),Math.floor(s[d+1]))&&o.set(d/2,l)}catch{throw new N}}return o},e}(ya),Qn=function(){function r(){}return r.setGridSampler=function(e){r.gridSampler=e},r.getInstance=function(){return r.gridSampler},r.gridSampler=new Yl,r}(),Ge=function(){function r(e,t){this.x=e,this.y=t}return r.prototype.toResultPoint=function(){return new z(this.getX(),this.getY())},r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r}(),Zl=function(){function r(e){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=e}return r.prototype.detect=function(){return this.detectMirror(!1)},r.prototype.detectMirror=function(e){var t=this.getMatrixCenter(),n=this.getBullsEyeCorners(t);if(e){var i=n[0];n[0]=n[2],n[2]=i}this.extractParameters(n);var a=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),o=this.getMatrixCornerPoints(n);return new Wl(a,o,this.compact,this.nbDataBlocks,this.nbLayers)},r.prototype.extractParameters=function(e){if(!this.isValidPoint(e[0])||!this.isValidPoint(e[1])||!this.isValidPoint(e[2])||!this.isValidPoint(e[3]))throw new N;var t=2*this.nbCenterLayers,n=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(n,t);for(var i=0,a=0;a<4;a++){var o=n[(this.shift+a)%4];this.compact?(i<<=7,i+=o>>1&127):(i<<=10,i+=(o>>2&992)+(o>>1&31))}var s=this.getCorrectedParameterData(i,this.compact);this.compact?(this.nbLayers=(s>>6)+1,this.nbDataBlocks=(s&63)+1):(this.nbLayers=(s>>11)+1,this.nbDataBlocks=(s&2047)+1)},r.prototype.getRotation=function(e,t){var n=0;e.forEach(function(a,o,s){var l=(a>>t-2<<1)+(a&1);n=(n<<3)+l}),n=((n&1)<<11)+(n>>1);for(var i=0;i<4;i++)if(q.bitCount(n^this.EXPECTED_CORNER_BITS[i])<=2)return i;throw new N},r.prototype.getCorrectedParameterData=function(e,t){var n,i;t?(n=7,i=2):(n=10,i=4);for(var a=n-i,o=new Int32Array(n),s=n-1;s>=0;--s)o[s]=e&15,e>>=4;try{var l=new Kr(He.AZTEC_PARAM);l.decode(o,a)}catch{throw new N}for(var u=0,s=0;s<i;s++)u=(u<<4)+o[s];return u},r.prototype.getBullsEyeCorners=function(e){var t=e,n=e,i=e,a=e,o=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){var s=this.getFirstDifferent(t,o,1,-1),l=this.getFirstDifferent(n,o,1,1),u=this.getFirstDifferent(i,o,-1,1),c=this.getFirstDifferent(a,o,-1,-1);if(this.nbCenterLayers>2){var d=this.distancePoint(c,s)*this.nbCenterLayers/(this.distancePoint(a,t)*(this.nbCenterLayers+2));if(d<.75||d>1.25||!this.isWhiteOrBlackRectangle(s,l,u,c))break}t=s,n=l,i=u,a=c,o=!o}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new N;this.compact=this.nbCenterLayers===5;var p=new z(t.getX()+.5,t.getY()-.5),h=new z(n.getX()+.5,n.getY()+.5),g=new z(i.getX()-.5,i.getY()+.5),x=new z(a.getX()-.5,a.getY()-.5);return this.expandSquare([p,h,g,x],2*this.nbCenterLayers-3,2*this.nbCenterLayers)},r.prototype.getMatrixCenter=function(){var e,t,n,i;try{var a=new Kn(this.image).detect();e=a[0],t=a[1],n=a[2],i=a[3]}catch{var o=this.image.getWidth()/2,s=this.image.getHeight()/2;e=this.getFirstDifferent(new Ge(o+7,s-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ge(o+7,s+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ge(o-7,s+7),!1,-1,1).toResultPoint(),i=this.getFirstDifferent(new Ge(o-7,s-7),!1,-1,-1).toResultPoint()}var l=Q.round((e.getX()+i.getX()+t.getX()+n.getX())/4),u=Q.round((e.getY()+i.getY()+t.getY()+n.getY())/4);try{var a=new Kn(this.image,15,l,u).detect();e=a[0],t=a[1],n=a[2],i=a[3]}catch{e=this.getFirstDifferent(new Ge(l+7,u-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ge(l+7,u+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ge(l-7,u+7),!1,-1,1).toResultPoint(),i=this.getFirstDifferent(new Ge(l-7,u-7),!1,-1,-1).toResultPoint()}return l=Q.round((e.getX()+i.getX()+t.getX()+n.getX())/4),u=Q.round((e.getY()+i.getY()+t.getY()+n.getY())/4),new Ge(l,u)},r.prototype.getMatrixCornerPoints=function(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())},r.prototype.sampleGrid=function(e,t,n,i,a){var o=Qn.getInstance(),s=this.getDimension(),l=s/2-this.nbCenterLayers,u=s/2+this.nbCenterLayers;return o.sampleGrid(e,s,s,l,l,u,l,u,u,l,u,t.getX(),t.getY(),n.getX(),n.getY(),i.getX(),i.getY(),a.getX(),a.getY())},r.prototype.sampleLine=function(e,t,n){for(var i=0,a=this.distanceResultPoint(e,t),o=a/n,s=e.getX(),l=e.getY(),u=o*(t.getX()-e.getX())/a,c=o*(t.getY()-e.getY())/a,d=0;d<n;d++)this.image.get(Q.round(s+d*u),Q.round(l+d*c))&&(i|=1<<n-d-1);return i},r.prototype.isWhiteOrBlackRectangle=function(e,t,n,i){var a=3;e=new Ge(e.getX()-a,e.getY()+a),t=new Ge(t.getX()-a,t.getY()-a),n=new Ge(n.getX()+a,n.getY()-a),i=new Ge(i.getX()+a,i.getY()+a);var o=this.getColor(i,e);if(o===0)return!1;var s=this.getColor(e,t);return s!==o||(s=this.getColor(t,n),s!==o)?!1:(s=this.getColor(n,i),s===o)},r.prototype.getColor=function(e,t){for(var n=this.distancePoint(e,t),i=(t.getX()-e.getX())/n,a=(t.getY()-e.getY())/n,o=0,s=e.getX(),l=e.getY(),u=this.image.get(e.getX(),e.getY()),c=Math.ceil(n),d=0;d<c;d++)s+=i,l+=a,this.image.get(Q.round(s),Q.round(l))!==u&&o++;var p=o/n;return p>.1&&p<.9?0:p<=.1===u?1:-1},r.prototype.getFirstDifferent=function(e,t,n,i){for(var a=e.getX()+n,o=e.getY()+i;this.isValid(a,o)&&this.image.get(a,o)===t;)a+=n,o+=i;for(a-=n,o-=i;this.isValid(a,o)&&this.image.get(a,o)===t;)a+=n;for(a-=n;this.isValid(a,o)&&this.image.get(a,o)===t;)o+=i;return o-=i,new Ge(a,o)},r.prototype.expandSquare=function(e,t,n){var i=n/(2*t),a=e[0].getX()-e[2].getX(),o=e[0].getY()-e[2].getY(),s=(e[0].getX()+e[2].getX())/2,l=(e[0].getY()+e[2].getY())/2,u=new z(s+i*a,l+i*o),c=new z(s-i*a,l-i*o);a=e[1].getX()-e[3].getX(),o=e[1].getY()-e[3].getY(),s=(e[1].getX()+e[3].getX())/2,l=(e[1].getY()+e[3].getY())/2;var d=new z(s+i*a,l+i*o),p=new z(s-i*a,l-i*o),h=[u,d,c,p];return h},r.prototype.isValid=function(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()},r.prototype.isValidPoint=function(e){var t=Q.round(e.getX()),n=Q.round(e.getY());return this.isValid(t,n)},r.prototype.distancePoint=function(e,t){return Q.distance(e.getX(),e.getY(),t.getX(),t.getY())},r.prototype.distanceResultPoint=function(e,t){return Q.distance(e.getX(),e.getY(),t.getX(),t.getY())},r.prototype.getDimension=function(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(q.truncDivision(this.nbLayers-4,8)+1)+15},r}(),Jn=function(){function r(){}return r.prototype.decode=function(e,t){t===void 0&&(t=null);var n=null,i=new Zl(e.getBlackMatrix()),a=null,o=null;try{var s=i.detectMirror(!1);a=s.getPoints(),this.reportFoundResultPoints(t,a),o=new xa().decode(s)}catch(d){n=d}if(o==null)try{var s=i.detectMirror(!0);a=s.getPoints(),this.reportFoundResultPoints(t,a),o=new xa().decode(s)}catch(d){throw n??d}var l=new Ne(o.getText(),o.getRawBytes(),o.getNumBits(),a,B.AZTEC,se.currentTimeMillis()),u=o.getByteSegments();u!=null&&l.putMetadata(Ae.BYTE_SEGMENTS,u);var c=o.getECLevel();return c!=null&&l.putMetadata(Ae.ERROR_CORRECTION_LEVEL,c),l},r.prototype.reportFoundResultPoints=function(e,t){if(e!=null){var n=e.get(ce.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach(function(i,a,o){n.foundPossibleResultPoint(i)})}},r.prototype.reset=function(){},r}(),Kl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){Kl(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new Jn,t)||this}return e})(kt);var ve=function(){function r(){}return r.prototype.decode=function(e,t){try{return this.doDecode(e,t)}catch{var n=t&&t.get(ce.TRY_HARDER)===!0;if(n&&e.isRotateSupported()){var i=e.rotateCounterClockwise(),a=this.doDecode(i,t),o=a.getResultMetadata(),s=270;o!==null&&o.get(Ae.ORIENTATION)===!0&&(s=s+o.get(Ae.ORIENTATION)%360),a.putMetadata(Ae.ORIENTATION,s);var l=a.getResultPoints();if(l!==null)for(var u=i.getHeight(),c=0;c<l.length;c++)l[c]=new z(u-l[c].getY()-1,l[c].getX());return a}else throw new N}},r.prototype.reset=function(){},r.prototype.doDecode=function(e,t){var n=e.getWidth(),i=e.getHeight(),a=new we(n),o=t&&t.get(ce.TRY_HARDER)===!0,s=Math.max(1,i>>(o?8:5)),l;o?l=i:l=15;for(var u=Math.trunc(i/2),c=0;c<l;c++){var d=Math.trunc((c+1)/2),p=(c&1)===0,h=u+s*(p?d:-d);if(h<0||h>=i)break;try{a=e.getBlackRow(h,a)}catch{continue}for(var g=function(m){if(m===1&&(a.reverse(),t&&t.get(ce.NEED_RESULT_POINT_CALLBACK)===!0)){var _=new Map;t.forEach(function(T,D){return _.set(D,T)}),_.delete(ce.NEED_RESULT_POINT_CALLBACK),t=_}try{var E=x.decodeRow(h,a,t);if(m===1){E.putMetadata(Ae.ORIENTATION,180);var S=E.getResultPoints();S!==null&&(S[0]=new z(n-S[0].getX()-1,S[0].getY()),S[1]=new z(n-S[1].getX()-1,S[1].getY()))}return{value:E}}catch{}},x=this,C=0;C<2;C++){var w=g(C);if(typeof w=="object")return w.value}}throw new N},r.recordPattern=function(e,t,n){for(var i=n.length,a=0;a<i;a++)n[a]=0;var o=e.getSize();if(t>=o)throw new N;for(var s=!e.get(t),l=0,u=t;u<o;){if(e.get(u)!==s)n[l]++;else{if(++l===i)break;n[l]=1,s=!s}u++}if(!(l===i||l===i-1&&u===o))throw new N},r.recordPatternInReverse=function(e,t,n){for(var i=n.length,a=e.get(t);t>0&&i>=0;)e.get(--t)!==a&&(i--,a=!a);if(i>=0)throw new N;r.recordPattern(e,t+1,n)},r.patternMatchVariance=function(e,t,n){for(var i=e.length,a=0,o=0,s=0;s<i;s++)a+=e[s],o+=t[s];if(a<o)return Number.POSITIVE_INFINITY;var l=a/o;n*=l;for(var u=0,c=0;c<i;c++){var d=e[c],p=t[c]*l,h=d>p?d-p:p-d;if(h>n)return Number.POSITIVE_INFINITY;u+=h}return u/a},r}(),Ql=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),wa=function(r){Ql(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.findStartPattern=function(t){for(var n=t.getSize(),i=t.getNextSet(0),a=0,o=Int32Array.from([0,0,0,0,0,0]),s=i,l=!1,u=6,c=i;c<n;c++)if(t.get(c)!==l)o[a]++;else{if(a===u-1){for(var d=e.MAX_AVG_VARIANCE,p=-1,h=e.CODE_START_A;h<=e.CODE_START_C;h++){var g=ve.patternMatchVariance(o,e.CODE_PATTERNS[h],e.MAX_INDIVIDUAL_VARIANCE);g<d&&(d=g,p=h)}if(p>=0&&t.isRange(Math.max(0,s-(c-s)/2),s,!1))return Int32Array.from([s,c,p]);s+=o[0]+o[1],o=o.slice(2,o.length-1),o[a-1]=0,o[a]=0,a--}else a++;o[a]=1,l=!l}throw new N},e.decodeCode=function(t,n,i){ve.recordPattern(t,i,n);for(var a=e.MAX_AVG_VARIANCE,o=-1,s=0;s<e.CODE_PATTERNS.length;s++){var l=e.CODE_PATTERNS[s],u=this.patternMatchVariance(n,l,e.MAX_INDIVIDUAL_VARIANCE);u<a&&(a=u,o=s)}if(o>=0)return o;throw new N},e.prototype.decodeRow=function(t,n,i){var a=i&&i.get(ce.ASSUME_GS1)===!0,o=e.findStartPattern(n),s=o[2],l=0,u=new Uint8Array(20);u[l++]=s;var c;switch(s){case e.CODE_START_A:c=e.CODE_CODE_A;break;case e.CODE_START_B:c=e.CODE_CODE_B;break;case e.CODE_START_C:c=e.CODE_CODE_C;break;default:throw new F}for(var d=!1,p=!1,h="",g=o[0],x=o[1],C=Int32Array.from([0,0,0,0,0,0]),w=0,m=0,_=s,E=0,S=!0,T=!1,D=!1;!d;){var M=p;switch(p=!1,w=m,m=e.decodeCode(n,C,x),u[l++]=m,m!==e.CODE_STOP&&(S=!0),m!==e.CODE_STOP&&(E++,_+=E*m),g=x,x+=C.reduce(function(ae,Fe){return ae+Fe},0),m){case e.CODE_START_A:case e.CODE_START_B:case e.CODE_START_C:throw new F}switch(c){case e.CODE_CODE_A:if(m<64)D===T?h+=String.fromCharCode(32+m):h+=String.fromCharCode(32+m+128),D=!1;else if(m<96)D===T?h+=String.fromCharCode(m-64):h+=String.fromCharCode(m+64),D=!1;else switch(m!==e.CODE_STOP&&(S=!1),m){case e.CODE_FNC_1:a&&(h.length===0?h+="]C1":h+="");break;case e.CODE_FNC_2:case e.CODE_FNC_3:break;case e.CODE_FNC_4_A:!T&&D?(T=!0,D=!1):T&&D?(T=!1,D=!1):D=!0;break;case e.CODE_SHIFT:p=!0,c=e.CODE_CODE_B;break;case e.CODE_CODE_B:c=e.CODE_CODE_B;break;case e.CODE_CODE_C:c=e.CODE_CODE_C;break;case e.CODE_STOP:d=!0;break}break;case e.CODE_CODE_B:if(m<96)D===T?h+=String.fromCharCode(32+m):h+=String.fromCharCode(32+m+128),D=!1;else switch(m!==e.CODE_STOP&&(S=!1),m){case e.CODE_FNC_1:a&&(h.length===0?h+="]C1":h+="");break;case e.CODE_FNC_2:case e.CODE_FNC_3:break;case e.CODE_FNC_4_B:!T&&D?(T=!0,D=!1):T&&D?(T=!1,D=!1):D=!0;break;case e.CODE_SHIFT:p=!0,c=e.CODE_CODE_A;break;case e.CODE_CODE_A:c=e.CODE_CODE_A;break;case e.CODE_CODE_C:c=e.CODE_CODE_C;break;case e.CODE_STOP:d=!0;break}break;case e.CODE_CODE_C:if(m<100)m<10&&(h+="0"),h+=m;else switch(m!==e.CODE_STOP&&(S=!1),m){case e.CODE_FNC_1:a&&(h.length===0?h+="]C1":h+="");break;case e.CODE_CODE_A:c=e.CODE_CODE_A;break;case e.CODE_CODE_B:c=e.CODE_CODE_B;break;case e.CODE_STOP:d=!0;break}break}M&&(c=c===e.CODE_CODE_A?e.CODE_CODE_B:e.CODE_CODE_A)}var P=x-g;if(x=n.getNextUnset(x),!n.isRange(x,Math.min(n.getSize(),x+(x-g)/2),!1))throw new N;if(_-=E*w,_%103!==w)throw new Ce;var V=h.length;if(V===0)throw new N;V>0&&S&&(c===e.CODE_CODE_C?h=h.substring(0,V-2):h=h.substring(0,V-1));for(var W=(o[1]+o[0])/2,U=g+P/2,J=u.length,R=new Uint8Array(J),K=0;K<J;K++)R[K]=u[K];var X=[new z(W,t),new z(U,t)];return new Ne(h,R,0,X,B.CODE_128,new Date().getTime())},e.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],e.MAX_AVG_VARIANCE=.25,e.MAX_INDIVIDUAL_VARIANCE=.7,e.CODE_SHIFT=98,e.CODE_CODE_C=99,e.CODE_CODE_B=100,e.CODE_CODE_A=101,e.CODE_FNC_1=102,e.CODE_FNC_2=97,e.CODE_FNC_3=96,e.CODE_FNC_4_A=101,e.CODE_FNC_4_B=100,e.CODE_START_A=103,e.CODE_START_B=104,e.CODE_START_C=105,e.CODE_STOP=106,e}(ve),Jl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ei=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ma=function(r){Jl(e,r);function e(t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var i=r.call(this)||this;return i.usingCheckDigit=t,i.extendedMode=n,i.decodeRowResult="",i.counters=new Int32Array(9),i}return e.prototype.decodeRow=function(t,n,i){var a,o,s,l,u=this.counters;u.fill(0),this.decodeRowResult="";var c=e.findAsteriskPattern(n,u),d=n.getNextSet(c[1]),p=n.getSize(),h,g;do{e.recordPattern(n,d,u);var x=e.toNarrowWidePattern(u);if(x<0)throw new N;h=e.patternToChar(x),this.decodeRowResult+=h,g=d;try{for(var C=(a=void 0,ei(u)),w=C.next();!w.done;w=C.next()){var m=w.value;d+=m}}catch(J){a={error:J}}finally{try{w&&!w.done&&(o=C.return)&&o.call(C)}finally{if(a)throw a.error}}d=n.getNextSet(d)}while(h!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);var _=0;try{for(var E=ei(u),S=E.next();!S.done;S=E.next()){var m=S.value;_+=m}}catch(J){s={error:J}}finally{try{S&&!S.done&&(l=E.return)&&l.call(E)}finally{if(s)throw s.error}}var T=d-g-_;if(d!==p&&T*2<_)throw new N;if(this.usingCheckDigit){for(var D=this.decodeRowResult.length-1,M=0,P=0;P<D;P++)M+=e.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(P));if(this.decodeRowResult.charAt(D)!==e.ALPHABET_STRING.charAt(M%43))throw new Ce;this.decodeRowResult=this.decodeRowResult.substring(0,D)}if(this.decodeRowResult.length===0)throw new N;var V;this.extendedMode?V=e.decodeExtended(this.decodeRowResult):V=this.decodeRowResult;var W=(c[1]+c[0])/2,U=g+_/2;return new Ne(V,null,0,[new z(W,t),new z(U,t)],B.CODE_39,new Date().getTime())},e.findAsteriskPattern=function(t,n){for(var i=t.getSize(),a=t.getNextSet(0),o=0,s=a,l=!1,u=n.length,c=a;c<i;c++)if(t.get(c)!==l)n[o]++;else{if(o===u-1){if(this.toNarrowWidePattern(n)===e.ASTERISK_ENCODING&&t.isRange(Math.max(0,s-Math.floor((c-s)/2)),s,!1))return[s,c];s+=n[0]+n[1],n.copyWithin(0,2,2+o-1),n[o-1]=0,n[o]=0,o--}else o++;n[o]=1,l=!l}throw new N},e.toNarrowWidePattern=function(t){var n,i,a=t.length,o=0,s;do{var l=2147483647;try{for(var u=(n=void 0,ei(t)),c=u.next();!c.done;c=u.next()){var d=c.value;d<l&&d>o&&(l=d)}}catch(x){n={error:x}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}o=l,s=0;for(var p=0,h=0,g=0;g<a;g++){var d=t[g];d>o&&(h|=1<<a-1-g,s++,p+=d)}if(s===3){for(var g=0;g<a&&s>0;g++){var d=t[g];if(d>o&&(s--,d*2>=p))return-1}return h}}while(s>3);return-1},e.patternToChar=function(t){for(var n=0;n<e.CHARACTER_ENCODINGS.length;n++)if(e.CHARACTER_ENCODINGS[n]===t)return e.ALPHABET_STRING.charAt(n);if(t===e.ASTERISK_ENCODING)return"*";throw new N},e.decodeExtended=function(t){for(var n=t.length,i="",a=0;a<n;a++){var o=t.charAt(a);if(o==="+"||o==="$"||o==="%"||o==="/"){var s=t.charAt(a+1),l="\0";switch(o){case"+":if(s>="A"&&s<="Z")l=String.fromCharCode(s.charCodeAt(0)+32);else throw new F;break;case"$":if(s>="A"&&s<="Z")l=String.fromCharCode(s.charCodeAt(0)-64);else throw new F;break;case"%":if(s>="A"&&s<="E")l=String.fromCharCode(s.charCodeAt(0)-38);else if(s>="F"&&s<="J")l=String.fromCharCode(s.charCodeAt(0)-11);else if(s>="K"&&s<="O")l=String.fromCharCode(s.charCodeAt(0)+16);else if(s>="P"&&s<="T")l=String.fromCharCode(s.charCodeAt(0)+43);else if(s==="U")l="\0";else if(s==="V")l="@";else if(s==="W")l="`";else if(s==="X"||s==="Y"||s==="Z")l="";else throw new F;break;case"/":if(s>="A"&&s<="O")l=String.fromCharCode(s.charCodeAt(0)-32);else if(s==="Z")l=":";else throw new F;break}i+=l,a++}else i+=o}return i},e.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",e.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],e.ASTERISK_ENCODING=148,e}(ve),eu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ti=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},_a=function(r){eu(e,r);function e(){var t=r.call(this)||this;return t.decodeRowResult="",t.counters=new Int32Array(6),t}return e.prototype.decodeRow=function(t,n,i){var a,o,s,l,u=this.findAsteriskPattern(n),c=n.getNextSet(u[1]),d=n.getSize(),p=this.counters;p.fill(0),this.decodeRowResult="";var h,g;do{e.recordPattern(n,c,p);var x=this.toPattern(p);if(x<0)throw new N;h=this.patternToChar(x),this.decodeRowResult+=h,g=c;try{for(var C=(a=void 0,ti(p)),w=C.next();!w.done;w=C.next()){var m=w.value;c+=m}}catch(P){a={error:P}}finally{try{w&&!w.done&&(o=C.return)&&o.call(C)}finally{if(a)throw a.error}}c=n.getNextSet(c)}while(h!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);var _=0;try{for(var E=ti(p),S=E.next();!S.done;S=E.next()){var m=S.value;_+=m}}catch(P){s={error:P}}finally{try{S&&!S.done&&(l=E.return)&&l.call(E)}finally{if(s)throw s.error}}if(c===d||!n.get(c))throw new N;if(this.decodeRowResult.length<2)throw new N;this.checkChecksums(this.decodeRowResult),this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-2);var T=this.decodeExtended(this.decodeRowResult),D=(u[1]+u[0])/2,M=g+_/2;return new Ne(T,null,0,[new z(D,t),new z(M,t)],B.CODE_93,new Date().getTime())},e.prototype.findAsteriskPattern=function(t){var n=t.getSize(),i=t.getNextSet(0);this.counters.fill(0);for(var a=this.counters,o=i,s=!1,l=a.length,u=0,c=i;c<n;c++)if(t.get(c)!==s)a[u]++;else{if(u===l-1){if(this.toPattern(a)===e.ASTERISK_ENCODING)return new Int32Array([o,c]);o+=a[0]+a[1],a.copyWithin(0,2,2+u-1),a[u-1]=0,a[u]=0,u--}else u++;a[u]=1,s=!s}throw new N},e.prototype.toPattern=function(t){var n,i,a=0;try{for(var o=ti(t),s=o.next();!s.done;s=o.next()){var l=s.value;a+=l}}catch(g){n={error:g}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}for(var u=0,c=t.length,d=0;d<c;d++){var p=Math.round(t[d]*9/a);if(p<1||p>4)return-1;if((d&1)===0)for(var h=0;h<p;h++)u=u<<1|1;else u<<=p}return u},e.prototype.patternToChar=function(t){for(var n=0;n<e.CHARACTER_ENCODINGS.length;n++)if(e.CHARACTER_ENCODINGS[n]===t)return e.ALPHABET_STRING.charAt(n);throw new N},e.prototype.decodeExtended=function(t){for(var n=t.length,i="",a=0;a<n;a++){var o=t.charAt(a);if(o>="a"&&o<="d"){if(a>=n-1)throw new F;var s=t.charAt(a+1),l="\0";switch(o){case"d":if(s>="A"&&s<="Z")l=String.fromCharCode(s.charCodeAt(0)+32);else throw new F;break;case"a":if(s>="A"&&s<="Z")l=String.fromCharCode(s.charCodeAt(0)-64);else throw new F;break;case"b":if(s>="A"&&s<="E")l=String.fromCharCode(s.charCodeAt(0)-38);else if(s>="F"&&s<="J")l=String.fromCharCode(s.charCodeAt(0)-11);else if(s>="K"&&s<="O")l=String.fromCharCode(s.charCodeAt(0)+16);else if(s>="P"&&s<="T")l=String.fromCharCode(s.charCodeAt(0)+43);else if(s==="U")l="\0";else if(s==="V")l="@";else if(s==="W")l="`";else if(s>="X"&&s<="Z")l="";else throw new F;break;case"c":if(s>="A"&&s<="O")l=String.fromCharCode(s.charCodeAt(0)-32);else if(s==="Z")l=":";else throw new F;break}i+=l,a++}else i+=o}return i},e.prototype.checkChecksums=function(t){var n=t.length;this.checkOneChecksum(t,n-2,20),this.checkOneChecksum(t,n-1,15)},e.prototype.checkOneChecksum=function(t,n,i){for(var a=1,o=0,s=n-1;s>=0;s--)o+=a*e.ALPHABET_STRING.indexOf(t.charAt(s)),++a>i&&(a=1);if(t.charAt(n)!==e.ALPHABET_STRING[o%47])throw new Ce},e.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*",e.CHARACTER_ENCODINGS=[276,328,324,322,296,292,290,336,274,266,424,420,418,404,402,394,360,356,354,308,282,344,332,326,300,278,436,434,428,422,406,410,364,358,310,314,302,468,466,458,366,374,430,294,474,470,306,350],e.ASTERISK_ENCODING=e.CHARACTER_ENCODINGS[47],e}(ve),tu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ru=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Aa=function(r){tu(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.narrowLineWidth=-1,t}return e.prototype.decodeRow=function(t,n,i){var a,o,s=this.decodeStart(n),l=this.decodeEnd(n),u=new $;e.decodeMiddle(n,s[1],l[0],u);var c=u.toString(),d=null;i!=null&&(d=i.get(ce.ALLOWED_LENGTHS)),d==null&&(d=e.DEFAULT_ALLOWED_LENGTHS);var p=c.length,h=!1,g=0;try{for(var x=ru(d),C=x.next();!C.done;C=x.next()){var w=C.value;if(p===w){h=!0;break}w>g&&(g=w)}}catch(E){a={error:E}}finally{try{C&&!C.done&&(o=x.return)&&o.call(x)}finally{if(a)throw a.error}}if(!h&&p>g&&(h=!0),!h)throw new F;var m=[new z(s[1],t),new z(l[0],t)],_=new Ne(c,null,0,m,B.ITF,new Date().getTime());return _},e.decodeMiddle=function(t,n,i,a){var o=new Int32Array(10),s=new Int32Array(5),l=new Int32Array(5);for(o.fill(0),s.fill(0),l.fill(0);n<i;){ve.recordPattern(t,n,o);for(var u=0;u<5;u++){var c=2*u;s[u]=o[c],l[u]=o[c+1]}var d=e.decodeDigit(s);a.append(d.toString()),d=this.decodeDigit(l),a.append(d.toString()),o.forEach(function(p){n+=p})}},e.prototype.decodeStart=function(t){var n=e.skipWhiteSpace(t),i=e.findGuardPattern(t,n,e.START_PATTERN);return this.narrowLineWidth=(i[1]-i[0])/4,this.validateQuietZone(t,i[0]),i},e.prototype.validateQuietZone=function(t,n){var i=this.narrowLineWidth*10;i=i<n?i:n;for(var a=n-1;i>0&&a>=0&&!t.get(a);a--)i--;if(i!==0)throw new N},e.skipWhiteSpace=function(t){var n=t.getSize(),i=t.getNextSet(0);if(i===n)throw new N;return i},e.prototype.decodeEnd=function(t){t.reverse();try{var n=e.skipWhiteSpace(t),i=void 0;try{i=e.findGuardPattern(t,n,e.END_PATTERN_REVERSED[0])}catch(o){o instanceof N&&(i=e.findGuardPattern(t,n,e.END_PATTERN_REVERSED[1]))}this.validateQuietZone(t,i[0]);var a=i[0];return i[0]=t.getSize()-i[1],i[1]=t.getSize()-a,i}finally{t.reverse()}},e.findGuardPattern=function(t,n,i){var a=i.length,o=new Int32Array(a),s=t.getSize(),l=!1,u=0,c=n;o.fill(0);for(var d=n;d<s;d++)if(t.get(d)!==l)o[u]++;else{if(u===a-1){if(ve.patternMatchVariance(o,i,e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return[c,d];c+=o[0]+o[1],se.arraycopy(o,2,o,0,u-1),o[u-1]=0,o[u]=0,u--}else u++;o[u]=1,l=!l}throw new N},e.decodeDigit=function(t){for(var n=e.MAX_AVG_VARIANCE,i=-1,a=e.PATTERNS.length,o=0;o<a;o++){var s=e.PATTERNS[o],l=ve.patternMatchVariance(t,s,e.MAX_INDIVIDUAL_VARIANCE);l<n?(n=l,i=o):l===n&&(i=-1)}if(i>=0)return i%10;throw new N},e.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],e.MAX_AVG_VARIANCE=.38,e.MAX_INDIVIDUAL_VARIANCE=.5,e.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],e.START_PATTERN=Int32Array.from([1,1,1,1]),e.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])],e}(ve),nu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Rt=function(r){nu(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.decodeRowStringBuffer="",t}return e.findStartGuardPattern=function(t){for(var n=!1,i,a=0,o=Int32Array.from([0,0,0]);!n;){o=Int32Array.from([0,0,0]),i=e.findGuardPattern(t,a,!1,this.START_END_PATTERN,o);var s=i[0];a=i[1];var l=s-(a-s);l>=0&&(n=t.isRange(l,s,!1))}return i},e.checkChecksum=function(t){return e.checkStandardUPCEANChecksum(t)},e.checkStandardUPCEANChecksum=function(t){var n=t.length;if(n===0)return!1;var i=parseInt(t.charAt(n-1),10);return e.getStandardUPCEANChecksum(t.substring(0,n-1))===i},e.getStandardUPCEANChecksum=function(t){for(var n=t.length,i=0,a=n-1;a>=0;a-=2){var o=t.charAt(a).charCodeAt(0)-48;if(o<0||o>9)throw new F;i+=o}i*=3;for(var a=n-2;a>=0;a-=2){var o=t.charAt(a).charCodeAt(0)-48;if(o<0||o>9)throw new F;i+=o}return(1e3-i)%10},e.decodeEnd=function(t,n){return e.findGuardPattern(t,n,!1,e.START_END_PATTERN,new Int32Array(e.START_END_PATTERN.length).fill(0))},e.findGuardPatternWithoutCounters=function(t,n,i,a){return this.findGuardPattern(t,n,i,a,new Int32Array(a.length))},e.findGuardPattern=function(t,n,i,a,o){var s=t.getSize();n=i?t.getNextUnset(n):t.getNextSet(n);for(var l=0,u=n,c=a.length,d=i,p=n;p<s;p++)if(t.get(p)!==d)o[l]++;else{if(l===c-1){if(ve.patternMatchVariance(o,a,e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return Int32Array.from([u,p]);u+=o[0]+o[1];for(var h=o.slice(2,o.length),g=0;g<l-1;g++)o[g]=h[g];o[l-1]=0,o[l]=0,l--}else l++;o[l]=1,d=!d}throw new N},e.decodeDigit=function(t,n,i,a){this.recordPattern(t,i,n);for(var o=this.MAX_AVG_VARIANCE,s=-1,l=a.length,u=0;u<l;u++){var c=a[u],d=ve.patternMatchVariance(n,c,e.MAX_INDIVIDUAL_VARIANCE);d<o&&(o=d,s=u)}if(s>=0)return s;throw new N},e.MAX_AVG_VARIANCE=.48,e.MAX_INDIVIDUAL_VARIANCE=.7,e.START_END_PATTERN=Int32Array.from([1,1,1]),e.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),e.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),e.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])],e}(ve),iu=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},au=function(){function r(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}return r.prototype.decodeRow=function(e,t,n){var i=this.decodeRowStringBuffer,a=this.decodeMiddle(t,n,i),o=i.toString(),s=r.parseExtensionString(o),l=[new z((n[0]+n[1])/2,e),new z(a,e)],u=new Ne(o,null,0,l,B.UPC_EAN_EXTENSION,new Date().getTime());return s!=null&&u.putAllMetadata(s),u},r.prototype.decodeMiddle=function(e,t,n){var i,a,o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;for(var s=e.getSize(),l=t[1],u=0,c=0;c<5&&l<s;c++){var d=Rt.decodeDigit(e,o,l,Rt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+d%10);try{for(var p=(i=void 0,iu(o)),h=p.next();!h.done;h=p.next()){var g=h.value;l+=g}}catch(C){i={error:C}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}d>=10&&(u|=1<<4-c),c!==4&&(l=e.getNextSet(l),l=e.getNextUnset(l))}if(n.length!==5)throw new N;var x=this.determineCheckDigit(u);if(r.extensionChecksum(n.toString())!==x)throw new N;return l},r.extensionChecksum=function(e){for(var t=e.length,n=0,i=t-2;i>=0;i-=2)n+=e.charAt(i).charCodeAt(0)-48;n*=3;for(var i=t-1;i>=0;i-=2)n+=e.charAt(i).charCodeAt(0)-48;return n*=3,n%10},r.prototype.determineCheckDigit=function(e){for(var t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new N},r.parseExtensionString=function(e){if(e.length!==5)return null;var t=r.parseExtension5String(e);return t==null?null:new Map([[Ae.SUGGESTED_PRICE,t]])},r.parseExtension5String=function(e){var t;switch(e.charAt(0)){case"0":t="£";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t="";break}var n=parseInt(e.substring(1)),i=(n/100).toString(),a=n%100,o=a<10?"0"+a:a.toString();return t+i+"."+o},r}(),ou=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},su=function(){function r(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}return r.prototype.decodeRow=function(e,t,n){var i=this.decodeRowStringBuffer,a=this.decodeMiddle(t,n,i),o=i.toString(),s=r.parseExtensionString(o),l=[new z((n[0]+n[1])/2,e),new z(a,e)],u=new Ne(o,null,0,l,B.UPC_EAN_EXTENSION,new Date().getTime());return s!=null&&u.putAllMetadata(s),u},r.prototype.decodeMiddle=function(e,t,n){var i,a,o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;for(var s=e.getSize(),l=t[1],u=0,c=0;c<2&&l<s;c++){var d=Rt.decodeDigit(e,o,l,Rt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+d%10);try{for(var p=(i=void 0,ou(o)),h=p.next();!h.done;h=p.next()){var g=h.value;l+=g}}catch(x){i={error:x}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}d>=10&&(u|=1<<1-c),c!==1&&(l=e.getNextSet(l),l=e.getNextUnset(l))}if(n.length!==2)throw new N;if(parseInt(n.toString())%4!==u)throw new N;return l},r.parseExtensionString=function(e){return e.length!==2?null:new Map([[Ae.ISSUE_NUMBER,parseInt(e)]])},r}(),lu=function(){function r(){}return r.decodeRow=function(e,t,n){var i=Rt.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{var a=new au;return a.decodeRow(e,t,i)}catch{var o=new su;return o.decodeRow(e,t,i)}},r.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]),r}(),uu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ge=function(r){uu(e,r);function e(){var t=r.call(this)||this;t.decodeRowStringBuffer="",e.L_AND_G_PATTERNS=e.L_PATTERNS.map(function(s){return Int32Array.from(s)});for(var n=10;n<20;n++){for(var i=e.L_PATTERNS[n-10],a=new Int32Array(i.length),o=0;o<i.length;o++)a[o]=i[i.length-o-1];e.L_AND_G_PATTERNS[n]=a}return t}return e.prototype.decodeRow=function(t,n,i){var a=e.findStartGuardPattern(n),o=i==null?null:i.get(ce.NEED_RESULT_POINT_CALLBACK);if(o!=null){var s=new z((a[0]+a[1])/2,t);o.foundPossibleResultPoint(s)}var l=this.decodeMiddle(n,a,this.decodeRowStringBuffer),u=l.rowOffset,c=l.resultString;if(o!=null){var d=new z(u,t);o.foundPossibleResultPoint(d)}var p=e.decodeEnd(n,u);if(o!=null){var h=new z((p[0]+p[1])/2,t);o.foundPossibleResultPoint(h)}var g=p[1],x=g+(g-p[0]);if(x>=n.getSize()||!n.isRange(g,x,!1))throw new N;var C=c.toString();if(C.length<8)throw new F;if(!e.checkChecksum(C))throw new Ce;var w=(a[1]+a[0])/2,m=(p[1]+p[0])/2,_=this.getBarcodeFormat(),E=[new z(w,t),new z(m,t)],S=new Ne(C,null,0,E,_,new Date().getTime()),T=0;try{var D=lu.decodeRow(t,n,p[1]);S.putMetadata(Ae.UPC_EAN_EXTENSION,D.getText()),S.putAllMetadata(D.getResultMetadata()),S.addResultPoints(D.getResultPoints()),T=D.getText().length}catch{}var M=i==null?null:i.get(ce.ALLOWED_EAN_EXTENSIONS);if(M!=null){var P=!1;for(var V in M)if(T.toString()===V){P=!0;break}if(!P)throw new N}return _===B.EAN_13||B.UPC_A,S},e.checkChecksum=function(t){return e.checkStandardUPCEANChecksum(t)},e.checkStandardUPCEANChecksum=function(t){var n=t.length;if(n===0)return!1;var i=parseInt(t.charAt(n-1),10);return e.getStandardUPCEANChecksum(t.substring(0,n-1))===i},e.getStandardUPCEANChecksum=function(t){for(var n=t.length,i=0,a=n-1;a>=0;a-=2){var o=t.charAt(a).charCodeAt(0)-48;if(o<0||o>9)throw new F;i+=o}i*=3;for(var a=n-2;a>=0;a-=2){var o=t.charAt(a).charCodeAt(0)-48;if(o<0||o>9)throw new F;i+=o}return(1e3-i)%10},e.decodeEnd=function(t,n){return e.findGuardPattern(t,n,!1,e.START_END_PATTERN,new Int32Array(e.START_END_PATTERN.length).fill(0))},e}(Rt),cu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ea=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ri=function(r){cu(e,r);function e(){var t=r.call(this)||this;return t.decodeMiddleCounters=Int32Array.from([0,0,0,0]),t}return e.prototype.decodeMiddle=function(t,n,i){var a,o,s,l,u=this.decodeMiddleCounters;u[0]=0,u[1]=0,u[2]=0,u[3]=0;for(var c=t.getSize(),d=n[1],p=0,h=0;h<6&&d<c;h++){var g=ge.decodeDigit(t,u,d,ge.L_AND_G_PATTERNS);i+=String.fromCharCode(48+g%10);try{for(var x=(a=void 0,Ea(u)),C=x.next();!C.done;C=x.next()){var w=C.value;d+=w}}catch(S){a={error:S}}finally{try{C&&!C.done&&(o=x.return)&&o.call(x)}finally{if(a)throw a.error}}g>=10&&(p|=1<<5-h)}i=e.determineFirstDigit(i,p);var m=ge.findGuardPattern(t,d,!0,ge.MIDDLE_PATTERN,new Int32Array(ge.MIDDLE_PATTERN.length).fill(0));d=m[1];for(var h=0;h<6&&d<c;h++){var g=ge.decodeDigit(t,u,d,ge.L_PATTERNS);i+=String.fromCharCode(48+g);try{for(var _=(s=void 0,Ea(u)),E=_.next();!E.done;E=_.next()){var w=E.value;d+=w}}catch(D){s={error:D}}finally{try{E&&!E.done&&(l=_.return)&&l.call(_)}finally{if(s)throw s.error}}}return{rowOffset:d,resultString:i}},e.prototype.getBarcodeFormat=function(){return B.EAN_13},e.determineFirstDigit=function(t,n){for(var i=0;i<10;i++)if(n===this.FIRST_DIGIT_ENCODINGS[i])return t=String.fromCharCode(48+i)+t,t;throw new N},e.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26],e}(ge),du=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ia=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Sa=function(r){du(e,r);function e(){var t=r.call(this)||this;return t.decodeMiddleCounters=Int32Array.from([0,0,0,0]),t}return e.prototype.decodeMiddle=function(t,n,i){var a,o,s,l,u=this.decodeMiddleCounters;u[0]=0,u[1]=0,u[2]=0,u[3]=0;for(var c=t.getSize(),d=n[1],p=0;p<4&&d<c;p++){var h=ge.decodeDigit(t,u,d,ge.L_PATTERNS);i+=String.fromCharCode(48+h);try{for(var g=(a=void 0,Ia(u)),x=g.next();!x.done;x=g.next()){var C=x.value;d+=C}}catch(E){a={error:E}}finally{try{x&&!x.done&&(o=g.return)&&o.call(g)}finally{if(a)throw a.error}}}var w=ge.findGuardPattern(t,d,!0,ge.MIDDLE_PATTERN,new Int32Array(ge.MIDDLE_PATTERN.length).fill(0));d=w[1];for(var p=0;p<4&&d<c;p++){var h=ge.decodeDigit(t,u,d,ge.L_PATTERNS);i+=String.fromCharCode(48+h);try{for(var m=(s=void 0,Ia(u)),_=m.next();!_.done;_=m.next()){var C=_.value;d+=C}}catch(T){s={error:T}}finally{try{_&&!_.done&&(l=m.return)&&l.call(m)}finally{if(s)throw s.error}}}return{rowOffset:d,resultString:i}},e.prototype.getBarcodeFormat=function(){return B.EAN_8},e}(ge),fu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Oa=function(r){fu(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.ean13Reader=new ri,t}return e.prototype.getBarcodeFormat=function(){return B.UPC_A},e.prototype.decode=function(t,n){return this.maybeReturnResult(this.ean13Reader.decode(t))},e.prototype.decodeRow=function(t,n,i){return this.maybeReturnResult(this.ean13Reader.decodeRow(t,n,i))},e.prototype.decodeMiddle=function(t,n,i){return this.ean13Reader.decodeMiddle(t,n,i)},e.prototype.maybeReturnResult=function(t){var n=t.getText();if(n.charAt(0)==="0"){var i=new Ne(n.substring(1),null,null,t.getResultPoints(),B.UPC_A);return t.getResultMetadata()!=null&&i.putAllMetadata(t.getResultMetadata()),i}else throw new N},e.prototype.reset=function(){this.ean13Reader.reset()},e}(ge),hu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),pu=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ba=function(r){hu(e,r);function e(){var t=r.call(this)||this;return t.decodeMiddleCounters=new Int32Array(4),t}return e.prototype.decodeMiddle=function(t,n,i){var a,o,s=this.decodeMiddleCounters.map(function(C){return C});s[0]=0,s[1]=0,s[2]=0,s[3]=0;for(var l=t.getSize(),u=n[1],c=0,d=0;d<6&&u<l;d++){var p=e.decodeDigit(t,s,u,e.L_AND_G_PATTERNS);i+=String.fromCharCode(48+p%10);try{for(var h=(a=void 0,pu(s)),g=h.next();!g.done;g=h.next()){var x=g.value;u+=x}}catch(C){a={error:C}}finally{try{g&&!g.done&&(o=h.return)&&o.call(h)}finally{if(a)throw a.error}}p>=10&&(c|=1<<5-d)}return e.determineNumSysAndCheckDigit(new $(i),c),u},e.prototype.decodeEnd=function(t,n){return e.findGuardPatternWithoutCounters(t,n,!0,e.MIDDLE_END_PATTERN)},e.prototype.checkChecksum=function(t){return ge.checkChecksum(e.convertUPCEtoUPCA(t))},e.determineNumSysAndCheckDigit=function(t,n){for(var i=0;i<=1;i++)for(var a=0;a<10;a++)if(n===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[i][a]){t.insert(0,"0"+i),t.append("0"+a);return}throw N.getNotFoundInstance()},e.prototype.getBarcodeFormat=function(){return B.UPC_E},e.convertUPCEtoUPCA=function(t){var n=t.slice(1,7).split("").map(function(o){return o.charCodeAt(0)}),i=new $;i.append(t.charAt(0));var a=n[5];switch(a){case 0:case 1:case 2:i.appendChars(n,0,2),i.append(a),i.append("0000"),i.appendChars(n,2,3);break;case 3:i.appendChars(n,0,3),i.append("00000"),i.appendChars(n,3,2);break;case 4:i.appendChars(n,0,4),i.append("00000"),i.append(n[4]);break;default:i.appendChars(n,0,5),i.append("0000"),i.append(a);break}return t.length>=8&&i.append(t.charAt(7)),i.toString()},e.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),e.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,1])],e}(ge),vu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Na=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ni=function(r){vu(e,r);function e(t){var n=r.call(this)||this,i=t==null?null:t.get(ce.POSSIBLE_FORMATS),a=[];return i!=null&&(i.indexOf(B.EAN_13)>-1&&a.push(new ri),i.indexOf(B.UPC_A)>-1&&a.push(new Oa),i.indexOf(B.EAN_8)>-1&&a.push(new Sa),i.indexOf(B.UPC_E)>-1&&a.push(new ba)),a.length===0&&(a.push(new ri),a.push(new Oa),a.push(new Sa),a.push(new ba)),n.readers=a,n}return e.prototype.decodeRow=function(t,n,i){var a,o;try{for(var s=Na(this.readers),l=s.next();!l.done;l=s.next()){var u=l.value;try{var c=u.decodeRow(t,n,i),d=c.getBarcodeFormat()===B.EAN_13&&c.getText().charAt(0)==="0",p=i==null?null:i.get(ce.POSSIBLE_FORMATS),h=p==null||p.includes(B.UPC_A);if(d&&h){var g=c.getRawBytes(),x=new Ne(c.getText().substring(1),g,g?g.length:null,c.getResultPoints(),B.UPC_A);return x.putAllMetadata(c.getResultMetadata()),x}return c}catch{}}}catch(C){a={error:C}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(a)throw a.error}}throw new N},e.prototype.reset=function(){var t,n;try{for(var i=Na(this.readers),a=i.next();!a.done;a=i.next()){var o=a.value;o.reset()}}catch(s){t={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},e}(ve),gu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),xu=function(r){gu(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.CODA_BAR_CHAR_SET={nnnnnww:"0",nnnnwwn:"1",nnnwnnw:"2",wwnnnnn:"3",nnwnnwn:"4",wnnnnwn:"5",nwnnnnw:"6",nwnnwnn:"7",nwwnnnn:"8",wnnwnnn:"9",nnnwwnn:"-",nnwwnnn:"$",wnnnwnw:":",wnwnnnw:"/",wnwnwnn:".",nnwwwww:"+",nnwwnwn:"A",nwnwnnw:"B",nnnwnww:"C",nnnwwwn:"D"},t}return e.prototype.decodeRow=function(t,n,i){var a=this.getValidRowData(n);if(!a)throw new N;var o=this.codaBarDecodeRow(a.row);if(!o)throw new N;return new Ne(o,null,0,[new z(a.left,t),new z(a.right,t)],B.CODABAR,new Date().getTime())},e.prototype.getValidRowData=function(t){var n=t.toArray(),i=n.indexOf(!0);if(i===-1)return null;var a=n.lastIndexOf(!0);if(a<=i)return null;n=n.slice(i,a+1);for(var o=[],s=n[0],l=1,u=1;u<n.length;u++)n[u]===s?l++:(s=n[u],o.push(l),l=1);return o.push(l),o.length<23&&(o.length+1)%8!==0?null:{row:o,left:i,right:a}},e.prototype.codaBarDecodeRow=function(t){for(var n=[],i=Math.ceil(t.reduce(function(l,u){return(l+u)/2},0));t.length>0;){var a=t.splice(0,8).splice(0,7),o=a.map(function(l){return l<i?"n":"w"}).join("");if(this.CODA_BAR_CHAR_SET[o]===void 0)return null;n.push(this.CODA_BAR_CHAR_SET[o])}var s=n.join("");return this.validCodaBarString(s)?s:null},e.prototype.validCodaBarString=function(t){var n=/^[A-D].{1,}[A-D]$/;return n.test(t)},e}(ve),yu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Cu=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},xt=function(r){yu(e,r);function e(){var t=r.call(this)||this;return t.decodeFinderCounters=new Int32Array(4),t.dataCharacterCounters=new Int32Array(8),t.oddRoundingErrors=new Array(4),t.evenRoundingErrors=new Array(4),t.oddCounts=new Array(t.dataCharacterCounters.length/2),t.evenCounts=new Array(t.dataCharacterCounters.length/2),t}return e.prototype.getDecodeFinderCounters=function(){return this.decodeFinderCounters},e.prototype.getDataCharacterCounters=function(){return this.dataCharacterCounters},e.prototype.getOddRoundingErrors=function(){return this.oddRoundingErrors},e.prototype.getEvenRoundingErrors=function(){return this.evenRoundingErrors},e.prototype.getOddCounts=function(){return this.oddCounts},e.prototype.getEvenCounts=function(){return this.evenCounts},e.prototype.parseFinderValue=function(t,n){for(var i=0;i<n.length;i++)if(ve.patternMatchVariance(t,n[i],e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return i;throw new N},e.count=function(t){return Q.sum(new Int32Array(t))},e.increment=function(t,n){for(var i=0,a=n[0],o=1;o<t.length;o++)n[o]>a&&(a=n[o],i=o);t[i]++},e.decrement=function(t,n){for(var i=0,a=n[0],o=1;o<t.length;o++)n[o]<a&&(a=n[o],i=o);t[i]--},e.isFinderPattern=function(t){var n,i,a=t[0]+t[1],o=a+t[2]+t[3],s=a/o;if(s>=e.MIN_FINDER_PATTERN_RATIO&&s<=e.MAX_FINDER_PATTERN_RATIO){var l=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER;try{for(var c=Cu(t),d=c.next();!d.done;d=c.next()){var p=d.value;p>u&&(u=p),p<l&&(l=p)}}catch(h){n={error:h}}finally{try{d&&!d.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}return u<10*l}return!1},e.MAX_AVG_VARIANCE=.2,e.MAX_INDIVIDUAL_VARIANCE=.45,e.MIN_FINDER_PATTERN_RATIO=9.5/12,e.MAX_FINDER_PATTERN_RATIO=12.5/14,e}(ve),Qr=function(){function r(e,t){this.value=e,this.checksumPortion=t}return r.prototype.getValue=function(){return this.value},r.prototype.getChecksumPortion=function(){return this.checksumPortion},r.prototype.toString=function(){return this.value+"("+this.checksumPortion+")"},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion},r.prototype.hashCode=function(){return this.value^this.checksumPortion},r}(),Ta=function(){function r(e,t,n,i,a){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new z(n,a)),this.resultPoints.push(new z(i,a))}return r.prototype.getValue=function(){return this.value},r.prototype.getStartEnd=function(){return this.startEnd},r.prototype.getResultPoints=function(){return this.resultPoints},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value},r.prototype.hashCode=function(){return this.value},r}(),wu=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Ut=function(){function r(){}return r.getRSSvalue=function(e,t,n){var i,a,o=0;try{for(var s=wu(e),l=s.next();!l.done;l=s.next()){var u=l.value;o+=u}}catch(m){i={error:m}}finally{try{l&&!l.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}for(var c=0,d=0,p=e.length,h=0;h<p-1;h++){var g=void 0;for(g=1,d|=1<<h;g<e[h];g++,d&=~(1<<h)){var x=r.combins(o-g-1,p-h-2);if(n&&d===0&&o-g-(p-h-1)>=p-h-1&&(x-=r.combins(o-g-(p-h),p-h-2)),p-h-1>1){for(var C=0,w=o-g-(p-h-2);w>t;w--)C+=r.combins(o-g-w-1,p-h-3);x-=C*(p-1-h)}else o-g>t&&x--;c+=x}o-=g}return c},r.combins=function(e,t){var n,i;e-t>t?(i=t,n=e-t):(i=e-t,n=t);for(var a=1,o=1,s=e;s>n;s--)a*=s,o<=i&&(a/=o,o++);for(;o<=i;)a/=o,o++;return a},r}(),mu=function(){function r(){}return r.buildBitArray=function(e){var t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);for(var n=12*t,i=new we(n),a=0,o=e[0],s=o.getRightChar().getValue(),l=11;l>=0;--l)(s&1<<l)!==0&&i.set(a),a++;for(var l=1;l<e.length;++l){for(var u=e[l],c=u.getLeftChar().getValue(),d=11;d>=0;--d)(c&1<<d)!==0&&i.set(a),a++;if(u.getRightChar()!==null)for(var p=u.getRightChar().getValue(),d=11;d>=0;--d)(p&1<<d)!==0&&i.set(a),a++}return i},r}(),yt=function(){function r(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}return r.prototype.getDecodedInformation=function(){return this.decodedInformation},r.prototype.isFinished=function(){return this.finished},r}(),ii=function(){function r(e){this.newPosition=e}return r.prototype.getNewPosition=function(){return this.newPosition},r}(),_u=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Qe=function(r){_u(e,r);function e(t,n){var i=r.call(this,t)||this;return i.value=n,i}return e.prototype.getValue=function(){return this.value},e.prototype.isFNC1=function(){return this.value===e.FNC1},e.FNC1="$",e}(ii),Au=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ct=function(r){Au(e,r);function e(t,n,i){var a=r.call(this,t)||this;return i?(a.remaining=!0,a.remainingValue=a.remainingValue):(a.remaining=!1,a.remainingValue=0),a.newString=n,a}return e.prototype.getNewString=function(){return this.newString},e.prototype.isRemaining=function(){return this.remaining},e.prototype.getRemainingValue=function(){return this.remainingValue},e}(ii),Eu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ht=function(r){Eu(e,r);function e(t,n,i){var a=r.call(this,t)||this;if(n<0||n>10||i<0||i>10)throw new F;return a.firstDigit=n,a.secondDigit=i,a}return e.prototype.getFirstDigit=function(){return this.firstDigit},e.prototype.getSecondDigit=function(){return this.secondDigit},e.prototype.getValue=function(){return this.firstDigit*10+this.secondDigit},e.prototype.isFirstDigitFNC1=function(){return this.firstDigit===e.FNC1},e.prototype.isSecondDigitFNC1=function(){return this.secondDigit===e.FNC1},e.prototype.isAnyFNC1=function(){return this.firstDigit===e.FNC1||this.secondDigit===e.FNC1},e.FNC1=10,e}(ii),Jr=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Iu=function(){function r(){}return r.parseFieldsInGeneralPurpose=function(e){var t,n,i,a,o,s,l,u;if(!e)return null;if(e.length<2)throw new N;var c=e.substring(0,2);try{for(var d=Jr(r.TWO_DIGIT_DATA_LENGTH),p=d.next();!p.done;p=d.next()){var h=p.value;if(h[0]===c)return h[1]===r.VARIABLE_LENGTH?r.processVariableAI(2,h[2],e):r.processFixedAI(2,h[1],e)}}catch(T){t={error:T}}finally{try{p&&!p.done&&(n=d.return)&&n.call(d)}finally{if(t)throw t.error}}if(e.length<3)throw new N;var g=e.substring(0,3);try{for(var x=Jr(r.THREE_DIGIT_DATA_LENGTH),C=x.next();!C.done;C=x.next()){var h=C.value;if(h[0]===g)return h[1]===r.VARIABLE_LENGTH?r.processVariableAI(3,h[2],e):r.processFixedAI(3,h[1],e)}}catch(T){i={error:T}}finally{try{C&&!C.done&&(a=x.return)&&a.call(x)}finally{if(i)throw i.error}}try{for(var w=Jr(r.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH),m=w.next();!m.done;m=w.next()){var h=m.value;if(h[0]===g)return h[1]===r.VARIABLE_LENGTH?r.processVariableAI(4,h[2],e):r.processFixedAI(4,h[1],e)}}catch(T){o={error:T}}finally{try{m&&!m.done&&(s=w.return)&&s.call(w)}finally{if(o)throw o.error}}if(e.length<4)throw new N;var _=e.substring(0,4);try{for(var E=Jr(r.FOUR_DIGIT_DATA_LENGTH),S=E.next();!S.done;S=E.next()){var h=S.value;if(h[0]===_)return h[1]===r.VARIABLE_LENGTH?r.processVariableAI(4,h[2],e):r.processFixedAI(4,h[1],e)}}catch(T){l={error:T}}finally{try{S&&!S.done&&(u=E.return)&&u.call(E)}finally{if(l)throw l.error}}throw new N},r.processFixedAI=function(e,t,n){if(n.length<e)throw new N;var i=n.substring(0,e);if(n.length<e+t)throw new N;var a=n.substring(e,e+t),o=n.substring(e+t),s="("+i+")"+a,l=r.parseFieldsInGeneralPurpose(o);return l==null?s:s+l},r.processVariableAI=function(e,t,n){var i=n.substring(0,e),a;n.length<e+t?a=n.length:a=e+t;var o=n.substring(e,a),s=n.substring(a),l="("+i+")"+o,u=r.parseFieldsInGeneralPurpose(s);return u==null?l:l+u},r.VARIABLE_LENGTH=[],r.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",r.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",r.VARIABLE_LENGTH,20],["22",r.VARIABLE_LENGTH,29],["30",r.VARIABLE_LENGTH,8],["37",r.VARIABLE_LENGTH,8],["90",r.VARIABLE_LENGTH,30],["91",r.VARIABLE_LENGTH,30],["92",r.VARIABLE_LENGTH,30],["93",r.VARIABLE_LENGTH,30],["94",r.VARIABLE_LENGTH,30],["95",r.VARIABLE_LENGTH,30],["96",r.VARIABLE_LENGTH,30],["97",r.VARIABLE_LENGTH,3],["98",r.VARIABLE_LENGTH,30],["99",r.VARIABLE_LENGTH,30]],r.THREE_DIGIT_DATA_LENGTH=[["240",r.VARIABLE_LENGTH,30],["241",r.VARIABLE_LENGTH,30],["242",r.VARIABLE_LENGTH,6],["250",r.VARIABLE_LENGTH,30],["251",r.VARIABLE_LENGTH,30],["253",r.VARIABLE_LENGTH,17],["254",r.VARIABLE_LENGTH,20],["400",r.VARIABLE_LENGTH,30],["401",r.VARIABLE_LENGTH,30],["402",17],["403",r.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",r.VARIABLE_LENGTH,20],["421",r.VARIABLE_LENGTH,15],["422",3],["423",r.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],r.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",r.VARIABLE_LENGTH,15],["391",r.VARIABLE_LENGTH,18],["392",r.VARIABLE_LENGTH,15],["393",r.VARIABLE_LENGTH,18],["703",r.VARIABLE_LENGTH,30]],r.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",r.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",r.VARIABLE_LENGTH,20],["8003",r.VARIABLE_LENGTH,30],["8004",r.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",r.VARIABLE_LENGTH,30],["8008",r.VARIABLE_LENGTH,12],["8018",18],["8020",r.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",r.VARIABLE_LENGTH,70],["8200",r.VARIABLE_LENGTH,70]],r}(),en=function(){function r(e){this.buffer=new $,this.information=e}return r.prototype.decodeAllCodes=function(e,t){var n=t,i=null;do{var a=this.decodeGeneralPurposeField(n,i),o=Iu.parseFieldsInGeneralPurpose(a.getNewString());if(o!=null&&e.append(o),a.isRemaining()?i=""+a.getRemainingValue():i=null,n===a.getNewPosition())break;n=a.getNewPosition()}while(!0);return e.toString()},r.prototype.isStillNumeric=function(e){if(e+7>this.information.getSize())return e+4<=this.information.getSize();for(var t=e;t<e+3;++t)if(this.information.get(t))return!0;return this.information.get(e+3)},r.prototype.decodeNumeric=function(e){if(e+7>this.information.getSize()){var t=this.extractNumericValueFromBitArray(e,4);return t===0?new Ht(this.information.getSize(),Ht.FNC1,Ht.FNC1):new Ht(this.information.getSize(),t-1,Ht.FNC1)}var n=this.extractNumericValueFromBitArray(e,7),i=(n-8)/11,a=(n-8)%11;return new Ht(e+7,i,a)},r.prototype.extractNumericValueFromBitArray=function(e,t){return r.extractNumericValueFromBitArray(this.information,e,t)},r.extractNumericValueFromBitArray=function(e,t,n){for(var i=0,a=0;a<n;++a)e.get(t+a)&&(i|=1<<n-a-1);return i},r.prototype.decodeGeneralPurposeField=function(e,t){this.buffer.setLengthToZero(),t!=null&&this.buffer.append(t),this.current.setPosition(e);var n=this.parseBlocks();return n!=null&&n.isRemaining()?new Ct(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new Ct(this.current.getPosition(),this.buffer.toString())},r.prototype.parseBlocks=function(){var e,t;do{var n=this.current.getPosition();this.current.isAlpha()?(t=this.parseAlphaBlock(),e=t.isFinished()):this.current.isIsoIec646()?(t=this.parseIsoIec646Block(),e=t.isFinished()):(t=this.parseNumericBlock(),e=t.isFinished());var i=n!==this.current.getPosition();if(!i&&!e)break}while(!e);return t.getDecodedInformation()},r.prototype.parseNumericBlock=function(){for(;this.isStillNumeric(this.current.getPosition());){var e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1()){var t=void 0;return e.isSecondDigitFNC1()?t=new Ct(this.current.getPosition(),this.buffer.toString()):t=new Ct(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new yt(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){var t=new Ct(this.current.getPosition(),this.buffer.toString());return new yt(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new yt(!1)},r.prototype.parseIsoIec646Block=function(){for(;this.isStillIsoIec646(this.current.getPosition());){var e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){var t=new Ct(this.current.getPosition(),this.buffer.toString());return new yt(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new yt(!1)},r.prototype.parseAlphaBlock=function(){for(;this.isStillAlpha(this.current.getPosition());){var e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){var t=new Ct(this.current.getPosition(),this.buffer.toString());return new yt(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new yt(!1)},r.prototype.isStillIsoIec646=function(e){if(e+5>this.information.getSize())return!1;var t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;var n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<116)return!0;if(e+8>this.information.getSize())return!1;var i=this.extractNumericValueFromBitArray(e,8);return i>=232&&i<253},r.prototype.decodeIsoIec646=function(e){var t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Qe(e+5,Qe.FNC1);if(t>=5&&t<15)return new Qe(e+5,"0"+(t-5));var n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new Qe(e+7,""+(n+1));if(n>=90&&n<116)return new Qe(e+7,""+(n+7));var i=this.extractNumericValueFromBitArray(e,8),a;switch(i){case 232:a="!";break;case 233:a='"';break;case 234:a="%";break;case 235:a="&";break;case 236:a="'";break;case 237:a="(";break;case 238:a=")";break;case 239:a="*";break;case 240:a="+";break;case 241:a=",";break;case 242:a="-";break;case 243:a=".";break;case 244:a="/";break;case 245:a=":";break;case 246:a=";";break;case 247:a="<";break;case 248:a="=";break;case 249:a=">";break;case 250:a="?";break;case 251:a="_";break;case 252:a=" ";break;default:throw new F}return new Qe(e+8,a)},r.prototype.isStillAlpha=function(e){if(e+5>this.information.getSize())return!1;var t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;var n=this.extractNumericValueFromBitArray(e,6);return n>=16&&n<63},r.prototype.decodeAlphanumeric=function(e){var t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Qe(e+5,Qe.FNC1);if(t>=5&&t<15)return new Qe(e+5,"0"+(t-5));var n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new Qe(e+6,""+(n+33));var i;switch(n){case 58:i="*";break;case 59:i=",";break;case 60:i="-";break;case 61:i=".";break;case 62:i="/";break;default:throw new pr("Decoding invalid alphanumeric value: "+n)}return new Qe(e+6,i)},r.prototype.isAlphaTo646ToAlphaLatch=function(e){if(e+1>this.information.getSize())return!1;for(var t=0;t<5&&t+e<this.information.getSize();++t)if(t===2){if(!this.information.get(e+2))return!1}else if(this.information.get(e+t))return!1;return!0},r.prototype.isAlphaOr646ToNumericLatch=function(e){if(e+3>this.information.getSize())return!1;for(var t=e;t<e+3;++t)if(this.information.get(t))return!1;return!0},r.prototype.isNumericToAlphaNumericLatch=function(e){if(e+1>this.information.getSize())return!1;for(var t=0;t<4&&t+e<this.information.getSize();++t)if(this.information.get(e+t))return!1;return!0},r}(),Da=function(){function r(e){this.information=e,this.generalDecoder=new en(e)}return r.prototype.getInformation=function(){return this.information},r.prototype.getGeneralDecoder=function(){return this.generalDecoder},r}(),Su=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Je=function(r){Su(e,r);function e(t){return r.call(this,t)||this}return e.prototype.encodeCompressedGtin=function(t,n){t.append("(01)");var i=t.length();t.append("9"),this.encodeCompressedGtinWithoutAI(t,n,i)},e.prototype.encodeCompressedGtinWithoutAI=function(t,n,i){for(var a=0;a<4;++a){var o=this.getGeneralDecoder().extractNumericValueFromBitArray(n+10*a,10);o/100===0&&t.append("0"),o/10===0&&t.append("0"),t.append(o)}e.appendCheckDigit(t,i)},e.appendCheckDigit=function(t,n){for(var i=0,a=0;a<13;a++){var o=t.charAt(a+n).charCodeAt(0)-48;i+=(a&1)===0?3*o:o}i=10-i%10,i===10&&(i=0),t.append(i)},e.GTIN_SIZE=40,e}(Da),Ou=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),bu=function(r){Ou(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){var t=new $;t.append("(01)");var n=t.length(),i=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE,4);return t.append(i),this.encodeCompressedGtinWithoutAI(t,e.HEADER_SIZE+4,n),this.getGeneralDecoder().decodeAllCodes(t,e.HEADER_SIZE+44)},e.HEADER_SIZE=4,e}(Je),Nu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Tu=function(r){Nu(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){var t=new $;return this.getGeneralDecoder().decodeAllCodes(t,e.HEADER_SIZE)},e.HEADER_SIZE=5,e}(Da),Du=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),tn=function(r){Du(e,r);function e(t){return r.call(this,t)||this}return e.prototype.encodeCompressedWeight=function(t,n,i){var a=this.getGeneralDecoder().extractNumericValueFromBitArray(n,i);this.addWeightCode(t,a);for(var o=this.checkWeight(a),s=1e5,l=0;l<5;++l)o/s===0&&t.append("0"),s/=10;t.append(o)},e}(Je),Mu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ma=function(r){Mu(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()!==e.HEADER_SIZE+tn.GTIN_SIZE+e.WEIGHT_SIZE)throw new N;var t=new $;return this.encodeCompressedGtin(t,e.HEADER_SIZE),this.encodeCompressedWeight(t,e.HEADER_SIZE+tn.GTIN_SIZE,e.WEIGHT_SIZE),t.toString()},e.HEADER_SIZE=5,e.WEIGHT_SIZE=15,e}(tn),Pu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Fu=function(r){Pu(e,r);function e(t){return r.call(this,t)||this}return e.prototype.addWeightCode=function(t,n){t.append("(3103)")},e.prototype.checkWeight=function(t){return t},e}(Ma),Vu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Bu=function(r){Vu(e,r);function e(t){return r.call(this,t)||this}return e.prototype.addWeightCode=function(t,n){n<1e4?t.append("(3202)"):t.append("(3203)")},e.prototype.checkWeight=function(t){return t<1e4?t:t-1e4},e}(Ma),Lu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),zu=function(r){Lu(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()<e.HEADER_SIZE+Je.GTIN_SIZE)throw new N;var t=new $;this.encodeCompressedGtin(t,e.HEADER_SIZE);var n=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE+Je.GTIN_SIZE,e.LAST_DIGIT_SIZE);t.append("(392"),t.append(n),t.append(")");var i=this.getGeneralDecoder().decodeGeneralPurposeField(e.HEADER_SIZE+Je.GTIN_SIZE+e.LAST_DIGIT_SIZE,null);return t.append(i.getNewString()),t.toString()},e.HEADER_SIZE=8,e.LAST_DIGIT_SIZE=2,e}(Je),ku=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ru=function(r){ku(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()<e.HEADER_SIZE+Je.GTIN_SIZE)throw new N;var t=new $;this.encodeCompressedGtin(t,e.HEADER_SIZE);var n=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE+Je.GTIN_SIZE,e.LAST_DIGIT_SIZE);t.append("(393"),t.append(n),t.append(")");var i=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE+Je.GTIN_SIZE+e.LAST_DIGIT_SIZE,e.FIRST_THREE_DIGITS_SIZE);i/100===0&&t.append("0"),i/10===0&&t.append("0"),t.append(i);var a=this.getGeneralDecoder().decodeGeneralPurposeField(e.HEADER_SIZE+Je.GTIN_SIZE+e.LAST_DIGIT_SIZE+e.FIRST_THREE_DIGITS_SIZE,null);return t.append(a.getNewString()),t.toString()},e.HEADER_SIZE=8,e.LAST_DIGIT_SIZE=2,e.FIRST_THREE_DIGITS_SIZE=10,e}(Je),Uu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),st=function(r){Uu(e,r);function e(t,n,i){var a=r.call(this,t)||this;return a.dateCode=i,a.firstAIdigits=n,a}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()!==e.HEADER_SIZE+e.GTIN_SIZE+e.WEIGHT_SIZE+e.DATE_SIZE)throw new N;var t=new $;return this.encodeCompressedGtin(t,e.HEADER_SIZE),this.encodeCompressedWeight(t,e.HEADER_SIZE+e.GTIN_SIZE,e.WEIGHT_SIZE),this.encodeCompressedDate(t,e.HEADER_SIZE+e.GTIN_SIZE+e.WEIGHT_SIZE),t.toString()},e.prototype.encodeCompressedDate=function(t,n){var i=this.getGeneralDecoder().extractNumericValueFromBitArray(n,e.DATE_SIZE);if(i!==38400){t.append("("),t.append(this.dateCode),t.append(")");var a=i%32;i/=32;var o=i%12+1;i/=12;var s=i;s/10===0&&t.append("0"),t.append(s),o/10===0&&t.append("0"),t.append(o),a/10===0&&t.append("0"),t.append(a)}},e.prototype.addWeightCode=function(t,n){t.append("("),t.append(this.firstAIdigits),t.append(n/1e5),t.append(")")},e.prototype.checkWeight=function(t){return t%1e5},e.HEADER_SIZE=8,e.WEIGHT_SIZE=20,e.DATE_SIZE=16,e}(tn);function Hu(r){try{if(r.get(1))return new bu(r);if(!r.get(2))return new Tu(r);var e=en.extractNumericValueFromBitArray(r,1,4);switch(e){case 4:return new Fu(r);case 5:return new Bu(r)}var t=en.extractNumericValueFromBitArray(r,1,5);switch(t){case 12:return new zu(r);case 13:return new Ru(r)}var n=en.extractNumericValueFromBitArray(r,1,7);switch(n){case 56:return new st(r,"310","11");case 57:return new st(r,"320","11");case 58:return new st(r,"310","13");case 59:return new st(r,"320","13");case 60:return new st(r,"310","15");case 61:return new st(r,"320","15");case 62:return new st(r,"310","17");case 63:return new st(r,"320","17")}}catch(i){throw console.log(i),new pr("unknown decoder: "+r)}}var Pa=function(){function r(e,t,n,i){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=i}return r.prototype.mayBeLast=function(){return this.maybeLast},r.prototype.getLeftChar=function(){return this.leftchar},r.prototype.getRightChar=function(){return this.rightchar},r.prototype.getFinderPattern=function(){return this.finderpattern},r.prototype.mustBeLast=function(){return this.rightchar==null},r.prototype.toString=function(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"},r.equals=function(e,t){return e instanceof r?r.equalsOrNull(e.leftchar,t.leftchar)&&r.equalsOrNull(e.rightchar,t.rightchar)&&r.equalsOrNull(e.finderpattern,t.finderpattern):!1},r.equalsOrNull=function(e,t){return e===null?t===null:r.equals(e,t)},r.prototype.hashCode=function(){var e=this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue();return e},r}(),Gu=function(){function r(e,t,n){this.pairs=e,this.rowNumber=t,this.wasReversed=n}return r.prototype.getPairs=function(){return this.pairs},r.prototype.getRowNumber=function(){return this.rowNumber},r.prototype.isReversed=function(){return this.wasReversed},r.prototype.isEquivalent=function(e){return this.checkEqualitity(this,e)},r.prototype.toString=function(){return"{ "+this.pairs+" }"},r.prototype.equals=function(e,t){return e instanceof r?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1},r.prototype.checkEqualitity=function(e,t){if(!(!e||!t)){var n;return e.forEach(function(i,a){t.forEach(function(o){i.getLeftChar().getValue()===o.getLeftChar().getValue()&&i.getRightChar().getValue()===o.getRightChar().getValue()&&i.getFinderPatter().getValue()===o.getFinderPatter().getValue()&&(n=!0)})}),n}},r}(),Xu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),lt=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},$u=function(r){Xu(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.pairs=new Array(e.MAX_PAIRS),t.rows=new Array,t.startEnd=[2],t}return e.prototype.decodeRow=function(t,n,i){this.pairs.length=0,this.startFromEven=!1;try{return e.constructResult(this.decodeRow2pairs(t,n))}catch{}return this.pairs.length=0,this.startFromEven=!0,e.constructResult(this.decodeRow2pairs(t,n))},e.prototype.reset=function(){this.pairs.length=0,this.rows.length=0},e.prototype.decodeRow2pairs=function(t,n){for(var i=!1;!i;)try{this.pairs.push(this.retrieveNextPair(n,this.pairs,t))}catch(s){if(s instanceof N){if(!this.pairs.length)throw new N;i=!0}}if(this.checkChecksum())return this.pairs;var a;if(this.rows.length?a=!0:a=!1,this.storeRow(t,!1),a){var o=this.checkRowsBoolean(!1);if(o!=null||(o=this.checkRowsBoolean(!0),o!=null))return o}throw new N},e.prototype.checkRowsBoolean=function(t){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,t&&(this.rows=this.rows.reverse());var n=null;try{n=this.checkRows(new Array,0)}catch(i){console.log(i)}return t&&(this.rows=this.rows.reverse()),n},e.prototype.checkRows=function(t,n){for(var i,a,o=n;o<this.rows.length;o++){var s=this.rows[o];this.pairs.length=0;try{for(var l=(i=void 0,lt(t)),u=l.next();!u.done;u=l.next()){var c=u.value;this.pairs.push(c.getPairs())}}catch(p){i={error:p}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(i)throw i.error}}if(this.pairs.push(s.getPairs()),!!e.isValidSequence(this.pairs)){if(this.checkChecksum())return this.pairs;var d=new Array(t);d.push(s);try{return this.checkRows(d,o+1)}catch(p){console.log(p)}}}throw new N},e.isValidSequence=function(t){var n,i;try{for(var a=lt(e.FINDER_PATTERN_SEQUENCES),o=a.next();!o.done;o=a.next()){var s=o.value;if(!(t.length>s.length)){for(var l=!0,u=0;u<t.length;u++)if(t[u].getFinderPattern().getValue()!==s[u]){l=!1;break}if(l)return!0}}}catch(c){n={error:c}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return!1},e.prototype.storeRow=function(t,n){for(var i=0,a=!1,o=!1;i<this.rows.length;){var s=this.rows[i];if(s.getRowNumber()>t){o=s.isEquivalent(this.pairs);break}a=s.isEquivalent(this.pairs),i++}o||a||e.isPartialRow(this.pairs,this.rows)||(this.rows.push(i,new Gu(this.pairs,t,n)),this.removePartialRows(this.pairs,this.rows))},e.prototype.removePartialRows=function(t,n){var i,a,o,s,l,u;try{for(var c=lt(n),d=c.next();!d.done;d=c.next()){var p=d.value;if(p.getPairs().length!==t.length){var h=!0;try{for(var g=(o=void 0,lt(p.getPairs())),x=g.next();!x.done;x=g.next()){var C=x.value,w=!1;try{for(var m=(l=void 0,lt(t)),_=m.next();!_.done;_=m.next()){var E=_.value;if(Pa.equals(C,E)){w=!0;break}}}catch(S){l={error:S}}finally{try{_&&!_.done&&(u=m.return)&&u.call(m)}finally{if(l)throw l.error}}w||(h=!1)}}catch(S){o={error:S}}finally{try{x&&!x.done&&(s=g.return)&&s.call(g)}finally{if(o)throw o.error}}}}}catch(S){i={error:S}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(i)throw i.error}}},e.isPartialRow=function(t,n){var i,a,o,s,l,u;try{for(var c=lt(n),d=c.next();!d.done;d=c.next()){var p=d.value,h=!0;try{for(var g=(o=void 0,lt(t)),x=g.next();!x.done;x=g.next()){var C=x.value,w=!1;try{for(var m=(l=void 0,lt(p.getPairs())),_=m.next();!_.done;_=m.next()){var E=_.value;if(C.equals(E)){w=!0;break}}}catch(S){l={error:S}}finally{try{_&&!_.done&&(u=m.return)&&u.call(m)}finally{if(l)throw l.error}}if(!w){h=!1;break}}}catch(S){o={error:S}}finally{try{x&&!x.done&&(s=g.return)&&s.call(g)}finally{if(o)throw o.error}}if(h)return!0}}catch(S){i={error:S}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(i)throw i.error}}return!1},e.prototype.getRows=function(){return this.rows},e.constructResult=function(t){var n=mu.buildBitArray(t),i=Hu(n),a=i.parseInformation(),o=t[0].getFinderPattern().getResultPoints(),s=t[t.length-1].getFinderPattern().getResultPoints(),l=[o[0],o[1],s[0],s[1]];return new Ne(a,null,null,l,B.RSS_EXPANDED,null)},e.prototype.checkChecksum=function(){var t=this.pairs.get(0),n=t.getLeftChar(),i=t.getRightChar();if(i===null)return!1;for(var a=i.getChecksumPortion(),o=2,s=1;s<this.pairs.size();++s){var l=this.pairs.get(s);a+=l.getLeftChar().getChecksumPortion(),o++;var u=l.getRightChar();u!=null&&(a+=u.getChecksumPortion(),o++)}a%=211;var c=211*(o-4)+a;return c===n.getValue()},e.getNextSecondBar=function(t,n){var i;return t.get(n)?(i=t.getNextUnset(n),i=t.getNextSet(i)):(i=t.getNextSet(n),i=t.getNextUnset(i)),i},e.prototype.retrieveNextPair=function(t,n,i){var a=n.length%2===0;this.startFromEven&&(a=!a);var o,s=!0,l=-1;do this.findNextPair(t,n,l),o=this.parseFoundFinderPattern(t,i,a),o===null?l=e.getNextSecondBar(t,this.startEnd[0]):s=!1;while(s);var u=this.decodeDataCharacter(t,o,a,!0);if(!this.isEmptyPair(n)&&n[n.length-1].mustBeLast())throw new N;var c;try{c=this.decodeDataCharacter(t,o,a,!1)}catch(d){c=null,console.log(d)}return new Pa(u,c,o,!0)},e.prototype.isEmptyPair=function(t){return t.length===0},e.prototype.findNextPair=function(t,n,i){var a=this.getDecodeFinderCounters();a[0]=0,a[1]=0,a[2]=0,a[3]=0;var o=t.getSize(),s;if(i>=0)s=i;else if(this.isEmptyPair(n))s=0;else{var l=n[n.length-1];s=l.getFinderPattern().getStartEnd()[1]}var u=n.length%2!==0;this.startFromEven&&(u=!u);for(var c=!1;s<o&&(c=!t.get(s),!!c);)s++;for(var d=0,p=s,h=s;h<o;h++)if(t.get(h)!==c)a[d]++;else{if(d===3){if(u&&e.reverseCounters(a),e.isFinderPattern(a)){this.startEnd[0]=p,this.startEnd[1]=h;return}u&&e.reverseCounters(a),p+=a[0]+a[1],a[0]=a[2],a[1]=a[3],a[2]=0,a[3]=0,d--}else d++;a[d]=1,c=!c}throw new N},e.reverseCounters=function(t){for(var n=t.length,i=0;i<n/2;++i){var a=t[i];t[i]=t[n-i-1],t[n-i-1]=a}},e.prototype.parseFoundFinderPattern=function(t,n,i){var a,o,s;if(i){for(var l=this.startEnd[0]-1;l>=0&&!t.get(l);)l--;l++,a=this.startEnd[0]-l,o=l,s=this.startEnd[1]}else o=this.startEnd[0],s=t.getNextUnset(this.startEnd[1]+1),a=s-this.startEnd[1];var u=this.getDecodeFinderCounters();se.arraycopy(u,0,u,1,u.length-1),u[0]=a;var c;try{c=this.parseFinderValue(u,e.FINDER_PATTERNS)}catch{return null}return new Ta(c,[o,s],o,s,n)},e.prototype.decodeDataCharacter=function(t,n,i,a){for(var o=this.getDataCharacterCounters(),s=0;s<o.length;s++)o[s]=0;if(a)e.recordPatternInReverse(t,n.getStartEnd()[0],o);else{e.recordPattern(t,n.getStartEnd()[1],o);for(var l=0,u=o.length-1;l<u;l++,u--){var c=o[l];o[l]=o[u],o[u]=c}}var d=17,p=Q.sum(new Int32Array(o))/d,h=(n.getStartEnd()[1]-n.getStartEnd()[0])/15;if(Math.abs(p-h)/h>.3)throw new N;for(var g=this.getOddCounts(),x=this.getEvenCounts(),C=this.getOddRoundingErrors(),w=this.getEvenRoundingErrors(),l=0;l<o.length;l++){var m=1*o[l]/p,_=m+.5;if(_<1){if(m<.3)throw new N;_=1}else if(_>8){if(m>8.7)throw new N;_=8}var E=l/2;(l&1)===0?(g[E]=_,C[E]=m-_):(x[E]=_,w[E]=m-_)}this.adjustOddEvenCounts(d);for(var S=4*n.getValue()+(i?0:2)+(a?0:1)-1,T=0,D=0,l=g.length-1;l>=0;l--){if(e.isNotA1left(n,i,a)){var M=e.WEIGHTS[S][2*l];D+=g[l]*M}T+=g[l]}for(var P=0,l=x.length-1;l>=0;l--)if(e.isNotA1left(n,i,a)){var M=e.WEIGHTS[S][2*l+1];P+=x[l]*M}var V=D+P;if((T&1)!==0||T>13||T<4)throw new N;var W=(13-T)/2,U=e.SYMBOL_WIDEST[W],J=9-U,R=Ut.getRSSvalue(g,U,!0),K=Ut.getRSSvalue(x,J,!1),X=e.EVEN_TOTAL_SUBSET[W],ae=e.GSUM[W],Fe=R*X+K+ae;return new Qr(Fe,V)},e.isNotA1left=function(t,n,i){return!(t.getValue()===0&&n&&i)},e.prototype.adjustOddEvenCounts=function(t){var n=Q.sum(new Int32Array(this.getOddCounts())),i=Q.sum(new Int32Array(this.getEvenCounts())),a=!1,o=!1;n>13?o=!0:n<4&&(a=!0);var s=!1,l=!1;i>13?l=!0:i<4&&(s=!0);var u=n+i-t,c=(n&1)===1,d=(i&1)===0;if(u===1)if(c){if(d)throw new N;o=!0}else{if(!d)throw new N;l=!0}else if(u===-1)if(c){if(d)throw new N;a=!0}else{if(!d)throw new N;s=!0}else if(u===0){if(c){if(!d)throw new N;n<i?(a=!0,l=!0):(o=!0,s=!0)}else if(d)throw new N}else throw new N;if(a){if(o)throw new N;e.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(o&&e.decrement(this.getOddCounts(),this.getOddRoundingErrors()),s){if(l)throw new N;e.increment(this.getEvenCounts(),this.getOddRoundingErrors())}l&&e.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())},e.SYMBOL_WIDEST=[7,5,4,3,1],e.EVEN_TOTAL_SUBSET=[4,20,52,104,204],e.GSUM=[0,348,1388,2948,3988],e.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],e.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],e.FINDER_PAT_A=0,e.FINDER_PAT_B=1,e.FINDER_PAT_C=2,e.FINDER_PAT_D=3,e.FINDER_PAT_E=4,e.FINDER_PAT_F=5,e.FINDER_PATTERN_SEQUENCES=[[e.FINDER_PAT_A,e.FINDER_PAT_A],[e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B],[e.FINDER_PAT_A,e.FINDER_PAT_C,e.FINDER_PAT_B,e.FINDER_PAT_D],[e.FINDER_PAT_A,e.FINDER_PAT_E,e.FINDER_PAT_B,e.FINDER_PAT_D,e.FINDER_PAT_C],[e.FINDER_PAT_A,e.FINDER_PAT_E,e.FINDER_PAT_B,e.FINDER_PAT_D,e.FINDER_PAT_D,e.FINDER_PAT_F],[e.FINDER_PAT_A,e.FINDER_PAT_E,e.FINDER_PAT_B,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_F,e.FINDER_PAT_F],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_D],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_E],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_F,e.FINDER_PAT_F],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_E,e.FINDER_PAT_F,e.FINDER_PAT_F]],e.MAX_PAIRS=11,e}(xt),qu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Wu=function(r){qu(e,r);function e(t,n,i){var a=r.call(this,t,n)||this;return a.count=0,a.finderPattern=i,a}return e.prototype.getFinderPattern=function(){return this.finderPattern},e.prototype.getCount=function(){return this.count},e.prototype.incrementCount=function(){this.count++},e}(Qr),ju=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ai=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Fa=function(r){ju(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.possibleLeftPairs=[],t.possibleRightPairs=[],t}return e.prototype.decodeRow=function(t,n,i){var a,o,s,l,u=this.decodePair(n,!1,t,i);e.addOrTally(this.possibleLeftPairs,u),n.reverse();var c=this.decodePair(n,!0,t,i);e.addOrTally(this.possibleRightPairs,c),n.reverse();try{for(var d=ai(this.possibleLeftPairs),p=d.next();!p.done;p=d.next()){var h=p.value;if(h.getCount()>1)try{for(var g=(s=void 0,ai(this.possibleRightPairs)),x=g.next();!x.done;x=g.next()){var C=x.value;if(C.getCount()>1&&e.checkChecksum(h,C))return e.constructResult(h,C)}}catch(w){s={error:w}}finally{try{x&&!x.done&&(l=g.return)&&l.call(g)}finally{if(s)throw s.error}}}}catch(w){a={error:w}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(a)throw a.error}}throw new N},e.addOrTally=function(t,n){var i,a;if(n!=null){var o=!1;try{for(var s=ai(t),l=s.next();!l.done;l=s.next()){var u=l.value;if(u.getValue()===n.getValue()){u.incrementCount(),o=!0;break}}}catch(c){i={error:c}}finally{try{l&&!l.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}o||t.push(n)}},e.prototype.reset=function(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0},e.constructResult=function(t,n){for(var i=4537077*t.getValue()+n.getValue(),a=new String(i).toString(),o=new $,s=13-a.length;s>0;s--)o.append("0");o.append(a);for(var l=0,s=0;s<13;s++){var u=o.charAt(s).charCodeAt(0)-48;l+=(s&1)===0?3*u:u}l=10-l%10,l===10&&(l=0),o.append(l.toString());var c=t.getFinderPattern().getResultPoints(),d=n.getFinderPattern().getResultPoints();return new Ne(o.toString(),null,0,[c[0],c[1],d[0],d[1]],B.RSS_14,new Date().getTime())},e.checkChecksum=function(t,n){var i=(t.getChecksumPortion()+16*n.getChecksumPortion())%79,a=9*t.getFinderPattern().getValue()+n.getFinderPattern().getValue();return a>72&&a--,a>8&&a--,i===a},e.prototype.decodePair=function(t,n,i,a){try{var o=this.findFinderPattern(t,n),s=this.parseFoundFinderPattern(t,i,n,o),l=a==null?null:a.get(ce.NEED_RESULT_POINT_CALLBACK);if(l!=null){var u=(o[0]+o[1])/2;n&&(u=t.getSize()-1-u),l.foundPossibleResultPoint(new z(u,i))}var c=this.decodeDataCharacter(t,s,!0),d=this.decodeDataCharacter(t,s,!1);return new Wu(1597*c.getValue()+d.getValue(),c.getChecksumPortion()+4*d.getChecksumPortion(),s)}catch{return null}},e.prototype.decodeDataCharacter=function(t,n,i){for(var a=this.getDataCharacterCounters(),o=0;o<a.length;o++)a[o]=0;if(i)ve.recordPatternInReverse(t,n.getStartEnd()[0],a);else{ve.recordPattern(t,n.getStartEnd()[1]+1,a);for(var s=0,l=a.length-1;s<l;s++,l--){var u=a[s];a[s]=a[l],a[l]=u}}for(var c=i?16:15,d=Q.sum(new Int32Array(a))/c,p=this.getOddCounts(),h=this.getEvenCounts(),g=this.getOddRoundingErrors(),x=this.getEvenRoundingErrors(),s=0;s<a.length;s++){var C=a[s]/d,w=Math.floor(C+.5);w<1?w=1:w>8&&(w=8);var m=Math.floor(s/2);(s&1)===0?(p[m]=w,g[m]=C-w):(h[m]=w,x[m]=C-w)}this.adjustOddEvenCounts(i,c);for(var _=0,E=0,s=p.length-1;s>=0;s--)E*=9,E+=p[s],_+=p[s];for(var S=0,T=0,s=h.length-1;s>=0;s--)S*=9,S+=h[s],T+=h[s];var D=E+3*S;if(i){if((_&1)!==0||_>12||_<4)throw new N;var M=(12-_)/2,P=e.OUTSIDE_ODD_WIDEST[M],V=9-P,W=Ut.getRSSvalue(p,P,!1),U=Ut.getRSSvalue(h,V,!0),J=e.OUTSIDE_EVEN_TOTAL_SUBSET[M],R=e.OUTSIDE_GSUM[M];return new Qr(W*J+U+R,D)}else{if((T&1)!==0||T>10||T<4)throw new N;var M=(10-T)/2,P=e.INSIDE_ODD_WIDEST[M],V=9-P,W=Ut.getRSSvalue(p,P,!0),U=Ut.getRSSvalue(h,V,!1),K=e.INSIDE_ODD_TOTAL_SUBSET[M],R=e.INSIDE_GSUM[M];return new Qr(U*K+W+R,D)}},e.prototype.findFinderPattern=function(t,n){var i=this.getDecodeFinderCounters();i[0]=0,i[1]=0,i[2]=0,i[3]=0;for(var a=t.getSize(),o=!1,s=0;s<a&&(o=!t.get(s),n!==o);)s++;for(var l=0,u=s,c=s;c<a;c++)if(t.get(c)!==o)i[l]++;else{if(l===3){if(xt.isFinderPattern(i))return[u,c];u+=i[0]+i[1],i[0]=i[2],i[1]=i[3],i[2]=0,i[3]=0,l--}else l++;i[l]=1,o=!o}throw new N},e.prototype.parseFoundFinderPattern=function(t,n,i,a){for(var o=t.get(a[0]),s=a[0]-1;s>=0&&o!==t.get(s);)s--;s++;var l=a[0]-s,u=this.getDecodeFinderCounters(),c=new Int32Array(u.length);se.arraycopy(u,0,c,1,u.length-1),c[0]=l;var d=this.parseFinderValue(c,e.FINDER_PATTERNS),p=s,h=a[1];return i&&(p=t.getSize()-1-p,h=t.getSize()-1-h),new Ta(d,[s,a[1]],p,h,n)},e.prototype.adjustOddEvenCounts=function(t,n){var i=Q.sum(new Int32Array(this.getOddCounts())),a=Q.sum(new Int32Array(this.getEvenCounts())),o=!1,s=!1,l=!1,u=!1;t?(i>12?s=!0:i<4&&(o=!0),a>12?u=!0:a<4&&(l=!0)):(i>11?s=!0:i<5&&(o=!0),a>10?u=!0:a<4&&(l=!0));var c=i+a-n,d=(i&1)===(t?1:0),p=(a&1)===1;if(c===1)if(d){if(p)throw new N;s=!0}else{if(!p)throw new N;u=!0}else if(c===-1)if(d){if(p)throw new N;o=!0}else{if(!p)throw new N;l=!0}else if(c===0){if(d){if(!p)throw new N;i<a?(o=!0,u=!0):(s=!0,l=!0)}else if(p)throw new N}else throw new N;if(o){if(s)throw new N;xt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(s&&xt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),l){if(u)throw new N;xt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}u&&xt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())},e.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],e.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],e.OUTSIDE_GSUM=[0,161,961,2015,2715],e.INSIDE_GSUM=[0,336,1036,1516],e.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],e.INSIDE_ODD_WIDEST=[2,4,6,8],e.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])],e}(xt),Yu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),vr=function(r){Yu(e,r);function e(t){var n=r.call(this)||this;n.readers=[];var i=t?t.get(ce.POSSIBLE_FORMATS):null,a=t&&t.get(ce.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;return i&&((i.includes(B.EAN_13)||i.includes(B.UPC_A)||i.includes(B.EAN_8)||i.includes(B.UPC_E))&&n.readers.push(new ni(t)),i.includes(B.CODE_39)&&n.readers.push(new ma(a)),i.includes(B.CODE_93)&&n.readers.push(new _a),i.includes(B.CODE_128)&&n.readers.push(new wa),i.includes(B.ITF)&&n.readers.push(new Aa),i.includes(B.CODABAR)&&n.readers.push(new xu),i.includes(B.RSS_14)&&n.readers.push(new Fa),i.includes(B.RSS_EXPANDED)&&(console.warn("RSS Expanded reader IS NOT ready for production yet! use at your own risk."),n.readers.push(new $u))),n.readers.length===0&&(n.readers.push(new ni(t)),n.readers.push(new ma),n.readers.push(new _a),n.readers.push(new ni(t)),n.readers.push(new wa),n.readers.push(new Aa),n.readers.push(new Fa)),n}return e.prototype.decodeRow=function(t,n,i){for(var a=0;a<this.readers.length;a++)try{return this.readers[a].decodeRow(t,n,i)}catch{}throw new N},e.prototype.reset=function(){this.readers.forEach(function(t){return t.reset()})},e}(ve),Zu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){Zu(e,r);function e(t,n){return t===void 0&&(t=500),r.call(this,new vr(n),t,n)||this}return e})(kt);var Va=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},re=function(){function r(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}return r.prototype.getECCodewords=function(){return this.ecCodewords},r.prototype.getECBlocks=function(){return this.ecBlocks},r}(),ee=function(){function r(e,t){this.count=e,this.dataCodewords=t}return r.prototype.getCount=function(){return this.count},r.prototype.getDataCodewords=function(){return this.dataCodewords},r}(),Ku=function(){function r(e,t,n,i,a,o){var s,l;this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=i,this.dataRegionSizeColumns=a,this.ecBlocks=o;var u=0,c=o.getECCodewords(),d=o.getECBlocks();try{for(var p=Va(d),h=p.next();!h.done;h=p.next()){var g=h.value;u+=g.getCount()*(g.getDataCodewords()+c)}}catch(x){s={error:x}}finally{try{h&&!h.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}this.totalCodewords=u}return r.prototype.getVersionNumber=function(){return this.versionNumber},r.prototype.getSymbolSizeRows=function(){return this.symbolSizeRows},r.prototype.getSymbolSizeColumns=function(){return this.symbolSizeColumns},r.prototype.getDataRegionSizeRows=function(){return this.dataRegionSizeRows},r.prototype.getDataRegionSizeColumns=function(){return this.dataRegionSizeColumns},r.prototype.getTotalCodewords=function(){return this.totalCodewords},r.prototype.getECBlocks=function(){return this.ecBlocks},r.getVersionForDimensions=function(e,t){var n,i;if((e&1)!==0||(t&1)!==0)throw new F;try{for(var a=Va(r.VERSIONS),o=a.next();!o.done;o=a.next()){var s=o.value;if(s.symbolSizeRows===e&&s.symbolSizeColumns===t)return s}}catch(l){n={error:l}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}throw new F},r.prototype.toString=function(){return""+this.versionNumber},r.buildVersions=function(){return[new r(1,10,10,8,8,new re(5,new ee(1,3))),new r(2,12,12,10,10,new re(7,new ee(1,5))),new r(3,14,14,12,12,new re(10,new ee(1,8))),new r(4,16,16,14,14,new re(12,new ee(1,12))),new r(5,18,18,16,16,new re(14,new ee(1,18))),new r(6,20,20,18,18,new re(18,new ee(1,22))),new r(7,22,22,20,20,new re(20,new ee(1,30))),new r(8,24,24,22,22,new re(24,new ee(1,36))),new r(9,26,26,24,24,new re(28,new ee(1,44))),new r(10,32,32,14,14,new re(36,new ee(1,62))),new r(11,36,36,16,16,new re(42,new ee(1,86))),new r(12,40,40,18,18,new re(48,new ee(1,114))),new r(13,44,44,20,20,new re(56,new ee(1,144))),new r(14,48,48,22,22,new re(68,new ee(1,174))),new r(15,52,52,24,24,new re(42,new ee(2,102))),new r(16,64,64,14,14,new re(56,new ee(2,140))),new r(17,72,72,16,16,new re(36,new ee(4,92))),new r(18,80,80,18,18,new re(48,new ee(4,114))),new r(19,88,88,20,20,new re(56,new ee(4,144))),new r(20,96,96,22,22,new re(68,new ee(4,174))),new r(21,104,104,24,24,new re(56,new ee(6,136))),new r(22,120,120,18,18,new re(68,new ee(6,175))),new r(23,132,132,20,20,new re(62,new ee(8,163))),new r(24,144,144,22,22,new re(62,new ee(8,156),new ee(2,155))),new r(25,8,18,6,16,new re(7,new ee(1,5))),new r(26,8,32,6,14,new re(11,new ee(1,10))),new r(27,12,26,10,24,new re(14,new ee(1,16))),new r(28,12,36,10,16,new re(18,new ee(1,22))),new r(29,16,36,14,16,new re(24,new ee(1,32))),new r(30,16,48,14,22,new re(28,new ee(1,49)))]},r.VERSIONS=r.buildVersions(),r}(),Qu=function(){function r(e){var t=e.getHeight();if(t<8||t>144||(t&1)!==0)throw new F;this.version=r.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new tt(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}return r.prototype.getVersion=function(){return this.version},r.readVersion=function(e){var t=e.getHeight(),n=e.getWidth();return Ku.getVersionForDimensions(t,n)},r.prototype.readCodewords=function(){var e=new Int8Array(this.version.getTotalCodewords()),t=0,n=4,i=0,a=this.mappingBitMatrix.getHeight(),o=this.mappingBitMatrix.getWidth(),s=!1,l=!1,u=!1,c=!1;do if(n===a&&i===0&&!s)e[t++]=this.readCorner1(a,o)&255,n-=2,i+=2,s=!0;else if(n===a-2&&i===0&&(o&3)!==0&&!l)e[t++]=this.readCorner2(a,o)&255,n-=2,i+=2,l=!0;else if(n===a+4&&i===2&&(o&7)===0&&!u)e[t++]=this.readCorner3(a,o)&255,n-=2,i+=2,u=!0;else if(n===a-2&&i===0&&(o&7)===4&&!c)e[t++]=this.readCorner4(a,o)&255,n-=2,i+=2,c=!0;else{do n<a&&i>=0&&!this.readMappingMatrix.get(i,n)&&(e[t++]=this.readUtah(n,i,a,o)&255),n-=2,i+=2;while(n>=0&&i<o);n+=1,i+=3;do n>=0&&i<o&&!this.readMappingMatrix.get(i,n)&&(e[t++]=this.readUtah(n,i,a,o)&255),n+=2,i-=2;while(n<a&&i>=0);n+=3,i+=1}while(n<a||i<o);if(t!==this.version.getTotalCodewords())throw new F;return e},r.prototype.readModule=function(e,t,n,i){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=i,e+=4-(i+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)},r.prototype.readUtah=function(e,t,n,i){var a=0;return this.readModule(e-2,t-2,n,i)&&(a|=1),a<<=1,this.readModule(e-2,t-1,n,i)&&(a|=1),a<<=1,this.readModule(e-1,t-2,n,i)&&(a|=1),a<<=1,this.readModule(e-1,t-1,n,i)&&(a|=1),a<<=1,this.readModule(e-1,t,n,i)&&(a|=1),a<<=1,this.readModule(e,t-2,n,i)&&(a|=1),a<<=1,this.readModule(e,t-1,n,i)&&(a|=1),a<<=1,this.readModule(e,t,n,i)&&(a|=1),a},r.prototype.readCorner1=function(e,t){var n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,1,e,t)&&(n|=1),n<<=1,this.readModule(e-1,2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n},r.prototype.readCorner2=function(e,t){var n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-4,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n},r.prototype.readCorner3=function(e,t){var n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-3,e,t)&&(n|=1),n<<=1,this.readModule(1,t-2,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n},r.prototype.readCorner4=function(e,t){var n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n},r.prototype.extractDataRegion=function(e){var t=this.version.getSymbolSizeRows(),n=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new k("Dimension of bitMatrix must match the version size");for(var i=this.version.getDataRegionSizeRows(),a=this.version.getDataRegionSizeColumns(),o=t/i|0,s=n/a|0,l=o*i,u=s*a,c=new tt(u,l),d=0;d<o;++d)for(var p=d*i,h=0;h<s;++h)for(var g=h*a,x=0;x<i;++x)for(var C=d*(i+2)+1+x,w=p+x,m=0;m<a;++m){var _=h*(a+2)+1+m;if(e.get(_,C)){var E=g+m;c.set(E,w)}}return c},r}(),Ba=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Ju=function(){function r(e,t){this.numDataCodewords=e,this.codewords=t}return r.getDataBlocks=function(e,t){var n,i,a,o,s=t.getECBlocks(),l=0,u=s.getECBlocks();try{for(var c=Ba(u),d=c.next();!d.done;d=c.next()){var p=d.value;l+=p.getCount()}}catch(R){n={error:R}}finally{try{d&&!d.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}var h=new Array(l),g=0;try{for(var x=Ba(u),C=x.next();!C.done;C=x.next())for(var p=C.value,w=0;w<p.getCount();w++){var m=p.getDataCodewords(),_=s.getECCodewords()+m;h[g++]=new r(m,new Uint8Array(_))}}catch(R){a={error:R}}finally{try{C&&!C.done&&(o=x.return)&&o.call(x)}finally{if(a)throw a.error}}for(var E=h[0].codewords.length,S=E-s.getECCodewords(),T=S-1,D=0,w=0;w<T;w++)for(var M=0;M<g;M++)h[M].codewords[w]=e[D++];for(var P=t.getVersionNumber()===24,V=P?8:g,M=0;M<V;M++)h[M].codewords[S-1]=e[D++];for(var W=h[0].codewords.length,w=S;w<W;w++)for(var M=0;M<g;M++){var U=P?(M+8)%g:M,J=P&&U>7?w-1:w;h[U].codewords[J]=e[D++]}if(D!==e.length)throw new k;return h},r.prototype.getNumDataCodewords=function(){return this.numDataCodewords},r.prototype.getCodewords=function(){return this.codewords},r}(),La=function(){function r(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}return r.prototype.getBitOffset=function(){return this.bitOffset},r.prototype.getByteOffset=function(){return this.byteOffset},r.prototype.readBits=function(e){if(e<1||e>32||e>this.available())throw new k(""+e);var t=0,n=this.bitOffset,i=this.byteOffset,a=this.bytes;if(n>0){var o=8-n,s=e<o?e:o,l=o-s,u=255>>8-s<<l;t=(a[i]&u)>>l,e-=s,n+=s,n===8&&(n=0,i++)}if(e>0){for(;e>=8;)t=t<<8|a[i]&255,i++,e-=8;if(e>0){var l=8-e,u=255>>l<<l;t=t<<e|(a[i]&u)>>l,n+=e}}return this.bitOffset=n,this.byteOffset=i,t},r.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},r}(),xe;(function(r){r[r.PAD_ENCODE=0]="PAD_ENCODE",r[r.ASCII_ENCODE=1]="ASCII_ENCODE",r[r.C40_ENCODE=2]="C40_ENCODE",r[r.TEXT_ENCODE=3]="TEXT_ENCODE",r[r.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",r[r.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",r[r.BASE256_ENCODE=6]="BASE256_ENCODE"})(xe||(xe={}));var ec=function(){function r(){}return r.decode=function(e){var t=new La(e),n=new $,i=new $,a=new Array,o=xe.ASCII_ENCODE;do if(o===xe.ASCII_ENCODE)o=this.decodeAsciiSegment(t,n,i);else{switch(o){case xe.C40_ENCODE:this.decodeC40Segment(t,n);break;case xe.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case xe.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case xe.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case xe.BASE256_ENCODE:this.decodeBase256Segment(t,n,a);break;default:throw new F}o=xe.ASCII_ENCODE}while(o!==xe.PAD_ENCODE&&t.available()>0);return i.length()>0&&n.append(i.toString()),new Yr(e,n.toString(),a.length===0?null:a,null)},r.decodeAsciiSegment=function(e,t,n){var i=!1;do{var a=e.readBits(8);if(a===0)throw new F;if(a<=128)return i&&(a+=128),t.append(String.fromCharCode(a-1)),xe.ASCII_ENCODE;if(a===129)return xe.PAD_ENCODE;if(a<=229){var o=a-130;o<10&&t.append("0"),t.append(""+o)}else switch(a){case 230:return xe.C40_ENCODE;case 231:return xe.BASE256_ENCODE;case 232:t.append("");break;case 233:case 234:break;case 235:i=!0;break;case 236:t.append("[)>05"),n.insert(0,"");break;case 237:t.append("[)>06"),n.insert(0,"");break;case 238:return xe.ANSIX12_ENCODE;case 239:return xe.TEXT_ENCODE;case 240:return xe.EDIFACT_ENCODE;case 241:break;default:if(a!==254||e.available()!==0)throw new F;break}}while(e.available()>0);return xe.ASCII_ENCODE},r.decodeC40Segment=function(e,t){var n=!1,i=[],a=0;do{if(e.available()===8)return;var o=e.readBits(8);if(o===254)return;this.parseTwoBytes(o,e.readBits(8),i);for(var s=0;s<3;s++){var l=i[s];switch(a){case 0:if(l<3)a=l+1;else if(l<this.C40_BASIC_SET_CHARS.length){var u=this.C40_BASIC_SET_CHARS[l];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else throw new F;break;case 1:n?(t.append(String.fromCharCode(l+128)),n=!1):t.append(String.fromCharCode(l)),a=0;break;case 2:if(l<this.C40_SHIFT2_SET_CHARS.length){var u=this.C40_SHIFT2_SET_CHARS[l];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else switch(l){case 27:t.append("");break;case 30:n=!0;break;default:throw new F}a=0;break;case 3:n?(t.append(String.fromCharCode(l+224)),n=!1):t.append(String.fromCharCode(l+96)),a=0;break;default:throw new F}}}while(e.available()>0)},r.decodeTextSegment=function(e,t){var n=!1,i=[],a=0;do{if(e.available()===8)return;var o=e.readBits(8);if(o===254)return;this.parseTwoBytes(o,e.readBits(8),i);for(var s=0;s<3;s++){var l=i[s];switch(a){case 0:if(l<3)a=l+1;else if(l<this.TEXT_BASIC_SET_CHARS.length){var u=this.TEXT_BASIC_SET_CHARS[l];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else throw new F;break;case 1:n?(t.append(String.fromCharCode(l+128)),n=!1):t.append(String.fromCharCode(l)),a=0;break;case 2:if(l<this.TEXT_SHIFT2_SET_CHARS.length){var u=this.TEXT_SHIFT2_SET_CHARS[l];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else switch(l){case 27:t.append("");break;case 30:n=!0;break;default:throw new F}a=0;break;case 3:if(l<this.TEXT_SHIFT3_SET_CHARS.length){var u=this.TEXT_SHIFT3_SET_CHARS[l];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u),a=0}else throw new F;break;default:throw new F}}}while(e.available()>0)},r.decodeAnsiX12Segment=function(e,t){var n=[];do{if(e.available()===8)return;var i=e.readBits(8);if(i===254)return;this.parseTwoBytes(i,e.readBits(8),n);for(var a=0;a<3;a++){var o=n[a];switch(o){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(o<14)t.append(String.fromCharCode(o+44));else if(o<40)t.append(String.fromCharCode(o+51));else throw new F;break}}}while(e.available()>0)},r.parseTwoBytes=function(e,t,n){var i=(e<<8)+t-1,a=Math.floor(i/1600);n[0]=a,i-=a*1600,a=Math.floor(i/40),n[1]=a,n[2]=i-a*40},r.decodeEdifactSegment=function(e,t){do{if(e.available()<=16)return;for(var n=0;n<4;n++){var i=e.readBits(6);if(i===31){var a=8-e.getBitOffset();a!==8&&e.readBits(a);return}(i&32)===0&&(i|=64),t.append(String.fromCharCode(i))}}while(e.available()>0)},r.decodeBase256Segment=function(e,t,n){var i=1+e.getByteOffset(),a=this.unrandomize255State(e.readBits(8),i++),o;if(a===0?o=e.available()/8|0:a<250?o=a:o=250*(a-249)+this.unrandomize255State(e.readBits(8),i++),o<0)throw new F;for(var s=new Uint8Array(o),l=0;l<o;l++){if(e.available()<8)throw new F;s[l]=this.unrandomize255State(e.readBits(8),i++)}n.push(s);try{t.append(qe.decode(s,Y.ISO88591))}catch(u){throw new pr("Platform does not support required encoding: "+u.message)}},r.unrandomize255State=function(e,t){var n=149*t%255+1,i=e-n;return i>=0?i:i+256},r.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],r.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],r.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],r.TEXT_SHIFT2_SET_CHARS=r.C40_SHIFT2_SET_CHARS,r.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""],r}(),tc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},rc=function(){function r(){this.rsDecoder=new Kr(He.DATA_MATRIX_FIELD_256)}return r.prototype.decode=function(e){var t,n,i=new Qu(e),a=i.getVersion(),o=i.readCodewords(),s=Ju.getDataBlocks(o,a),l=0;try{for(var u=tc(s),c=u.next();!c.done;c=u.next()){var d=c.value;l+=d.getNumDataCodewords()}}catch(_){t={error:_}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}for(var p=new Uint8Array(l),h=s.length,g=0;g<h;g++){var x=s[g],C=x.getCodewords(),w=x.getNumDataCodewords();this.correctErrors(C,w);for(var m=0;m<w;m++)p[m*h+g]=C[m]}return ec.decode(p)},r.prototype.correctErrors=function(e,t){var n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new Ce}for(var i=0;i<t;i++)e[i]=n[i]},r}(),nc=function(){function r(e){this.image=e,this.rectangleDetector=new Kn(this.image)}return r.prototype.detect=function(){var e=this.rectangleDetector.detect(),t=this.detectSolid1(e);if(t=this.detectSolid2(t),t[3]=this.correctTopRight(t),!t[3])throw new N;t=this.shiftToModuleCenter(t);var n=t[0],i=t[1],a=t[2],o=t[3],s=this.transitionsBetween(n,o)+1,l=this.transitionsBetween(a,o)+1;(s&1)===1&&(s+=1),(l&1)===1&&(l+=1),4*s<7*l&&4*l<7*s&&(s=l=Math.max(s,l));var u=r.sampleGrid(this.image,n,i,a,o,s,l);return new Zn(u,[n,i,a,o])},r.shiftPoint=function(e,t,n){var i=(t.getX()-e.getX())/(n+1),a=(t.getY()-e.getY())/(n+1);return new z(e.getX()+i,e.getY()+a)},r.moveAway=function(e,t,n){var i=e.getX(),a=e.getY();return i<t?i-=1:i+=1,a<n?a-=1:a+=1,new z(i,a)},r.prototype.detectSolid1=function(e){var t=e[0],n=e[1],i=e[3],a=e[2],o=this.transitionsBetween(t,n),s=this.transitionsBetween(n,i),l=this.transitionsBetween(i,a),u=this.transitionsBetween(a,t),c=o,d=[a,t,n,i];return c>s&&(c=s,d[0]=t,d[1]=n,d[2]=i,d[3]=a),c>l&&(c=l,d[0]=n,d[1]=i,d[2]=a,d[3]=t),c>u&&(d[0]=i,d[1]=a,d[2]=t,d[3]=n),d},r.prototype.detectSolid2=function(e){var t=e[0],n=e[1],i=e[2],a=e[3],o=this.transitionsBetween(t,a),s=r.shiftPoint(n,i,(o+1)*4),l=r.shiftPoint(i,n,(o+1)*4),u=this.transitionsBetween(s,t),c=this.transitionsBetween(l,a);return u<c?(e[0]=t,e[1]=n,e[2]=i,e[3]=a):(e[0]=n,e[1]=i,e[2]=a,e[3]=t),e},r.prototype.correctTopRight=function(e){var t=e[0],n=e[1],i=e[2],a=e[3],o=this.transitionsBetween(t,a),s=this.transitionsBetween(n,a),l=r.shiftPoint(t,n,(s+1)*4),u=r.shiftPoint(i,n,(o+1)*4);o=this.transitionsBetween(l,a),s=this.transitionsBetween(u,a);var c=new z(a.getX()+(i.getX()-n.getX())/(o+1),a.getY()+(i.getY()-n.getY())/(o+1)),d=new z(a.getX()+(t.getX()-n.getX())/(s+1),a.getY()+(t.getY()-n.getY())/(s+1));if(!this.isValid(c))return this.isValid(d)?d:null;if(!this.isValid(d))return c;var p=this.transitionsBetween(l,c)+this.transitionsBetween(u,c),h=this.transitionsBetween(l,d)+this.transitionsBetween(u,d);return p>h?c:d},r.prototype.shiftToModuleCenter=function(e){var t=e[0],n=e[1],i=e[2],a=e[3],o=this.transitionsBetween(t,a)+1,s=this.transitionsBetween(i,a)+1,l=r.shiftPoint(t,n,s*4),u=r.shiftPoint(i,n,o*4);o=this.transitionsBetween(l,a)+1,s=this.transitionsBetween(u,a)+1,(o&1)===1&&(o+=1),(s&1)===1&&(s+=1);var c=(t.getX()+n.getX()+i.getX()+a.getX())/4,d=(t.getY()+n.getY()+i.getY()+a.getY())/4;t=r.moveAway(t,c,d),n=r.moveAway(n,c,d),i=r.moveAway(i,c,d),a=r.moveAway(a,c,d);var p,h;return l=r.shiftPoint(t,n,s*4),l=r.shiftPoint(l,a,o*4),p=r.shiftPoint(n,t,s*4),p=r.shiftPoint(p,i,o*4),u=r.shiftPoint(i,a,s*4),u=r.shiftPoint(u,n,o*4),h=r.shiftPoint(a,i,s*4),h=r.shiftPoint(h,t,o*4),[l,p,u,h]},r.prototype.isValid=function(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()},r.sampleGrid=function(e,t,n,i,a,o,s){var l=Qn.getInstance();return l.sampleGrid(e,o,s,.5,.5,o-.5,.5,o-.5,s-.5,.5,s-.5,t.getX(),t.getY(),a.getX(),a.getY(),i.getX(),i.getY(),n.getX(),n.getY())},r.prototype.transitionsBetween=function(e,t){var n=Math.trunc(e.getX()),i=Math.trunc(e.getY()),a=Math.trunc(t.getX()),o=Math.trunc(t.getY()),s=Math.abs(o-i)>Math.abs(a-n);if(s){var l=n;n=i,i=l,l=a,a=o,o=l}for(var u=Math.abs(a-n),c=Math.abs(o-i),d=-u/2,p=i<o?1:-1,h=n<a?1:-1,g=0,x=this.image.get(s?i:n,s?n:i),C=n,w=i;C!==a;C+=h){var m=this.image.get(s?w:C,s?C:w);if(m!==x&&(g++,x=m),d+=c,d>0){if(w===o)break;w+=p,d-=u}}return g},r}(),oi=function(){function r(){this.decoder=new rc}return r.prototype.decode=function(e,t){t===void 0&&(t=null);var n,i;if(t!=null&&t.has(ce.PURE_BARCODE)){var a=r.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(a),i=r.NO_POINTS}else{var o=new nc(e.getBlackMatrix()).detect();n=this.decoder.decode(o.getBits()),i=o.getPoints()}var s=n.getRawBytes(),l=new Ne(n.getText(),s,8*s.length,i,B.DATA_MATRIX,se.currentTimeMillis()),u=n.getByteSegments();u!=null&&l.putMetadata(Ae.BYTE_SEGMENTS,u);var c=n.getECLevel();return c!=null&&l.putMetadata(Ae.ERROR_CORRECTION_LEVEL,c),l},r.prototype.reset=function(){},r.extractPureBits=function(e){var t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new N;var i=this.moduleSize(t,e),a=t[1],o=n[1],s=t[0],l=n[0],u=(l-s+1)/i,c=(o-a+1)/i;if(u<=0||c<=0)throw new N;var d=i/2;a+=d,s+=d;for(var p=new tt(u,c),h=0;h<c;h++)for(var g=a+h*i,x=0;x<u;x++)e.get(s+x*i,g)&&p.set(x,h);return p},r.moduleSize=function(e,t){for(var n=t.getWidth(),i=e[0],a=e[1];i<n&&t.get(i,a);)i++;if(i===n)throw new N;var o=i-e[0];if(o===0)throw new N;return o},r.NO_POINTS=[],r}(),ic=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){ic(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new oi,t)||this}return e})(kt);var Gt;(function(r){r[r.L=0]="L",r[r.M=1]="M",r[r.Q=2]="Q",r[r.H=3]="H"})(Gt||(Gt={}));var ac=function(){function r(e,t,n){this.value=e,this.stringValue=t,this.bits=n,r.FOR_BITS.set(n,this),r.FOR_VALUE.set(e,this)}return r.prototype.getValue=function(){return this.value},r.prototype.getBits=function(){return this.bits},r.fromString=function(e){switch(e){case"L":return r.L;case"M":return r.M;case"Q":return r.Q;case"H":return r.H;default:throw new Ke(e+"not available")}},r.prototype.toString=function(){return this.stringValue},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value},r.forBits=function(e){if(e<0||e>=r.FOR_BITS.size)throw new k;return r.FOR_BITS.get(e)},r.FOR_BITS=new Map,r.FOR_VALUE=new Map,r.L=new r(Gt.L,"L",1),r.M=new r(Gt.M,"M",0),r.Q=new r(Gt.Q,"Q",3),r.H=new r(Gt.H,"H",2),r}(),oc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},za=function(){function r(e){this.errorCorrectionLevel=ac.forBits(e>>3&3),this.dataMask=e&7}return r.numBitsDiffering=function(e,t){return q.bitCount(e^t)},r.decodeFormatInformation=function(e,t){var n=r.doDecodeFormatInformation(e,t);return n!==null?n:r.doDecodeFormatInformation(e^r.FORMAT_INFO_MASK_QR,t^r.FORMAT_INFO_MASK_QR)},r.doDecodeFormatInformation=function(e,t){var n,i,a=Number.MAX_SAFE_INTEGER,o=0;try{for(var s=oc(r.FORMAT_INFO_DECODE_LOOKUP),l=s.next();!l.done;l=s.next()){var u=l.value,c=u[0];if(c===e||c===t)return new r(u[1]);var d=r.numBitsDiffering(e,c);d<a&&(o=u[1],a=d),e!==t&&(d=r.numBitsDiffering(t,c),d<a&&(o=u[1],a=d))}}catch(p){n={error:p}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return a<=3?new r(o):null},r.prototype.getErrorCorrectionLevel=function(){return this.errorCorrectionLevel},r.prototype.getDataMask=function(){return this.dataMask},r.prototype.hashCode=function(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask},r.FORMAT_INFO_MASK_QR=21522,r.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])],r}(),sc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},O=function(){function r(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.ecCodewordsPerBlock=e,this.ecBlocks=t}return r.prototype.getECCodewordsPerBlock=function(){return this.ecCodewordsPerBlock},r.prototype.getNumBlocks=function(){var e,t,n=0,i=this.ecBlocks;try{for(var a=sc(i),o=a.next();!o.done;o=a.next()){var s=o.value;n+=s.getCount()}}catch(l){e={error:l}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return n},r.prototype.getTotalECCodewords=function(){return this.ecCodewordsPerBlock*this.getNumBlocks()},r.prototype.getECBlocks=function(){return this.ecBlocks},r}(),y=function(){function r(e,t){this.count=e,this.dataCodewords=t}return r.prototype.getCount=function(){return this.count},r.prototype.getDataCodewords=function(){return this.dataCodewords},r}(),lc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},wt=function(){function r(e,t){for(var n,i,a=[],o=2;o<arguments.length;o++)a[o-2]=arguments[o];this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=a;var s=0,l=a[0].getECCodewordsPerBlock(),u=a[0].getECBlocks();try{for(var c=lc(u),d=c.next();!d.done;d=c.next()){var p=d.value;s+=p.getCount()*(p.getDataCodewords()+l)}}catch(h){n={error:h}}finally{try{d&&!d.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}this.totalCodewords=s}return r.prototype.getVersionNumber=function(){return this.versionNumber},r.prototype.getAlignmentPatternCenters=function(){return this.alignmentPatternCenters},r.prototype.getTotalCodewords=function(){return this.totalCodewords},r.prototype.getDimensionForVersion=function(){return 17+4*this.versionNumber},r.prototype.getECBlocksForLevel=function(e){return this.ecBlocks[e.getValue()]},r.getProvisionalVersionForDimension=function(e){if(e%4!==1)throw new F;try{return this.getVersionForNumber((e-17)/4)}catch{throw new F}},r.getVersionForNumber=function(e){if(e<1||e>40)throw new k;return r.VERSIONS[e-1]},r.decodeVersionInformation=function(e){for(var t=Number.MAX_SAFE_INTEGER,n=0,i=0;i<r.VERSION_DECODE_INFO.length;i++){var a=r.VERSION_DECODE_INFO[i];if(a===e)return r.getVersionForNumber(i+7);var o=za.numBitsDiffering(e,a);o<t&&(n=i+7,t=o)}return t<=3?r.getVersionForNumber(n):null},r.prototype.buildFunctionPattern=function(){var e=this.getDimensionForVersion(),t=new tt(e);t.setRegion(0,0,9,9),t.setRegion(e-8,0,8,9),t.setRegion(0,e-8,9,8);for(var n=this.alignmentPatternCenters.length,i=0;i<n;i++)for(var a=this.alignmentPatternCenters[i]-2,o=0;o<n;o++)i===0&&(o===0||o===n-1)||i===n-1&&o===0||t.setRegion(this.alignmentPatternCenters[o]-2,a,5,5);return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t},r.prototype.toString=function(){return""+this.versionNumber},r.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),r.VERSIONS=[new r(1,new Int32Array(0),new O(7,new y(1,19)),new O(10,new y(1,16)),new O(13,new y(1,13)),new O(17,new y(1,9))),new r(2,Int32Array.from([6,18]),new O(10,new y(1,34)),new O(16,new y(1,28)),new O(22,new y(1,22)),new O(28,new y(1,16))),new r(3,Int32Array.from([6,22]),new O(15,new y(1,55)),new O(26,new y(1,44)),new O(18,new y(2,17)),new O(22,new y(2,13))),new r(4,Int32Array.from([6,26]),new O(20,new y(1,80)),new O(18,new y(2,32)),new O(26,new y(2,24)),new O(16,new y(4,9))),new r(5,Int32Array.from([6,30]),new O(26,new y(1,108)),new O(24,new y(2,43)),new O(18,new y(2,15),new y(2,16)),new O(22,new y(2,11),new y(2,12))),new r(6,Int32Array.from([6,34]),new O(18,new y(2,68)),new O(16,new y(4,27)),new O(24,new y(4,19)),new O(28,new y(4,15))),new r(7,Int32Array.from([6,22,38]),new O(20,new y(2,78)),new O(18,new y(4,31)),new O(18,new y(2,14),new y(4,15)),new O(26,new y(4,13),new y(1,14))),new r(8,Int32Array.from([6,24,42]),new O(24,new y(2,97)),new O(22,new y(2,38),new y(2,39)),new O(22,new y(4,18),new y(2,19)),new O(26,new y(4,14),new y(2,15))),new r(9,Int32Array.from([6,26,46]),new O(30,new y(2,116)),new O(22,new y(3,36),new y(2,37)),new O(20,new y(4,16),new y(4,17)),new O(24,new y(4,12),new y(4,13))),new r(10,Int32Array.from([6,28,50]),new O(18,new y(2,68),new y(2,69)),new O(26,new y(4,43),new y(1,44)),new O(24,new y(6,19),new y(2,20)),new O(28,new y(6,15),new y(2,16))),new r(11,Int32Array.from([6,30,54]),new O(20,new y(4,81)),new O(30,new y(1,50),new y(4,51)),new O(28,new y(4,22),new y(4,23)),new O(24,new y(3,12),new y(8,13))),new r(12,Int32Array.from([6,32,58]),new O(24,new y(2,92),new y(2,93)),new O(22,new y(6,36),new y(2,37)),new O(26,new y(4,20),new y(6,21)),new O(28,new y(7,14),new y(4,15))),new r(13,Int32Array.from([6,34,62]),new O(26,new y(4,107)),new O(22,new y(8,37),new y(1,38)),new O(24,new y(8,20),new y(4,21)),new O(22,new y(12,11),new y(4,12))),new r(14,Int32Array.from([6,26,46,66]),new O(30,new y(3,115),new y(1,116)),new O(24,new y(4,40),new y(5,41)),new O(20,new y(11,16),new y(5,17)),new O(24,new y(11,12),new y(5,13))),new r(15,Int32Array.from([6,26,48,70]),new O(22,new y(5,87),new y(1,88)),new O(24,new y(5,41),new y(5,42)),new O(30,new y(5,24),new y(7,25)),new O(24,new y(11,12),new y(7,13))),new r(16,Int32Array.from([6,26,50,74]),new O(24,new y(5,98),new y(1,99)),new O(28,new y(7,45),new y(3,46)),new O(24,new y(15,19),new y(2,20)),new O(30,new y(3,15),new y(13,16))),new r(17,Int32Array.from([6,30,54,78]),new O(28,new y(1,107),new y(5,108)),new O(28,new y(10,46),new y(1,47)),new O(28,new y(1,22),new y(15,23)),new O(28,new y(2,14),new y(17,15))),new r(18,Int32Array.from([6,30,56,82]),new O(30,new y(5,120),new y(1,121)),new O(26,new y(9,43),new y(4,44)),new O(28,new y(17,22),new y(1,23)),new O(28,new y(2,14),new y(19,15))),new r(19,Int32Array.from([6,30,58,86]),new O(28,new y(3,113),new y(4,114)),new O(26,new y(3,44),new y(11,45)),new O(26,new y(17,21),new y(4,22)),new O(26,new y(9,13),new y(16,14))),new r(20,Int32Array.from([6,34,62,90]),new O(28,new y(3,107),new y(5,108)),new O(26,new y(3,41),new y(13,42)),new O(30,new y(15,24),new y(5,25)),new O(28,new y(15,15),new y(10,16))),new r(21,Int32Array.from([6,28,50,72,94]),new O(28,new y(4,116),new y(4,117)),new O(26,new y(17,42)),new O(28,new y(17,22),new y(6,23)),new O(30,new y(19,16),new y(6,17))),new r(22,Int32Array.from([6,26,50,74,98]),new O(28,new y(2,111),new y(7,112)),new O(28,new y(17,46)),new O(30,new y(7,24),new y(16,25)),new O(24,new y(34,13))),new r(23,Int32Array.from([6,30,54,78,102]),new O(30,new y(4,121),new y(5,122)),new O(28,new y(4,47),new y(14,48)),new O(30,new y(11,24),new y(14,25)),new O(30,new y(16,15),new y(14,16))),new r(24,Int32Array.from([6,28,54,80,106]),new O(30,new y(6,117),new y(4,118)),new O(28,new y(6,45),new y(14,46)),new O(30,new y(11,24),new y(16,25)),new O(30,new y(30,16),new y(2,17))),new r(25,Int32Array.from([6,32,58,84,110]),new O(26,new y(8,106),new y(4,107)),new O(28,new y(8,47),new y(13,48)),new O(30,new y(7,24),new y(22,25)),new O(30,new y(22,15),new y(13,16))),new r(26,Int32Array.from([6,30,58,86,114]),new O(28,new y(10,114),new y(2,115)),new O(28,new y(19,46),new y(4,47)),new O(28,new y(28,22),new y(6,23)),new O(30,new y(33,16),new y(4,17))),new r(27,Int32Array.from([6,34,62,90,118]),new O(30,new y(8,122),new y(4,123)),new O(28,new y(22,45),new y(3,46)),new O(30,new y(8,23),new y(26,24)),new O(30,new y(12,15),new y(28,16))),new r(28,Int32Array.from([6,26,50,74,98,122]),new O(30,new y(3,117),new y(10,118)),new O(28,new y(3,45),new y(23,46)),new O(30,new y(4,24),new y(31,25)),new O(30,new y(11,15),new y(31,16))),new r(29,Int32Array.from([6,30,54,78,102,126]),new O(30,new y(7,116),new y(7,117)),new O(28,new y(21,45),new y(7,46)),new O(30,new y(1,23),new y(37,24)),new O(30,new y(19,15),new y(26,16))),new r(30,Int32Array.from([6,26,52,78,104,130]),new O(30,new y(5,115),new y(10,116)),new O(28,new y(19,47),new y(10,48)),new O(30,new y(15,24),new y(25,25)),new O(30,new y(23,15),new y(25,16))),new r(31,Int32Array.from([6,30,56,82,108,134]),new O(30,new y(13,115),new y(3,116)),new O(28,new y(2,46),new y(29,47)),new O(30,new y(42,24),new y(1,25)),new O(30,new y(23,15),new y(28,16))),new r(32,Int32Array.from([6,34,60,86,112,138]),new O(30,new y(17,115)),new O(28,new y(10,46),new y(23,47)),new O(30,new y(10,24),new y(35,25)),new O(30,new y(19,15),new y(35,16))),new r(33,Int32Array.from([6,30,58,86,114,142]),new O(30,new y(17,115),new y(1,116)),new O(28,new y(14,46),new y(21,47)),new O(30,new y(29,24),new y(19,25)),new O(30,new y(11,15),new y(46,16))),new r(34,Int32Array.from([6,34,62,90,118,146]),new O(30,new y(13,115),new y(6,116)),new O(28,new y(14,46),new y(23,47)),new O(30,new y(44,24),new y(7,25)),new O(30,new y(59,16),new y(1,17))),new r(35,Int32Array.from([6,30,54,78,102,126,150]),new O(30,new y(12,121),new y(7,122)),new O(28,new y(12,47),new y(26,48)),new O(30,new y(39,24),new y(14,25)),new O(30,new y(22,15),new y(41,16))),new r(36,Int32Array.from([6,24,50,76,102,128,154]),new O(30,new y(6,121),new y(14,122)),new O(28,new y(6,47),new y(34,48)),new O(30,new y(46,24),new y(10,25)),new O(30,new y(2,15),new y(64,16))),new r(37,Int32Array.from([6,28,54,80,106,132,158]),new O(30,new y(17,122),new y(4,123)),new O(28,new y(29,46),new y(14,47)),new O(30,new y(49,24),new y(10,25)),new O(30,new y(24,15),new y(46,16))),new r(38,Int32Array.from([6,32,58,84,110,136,162]),new O(30,new y(4,122),new y(18,123)),new O(28,new y(13,46),new y(32,47)),new O(30,new y(48,24),new y(14,25)),new O(30,new y(42,15),new y(32,16))),new r(39,Int32Array.from([6,26,54,82,110,138,166]),new O(30,new y(20,117),new y(4,118)),new O(28,new y(40,47),new y(7,48)),new O(30,new y(43,24),new y(22,25)),new O(30,new y(10,15),new y(67,16))),new r(40,Int32Array.from([6,30,58,86,114,142,170]),new O(30,new y(19,118),new y(6,119)),new O(28,new y(18,47),new y(31,48)),new O(30,new y(34,24),new y(34,25)),new O(30,new y(20,15),new y(61,16)))],r}(),me;(function(r){r[r.DATA_MASK_000=0]="DATA_MASK_000",r[r.DATA_MASK_001=1]="DATA_MASK_001",r[r.DATA_MASK_010=2]="DATA_MASK_010",r[r.DATA_MASK_011=3]="DATA_MASK_011",r[r.DATA_MASK_100=4]="DATA_MASK_100",r[r.DATA_MASK_101=5]="DATA_MASK_101",r[r.DATA_MASK_110=6]="DATA_MASK_110",r[r.DATA_MASK_111=7]="DATA_MASK_111"})(me||(me={}));var ka=function(){function r(e,t){this.value=e,this.isMasked=t}return r.prototype.unmaskBitMatrix=function(e,t){for(var n=0;n<t;n++)for(var i=0;i<t;i++)this.isMasked(n,i)&&e.flip(i,n)},r.values=new Map([[me.DATA_MASK_000,new r(me.DATA_MASK_000,function(e,t){return(e+t&1)===0})],[me.DATA_MASK_001,new r(me.DATA_MASK_001,function(e,t){return(e&1)===0})],[me.DATA_MASK_010,new r(me.DATA_MASK_010,function(e,t){return t%3===0})],[me.DATA_MASK_011,new r(me.DATA_MASK_011,function(e,t){return(e+t)%3===0})],[me.DATA_MASK_100,new r(me.DATA_MASK_100,function(e,t){return(Math.floor(e/2)+Math.floor(t/3)&1)===0})],[me.DATA_MASK_101,new r(me.DATA_MASK_101,function(e,t){return e*t%6===0})],[me.DATA_MASK_110,new r(me.DATA_MASK_110,function(e,t){return e*t%6<3})],[me.DATA_MASK_111,new r(me.DATA_MASK_111,function(e,t){return(e+t+e*t%3&1)===0})]]),r}(),uc=function(){function r(e){var t=e.getHeight();if(t<21||(t&3)!==1)throw new F;this.bitMatrix=e}return r.prototype.readFormatInformation=function(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;for(var e=0,t=0;t<6;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(var n=5;n>=0;n--)e=this.copyBit(8,n,e);for(var i=this.bitMatrix.getHeight(),a=0,o=i-7,n=i-1;n>=o;n--)a=this.copyBit(8,n,a);for(var t=i-8;t<i;t++)a=this.copyBit(t,8,a);if(this.parsedFormatInfo=za.decodeFormatInformation(e,a),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new F},r.prototype.readVersion=function(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;var e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return wt.getVersionForNumber(t);for(var n=0,i=e-11,a=5;a>=0;a--)for(var o=e-9;o>=i;o--)n=this.copyBit(o,a,n);var s=wt.decodeVersionInformation(n);if(s!==null&&s.getDimensionForVersion()===e)return this.parsedVersion=s,s;n=0;for(var o=5;o>=0;o--)for(var a=e-9;a>=i;a--)n=this.copyBit(o,a,n);if(s=wt.decodeVersionInformation(n),s!==null&&s.getDimensionForVersion()===e)return this.parsedVersion=s,s;throw new F},r.prototype.copyBit=function(e,t,n){var i=this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t);return i?n<<1|1:n<<1},r.prototype.readCodewords=function(){var e=this.readFormatInformation(),t=this.readVersion(),n=ka.values.get(e.getDataMask()),i=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,i);for(var a=t.buildFunctionPattern(),o=!0,s=new Uint8Array(t.getTotalCodewords()),l=0,u=0,c=0,d=i-1;d>0;d-=2){d===6&&d--;for(var p=0;p<i;p++)for(var h=o?i-1-p:p,g=0;g<2;g++)a.get(d-g,h)||(c++,u<<=1,this.bitMatrix.get(d-g,h)&&(u|=1),c===8&&(s[l++]=u,c=0,u=0));o=!o}if(l!==t.getTotalCodewords())throw new F;return s},r.prototype.remask=function(){if(this.parsedFormatInfo!==null){var e=ka.values[this.parsedFormatInfo.getDataMask()],t=this.bitMatrix.getHeight();e.unmaskBitMatrix(this.bitMatrix,t)}},r.prototype.setMirror=function(e){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=e},r.prototype.mirror=function(){for(var e=this.bitMatrix,t=0,n=e.getWidth();t<n;t++)for(var i=t+1,a=e.getHeight();i<a;i++)e.get(t,i)!==e.get(i,t)&&(e.flip(i,t),e.flip(t,i))},r}(),Ra=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},cc=function(){function r(e,t){this.numDataCodewords=e,this.codewords=t}return r.getDataBlocks=function(e,t,n){var i,a,o,s;if(e.length!==t.getTotalCodewords())throw new k;var l=t.getECBlocksForLevel(n),u=0,c=l.getECBlocks();try{for(var d=Ra(c),p=d.next();!p.done;p=d.next()){var h=p.value;u+=h.getCount()}}catch(J){i={error:J}}finally{try{p&&!p.done&&(a=d.return)&&a.call(d)}finally{if(i)throw i.error}}var g=new Array(u),x=0;try{for(var C=Ra(c),w=C.next();!w.done;w=C.next())for(var h=w.value,m=0;m<h.getCount();m++){var _=h.getDataCodewords(),E=l.getECCodewordsPerBlock()+_;g[x++]=new r(_,new Uint8Array(E))}}catch(J){o={error:J}}finally{try{w&&!w.done&&(s=C.return)&&s.call(C)}finally{if(o)throw o.error}}for(var S=g[0].codewords.length,T=g.length-1;T>=0;){var D=g[T].codewords.length;if(D===S)break;T--}T++;for(var M=S-l.getECCodewordsPerBlock(),P=0,m=0;m<M;m++)for(var V=0;V<x;V++)g[V].codewords[m]=e[P++];for(var V=T;V<x;V++)g[V].codewords[M]=e[P++];for(var W=g[0].codewords.length,m=M;m<W;m++)for(var V=0;V<x;V++){var U=V<T?m:m+1;g[V].codewords[U]=e[P++]}return g},r.prototype.getNumDataCodewords=function(){return this.numDataCodewords},r.prototype.getCodewords=function(){return this.codewords},r}(),We;(function(r){r[r.TERMINATOR=0]="TERMINATOR",r[r.NUMERIC=1]="NUMERIC",r[r.ALPHANUMERIC=2]="ALPHANUMERIC",r[r.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",r[r.BYTE=4]="BYTE",r[r.ECI=5]="ECI",r[r.KANJI=6]="KANJI",r[r.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",r[r.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",r[r.HANZI=9]="HANZI"})(We||(We={}));var le=function(){function r(e,t,n,i){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=i,r.FOR_BITS.set(i,this),r.FOR_VALUE.set(e,this)}return r.forBits=function(e){var t=r.FOR_BITS.get(e);if(t===void 0)throw new k;return t},r.prototype.getCharacterCountBits=function(e){var t=e.getVersionNumber(),n;return t<=9?n=0:t<=26?n=1:n=2,this.characterCountBitsForVersions[n]},r.prototype.getValue=function(){return this.value},r.prototype.getBits=function(){return this.bits},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value},r.prototype.toString=function(){return this.stringValue},r.FOR_BITS=new Map,r.FOR_VALUE=new Map,r.TERMINATOR=new r(We.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),r.NUMERIC=new r(We.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),r.ALPHANUMERIC=new r(We.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),r.STRUCTURED_APPEND=new r(We.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),r.BYTE=new r(We.BYTE,"BYTE",Int32Array.from([8,16,16]),4),r.ECI=new r(We.ECI,"ECI",Int32Array.from([0,0,0]),7),r.KANJI=new r(We.KANJI,"KANJI",Int32Array.from([8,10,12]),8),r.FNC1_FIRST_POSITION=new r(We.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),r.FNC1_SECOND_POSITION=new r(We.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),r.HANZI=new r(We.HANZI,"HANZI",Int32Array.from([8,10,12]),13),r}(),dc=function(){function r(){}return r.decode=function(e,t,n,i){var a=new La(e),o=new $,s=new Array,l=-1,u=-1;try{var c=null,d=!1,p=void 0;do{if(a.available()<4)p=le.TERMINATOR;else{var h=a.readBits(4);p=le.forBits(h)}switch(p){case le.TERMINATOR:break;case le.FNC1_FIRST_POSITION:case le.FNC1_SECOND_POSITION:d=!0;break;case le.STRUCTURED_APPEND:if(a.available()<16)throw new F;l=a.readBits(8),u=a.readBits(8);break;case le.ECI:var g=r.parseECIValue(a);if(c=pe.getCharacterSetECIByValue(g),c===null)throw new F;break;case le.HANZI:var x=a.readBits(4),C=a.readBits(p.getCharacterCountBits(t));x===r.GB2312_SUBSET&&r.decodeHanziSegment(a,o,C);break;default:var w=a.readBits(p.getCharacterCountBits(t));switch(p){case le.NUMERIC:r.decodeNumericSegment(a,o,w);break;case le.ALPHANUMERIC:r.decodeAlphanumericSegment(a,o,w,d);break;case le.BYTE:r.decodeByteSegment(a,o,w,c,s,i);break;case le.KANJI:r.decodeKanjiSegment(a,o,w);break;default:throw new F}break}}while(p!==le.TERMINATOR)}catch{throw new F}return new Yr(e,o.toString(),s.length===0?null:s,n===null?null:n.toString(),l,u)},r.decodeHanziSegment=function(e,t,n){if(n*13>e.available())throw new F;for(var i=new Uint8Array(2*n),a=0;n>0;){var o=e.readBits(13),s=o/96<<8&4294967295|o%96;s<959?s+=41377:s+=42657,i[a]=s>>8&255,i[a+1]=s&255,a+=2,n--}try{t.append(qe.decode(i,Y.GB2312))}catch(l){throw new F(l)}},r.decodeKanjiSegment=function(e,t,n){if(n*13>e.available())throw new F;for(var i=new Uint8Array(2*n),a=0;n>0;){var o=e.readBits(13),s=o/192<<8&4294967295|o%192;s<7936?s+=33088:s+=49472,i[a]=s>>8,i[a+1]=s,a+=2,n--}try{t.append(qe.decode(i,Y.SHIFT_JIS))}catch(l){throw new F(l)}},r.decodeByteSegment=function(e,t,n,i,a,o){if(8*n>e.available())throw new F;for(var s=new Uint8Array(n),l=0;l<n;l++)s[l]=e.readBits(8);var u;i===null?u=Y.guessEncoding(s,o):u=i.getName();try{t.append(qe.decode(s,u))}catch(c){throw new F(c)}a.push(s)},r.toAlphaNumericChar=function(e){if(e>=r.ALPHANUMERIC_CHARS.length)throw new F;return r.ALPHANUMERIC_CHARS[e]},r.decodeAlphanumericSegment=function(e,t,n,i){for(var a=t.length();n>1;){if(e.available()<11)throw new F;var o=e.readBits(11);t.append(r.toAlphaNumericChar(Math.floor(o/45))),t.append(r.toAlphaNumericChar(o%45)),n-=2}if(n===1){if(e.available()<6)throw new F;t.append(r.toAlphaNumericChar(e.readBits(6)))}if(i)for(var s=a;s<t.length();s++)t.charAt(s)==="%"&&(s<t.length()-1&&t.charAt(s+1)==="%"?t.deleteCharAt(s+1):t.setCharAt(s,""))},r.decodeNumericSegment=function(e,t,n){for(;n>=3;){if(e.available()<10)throw new F;var i=e.readBits(10);if(i>=1e3)throw new F;t.append(r.toAlphaNumericChar(Math.floor(i/100))),t.append(r.toAlphaNumericChar(Math.floor(i/10)%10)),t.append(r.toAlphaNumericChar(i%10)),n-=3}if(n===2){if(e.available()<7)throw new F;var a=e.readBits(7);if(a>=100)throw new F;t.append(r.toAlphaNumericChar(Math.floor(a/10))),t.append(r.toAlphaNumericChar(a%10))}else if(n===1){if(e.available()<4)throw new F;var o=e.readBits(4);if(o>=10)throw new F;t.append(r.toAlphaNumericChar(o))}},r.parseECIValue=function(e){var t=e.readBits(8);if((t&128)===0)return t&127;if((t&192)===128){var n=e.readBits(8);return(t&63)<<8&4294967295|n}if((t&224)===192){var i=e.readBits(16);return(t&31)<<16&4294967295|i}throw new F},r.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",r.GB2312_SUBSET=1,r}(),Ua=function(){function r(e){this.mirrored=e}return r.prototype.isMirrored=function(){return this.mirrored},r.prototype.applyMirroredCorrection=function(e){if(!(!this.mirrored||e===null||e.length<3)){var t=e[0];e[0]=e[2],e[2]=t}},r}(),Ha=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},fc=function(){function r(){this.rsDecoder=new Kr(He.QR_CODE_FIELD_256)}return r.prototype.decodeBooleanArray=function(e,t){return this.decodeBitMatrix(tt.parseFromBooleanArray(e),t)},r.prototype.decodeBitMatrix=function(e,t){var n=new uc(e),i=null;try{return this.decodeBitMatrixParser(n,t)}catch(o){i=o}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();var a=this.decodeBitMatrixParser(n,t);return a.setOther(new Ua(!0)),a}catch(o){throw i!==null?i:o}},r.prototype.decodeBitMatrixParser=function(e,t){var n,i,a,o,s=e.readVersion(),l=e.readFormatInformation().getErrorCorrectionLevel(),u=e.readCodewords(),c=cc.getDataBlocks(u,s,l),d=0;try{for(var p=Ha(c),h=p.next();!h.done;h=p.next()){var g=h.value;d+=g.getNumDataCodewords()}}catch(T){n={error:T}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}var x=new Uint8Array(d),C=0;try{for(var w=Ha(c),m=w.next();!m.done;m=w.next()){var g=m.value,_=g.getCodewords(),E=g.getNumDataCodewords();this.correctErrors(_,E);for(var S=0;S<E;S++)x[C++]=_[S]}}catch(T){a={error:T}}finally{try{m&&!m.done&&(o=w.return)&&o.call(w)}finally{if(a)throw a.error}}return dc.decode(x,s,l,t)},r.prototype.correctErrors=function(e,t){var n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new Ce}for(var i=0;i<t;i++)e[i]=n[i]},r}(),hc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),pc=function(r){hc(e,r);function e(t,n,i){var a=r.call(this,t,n)||this;return a.estimatedModuleSize=i,a}return e.prototype.aboutEquals=function(t,n,i){if(Math.abs(n-this.getY())<=t&&Math.abs(i-this.getX())<=t){var a=Math.abs(t-this.estimatedModuleSize);return a<=1||a<=this.estimatedModuleSize}return!1},e.prototype.combineEstimate=function(t,n,i){var a=(this.getX()+n)/2,o=(this.getY()+t)/2,s=(this.estimatedModuleSize+i)/2;return new e(a,o,s)},e}(z),vc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},gc=function(){function r(e,t,n,i,a,o,s){this.image=e,this.startX=t,this.startY=n,this.width=i,this.height=a,this.moduleSize=o,this.resultPointCallback=s,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}return r.prototype.find=function(){for(var e=this.startX,t=this.height,n=this.width,i=e+n,a=this.startY+t/2,o=new Int32Array(3),s=this.image,l=0;l<t;l++){var u=a+((l&1)===0?Math.floor((l+1)/2):-Math.floor((l+1)/2));o[0]=0,o[1]=0,o[2]=0;for(var c=e;c<i&&!s.get(c,u);)c++;for(var d=0;c<i;){if(s.get(c,u))if(d===1)o[1]++;else if(d===2){if(this.foundPatternCross(o)){var p=this.handlePossibleCenter(o,u,c);if(p!==null)return p}o[0]=o[2],o[1]=1,o[2]=0,d=1}else o[++d]++;else d===1&&d++,o[d]++;c++}if(this.foundPatternCross(o)){var p=this.handlePossibleCenter(o,u,i);if(p!==null)return p}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new N},r.centerFromEnd=function(e,t){return t-e[2]-e[1]/2},r.prototype.foundPatternCross=function(e){for(var t=this.moduleSize,n=t/2,i=0;i<3;i++)if(Math.abs(t-e[i])>=n)return!1;return!0},r.prototype.crossCheckVertical=function(e,t,n,i){var a=this.image,o=a.getHeight(),s=this.crossCheckStateCount;s[0]=0,s[1]=0,s[2]=0;for(var l=e;l>=0&&a.get(t,l)&&s[1]<=n;)s[1]++,l--;if(l<0||s[1]>n)return NaN;for(;l>=0&&!a.get(t,l)&&s[0]<=n;)s[0]++,l--;if(s[0]>n)return NaN;for(l=e+1;l<o&&a.get(t,l)&&s[1]<=n;)s[1]++,l++;if(l===o||s[1]>n)return NaN;for(;l<o&&!a.get(t,l)&&s[2]<=n;)s[2]++,l++;if(s[2]>n)return NaN;var u=s[0]+s[1]+s[2];return 5*Math.abs(u-i)>=2*i?NaN:this.foundPatternCross(s)?r.centerFromEnd(s,l):NaN},r.prototype.handlePossibleCenter=function(e,t,n){var i,a,o=e[0]+e[1]+e[2],s=r.centerFromEnd(e,n),l=this.crossCheckVertical(t,s,2*e[1],o);if(!isNaN(l)){var u=(e[0]+e[1]+e[2])/3;try{for(var c=vc(this.possibleCenters),d=c.next();!d.done;d=c.next()){var p=d.value;if(p.aboutEquals(u,l,s))return p.combineEstimate(l,s,u)}}catch(g){i={error:g}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(i)throw i.error}}var h=new pc(s,l,u);this.possibleCenters.push(h),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(h)}return null},r}(),xc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),yc=function(r){xc(e,r);function e(t,n,i,a){var o=r.call(this,t,n)||this;return o.estimatedModuleSize=i,o.count=a,a===void 0&&(o.count=1),o}return e.prototype.getEstimatedModuleSize=function(){return this.estimatedModuleSize},e.prototype.getCount=function(){return this.count},e.prototype.aboutEquals=function(t,n,i){if(Math.abs(n-this.getY())<=t&&Math.abs(i-this.getX())<=t){var a=Math.abs(t-this.estimatedModuleSize);return a<=1||a<=this.estimatedModuleSize}return!1},e.prototype.combineEstimate=function(t,n,i){var a=this.count+1,o=(this.count*this.getX()+n)/a,s=(this.count*this.getY()+t)/a,l=(this.count*this.estimatedModuleSize+i)/a;return new e(o,s,l,a)},e}(z),Cc=function(){function r(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}return r.prototype.getBottomLeft=function(){return this.bottomLeft},r.prototype.getTopLeft=function(){return this.topLeft},r.prototype.getTopRight=function(){return this.topRight},r}(),gr=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},wc=function(){function r(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}return r.prototype.getImage=function(){return this.image},r.prototype.getPossibleCenters=function(){return this.possibleCenters},r.prototype.find=function(e){var t=e!=null&&e.get(ce.TRY_HARDER)!==void 0,n=e!=null&&e.get(ce.PURE_BARCODE)!==void 0,i=this.image,a=i.getHeight(),o=i.getWidth(),s=Math.floor(3*a/(4*r.MAX_MODULES));(s<r.MIN_SKIP||t)&&(s=r.MIN_SKIP);for(var l=!1,u=new Int32Array(5),c=s-1;c<a&&!l;c+=s){u[0]=0,u[1]=0,u[2]=0,u[3]=0,u[4]=0;for(var d=0,p=0;p<o;p++)if(i.get(p,c))(d&1)===1&&d++,u[d]++;else if((d&1)===0)if(d===4)if(r.foundPatternCross(u)){var h=this.handlePossibleCenter(u,c,p,n);if(h===!0)if(s=2,this.hasSkipped===!0)l=this.haveMultiplyConfirmedCenters();else{var g=this.findRowSkip();g>u[2]&&(c+=g-u[2]-s,p=o-1)}else{u[0]=u[2],u[1]=u[3],u[2]=u[4],u[3]=1,u[4]=0,d=3;continue}d=0,u[0]=0,u[1]=0,u[2]=0,u[3]=0,u[4]=0}else u[0]=u[2],u[1]=u[3],u[2]=u[4],u[3]=1,u[4]=0,d=3;else u[++d]++;else u[d]++;if(r.foundPatternCross(u)){var h=this.handlePossibleCenter(u,c,o,n);h===!0&&(s=u[0],this.hasSkipped&&(l=this.haveMultiplyConfirmedCenters()))}}var x=this.selectBestPatterns();return z.orderBestPatterns(x),new Cc(x)},r.centerFromEnd=function(e,t){return t-e[4]-e[3]-e[2]/2},r.foundPatternCross=function(e){for(var t=0,n=0;n<5;n++){var i=e[n];if(i===0)return!1;t+=i}if(t<7)return!1;var a=t/7,o=a/2;return Math.abs(a-e[0])<o&&Math.abs(a-e[1])<o&&Math.abs(3*a-e[2])<3*o&&Math.abs(a-e[3])<o&&Math.abs(a-e[4])<o},r.prototype.getCrossCheckStateCount=function(){var e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e},r.prototype.crossCheckDiagonal=function(e,t,n,i){for(var a=this.getCrossCheckStateCount(),o=0,s=this.image;e>=o&&t>=o&&s.get(t-o,e-o);)a[2]++,o++;if(e<o||t<o)return!1;for(;e>=o&&t>=o&&!s.get(t-o,e-o)&&a[1]<=n;)a[1]++,o++;if(e<o||t<o||a[1]>n)return!1;for(;e>=o&&t>=o&&s.get(t-o,e-o)&&a[0]<=n;)a[0]++,o++;if(a[0]>n)return!1;var l=s.getHeight(),u=s.getWidth();for(o=1;e+o<l&&t+o<u&&s.get(t+o,e+o);)a[2]++,o++;if(e+o>=l||t+o>=u)return!1;for(;e+o<l&&t+o<u&&!s.get(t+o,e+o)&&a[3]<n;)a[3]++,o++;if(e+o>=l||t+o>=u||a[3]>=n)return!1;for(;e+o<l&&t+o<u&&s.get(t+o,e+o)&&a[4]<n;)a[4]++,o++;if(a[4]>=n)return!1;var c=a[0]+a[1]+a[2]+a[3]+a[4];return Math.abs(c-i)<2*i&&r.foundPatternCross(a)},r.prototype.crossCheckVertical=function(e,t,n,i){for(var a=this.image,o=a.getHeight(),s=this.getCrossCheckStateCount(),l=e;l>=0&&a.get(t,l);)s[2]++,l--;if(l<0)return NaN;for(;l>=0&&!a.get(t,l)&&s[1]<=n;)s[1]++,l--;if(l<0||s[1]>n)return NaN;for(;l>=0&&a.get(t,l)&&s[0]<=n;)s[0]++,l--;if(s[0]>n)return NaN;for(l=e+1;l<o&&a.get(t,l);)s[2]++,l++;if(l===o)return NaN;for(;l<o&&!a.get(t,l)&&s[3]<n;)s[3]++,l++;if(l===o||s[3]>=n)return NaN;for(;l<o&&a.get(t,l)&&s[4]<n;)s[4]++,l++;if(s[4]>=n)return NaN;var u=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(u-i)>=2*i?NaN:r.foundPatternCross(s)?r.centerFromEnd(s,l):NaN},r.prototype.crossCheckHorizontal=function(e,t,n,i){for(var a=this.image,o=a.getWidth(),s=this.getCrossCheckStateCount(),l=e;l>=0&&a.get(l,t);)s[2]++,l--;if(l<0)return NaN;for(;l>=0&&!a.get(l,t)&&s[1]<=n;)s[1]++,l--;if(l<0||s[1]>n)return NaN;for(;l>=0&&a.get(l,t)&&s[0]<=n;)s[0]++,l--;if(s[0]>n)return NaN;for(l=e+1;l<o&&a.get(l,t);)s[2]++,l++;if(l===o)return NaN;for(;l<o&&!a.get(l,t)&&s[3]<n;)s[3]++,l++;if(l===o||s[3]>=n)return NaN;for(;l<o&&a.get(l,t)&&s[4]<n;)s[4]++,l++;if(s[4]>=n)return NaN;var u=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(u-i)>=i?NaN:r.foundPatternCross(s)?r.centerFromEnd(s,l):NaN},r.prototype.handlePossibleCenter=function(e,t,n,i){var a=e[0]+e[1]+e[2]+e[3]+e[4],o=r.centerFromEnd(e,n),s=this.crossCheckVertical(t,Math.floor(o),e[2],a);if(!isNaN(s)&&(o=this.crossCheckHorizontal(Math.floor(o),Math.floor(s),e[2],a),!isNaN(o)&&(!i||this.crossCheckDiagonal(Math.floor(s),Math.floor(o),e[2],a)))){for(var l=a/7,u=!1,c=this.possibleCenters,d=0,p=c.length;d<p;d++){var h=c[d];if(h.aboutEquals(l,s,o)){c[d]=h.combineEstimate(s,o,l),u=!0;break}}if(!u){var g=new yc(o,s,l);c.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return!0}return!1},r.prototype.findRowSkip=function(){var e,t,n=this.possibleCenters.length;if(n<=1)return 0;var i=null;try{for(var a=gr(this.possibleCenters),o=a.next();!o.done;o=a.next()){var s=o.value;if(s.getCount()>=r.CENTER_QUORUM)if(i==null)i=s;else return this.hasSkipped=!0,Math.floor((Math.abs(i.getX()-s.getX())-Math.abs(i.getY()-s.getY()))/2)}}catch(l){e={error:l}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return 0},r.prototype.haveMultiplyConfirmedCenters=function(){var e,t,n,i,a=0,o=0,s=this.possibleCenters.length;try{for(var l=gr(this.possibleCenters),u=l.next();!u.done;u=l.next()){var c=u.value;c.getCount()>=r.CENTER_QUORUM&&(a++,o+=c.getEstimatedModuleSize())}}catch(x){e={error:x}}finally{try{u&&!u.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}if(a<3)return!1;var d=o/s,p=0;try{for(var h=gr(this.possibleCenters),g=h.next();!g.done;g=h.next()){var c=g.value;p+=Math.abs(c.getEstimatedModuleSize()-d)}}catch(x){n={error:x}}finally{try{g&&!g.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return p<=.05*o},r.prototype.selectBestPatterns=function(){var e,t,n,i,a=this.possibleCenters.length;if(a<3)throw new N;var o=this.possibleCenters,s;if(a>3){var l=0,u=0;try{for(var c=gr(this.possibleCenters),d=c.next();!d.done;d=c.next()){var p=d.value,h=p.getEstimatedModuleSize();l+=h,u+=h*h}}catch(S){e={error:S}}finally{try{d&&!d.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}s=l/a;var g=Math.sqrt(u/a-s*s);o.sort(function(S,T){var D=Math.abs(T.getEstimatedModuleSize()-s),M=Math.abs(S.getEstimatedModuleSize()-s);return D<M?-1:D>M?1:0});for(var x=Math.max(.2*s,g),C=0;C<o.length&&o.length>3;C++){var w=o[C];Math.abs(w.getEstimatedModuleSize()-s)>x&&(o.splice(C,1),C--)}}if(o.length>3){var l=0;try{for(var m=gr(o),_=m.next();!_.done;_=m.next()){var E=_.value;l+=E.getEstimatedModuleSize()}}catch(T){n={error:T}}finally{try{_&&!_.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}s=l/o.length,o.sort(function(T,D){if(D.getCount()===T.getCount()){var M=Math.abs(D.getEstimatedModuleSize()-s),P=Math.abs(T.getEstimatedModuleSize()-s);return M<P?1:M>P?-1:0}else return D.getCount()-T.getCount()}),o.splice(3)}return[o[0],o[1],o[2]]},r.CENTER_QUORUM=2,r.MIN_SKIP=3,r.MAX_MODULES=57,r}(),mc=function(){function r(e){this.image=e}return r.prototype.getImage=function(){return this.image},r.prototype.getResultPointCallback=function(){return this.resultPointCallback},r.prototype.detect=function(e){this.resultPointCallback=e==null?null:e.get(ce.NEED_RESULT_POINT_CALLBACK);var t=new wc(this.image,this.resultPointCallback),n=t.find(e);return this.processFinderPatternInfo(n)},r.prototype.processFinderPatternInfo=function(e){var t=e.getTopLeft(),n=e.getTopRight(),i=e.getBottomLeft(),a=this.calculateModuleSize(t,n,i);if(a<1)throw new N("No pattern found in proccess finder.");var o=r.computeDimension(t,n,i,a),s=wt.getProvisionalVersionForDimension(o),l=s.getDimensionForVersion()-7,u=null;if(s.getAlignmentPatternCenters().length>0)for(var c=n.getX()-t.getX()+i.getX(),d=n.getY()-t.getY()+i.getY(),p=1-3/l,h=Math.floor(t.getX()+p*(c-t.getX())),g=Math.floor(t.getY()+p*(d-t.getY())),x=4;x<=16;x<<=1)try{u=this.findAlignmentInRegion(a,h,g,x);break}catch(_){if(!(_ instanceof N))throw _}var C=r.createTransform(t,n,i,u,o),w=r.sampleGrid(this.image,C,o),m;return u===null?m=[i,t,n]:m=[i,t,n,u],new Zn(w,m)},r.createTransform=function(e,t,n,i,a){var o=a-3.5,s,l,u,c;return i!==null?(s=i.getX(),l=i.getY(),u=o-3,c=u):(s=t.getX()-e.getX()+n.getX(),l=t.getY()-e.getY()+n.getY(),u=o,c=o),Ca.quadrilateralToQuadrilateral(3.5,3.5,o,3.5,u,c,3.5,o,e.getX(),e.getY(),t.getX(),t.getY(),s,l,n.getX(),n.getY())},r.sampleGrid=function(e,t,n){var i=Qn.getInstance();return i.sampleGridWithTransform(e,n,n,t)},r.computeDimension=function(e,t,n,i){var a=Q.round(z.distance(e,t)/i),o=Q.round(z.distance(e,n)/i),s=Math.floor((a+o)/2)+7;switch(s&3){case 0:s++;break;case 2:s--;break;case 3:throw new N("Dimensions could be not found.")}return s},r.prototype.calculateModuleSize=function(e,t,n){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,n))/2},r.prototype.calculateModuleSizeOneWay=function(e,t){var n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),i=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?i/7:isNaN(i)?n/7:(n+i)/14},r.prototype.sizeOfBlackWhiteBlackRunBothWays=function(e,t,n,i){var a=this.sizeOfBlackWhiteBlackRun(e,t,n,i),o=1,s=e-(n-e);s<0?(o=e/(e-s),s=0):s>=this.image.getWidth()&&(o=(this.image.getWidth()-1-e)/(s-e),s=this.image.getWidth()-1);var l=Math.floor(t-(i-t)*o);return o=1,l<0?(o=t/(t-l),l=0):l>=this.image.getHeight()&&(o=(this.image.getHeight()-1-t)/(l-t),l=this.image.getHeight()-1),s=Math.floor(e+(s-e)*o),a+=this.sizeOfBlackWhiteBlackRun(e,t,s,l),a-1},r.prototype.sizeOfBlackWhiteBlackRun=function(e,t,n,i){var a=Math.abs(i-t)>Math.abs(n-e);if(a){var o=e;e=t,t=o,o=n,n=i,i=o}for(var s=Math.abs(n-e),l=Math.abs(i-t),u=-s/2,c=e<n?1:-1,d=t<i?1:-1,p=0,h=n+c,g=e,x=t;g!==h;g+=c){var C=a?x:g,w=a?g:x;if(p===1===this.image.get(C,w)){if(p===2)return Q.distance(g,x,e,t);p++}if(u+=l,u>0){if(x===i)break;x+=d,u-=s}}return p===2?Q.distance(n+c,i,e,t):NaN},r.prototype.findAlignmentInRegion=function(e,t,n,i){var a=Math.floor(i*e),o=Math.max(0,t-a),s=Math.min(this.image.getWidth()-1,t+a);if(s-o<e*3)throw new N("Alignment top exceeds estimated module size.");var l=Math.max(0,n-a),u=Math.min(this.image.getHeight()-1,n+a);if(u-l<e*3)throw new N("Alignment bottom exceeds estimated module size.");var c=new gc(this.image,o,l,s-o,u-l,e,this.resultPointCallback);return c.find()},r}(),si=function(){function r(){this.decoder=new fc}return r.prototype.getDecoder=function(){return this.decoder},r.prototype.decode=function(e,t){var n,i;if(t!=null&&t.get(ce.PURE_BARCODE)!==void 0){var a=r.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(a,t),i=r.NO_POINTS}else{var o=new mc(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(o.getBits(),t),i=o.getPoints()}n.getOther()instanceof Ua&&n.getOther().applyMirroredCorrection(i);var s=new Ne(n.getText(),n.getRawBytes(),void 0,i,B.QR_CODE,void 0),l=n.getByteSegments();l!==null&&s.putMetadata(Ae.BYTE_SEGMENTS,l);var u=n.getECLevel();return u!==null&&s.putMetadata(Ae.ERROR_CORRECTION_LEVEL,u),n.hasStructuredAppend()&&(s.putMetadata(Ae.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),s.putMetadata(Ae.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),s},r.prototype.reset=function(){},r.extractPureBits=function(e){var t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new N;var i=this.moduleSize(t,e),a=t[1],o=n[1],s=t[0],l=n[0];if(s>=l||a>=o)throw new N;if(o-a!==l-s&&(l=s+(o-a),l>=e.getWidth()))throw new N;var u=Math.round((l-s+1)/i),c=Math.round((o-a+1)/i);if(u<=0||c<=0)throw new N;if(c!==u)throw new N;var d=Math.floor(i/2);a+=d,s+=d;var p=s+Math.floor((u-1)*i)-l;if(p>0){if(p>d)throw new N;s-=p}var h=a+Math.floor((c-1)*i)-o;if(h>0){if(h>d)throw new N;a-=h}for(var g=new tt(u,c),x=0;x<c;x++)for(var C=a+Math.floor(x*i),w=0;w<u;w++)e.get(s+Math.floor(w*i),C)&&g.set(w,x);return g},r.moduleSize=function(e,t){for(var n=t.getHeight(),i=t.getWidth(),a=e[0],o=e[1],s=!0,l=0;a<i&&o<n;){if(s!==t.get(a,o)){if(++l===5)break;s=!s}a++,o++}if(a===i||o===n)throw new N;return(a-e[0])/7},r.NO_POINTS=new Array,r}(),_c=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Z=function(){function r(){}return r.prototype.PDF417Common=function(){},r.getBitCountSum=function(e){return Q.sum(e)},r.toIntArray=function(e){var t,n;if(e==null||!e.length)return r.EMPTY_INT_ARRAY;var i=new Int32Array(e.length),a=0;try{for(var o=_c(e),s=o.next();!s.done;s=o.next()){var l=s.value;i[a++]=l}}catch(u){t={error:u}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i},r.getCodeword=function(e){var t=he.binarySearch(r.SYMBOL_TABLE,e&262143);return t<0?-1:(r.CODEWORD_TABLE[t]-1)%r.NUMBER_OF_CODEWORDS},r.NUMBER_OF_CODEWORDS=929,r.MAX_CODEWORDS_IN_BARCODE=r.NUMBER_OF_CODEWORDS-1,r.MIN_ROWS_IN_BARCODE=3,r.MAX_ROWS_IN_BARCODE=90,r.MODULES_IN_CODEWORD=17,r.MODULES_IN_STOP_PATTERN=18,r.BARS_IN_MODULE=8,r.EMPTY_INT_ARRAY=new Int32Array([]),r.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),r.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]),r}(),Ac=function(){function r(e,t){this.bits=e,this.points=t}return r.prototype.getBits=function(){return this.bits},r.prototype.getPoints=function(){return this.points},r}(),Ec=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Ic=function(){function r(){}return r.detectMultiple=function(e,t,n){var i=e.getBlackMatrix(),a=r.detect(n,i);return a.length||(i=i.clone(),i.rotate180(),a=r.detect(n,i)),new Ac(i,a)},r.detect=function(e,t){for(var n,i,a=new Array,o=0,s=0,l=!1;o<t.getHeight();){var u=r.findVertices(t,o,s);if(u[0]==null&&u[3]==null){if(!l)break;l=!1,s=0;try{for(var c=(n=void 0,Ec(a)),d=c.next();!d.done;d=c.next()){var p=d.value;p[1]!=null&&(o=Math.trunc(Math.max(o,p[1].getY()))),p[3]!=null&&(o=Math.max(o,Math.trunc(p[3].getY())))}}catch(h){n={error:h}}finally{try{d&&!d.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}o+=r.ROW_STEP;continue}if(l=!0,a.push(u),!e)break;u[2]!=null?(s=Math.trunc(u[2].getX()),o=Math.trunc(u[2].getY())):(s=Math.trunc(u[4].getX()),o=Math.trunc(u[4].getY()))}return a},r.findVertices=function(e,t,n){var i=e.getHeight(),a=e.getWidth(),o=new Array(8);return r.copyToResult(o,r.findRowsWithPattern(e,i,a,t,n,r.START_PATTERN),r.INDEXES_START_PATTERN),o[4]!=null&&(n=Math.trunc(o[4].getX()),t=Math.trunc(o[4].getY())),r.copyToResult(o,r.findRowsWithPattern(e,i,a,t,n,r.STOP_PATTERN),r.INDEXES_STOP_PATTERN),o},r.copyToResult=function(e,t,n){for(var i=0;i<n.length;i++)e[n[i]]=t[i]},r.findRowsWithPattern=function(e,t,n,i,a,o){for(var s=new Array(4),l=!1,u=new Int32Array(o.length);i<t;i+=r.ROW_STEP){var c=r.findGuardPattern(e,a,i,n,!1,o,u);if(c!=null){for(;i>0;){var d=r.findGuardPattern(e,a,--i,n,!1,o,u);if(d!=null)c=d;else{i++;break}}s[0]=new z(c[0],i),s[1]=new z(c[1],i),l=!0;break}}var p=i+1;if(l){for(var h=0,d=Int32Array.from([Math.trunc(s[0].getX()),Math.trunc(s[1].getX())]);p<t;p++){var c=r.findGuardPattern(e,d[0],p,n,!1,o,u);if(c!=null&&Math.abs(d[0]-c[0])<r.MAX_PATTERN_DRIFT&&Math.abs(d[1]-c[1])<r.MAX_PATTERN_DRIFT)d=c,h=0;else{if(h>r.SKIPPED_ROW_COUNT_MAX)break;h++}}p-=h+1,s[2]=new z(d[0],p),s[3]=new z(d[1],p)}return p-i<r.BARCODE_MIN_HEIGHT&&he.fill(s,null),s},r.findGuardPattern=function(e,t,n,i,a,o,s){he.fillWithin(s,0,s.length,0);for(var l=t,u=0;e.get(l,n)&&l>0&&u++<r.MAX_PIXEL_DRIFT;)l--;for(var c=l,d=0,p=o.length,h=a;c<i;c++){var g=e.get(c,n);if(g!==h)s[d]++;else{if(d===p-1){if(r.patternMatchVariance(s,o,r.MAX_INDIVIDUAL_VARIANCE)<r.MAX_AVG_VARIANCE)return new Int32Array([l,c]);l+=s[0]+s[1],se.arraycopy(s,2,s,0,d-1),s[d-1]=0,s[d]=0,d--}else d++;s[d]=1,h=!h}}return d===p-1&&r.patternMatchVariance(s,o,r.MAX_INDIVIDUAL_VARIANCE)<r.MAX_AVG_VARIANCE?new Int32Array([l,c-1]):null},r.patternMatchVariance=function(e,t,n){for(var i=e.length,a=0,o=0,s=0;s<i;s++)a+=e[s],o+=t[s];if(a<o)return 1/0;var l=a/o;n*=l;for(var u=0,c=0;c<i;c++){var d=e[c],p=t[c]*l,h=d>p?d-p:p-d;if(h>n)return 1/0;u+=h}return u/a},r.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),r.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),r.MAX_AVG_VARIANCE=.42,r.MAX_INDIVIDUAL_VARIANCE=.8,r.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),r.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),r.MAX_PIXEL_DRIFT=3,r.MAX_PATTERN_DRIFT=5,r.SKIPPED_ROW_COUNT_MAX=25,r.ROW_STEP=5,r.BARCODE_MIN_HEIGHT=10,r}(),Sc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},mt=function(){function r(e,t){if(t.length===0)throw new k;this.field=e;var n=t.length;if(n>1&&t[0]===0){for(var i=1;i<n&&t[i]===0;)i++;i===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-i),se.arraycopy(t,i,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}return r.prototype.getCoefficients=function(){return this.coefficients},r.prototype.getDegree=function(){return this.coefficients.length-1},r.prototype.isZero=function(){return this.coefficients[0]===0},r.prototype.getCoefficient=function(e){return this.coefficients[this.coefficients.length-1-e]},r.prototype.evaluateAt=function(e){var t,n;if(e===0)return this.getCoefficient(0);if(e===1){var i=0;try{for(var a=Sc(this.coefficients),o=a.next();!o.done;o=a.next()){var s=o.value;i=this.field.add(i,s)}}catch(d){t={error:d}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return i}for(var l=this.coefficients[0],u=this.coefficients.length,c=1;c<u;c++)l=this.field.add(this.field.multiply(e,l),this.coefficients[c]);return l},r.prototype.add=function(e){if(!this.field.equals(e.field))throw new k("ModulusPolys do not have same ModulusGF field");if(this.isZero())return e;if(e.isZero())return this;var t=this.coefficients,n=e.coefficients;if(t.length>n.length){var i=t;t=n,n=i}var a=new Int32Array(n.length),o=n.length-t.length;se.arraycopy(n,0,a,0,o);for(var s=o;s<n.length;s++)a[s]=this.field.add(t[s-o],n[s]);return new r(this.field,a)},r.prototype.subtract=function(e){if(!this.field.equals(e.field))throw new k("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())},r.prototype.multiply=function(e){return e instanceof r?this.multiplyOther(e):this.multiplyScalar(e)},r.prototype.multiplyOther=function(e){if(!this.field.equals(e.field))throw new k("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new r(this.field,new Int32Array([0]));for(var t=this.coefficients,n=t.length,i=e.coefficients,a=i.length,o=new Int32Array(n+a-1),s=0;s<n;s++)for(var l=t[s],u=0;u<a;u++)o[s+u]=this.field.add(o[s+u],this.field.multiply(l,i[u]));return new r(this.field,o)},r.prototype.negative=function(){for(var e=this.coefficients.length,t=new Int32Array(e),n=0;n<e;n++)t[n]=this.field.subtract(0,this.coefficients[n]);return new r(this.field,t)},r.prototype.multiplyScalar=function(e){if(e===0)return new r(this.field,new Int32Array([0]));if(e===1)return this;for(var t=this.coefficients.length,n=new Int32Array(t),i=0;i<t;i++)n[i]=this.field.multiply(this.coefficients[i],e);return new r(this.field,n)},r.prototype.multiplyByMonomial=function(e,t){if(e<0)throw new k;if(t===0)return new r(this.field,new Int32Array([0]));for(var n=this.coefficients.length,i=new Int32Array(n+e),a=0;a<n;a++)i[a]=this.field.multiply(this.coefficients[a],t);return new r(this.field,i)},r.prototype.toString=function(){for(var e=new $,t=this.getDegree();t>=0;t--){var n=this.getCoefficient(t);n!==0&&(n<0?(e.append(" - "),n=-n):e.length()>0&&e.append(" + "),(t===0||n!==1)&&e.append(n),t!==0&&(t===1?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()},r}(),Oc=function(){function r(){}return r.prototype.add=function(e,t){return(e+t)%this.modulus},r.prototype.subtract=function(e,t){return(this.modulus+e-t)%this.modulus},r.prototype.exp=function(e){return this.expTable[e]},r.prototype.log=function(e){if(e===0)throw new k;return this.logTable[e]},r.prototype.inverse=function(e){if(e===0)throw new ga;return this.expTable[this.modulus-this.logTable[e]-1]},r.prototype.multiply=function(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]},r.prototype.getSize=function(){return this.modulus},r.prototype.equals=function(e){return e===this},r}(),bc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Nc=function(r){bc(e,r);function e(t,n){var i=r.call(this)||this;i.modulus=t,i.expTable=new Int32Array(t),i.logTable=new Int32Array(t);for(var a=1,o=0;o<t;o++)i.expTable[o]=a,a=a*n%t;for(var o=0;o<t-1;o++)i.logTable[i.expTable[o]]=o;return i.zero=new mt(i,new Int32Array([0])),i.one=new mt(i,new Int32Array([1])),i}return e.prototype.getZero=function(){return this.zero},e.prototype.getOne=function(){return this.one},e.prototype.buildMonomial=function(t,n){if(t<0)throw new k;if(n===0)return this.zero;var i=new Int32Array(t+1);return i[0]=n,new mt(this,i)},e.PDF417_GF=new e(Z.NUMBER_OF_CODEWORDS,3),e}(Oc),Tc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Dc=function(){function r(){this.field=Nc.PDF417_GF}return r.prototype.decode=function(e,t,n){for(var i,a,o=new mt(this.field,e),s=new Int32Array(t),l=!1,u=t;u>0;u--){var c=o.evaluateAt(this.field.exp(u));s[t-u]=c,c!==0&&(l=!0)}if(!l)return 0;var d=this.field.getOne();if(n!=null)try{for(var p=Tc(n),h=p.next();!h.done;h=p.next()){var g=h.value,x=this.field.exp(e.length-1-g),C=new mt(this.field,new Int32Array([this.field.subtract(0,x),1]));d=d.multiply(C)}}catch(M){i={error:M}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}for(var w=new mt(this.field,s),m=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),w,t),_=m[0],E=m[1],S=this.findErrorLocations(_),T=this.findErrorMagnitudes(E,_,S),u=0;u<S.length;u++){var D=e.length-1-this.field.log(S[u]);if(D<0)throw Ce.getChecksumInstance();e[D]=this.field.subtract(e[D],T[u])}return S.length},r.prototype.runEuclideanAlgorithm=function(e,t,n){if(e.getDegree()<t.getDegree()){var i=e;e=t,t=i}for(var a=e,o=t,s=this.field.getZero(),l=this.field.getOne();o.getDegree()>=Math.round(n/2);){var u=a,c=s;if(a=o,s=l,a.isZero())throw Ce.getChecksumInstance();o=u;for(var d=this.field.getZero(),p=a.getCoefficient(a.getDegree()),h=this.field.inverse(p);o.getDegree()>=a.getDegree()&&!o.isZero();){var g=o.getDegree()-a.getDegree(),x=this.field.multiply(o.getCoefficient(o.getDegree()),h);d=d.add(this.field.buildMonomial(g,x)),o=o.subtract(a.multiplyByMonomial(g,x))}l=d.multiply(s).subtract(c).negative()}var C=l.getCoefficient(0);if(C===0)throw Ce.getChecksumInstance();var w=this.field.inverse(C),m=l.multiply(w),_=o.multiply(w);return[m,_]},r.prototype.findErrorLocations=function(e){for(var t=e.getDegree(),n=new Int32Array(t),i=0,a=1;a<this.field.getSize()&&i<t;a++)e.evaluateAt(a)===0&&(n[i]=this.field.inverse(a),i++);if(i!==t)throw Ce.getChecksumInstance();return n},r.prototype.findErrorMagnitudes=function(e,t,n){for(var i=t.getDegree(),a=new Int32Array(i),o=1;o<=i;o++)a[i-o]=this.field.multiply(o,t.getCoefficient(o));for(var s=new mt(this.field,a),l=n.length,u=new Int32Array(l),o=0;o<l;o++){var c=this.field.inverse(n[o]),d=this.field.subtract(0,e.evaluateAt(c)),p=this.field.inverse(s.evaluateAt(c));u[o]=this.field.multiply(d,p)}return u},r}(),li=function(){function r(e,t,n,i,a){e instanceof r?this.constructor_2(e):this.constructor_1(e,t,n,i,a)}return r.prototype.constructor_1=function(e,t,n,i,a){var o=t==null||n==null,s=i==null||a==null;if(o&&s)throw new N;o?(t=new z(0,i.getY()),n=new z(0,a.getY())):s&&(i=new z(e.getWidth()-1,t.getY()),a=new z(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=i,this.bottomRight=a,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(i.getX(),a.getX())),this.minY=Math.trunc(Math.min(t.getY(),i.getY())),this.maxY=Math.trunc(Math.max(n.getY(),a.getY()))},r.prototype.constructor_2=function(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()},r.merge=function(e,t){return e==null?t:t==null?e:new r(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)},r.prototype.addMissingRows=function(e,t,n){var i=this.topLeft,a=this.bottomLeft,o=this.topRight,s=this.bottomRight;if(e>0){var l=n?this.topLeft:this.topRight,u=Math.trunc(l.getY()-e);u<0&&(u=0);var c=new z(l.getX(),u);n?i=c:o=c}if(t>0){var d=n?this.bottomLeft:this.bottomRight,p=Math.trunc(d.getY()+t);p>=this.image.getHeight()&&(p=this.image.getHeight()-1);var h=new z(d.getX(),p);n?a=h:s=h}return new r(this.image,i,a,o,s)},r.prototype.getMinX=function(){return this.minX},r.prototype.getMaxX=function(){return this.maxX},r.prototype.getMinY=function(){return this.minY},r.prototype.getMaxY=function(){return this.maxY},r.prototype.getTopLeft=function(){return this.topLeft},r.prototype.getTopRight=function(){return this.topRight},r.prototype.getBottomLeft=function(){return this.bottomLeft},r.prototype.getBottomRight=function(){return this.bottomRight},r}(),Mc=function(){function r(e,t,n,i){this.columnCount=e,this.errorCorrectionLevel=i,this.rowCountUpperPart=t,this.rowCountLowerPart=n,this.rowCount=t+n}return r.prototype.getColumnCount=function(){return this.columnCount},r.prototype.getErrorCorrectionLevel=function(){return this.errorCorrectionLevel},r.prototype.getRowCount=function(){return this.rowCount},r.prototype.getRowCountUpperPart=function(){return this.rowCountUpperPart},r.prototype.getRowCountLowerPart=function(){return this.rowCountLowerPart},r}(),ui=function(){function r(){this.buffer=""}return r.form=function(e,t){var n=-1;function i(o,s,l,u,c,d){if(o==="%%")return"%";if(t[++n]!==void 0){o=u?parseInt(u.substr(1)):void 0;var p=c?parseInt(c.substr(1)):void 0,h;switch(d){case"s":h=t[n];break;case"c":h=t[n][0];break;case"f":h=parseFloat(t[n]).toFixed(o);break;case"p":h=parseFloat(t[n]).toPrecision(o);break;case"e":h=parseFloat(t[n]).toExponential(o);break;case"x":h=parseInt(t[n]).toString(p||16);break;case"d":h=parseFloat(parseInt(t[n],p||10).toPrecision(o)).toFixed(0);break}h=typeof h=="object"?JSON.stringify(h):(+h).toString(p);for(var g=parseInt(l),x=l&&l[0]+""=="0"?"0":" ";h.length<g;)h=s!==void 0?h+x:x+h;return h}}var a=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(a,i)},r.prototype.format=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.buffer+=r.form(e,t)},r.prototype.toString=function(){return this.buffer},r}(),Pc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Ga=function(){function r(e){this.boundingBox=new li(e),this.codewords=new Array(e.getMaxY()-e.getMinY()+1)}return r.prototype.getCodewordNearby=function(e){var t=this.getCodeword(e);if(t!=null)return t;for(var n=1;n<r.MAX_NEARBY_DISTANCE;n++){var i=this.imageRowToCodewordIndex(e)-n;if(i>=0&&(t=this.codewords[i],t!=null)||(i=this.imageRowToCodewordIndex(e)+n,i<this.codewords.length&&(t=this.codewords[i],t!=null)))return t}return null},r.prototype.imageRowToCodewordIndex=function(e){return e-this.boundingBox.getMinY()},r.prototype.setCodeword=function(e,t){this.codewords[this.imageRowToCodewordIndex(e)]=t},r.prototype.getCodeword=function(e){return this.codewords[this.imageRowToCodewordIndex(e)]},r.prototype.getBoundingBox=function(){return this.boundingBox},r.prototype.getCodewords=function(){return this.codewords},r.prototype.toString=function(){var e,t,n=new ui,i=0;try{for(var a=Pc(this.codewords),o=a.next();!o.done;o=a.next()){var s=o.value;if(s==null){n.format("%3d: | %n",i++);continue}n.format("%3d: %3d|%3d%n",i++,s.getRowNumber(),s.getValue())}}catch(l){e={error:l}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return n.toString()},r.MAX_NEARBY_DISTANCE=5,r}(),Fc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Vc=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return a},xr=function(){function r(){this.values=new Map}return r.prototype.setValue=function(e){e=Math.trunc(e);var t=this.values.get(e);t==null&&(t=0),t++,this.values.set(e,t)},r.prototype.getValue=function(){var e,t,n=-1,i=new Array,a=function(d,p){var h={getKey:function(){return d},getValue:function(){return p}};h.getValue()>n?(n=h.getValue(),i=[],i.push(h.getKey())):h.getValue()===n&&i.push(h.getKey())};try{for(var o=Fc(this.values.entries()),s=o.next();!s.done;s=o.next()){var l=Vc(s.value,2),u=l[0],c=l[1];a(u,c)}}catch(d){e={error:d}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}return Z.toIntArray(i)},r.prototype.getConfidence=function(e){return this.values.get(e)},r}(),Bc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ci=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Xa=function(r){Bc(e,r);function e(t,n){var i=r.call(this,t)||this;return i._isLeft=n,i}return e.prototype.setRowNumbers=function(){var t,n;try{for(var i=ci(this.getCodewords()),a=i.next();!a.done;a=i.next()){var o=a.value;o!=null&&o.setRowNumberAsRowIndicatorColumn()}}catch(s){t={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},e.prototype.adjustCompleteIndicatorColumnRowNumbers=function(t){var n=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(n,t);for(var i=this.getBoundingBox(),a=this._isLeft?i.getTopLeft():i.getTopRight(),o=this._isLeft?i.getBottomLeft():i.getBottomRight(),s=this.imageRowToCodewordIndex(Math.trunc(a.getY())),l=this.imageRowToCodewordIndex(Math.trunc(o.getY())),u=-1,c=1,d=0,p=s;p<l;p++)if(n[p]!=null){var h=n[p],g=h.getRowNumber()-u;if(g===0)d++;else if(g===1)c=Math.max(c,d),d=1,u=h.getRowNumber();else if(g<0||h.getRowNumber()>=t.getRowCount()||g>p)n[p]=null;else{var x=void 0;c>2?x=(c-2)*g:x=g;for(var C=x>=p,w=1;w<=x&&!C;w++)C=n[p-w]!=null;C?n[p]=null:(u=h.getRowNumber(),d=1)}}},e.prototype.getRowHeights=function(){var t,n,i=this.getBarcodeMetadata();if(i==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(i);var a=new Int32Array(i.getRowCount());try{for(var o=ci(this.getCodewords()),s=o.next();!s.done;s=o.next()){var l=s.value;if(l!=null){var u=l.getRowNumber();if(u>=a.length)continue;a[u]++}}}catch(c){t={error:c}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return a},e.prototype.adjustIncompleteIndicatorColumnRowNumbers=function(t){for(var n=this.getBoundingBox(),i=this._isLeft?n.getTopLeft():n.getTopRight(),a=this._isLeft?n.getBottomLeft():n.getBottomRight(),o=this.imageRowToCodewordIndex(Math.trunc(i.getY())),s=this.imageRowToCodewordIndex(Math.trunc(a.getY())),l=this.getCodewords(),u=-1,c=o;c<s;c++)if(l[c]!=null){var d=l[c];d.setRowNumberAsRowIndicatorColumn();var p=d.getRowNumber()-u;p===0||(p===1?u=d.getRowNumber():d.getRowNumber()>=t.getRowCount()?l[c]=null:u=d.getRowNumber())}},e.prototype.getBarcodeMetadata=function(){var t,n,i=this.getCodewords(),a=new xr,o=new xr,s=new xr,l=new xr;try{for(var u=ci(i),c=u.next();!c.done;c=u.next()){var d=c.value;if(d!=null){d.setRowNumberAsRowIndicatorColumn();var p=d.getValue()%30,h=d.getRowNumber();switch(this._isLeft||(h+=2),h%3){case 0:o.setValue(p*3+1);break;case 1:l.setValue(p/3),s.setValue(p%3);break;case 2:a.setValue(p+1);break}}}}catch(x){t={error:x}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}if(a.getValue().length===0||o.getValue().length===0||s.getValue().length===0||l.getValue().length===0||a.getValue()[0]<1||o.getValue()[0]+s.getValue()[0]<Z.MIN_ROWS_IN_BARCODE||o.getValue()[0]+s.getValue()[0]>Z.MAX_ROWS_IN_BARCODE)return null;var g=new Mc(a.getValue()[0],o.getValue()[0],s.getValue()[0],l.getValue()[0]);return this.removeIncorrectCodewords(i,g),g},e.prototype.removeIncorrectCodewords=function(t,n){for(var i=0;i<t.length;i++){var a=t[i];if(t[i]!=null){var o=a.getValue()%30,s=a.getRowNumber();if(s>n.getRowCount()){t[i]=null;continue}switch(this._isLeft||(s+=2),s%3){case 0:o*3+1!==n.getRowCountUpperPart()&&(t[i]=null);break;case 1:(Math.trunc(o/3)!==n.getErrorCorrectionLevel()||o%3!==n.getRowCountLowerPart())&&(t[i]=null);break;case 2:o+1!==n.getColumnCount()&&(t[i]=null);break}}}},e.prototype.isLeft=function(){return this._isLeft},e.prototype.toString=function(){return"IsLeft: "+this._isLeft+`
|
|
242
|
+
`+r.prototype.toString.call(this)},e}(Ga),Lc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},zc=function(){function r(e,t){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=e,this.barcodeColumnCount=e.getColumnCount(),this.boundingBox=t,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}return r.prototype.getDetectionResultColumns=function(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);var e=Z.MAX_CODEWORDS_IN_BARCODE,t;do t=e,e=this.adjustRowNumbersAndGetCount();while(e>0&&e<t);return this.detectionResultColumns},r.prototype.adjustIndicatorColumnRowNumbers=function(e){e!=null&&e.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)},r.prototype.adjustRowNumbersAndGetCount=function(){var e=this.adjustRowNumbersByRow();if(e===0)return 0;for(var t=1;t<this.barcodeColumnCount+1;t++)for(var n=this.detectionResultColumns[t].getCodewords(),i=0;i<n.length;i++)n[i]!=null&&(n[i].hasValidRowNumber()||this.adjustRowNumbers(t,i,n));return e},r.prototype.adjustRowNumbersByRow=function(){this.adjustRowNumbersFromBothRI();var e=this.adjustRowNumbersFromLRI();return e+this.adjustRowNumbersFromRRI()},r.prototype.adjustRowNumbersFromBothRI=function(){if(!(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)){for(var e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords(),n=0;n<e.length;n++)if(e[n]!=null&&t[n]!=null&&e[n].getRowNumber()===t[n].getRowNumber())for(var i=1;i<=this.barcodeColumnCount;i++){var a=this.detectionResultColumns[i].getCodewords()[n];a!=null&&(a.setRowNumber(e[n].getRowNumber()),a.hasValidRowNumber()||(this.detectionResultColumns[i].getCodewords()[n]=null))}}},r.prototype.adjustRowNumbersFromRRI=function(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;for(var e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords(),n=0;n<t.length;n++)if(t[n]!=null)for(var i=t[n].getRowNumber(),a=0,o=this.barcodeColumnCount+1;o>0&&a<this.ADJUST_ROW_NUMBER_SKIP;o--){var s=this.detectionResultColumns[o].getCodewords()[n];s!=null&&(a=r.adjustRowNumberIfValid(i,a,s),s.hasValidRowNumber()||e++)}return e},r.prototype.adjustRowNumbersFromLRI=function(){if(this.detectionResultColumns[0]==null)return 0;for(var e=0,t=this.detectionResultColumns[0].getCodewords(),n=0;n<t.length;n++)if(t[n]!=null)for(var i=t[n].getRowNumber(),a=0,o=1;o<this.barcodeColumnCount+1&&a<this.ADJUST_ROW_NUMBER_SKIP;o++){var s=this.detectionResultColumns[o].getCodewords()[n];s!=null&&(a=r.adjustRowNumberIfValid(i,a,s),s.hasValidRowNumber()||e++)}return e},r.adjustRowNumberIfValid=function(e,t,n){return n==null||n.hasValidRowNumber()||(n.isValidRowNumber(e)?(n.setRowNumber(e),t=0):++t),t},r.prototype.adjustRowNumbers=function(e,t,n){var i,a;if(this.detectionResultColumns[e-1]!=null){var o=n[t],s=this.detectionResultColumns[e-1].getCodewords(),l=s;this.detectionResultColumns[e+1]!=null&&(l=this.detectionResultColumns[e+1].getCodewords());var u=new Array(14);u[2]=s[t],u[3]=l[t],t>0&&(u[0]=n[t-1],u[4]=s[t-1],u[5]=l[t-1]),t>1&&(u[8]=n[t-2],u[10]=s[t-2],u[11]=l[t-2]),t<n.length-1&&(u[1]=n[t+1],u[6]=s[t+1],u[7]=l[t+1]),t<n.length-2&&(u[9]=n[t+2],u[12]=s[t+2],u[13]=l[t+2]);try{for(var c=Lc(u),d=c.next();!d.done;d=c.next()){var p=d.value;if(r.adjustRowNumber(o,p))return}}catch(h){i={error:h}}finally{try{d&&!d.done&&(a=c.return)&&a.call(c)}finally{if(i)throw i.error}}}},r.adjustRowNumber=function(e,t){return t==null?!1:t.hasValidRowNumber()&&t.getBucket()===e.getBucket()?(e.setRowNumber(t.getRowNumber()),!0):!1},r.prototype.getBarcodeColumnCount=function(){return this.barcodeColumnCount},r.prototype.getBarcodeRowCount=function(){return this.barcodeMetadata.getRowCount()},r.prototype.getBarcodeECLevel=function(){return this.barcodeMetadata.getErrorCorrectionLevel()},r.prototype.setBoundingBox=function(e){this.boundingBox=e},r.prototype.getBoundingBox=function(){return this.boundingBox},r.prototype.setDetectionResultColumn=function(e,t){this.detectionResultColumns[e]=t},r.prototype.getDetectionResultColumn=function(e){return this.detectionResultColumns[e]},r.prototype.toString=function(){var e=this.detectionResultColumns[0];e==null&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);for(var t=new ui,n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(var i=0;i<this.barcodeColumnCount+2;i++){if(this.detectionResultColumns[i]==null){t.format(" | ");continue}var a=this.detectionResultColumns[i].getCodewords()[n];if(a==null){t.format(" | ");continue}t.format(" %3d|%3d",a.getRowNumber(),a.getValue())}t.format("%n")}return t.toString()},r}(),kc=function(){function r(e,t,n,i){this.rowNumber=r.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(i)}return r.prototype.hasValidRowNumber=function(){return this.isValidRowNumber(this.rowNumber)},r.prototype.isValidRowNumber=function(e){return e!==r.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3},r.prototype.setRowNumberAsRowIndicatorColumn=function(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))},r.prototype.getWidth=function(){return this.endX-this.startX},r.prototype.getStartX=function(){return this.startX},r.prototype.getEndX=function(){return this.endX},r.prototype.getBucket=function(){return this.bucket},r.prototype.getValue=function(){return this.value},r.prototype.getRowNumber=function(){return this.rowNumber},r.prototype.setRowNumber=function(e){this.rowNumber=e},r.prototype.toString=function(){return this.rowNumber+"|"+this.value},r.BARCODE_ROW_UNKNOWN=-1,r}(),Rc=function(){function r(){}return r.initialize=function(){for(var e=0;e<Z.SYMBOL_TABLE.length;e++)for(var t=Z.SYMBOL_TABLE[e],n=t&1,i=0;i<Z.BARS_IN_MODULE;i++){for(var a=0;(t&1)===n;)a+=1,t>>=1;n=t&1,r.RATIOS_TABLE[e]||(r.RATIOS_TABLE[e]=new Array(Z.BARS_IN_MODULE)),r.RATIOS_TABLE[e][Z.BARS_IN_MODULE-i-1]=Math.fround(a/Z.MODULES_IN_CODEWORD)}this.bSymbolTableReady=!0},r.getDecodedValue=function(e){var t=r.getDecodedCodewordValue(r.sampleBitCounts(e));return t!==-1?t:r.getClosestDecodedValue(e)},r.sampleBitCounts=function(e){for(var t=Q.sum(e),n=new Int32Array(Z.BARS_IN_MODULE),i=0,a=0,o=0;o<Z.MODULES_IN_CODEWORD;o++){var s=t/(2*Z.MODULES_IN_CODEWORD)+o*t/Z.MODULES_IN_CODEWORD;a+e[i]<=s&&(a+=e[i],i++),n[i]++}return n},r.getDecodedCodewordValue=function(e){var t=r.getBitValue(e);return Z.getCodeword(t)===-1?-1:t},r.getBitValue=function(e){for(var t=0,n=0;n<e.length;n++)for(var i=0;i<e[n];i++)t=t<<1|(n%2===0?1:0);return Math.trunc(t)},r.getClosestDecodedValue=function(e){var t=Q.sum(e),n=new Array(Z.BARS_IN_MODULE);if(t>1)for(var i=0;i<n.length;i++)n[i]=Math.fround(e[i]/t);var a=Yn.MAX_VALUE,o=-1;this.bSymbolTableReady||r.initialize();for(var s=0;s<r.RATIOS_TABLE.length;s++){for(var l=0,u=r.RATIOS_TABLE[s],c=0;c<Z.BARS_IN_MODULE;c++){var d=Math.fround(u[c]-n[c]);if(l+=Math.fround(d*d),l>=a)break}l<a&&(a=l,o=Z.SYMBOL_TABLE[s])}return o},r.bSymbolTableReady=!1,r.RATIOS_TABLE=new Array(Z.SYMBOL_TABLE.length).map(function(e){return new Array(Z.BARS_IN_MODULE)}),r}(),Uc=function(){function r(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}return r.prototype.getSegmentIndex=function(){return this.segmentIndex},r.prototype.setSegmentIndex=function(e){this.segmentIndex=e},r.prototype.getFileId=function(){return this.fileId},r.prototype.setFileId=function(e){this.fileId=e},r.prototype.getOptionalData=function(){return this.optionalData},r.prototype.setOptionalData=function(e){this.optionalData=e},r.prototype.isLastSegment=function(){return this.lastSegment},r.prototype.setLastSegment=function(e){this.lastSegment=e},r.prototype.getSegmentCount=function(){return this.segmentCount},r.prototype.setSegmentCount=function(e){this.segmentCount=e},r.prototype.getSender=function(){return this.sender||null},r.prototype.setSender=function(e){this.sender=e},r.prototype.getAddressee=function(){return this.addressee||null},r.prototype.setAddressee=function(e){this.addressee=e},r.prototype.getFileName=function(){return this.fileName},r.prototype.setFileName=function(e){this.fileName=e},r.prototype.getFileSize=function(){return this.fileSize},r.prototype.setFileSize=function(e){this.fileSize=e},r.prototype.getChecksum=function(){return this.checksum},r.prototype.setChecksum=function(e){this.checksum=e},r.prototype.getTimestamp=function(){return this.timestamp},r.prototype.setTimestamp=function(e){this.timestamp=e},r}(),$a=function(){function r(){}return r.parseLong=function(e,t){return t===void 0&&(t=void 0),parseInt(e,t)},r}(),Hc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Gc=function(r){Hc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="NullPointerException",e}(Ue),Xc=function(){function r(){}return r.prototype.writeBytes=function(e){this.writeBytesOffset(e,0,e.length)},r.prototype.writeBytesOffset=function(e,t,n){if(e==null)throw new Gc;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new Xn;if(n===0)return;for(var i=0;i<n;i++)this.write(e[t+i])},r.prototype.flush=function(){},r.prototype.close=function(){},r}(),$c=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),qc=function(r){$c(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(Ue),Wc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),jc=function(r){Wc(e,r);function e(t){t===void 0&&(t=32);var n=r.call(this)||this;if(n.count=0,t<0)throw new k("Negative initial size: "+t);return n.buf=new Uint8Array(t),n}return e.prototype.ensureCapacity=function(t){t-this.buf.length>0&&this.grow(t)},e.prototype.grow=function(t){var n=this.buf.length,i=n<<1;if(i-t<0&&(i=t),i<0){if(t<0)throw new qc;i=q.MAX_VALUE}this.buf=he.copyOfUint8Array(this.buf,i)},e.prototype.write=function(t){this.ensureCapacity(this.count+1),this.buf[this.count]=t,this.count+=1},e.prototype.writeBytesOffset=function(t,n,i){if(n<0||n>t.length||i<0||n+i-t.length>0)throw new Xn;this.ensureCapacity(this.count+i),se.arraycopy(t,n,this.buf,this.count,i),this.count+=i},e.prototype.writeTo=function(t){t.writeBytesOffset(this.buf,0,this.count)},e.prototype.reset=function(){this.count=0},e.prototype.toByteArray=function(){return he.copyOfUint8Array(this.buf,this.count)},e.prototype.size=function(){return this.count},e.prototype.toString=function(t){return t?typeof t=="string"?this.toString_string(t):this.toString_number(t):this.toString_void()},e.prototype.toString_void=function(){return new String(this.buf).toString()},e.prototype.toString_string=function(t){return new String(this.buf).toString()},e.prototype.toString_number=function(t){return new String(this.buf).toString()},e.prototype.close=function(){},e}(Xc),oe;(function(r){r[r.ALPHA=0]="ALPHA",r[r.LOWER=1]="LOWER",r[r.MIXED=2]="MIXED",r[r.PUNCT=3]="PUNCT",r[r.ALPHA_SHIFT=4]="ALPHA_SHIFT",r[r.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(oe||(oe={}));function qa(){if(typeof window<"u")return window.BigInt||null;if(typeof global<"u")return global.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}var rn;function ut(r){if(typeof rn>"u"&&(rn=qa()),rn===null)throw new Error("BigInt is not supported!");return rn(r)}function Yc(){var r=[];r[0]=ut(1);var e=ut(900);r[1]=e;for(var t=2;t<16;t++)r[t]=r[t-1]*e;return r}var Zc=function(){function r(){}return r.decode=function(e,t){var n=new $(""),i=pe.ISO8859_1;n.enableDecoding(i);for(var a=1,o=e[a++],s=new Uc;a<e[0];){switch(o){case r.TEXT_COMPACTION_MODE_LATCH:a=r.textCompaction(e,a,n);break;case r.BYTE_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:a=r.byteCompaction(o,e,i,a,n);break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[a++]);break;case r.NUMERIC_COMPACTION_MODE_LATCH:a=r.numericCompaction(e,a,n);break;case r.ECI_CHARSET:pe.getCharacterSetECIByValue(e[a++]);break;case r.ECI_GENERAL_PURPOSE:a+=2;break;case r.ECI_USER_DEFINED:a++;break;case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:a=r.decodeMacroBlock(e,a,s);break;case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:throw new F;default:a--,a=r.textCompaction(e,a,n);break}if(a<e.length)o=e[a++];else throw F.getFormatInstance()}if(n.length()===0)throw F.getFormatInstance();var l=new Yr(null,n.toString(),null,t);return l.setOther(s),l},r.decodeMacroBlock=function(e,t,n){if(t+r.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw F.getFormatInstance();for(var i=new Int32Array(r.NUMBER_OF_SEQUENCE_CODEWORDS),a=0;a<r.NUMBER_OF_SEQUENCE_CODEWORDS;a++,t++)i[a]=e[t];n.setSegmentIndex(q.parseInt(r.decodeBase900toBase10(i,r.NUMBER_OF_SEQUENCE_CODEWORDS)));var o=new $;t=r.textCompaction(e,t,o),n.setFileId(o.toString());var s=-1;for(e[t]===r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(s=t+1);t<e[0];)switch(e[t]){case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case r.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:var l=new $;t=r.textCompaction(e,t+1,l),n.setFileName(l.toString());break;case r.MACRO_PDF417_OPTIONAL_FIELD_SENDER:var u=new $;t=r.textCompaction(e,t+1,u),n.setSender(u.toString());break;case r.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:var c=new $;t=r.textCompaction(e,t+1,c),n.setAddressee(c.toString());break;case r.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:var d=new $;t=r.numericCompaction(e,t+1,d),n.setSegmentCount(q.parseInt(d.toString()));break;case r.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:var p=new $;t=r.numericCompaction(e,t+1,p),n.setTimestamp($a.parseLong(p.toString()));break;case r.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:var h=new $;t=r.numericCompaction(e,t+1,h),n.setChecksum(q.parseInt(h.toString()));break;case r.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:var g=new $;t=r.numericCompaction(e,t+1,g),n.setFileSize($a.parseLong(g.toString()));break;default:throw F.getFormatInstance()}break;case r.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw F.getFormatInstance()}if(s!==-1){var x=t-s;n.isLastSegment()&&x--,n.setOptionalData(he.copyOfRange(e,s,s+x))}return t},r.textCompaction=function(e,t,n){for(var i=new Int32Array((e[0]-t)*2),a=new Int32Array((e[0]-t)*2),o=0,s=!1;t<e[0]&&!s;){var l=e[t++];if(l<r.TEXT_COMPACTION_MODE_LATCH)i[o]=l/30,i[o+1]=l%30,o+=2;else switch(l){case r.TEXT_COMPACTION_MODE_LATCH:i[o++]=r.TEXT_COMPACTION_MODE_LATCH;break;case r.BYTE_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.NUMERIC_COMPACTION_MODE_LATCH:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:t--,s=!0;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i[o]=r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,l=e[t++],a[o]=l,o++;break}}return r.decodeTextCompaction(i,a,o,n),t},r.decodeTextCompaction=function(e,t,n,i){for(var a=oe.ALPHA,o=oe.ALPHA,s=0;s<n;){var l=e[s],u="";switch(a){case oe.ALPHA:if(l<26)u=String.fromCharCode(65+l);else switch(l){case 26:u=" ";break;case r.LL:a=oe.LOWER;break;case r.ML:a=oe.MIXED;break;case r.PS:o=a,a=oe.PUNCT_SHIFT;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:a=oe.ALPHA;break}break;case oe.LOWER:if(l<26)u=String.fromCharCode(97+l);else switch(l){case 26:u=" ";break;case r.AS:o=a,a=oe.ALPHA_SHIFT;break;case r.ML:a=oe.MIXED;break;case r.PS:o=a,a=oe.PUNCT_SHIFT;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:a=oe.ALPHA;break}break;case oe.MIXED:if(l<r.PL)u=r.MIXED_CHARS[l];else switch(l){case r.PL:a=oe.PUNCT;break;case 26:u=" ";break;case r.LL:a=oe.LOWER;break;case r.AL:a=oe.ALPHA;break;case r.PS:o=a,a=oe.PUNCT_SHIFT;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:a=oe.ALPHA;break}break;case oe.PUNCT:if(l<r.PAL)u=r.PUNCT_CHARS[l];else switch(l){case r.PAL:a=oe.ALPHA;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:a=oe.ALPHA;break}break;case oe.ALPHA_SHIFT:if(a=o,l<26)u=String.fromCharCode(65+l);else switch(l){case 26:u=" ";break;case r.TEXT_COMPACTION_MODE_LATCH:a=oe.ALPHA;break}break;case oe.PUNCT_SHIFT:if(a=o,l<r.PAL)u=r.PUNCT_CHARS[l];else switch(l){case r.PAL:a=oe.ALPHA;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:a=oe.ALPHA;break}break}u!==""&&i.append(u),s++}},r.byteCompaction=function(e,t,n,i,a){var o=new jc,s=0,l=0,u=!1;switch(e){case r.BYTE_COMPACTION_MODE_LATCH:for(var c=new Int32Array(6),d=t[i++];i<t[0]&&!u;)switch(c[s++]=d,l=900*l+d,d=t[i++],d){case r.TEXT_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH:case r.NUMERIC_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:i--,u=!0;break;default:if(s%5===0&&s>0){for(var p=0;p<6;++p)o.write(Number(ut(l)>>ut(8*(5-p))));l=0,s=0}break}i===t[0]&&d<r.TEXT_COMPACTION_MODE_LATCH&&(c[s++]=d);for(var h=0;h<s;h++)o.write(c[h]);break;case r.BYTE_COMPACTION_MODE_LATCH_6:for(;i<t[0]&&!u;){var g=t[i++];if(g<r.TEXT_COMPACTION_MODE_LATCH)s++,l=900*l+g;else switch(g){case r.TEXT_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH:case r.NUMERIC_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:i--,u=!0;break}if(s%5===0&&s>0){for(var p=0;p<6;++p)o.write(Number(ut(l)>>ut(8*(5-p))));l=0,s=0}}break}return a.append(qe.decode(o.toByteArray(),n)),i},r.numericCompaction=function(e,t,n){for(var i=0,a=!1,o=new Int32Array(r.MAX_NUMERIC_CODEWORDS);t<e[0]&&!a;){var s=e[t++];if(t===e[0]&&(a=!0),s<r.TEXT_COMPACTION_MODE_LATCH)o[i]=s,i++;else switch(s){case r.TEXT_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:t--,a=!0;break}(i%r.MAX_NUMERIC_CODEWORDS===0||s===r.NUMERIC_COMPACTION_MODE_LATCH||a)&&i>0&&(n.append(r.decodeBase900toBase10(o,i)),i=0)}return t},r.decodeBase900toBase10=function(e,t){for(var n=ut(0),i=0;i<t;i++)n+=r.EXP900[t-i-1]*ut(e[i]);var a=n.toString();if(a.charAt(0)!=="1")throw new F;return a.substring(1)},r.TEXT_COMPACTION_MODE_LATCH=900,r.BYTE_COMPACTION_MODE_LATCH=901,r.NUMERIC_COMPACTION_MODE_LATCH=902,r.BYTE_COMPACTION_MODE_LATCH_6=924,r.ECI_USER_DEFINED=925,r.ECI_GENERAL_PURPOSE=926,r.ECI_CHARSET=927,r.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,r.MACRO_PDF417_TERMINATOR=922,r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,r.MAX_NUMERIC_CODEWORDS=15,r.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,r.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,r.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,r.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,r.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,r.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,r.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,r.PL=25,r.LL=27,r.AS=27,r.ML=28,r.AL=28,r.PS=29,r.PAL=29,r.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
|
|
243
|
+
-.$/"|*()?{}'`,r.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",r.EXP900=qa()?Yc():[],r.NUMBER_OF_SEQUENCE_CODEWORDS=2,r}(),yr=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Kc=function(){function r(){}return r.decode=function(e,t,n,i,a,o,s){for(var l=new li(e,t,n,i,a),u=null,c=null,d,p=!0;;p=!1){if(t!=null&&(u=r.getRowIndicatorColumn(e,l,t,!0,o,s)),i!=null&&(c=r.getRowIndicatorColumn(e,l,i,!1,o,s)),d=r.merge(u,c),d==null)throw N.getNotFoundInstance();var h=d.getBoundingBox();if(p&&h!=null&&(h.getMinY()<l.getMinY()||h.getMaxY()>l.getMaxY()))l=h;else break}d.setBoundingBox(l);var g=d.getBarcodeColumnCount()+1;d.setDetectionResultColumn(0,u),d.setDetectionResultColumn(g,c);for(var x=u!=null,C=1;C<=g;C++){var w=x?C:g-C;if(d.getDetectionResultColumn(w)===void 0){var m=void 0;w===0||w===g?m=new Xa(l,w===0):m=new Ga(l),d.setDetectionResultColumn(w,m);for(var _=-1,E=_,S=l.getMinY();S<=l.getMaxY();S++){if(_=r.getStartColumn(d,w,S,x),_<0||_>l.getMaxX()){if(E===-1)continue;_=E}var T=r.detectCodeword(e,l.getMinX(),l.getMaxX(),x,_,S,o,s);T!=null&&(m.setCodeword(S,T),E=_,o=Math.min(o,T.getWidth()),s=Math.max(s,T.getWidth()))}}}return r.createDecoderResult(d)},r.merge=function(e,t){if(e==null&&t==null)return null;var n=r.getBarcodeMetadata(e,t);if(n==null)return null;var i=li.merge(r.adjustBoundingBox(e),r.adjustBoundingBox(t));return new zc(n,i)},r.adjustBoundingBox=function(e){var t,n;if(e==null)return null;var i=e.getRowHeights();if(i==null)return null;var a=r.getMax(i),o=0;try{for(var s=yr(i),l=s.next();!l.done;l=s.next()){var u=l.value;if(o+=a-u,u>0)break}}catch(h){t={error:h}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}for(var c=e.getCodewords(),d=0;o>0&&c[d]==null;d++)o--;for(var p=0,d=i.length-1;d>=0&&(p+=a-i[d],!(i[d]>0));d--);for(var d=c.length-1;p>0&&c[d]==null;d--)p--;return e.getBoundingBox().addMissingRows(o,p,e.isLeft())},r.getMax=function(e){var t,n,i=-1;try{for(var a=yr(e),o=a.next();!o.done;o=a.next()){var s=o.value;i=Math.max(i,s)}}catch(l){t={error:l}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return i},r.getBarcodeMetadata=function(e,t){var n;if(e==null||(n=e.getBarcodeMetadata())==null)return t==null?null:t.getBarcodeMetadata();var i;return t==null||(i=t.getBarcodeMetadata())==null?n:n.getColumnCount()!==i.getColumnCount()&&n.getErrorCorrectionLevel()!==i.getErrorCorrectionLevel()&&n.getRowCount()!==i.getRowCount()?null:n},r.getRowIndicatorColumn=function(e,t,n,i,a,o){for(var s=new Xa(t,i),l=0;l<2;l++)for(var u=l===0?1:-1,c=Math.trunc(Math.trunc(n.getX())),d=Math.trunc(Math.trunc(n.getY()));d<=t.getMaxY()&&d>=t.getMinY();d+=u){var p=r.detectCodeword(e,0,e.getWidth(),i,c,d,a,o);p!=null&&(s.setCodeword(d,p),i?c=p.getStartX():c=p.getEndX())}return s},r.adjustCodewordCount=function(e,t){var n=t[0][1],i=n.getValue(),a=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-r.getNumberOfECCodeWords(e.getBarcodeECLevel());if(i.length===0){if(a<1||a>Z.MAX_CODEWORDS_IN_BARCODE)throw N.getNotFoundInstance();n.setValue(a)}else i[0]!==a&&n.setValue(a)},r.createDecoderResult=function(e){var t=r.createBarcodeMatrix(e);r.adjustCodewordCount(e,t);for(var n=new Array,i=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),a=[],o=new Array,s=0;s<e.getBarcodeRowCount();s++)for(var l=0;l<e.getBarcodeColumnCount();l++){var u=t[s][l+1].getValue(),c=s*e.getBarcodeColumnCount()+l;u.length===0?n.push(c):u.length===1?i[c]=u[0]:(o.push(c),a.push(u))}for(var d=new Array(a.length),p=0;p<d.length;p++)d[p]=a[p];return r.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),i,Z.toIntArray(n),Z.toIntArray(o),d)},r.createDecoderResultFromAmbiguousValues=function(e,t,n,i,a){for(var o=new Int32Array(i.length),s=100;s-- >0;){for(var l=0;l<o.length;l++)t[i[l]]=a[l][o[l]];try{return r.decodeCodewords(t,e,n)}catch(c){var u=c instanceof Ce;if(!u)throw c}if(o.length===0)throw Ce.getChecksumInstance();for(var l=0;l<o.length;l++)if(o[l]<a[l].length-1){o[l]++;break}else if(o[l]=0,l===o.length-1)throw Ce.getChecksumInstance()}throw Ce.getChecksumInstance()},r.createBarcodeMatrix=function(e){for(var t,n,i,a,o=Array.from({length:e.getBarcodeRowCount()},function(){return new Array(e.getBarcodeColumnCount()+2)}),s=0;s<o.length;s++)for(var l=0;l<o[s].length;l++)o[s][l]=new xr;var u=0;try{for(var c=yr(e.getDetectionResultColumns()),d=c.next();!d.done;d=c.next()){var p=d.value;if(p!=null)try{for(var h=(i=void 0,yr(p.getCodewords())),g=h.next();!g.done;g=h.next()){var x=g.value;if(x!=null){var C=x.getRowNumber();if(C>=0){if(C>=o.length)continue;o[C][u].setValue(x.getValue())}}}}catch(w){i={error:w}}finally{try{g&&!g.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.error}}u++}}catch(w){t={error:w}}finally{try{d&&!d.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return o},r.isValidBarcodeColumn=function(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1},r.getStartColumn=function(e,t,n,i){var a,o,s=i?1:-1,l=null;if(r.isValidBarcodeColumn(e,t-s)&&(l=e.getDetectionResultColumn(t-s).getCodeword(n)),l!=null)return i?l.getEndX():l.getStartX();if(l=e.getDetectionResultColumn(t).getCodewordNearby(n),l!=null)return i?l.getStartX():l.getEndX();if(r.isValidBarcodeColumn(e,t-s)&&(l=e.getDetectionResultColumn(t-s).getCodewordNearby(n)),l!=null)return i?l.getEndX():l.getStartX();for(var u=0;r.isValidBarcodeColumn(e,t-s);){t-=s;try{for(var c=(a=void 0,yr(e.getDetectionResultColumn(t).getCodewords())),d=c.next();!d.done;d=c.next()){var p=d.value;if(p!=null)return(i?p.getEndX():p.getStartX())+s*u*(p.getEndX()-p.getStartX())}}catch(h){a={error:h}}finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(a)throw a.error}}u++}return i?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()},r.detectCodeword=function(e,t,n,i,a,o,s,l){a=r.adjustCodewordStartColumn(e,t,n,i,a,o);var u=r.getModuleBitCount(e,t,n,i,a,o);if(u==null)return null;var c,d=Q.sum(u);if(i)c=a+d;else{for(var p=0;p<u.length/2;p++){var h=u[p];u[p]=u[u.length-1-p],u[u.length-1-p]=h}c=a,a=c-d}if(!r.checkCodewordSkew(d,s,l))return null;var g=Rc.getDecodedValue(u),x=Z.getCodeword(g);return x===-1?null:new kc(a,c,r.getCodewordBucketNumber(g),x)},r.getModuleBitCount=function(e,t,n,i,a,o){for(var s=a,l=new Int32Array(8),u=0,c=i?1:-1,d=i;(i?s<n:s>=t)&&u<l.length;)e.get(s,o)===d?(l[u]++,s+=c):(u++,d=!d);return u===l.length||s===(i?n:t)&&u===l.length-1?l:null},r.getNumberOfECCodeWords=function(e){return 2<<e},r.adjustCodewordStartColumn=function(e,t,n,i,a,o){for(var s=a,l=i?-1:1,u=0;u<2;u++){for(;(i?s>=t:s<n)&&i===e.get(s,o);){if(Math.abs(a-s)>r.CODEWORD_SKEW_SIZE)return a;s+=l}l=-l,i=!i}return s},r.checkCodewordSkew=function(e,t,n){return t-r.CODEWORD_SKEW_SIZE<=e&&e<=n+r.CODEWORD_SKEW_SIZE},r.decodeCodewords=function(e,t,n){if(e.length===0)throw F.getFormatInstance();var i=1<<t+1,a=r.correctErrors(e,n,i);r.verifyCodewordCount(e,i);var o=Zc.decode(e,""+t);return o.setErrorsCorrected(a),o.setErasures(n.length),o},r.correctErrors=function(e,t,n){if(t!=null&&t.length>n/2+r.MAX_ERRORS||n<0||n>r.MAX_EC_CODEWORDS)throw Ce.getChecksumInstance();return r.errorCorrection.decode(e,n,t)},r.verifyCodewordCount=function(e,t){if(e.length<4)throw F.getFormatInstance();var n=e[0];if(n>e.length)throw F.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw F.getFormatInstance()},r.getBitCountForCodeword=function(e){for(var t=new Int32Array(8),n=0,i=t.length-1;!((e&1)!==n&&(n=e&1,i--,i<0));)t[i]++,e>>=1;return t},r.getCodewordBucketNumber=function(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)},r.getCodewordBucketNumber_number=function(e){return r.getCodewordBucketNumber(r.getBitCountForCodeword(e))},r.getCodewordBucketNumber_Int32Array=function(e){return(e[0]-e[2]+e[4]-e[6]+9)%9},r.toString=function(e){for(var t=new ui,n=0;n<e.length;n++){t.format("Row %2d: ",n);for(var i=0;i<e[n].length;i++){var a=e[n][i];a.getValue().length===0?t.format(" ",null):t.format("%4d(%2d)",a.getValue()[0],a.getConfidence(a.getValue()[0]))}t.format("%n")}return t.toString()},r.CODEWORD_SKEW_SIZE=2,r.MAX_ERRORS=3,r.MAX_EC_CODEWORDS=512,r.errorCorrection=new Dc,r}(),Qc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},di=function(){function r(){}return r.prototype.decode=function(e,t){t===void 0&&(t=null);var n=r.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw N.getNotFoundInstance();return n[0]},r.prototype.decodeMultiple=function(e,t){t===void 0&&(t=null);try{return r.decode(e,t,!0)}catch(n){throw n instanceof F||n instanceof Ce?N.getNotFoundInstance():n}},r.decode=function(e,t,n){var i,a,o=new Array,s=Ic.detectMultiple(e,t,n);try{for(var l=Qc(s.getPoints()),u=l.next();!u.done;u=l.next()){var c=u.value,d=Kc.decode(s.getBits(),c[4],c[5],c[6],c[7],r.getMinCodewordWidth(c),r.getMaxCodewordWidth(c)),p=new Ne(d.getText(),d.getRawBytes(),void 0,c,B.PDF_417);p.putMetadata(Ae.ERROR_CORRECTION_LEVEL,d.getECLevel());var h=d.getOther();h!=null&&p.putMetadata(Ae.PDF417_EXTRA_METADATA,h),o.push(p)}}catch(g){i={error:g}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(i)throw i.error}}return o.map(function(g){return g})},r.getMaxWidth=function(e,t){return e==null||t==null?0:Math.trunc(Math.abs(e.getX()-t.getX()))},r.getMinWidth=function(e,t){return e==null||t==null?q.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))},r.getMaxCodewordWidth=function(e){return Math.floor(Math.max(Math.max(r.getMaxWidth(e[0],e[4]),r.getMaxWidth(e[6],e[2])*Z.MODULES_IN_CODEWORD/Z.MODULES_IN_STOP_PATTERN),Math.max(r.getMaxWidth(e[1],e[5]),r.getMaxWidth(e[7],e[3])*Z.MODULES_IN_CODEWORD/Z.MODULES_IN_STOP_PATTERN)))},r.getMinCodewordWidth=function(e){return Math.floor(Math.min(Math.min(r.getMinWidth(e[0],e[4]),r.getMinWidth(e[6],e[2])*Z.MODULES_IN_CODEWORD/Z.MODULES_IN_STOP_PATTERN),Math.min(r.getMinWidth(e[1],e[5]),r.getMinWidth(e[7],e[3])*Z.MODULES_IN_CODEWORD/Z.MODULES_IN_STOP_PATTERN)))},r.prototype.reset=function(){},r}(),Jc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Wa=function(r){Jc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ReaderException",e}(Ue),ja=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ed=function(){function r(){}return r.prototype.decode=function(e,t){return this.setHints(t),this.decodeInternal(e)},r.prototype.decodeWithState=function(e){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(e)},r.prototype.setHints=function(e){this.hints=e;var t=e!=null&&e.get(ce.TRY_HARDER)!==void 0,n=e==null?null:e.get(ce.POSSIBLE_FORMATS),i=new Array;if(n!=null){var a=n.some(function(o){return o===B.UPC_A||o===B.UPC_E||o===B.EAN_13||o===B.EAN_8||o===B.CODABAR||o===B.CODE_39||o===B.CODE_93||o===B.CODE_128||o===B.ITF||o===B.RSS_14||o===B.RSS_EXPANDED});a&&!t&&i.push(new vr(e)),n.includes(B.QR_CODE)&&i.push(new si),n.includes(B.DATA_MATRIX)&&i.push(new oi),n.includes(B.AZTEC)&&i.push(new Jn),n.includes(B.PDF_417)&&i.push(new di),a&&t&&i.push(new vr(e))}i.length===0&&(t||i.push(new vr(e)),i.push(new si),i.push(new oi),i.push(new Jn),i.push(new di),t&&i.push(new vr(e))),this.readers=i},r.prototype.reset=function(){var e,t;if(this.readers!==null)try{for(var n=ja(this.readers),i=n.next();!i.done;i=n.next()){var a=i.value;a.reset()}}catch(o){e={error:o}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},r.prototype.decodeInternal=function(e){var t,n;if(this.readers===null)throw new Wa("No readers where selected, nothing can be read.");try{for(var i=ja(this.readers),a=i.next();!a.done;a=i.next()){var o=a.value;try{return o.decode(e,this.hints)}catch(s){if(s instanceof Wa)continue}}}catch(s){t={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}throw new N("No MultiFormat Readers were able to detect the code.")},r}(),td=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){td(e,r);function e(t,n){t===void 0&&(t=null),n===void 0&&(n=500);var i=this,a=new ed;return a.setHints(t),i=r.call(this,a,n)||this,i}return e.prototype.decodeBitmap=function(t){return this.reader.decodeWithState(t)},e})(kt);var rd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){rd(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new di,t)||this}return e})(kt);var nd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){nd(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new si,t)||this}return e})(kt);var fi;(function(r){r[r.ERROR_CORRECTION=0]="ERROR_CORRECTION",r[r.CHARACTER_SET=1]="CHARACTER_SET",r[r.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",r[r.DATA_MATRIX_COMPACT=3]="DATA_MATRIX_COMPACT",r[r.MIN_SIZE=4]="MIN_SIZE",r[r.MAX_SIZE=5]="MAX_SIZE",r[r.MARGIN=6]="MARGIN",r[r.PDF417_COMPACT=7]="PDF417_COMPACT",r[r.PDF417_COMPACTION=8]="PDF417_COMPACTION",r[r.PDF417_DIMENSIONS=9]="PDF417_DIMENSIONS",r[r.AZTEC_LAYERS=10]="AZTEC_LAYERS",r[r.QR_VERSION=11]="QR_VERSION",r[r.GS1_FORMAT=12]="GS1_FORMAT",r[r.FORCE_C40=13]="FORCE_C40"})(fi||(fi={}));const nn=fi;var Ya=function(){function r(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new ot(e,Int32Array.from([1])))}return r.prototype.buildGenerator=function(e){var t=this.cachedGenerators;if(e>=t.length)for(var n=t[t.length-1],i=this.field,a=t.length;a<=e;a++){var o=n.multiply(new ot(i,Int32Array.from([1,i.exp(a-1+i.getGeneratorBase())])));t.push(o),n=o}return t[e]},r.prototype.encode=function(e,t){if(t===0)throw new k("No error correction bytes");var n=e.length-t;if(n<=0)throw new k("No data bytes provided");var i=this.buildGenerator(t),a=new Int32Array(n);se.arraycopy(e,0,a,0,n);var o=new ot(this.field,a);o=o.multiplyByMonomial(t,1);for(var s=o.divide(i)[1],l=s.getCoefficients(),u=t-l.length,c=0;c<u;c++)e[n+c]=0;se.arraycopy(l,0,e,n+u,l.length)},r}(),Cr=function(){function r(){}return r.applyMaskPenaltyRule1=function(e){return r.applyMaskPenaltyRule1Internal(e,!0)+r.applyMaskPenaltyRule1Internal(e,!1)},r.applyMaskPenaltyRule2=function(e){for(var t=0,n=e.getArray(),i=e.getWidth(),a=e.getHeight(),o=0;o<a-1;o++)for(var s=n[o],l=0;l<i-1;l++){var u=s[l];u===s[l+1]&&u===n[o+1][l]&&u===n[o+1][l+1]&&t++}return r.N2*t},r.applyMaskPenaltyRule3=function(e){for(var t=0,n=e.getArray(),i=e.getWidth(),a=e.getHeight(),o=0;o<a;o++)for(var s=0;s<i;s++){var l=n[o];s+6<i&&l[s]===1&&l[s+1]===0&&l[s+2]===1&&l[s+3]===1&&l[s+4]===1&&l[s+5]===0&&l[s+6]===1&&(r.isWhiteHorizontal(l,s-4,s)||r.isWhiteHorizontal(l,s+7,s+11))&&t++,o+6<a&&n[o][s]===1&&n[o+1][s]===0&&n[o+2][s]===1&&n[o+3][s]===1&&n[o+4][s]===1&&n[o+5][s]===0&&n[o+6][s]===1&&(r.isWhiteVertical(n,s,o-4,o)||r.isWhiteVertical(n,s,o+7,o+11))&&t++}return t*r.N3},r.isWhiteHorizontal=function(e,t,n){t=Math.max(t,0),n=Math.min(n,e.length);for(var i=t;i<n;i++)if(e[i]===1)return!1;return!0},r.isWhiteVertical=function(e,t,n,i){n=Math.max(n,0),i=Math.min(i,e.length);for(var a=n;a<i;a++)if(e[a][t]===1)return!1;return!0},r.applyMaskPenaltyRule4=function(e){for(var t=0,n=e.getArray(),i=e.getWidth(),a=e.getHeight(),o=0;o<a;o++)for(var s=n[o],l=0;l<i;l++)s[l]===1&&t++;var u=e.getHeight()*e.getWidth(),c=Math.floor(Math.abs(t*2-u)*10/u);return c*r.N4},r.getDataMaskBit=function(e,t,n){var i,a;switch(e){case 0:i=n+t&1;break;case 1:i=n&1;break;case 2:i=t%3;break;case 3:i=(n+t)%3;break;case 4:i=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:a=n*t,i=(a&1)+a%3;break;case 6:a=n*t,i=(a&1)+a%3&1;break;case 7:a=n*t,i=a%3+(n+t&1)&1;break;default:throw new k("Invalid mask pattern: "+e)}return i===0},r.applyMaskPenaltyRule1Internal=function(e,t){for(var n=0,i=t?e.getHeight():e.getWidth(),a=t?e.getWidth():e.getHeight(),o=e.getArray(),s=0;s<i;s++){for(var l=0,u=-1,c=0;c<a;c++){var d=t?o[s][c]:o[c][s];d===u?l++:(l>=5&&(n+=r.N1+(l-5)),l=1,u=d)}l>=5&&(n+=r.N1+(l-5))}return n},r.N1=3,r.N2=3,r.N3=40,r.N4=10,r}(),id=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ad=function(){function r(e,t){this.width=e,this.height=t;for(var n=new Array(t),i=0;i!==t;i++)n[i]=new Uint8Array(e);this.bytes=n}return r.prototype.getHeight=function(){return this.height},r.prototype.getWidth=function(){return this.width},r.prototype.get=function(e,t){return this.bytes[t][e]},r.prototype.getArray=function(){return this.bytes},r.prototype.setNumber=function(e,t,n){this.bytes[t][e]=n},r.prototype.setBoolean=function(e,t,n){this.bytes[t][e]=n?1:0},r.prototype.clear=function(e){var t,n;try{for(var i=id(this.bytes),a=i.next();!a.done;a=i.next()){var o=a.value;he.fill(o,e)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;if(this.width!==t.width||this.height!==t.height)return!1;for(var n=0,i=this.height;n<i;++n)for(var a=this.bytes[n],o=t.bytes[n],s=0,l=this.width;s<l;++s)if(a[s]!==o[s])return!1;return!0},r.prototype.toString=function(){for(var e=new $,t=0,n=this.height;t<n;++t){for(var i=this.bytes[t],a=0,o=this.width;a<o;++a)switch(i[a]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(`
|
|
244
|
+
`)}return e.toString()},r}(),hi=function(){function r(){this.maskPattern=-1}return r.prototype.getMode=function(){return this.mode},r.prototype.getECLevel=function(){return this.ecLevel},r.prototype.getVersion=function(){return this.version},r.prototype.getMaskPattern=function(){return this.maskPattern},r.prototype.getMatrix=function(){return this.matrix},r.prototype.toString=function(){var e=new $;return e.append(`<<
|
|
230
245
|
`),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append(`
|
|
231
246
|
ecLevel: `),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append(`
|
|
232
247
|
version: `),e.append(this.version?this.version.toString():"null"),e.append(`
|
|
@@ -235,6 +250,6 @@
|
|
|
235
250
|
`),e.append(this.matrix.toString())):e.append(`
|
|
236
251
|
matrix: null
|
|
237
252
|
`),e.append(`>>
|
|
238
|
-
`),e.toString()},r.prototype.setMode=function(e){this.mode=e},r.prototype.setECLevel=function(e){this.ecLevel=e},r.prototype.setVersion=function(e){this.version=e},r.prototype.setMaskPattern=function(e){this.maskPattern=e},r.prototype.setMatrix=function(e){this.matrix=e},r.isValidMaskPattern=function(e){return e>=0&&e<r.NUM_MASK_PATTERNS},r.NUM_MASK_PATTERNS=8,r}(),rf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ue=function(r){rf(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="WriterException",e}(Ue),Za=function(){function r(){}return r.clearMatrix=function(e){e.clear(255)},r.buildMatrix=function(e,t,n,i,a){r.clearMatrix(a),r.embedBasicPatterns(n,a),r.embedTypeInfo(t,i,a),r.maybeEmbedVersionInfo(n,a),r.embedDataBits(e,i,a)},r.embedBasicPatterns=function(e,t){r.embedPositionDetectionPatternsAndSeparators(t),r.embedDarkDotAtLeftBottomCorner(t),r.maybeEmbedPositionAdjustmentPatterns(e,t),r.embedTimingPatterns(t)},r.embedTypeInfo=function(e,t,n){var i=new we;r.makeTypeInfoBits(e,t,i);for(var a=0,o=i.getSize();a<o;++a){var s=i.get(i.getSize()-1-a),l=r.TYPE_INFO_COORDINATES[a],u=l[0],c=l[1];if(n.setBoolean(u,c,s),a<8){var f=n.getWidth()-a-1,p=8;n.setBoolean(f,p,s)}else{var f=8,p=n.getHeight()-7+(a-8);n.setBoolean(f,p,s)}}},r.maybeEmbedVersionInfo=function(e,t){if(!(e.getVersionNumber()<7)){var n=new we;r.makeVersionInfoBits(e,n);for(var i=17,a=0;a<6;++a)for(var o=0;o<3;++o){var s=n.get(i);i--,t.setBoolean(a,t.getHeight()-11+o,s),t.setBoolean(t.getHeight()-11+o,a,s)}}},r.embedDataBits=function(e,t,n){for(var i=0,a=-1,o=n.getWidth()-1,s=n.getHeight()-1;o>0;){for(o===6&&(o-=1);s>=0&&s<n.getHeight();){for(var l=0;l<2;++l){var u=o-l;if(r.isEmpty(n.get(u,s))){var c=void 0;i<e.getSize()?(c=e.get(i),++i):c=!1,t!==255&&yr.getDataMaskBit(t,u,s)&&(c=!c),n.setBoolean(u,s,c)}}s+=a}a=-a,s+=a,o-=2}if(i!==e.getSize())throw new ue("Not all bits consumed: "+i+"/"+e.getSize())},r.findMSBSet=function(e){return 32-$.numberOfLeadingZeros(e)},r.calculateBCHCode=function(e,t){if(t===0)throw new k("0 polynomial");var n=r.findMSBSet(t);for(e<<=n-1;r.findMSBSet(e)>=n;)e^=t<<r.findMSBSet(e)-n;return e},r.makeTypeInfoBits=function(e,t,n){if(!hi.isValidMaskPattern(t))throw new ue("Invalid mask pattern");var i=e.getBits()<<3|t;n.appendBits(i,5);var a=r.calculateBCHCode(i,r.TYPE_INFO_POLY);n.appendBits(a,10);var o=new we;if(o.appendBits(r.TYPE_INFO_MASK_PATTERN,15),n.xor(o),n.getSize()!==15)throw new ue("should not happen but we got: "+n.getSize())},r.makeVersionInfoBits=function(e,t){t.appendBits(e.getVersionNumber(),6);var n=r.calculateBCHCode(e.getVersionNumber(),r.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new ue("should not happen but we got: "+t.getSize())},r.isEmpty=function(e){return e===255},r.embedTimingPatterns=function(e){for(var t=8;t<e.getWidth()-8;++t){var n=(t+1)%2;r.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),r.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}},r.embedDarkDotAtLeftBottomCorner=function(e){if(e.get(8,e.getHeight()-8)===0)throw new ue;e.setNumber(8,e.getHeight()-8,1)},r.embedHorizontalSeparationPattern=function(e,t,n){for(var i=0;i<8;++i){if(!r.isEmpty(n.get(e+i,t)))throw new ue;n.setNumber(e+i,t,0)}},r.embedVerticalSeparationPattern=function(e,t,n){for(var i=0;i<7;++i){if(!r.isEmpty(n.get(e,t+i)))throw new ue;n.setNumber(e,t+i,0)}},r.embedPositionAdjustmentPattern=function(e,t,n){for(var i=0;i<5;++i)for(var a=r.POSITION_ADJUSTMENT_PATTERN[i],o=0;o<5;++o)n.setNumber(e+o,t+i,a[o])},r.embedPositionDetectionPattern=function(e,t,n){for(var i=0;i<7;++i)for(var a=r.POSITION_DETECTION_PATTERN[i],o=0;o<7;++o)n.setNumber(e+o,t+i,a[o])},r.embedPositionDetectionPatternsAndSeparators=function(e){var t=r.POSITION_DETECTION_PATTERN[0].length;r.embedPositionDetectionPattern(0,0,e),r.embedPositionDetectionPattern(e.getWidth()-t,0,e),r.embedPositionDetectionPattern(0,e.getWidth()-t,e);var n=8;r.embedHorizontalSeparationPattern(0,n-1,e),r.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),r.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);var i=7;r.embedVerticalSeparationPattern(i,0,e),r.embedVerticalSeparationPattern(e.getHeight()-i-1,0,e),r.embedVerticalSeparationPattern(i,e.getHeight()-i,e)},r.maybeEmbedPositionAdjustmentPatterns=function(e,t){if(!(e.getVersionNumber()<2))for(var n=e.getVersionNumber()-1,i=r.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n],a=0,o=i.length;a!==o;a++){var s=i[a];if(s>=0)for(var l=0;l!==o;l++){var u=i[l];u>=0&&r.isEmpty(t.get(u,s))&&r.embedPositionAdjustmentPattern(u-2,s-2,t)}}},r.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),r.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),r.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),r.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),r.VERSION_INFO_POLY=7973,r.TYPE_INFO_POLY=1335,r.TYPE_INFO_MASK_PATTERN=21522,r}(),nf=function(){function r(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}return r.prototype.getDataBytes=function(){return this.dataBytes},r.prototype.getErrorCorrectionBytes=function(){return this.errorCorrectionBytes},r}(),Ka=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};(function(){function r(){}return r.calculateMaskPenalty=function(e){return yr.applyMaskPenaltyRule1(e)+yr.applyMaskPenaltyRule2(e)+yr.applyMaskPenaltyRule3(e)+yr.applyMaskPenaltyRule4(e)},r.encode=function(e,t,n){n===void 0&&(n=null);var i=r.DEFAULT_BYTE_MODE_ENCODING,a=n!==null&&n.get(nn.CHARACTER_SET)!==void 0;a&&(i=n.get(nn.CHARACTER_SET).toString());var o=this.chooseMode(e,i),s=new we;if(o===le.BYTE&&(a||r.DEFAULT_BYTE_MODE_ENCODING!==i)){var l=pe.getCharacterSetECIByName(i);l!==void 0&&this.appendECI(l,s)}this.appendModeInfo(o,s);var u=new we;this.appendBytes(e,o,u,i);var c;if(n!==null&&n.get(nn.QR_VERSION)!==void 0){var f=Number.parseInt(n.get(nn.QR_VERSION).toString(),10);c=Ct.getVersionForNumber(f);var p=this.calculateBitsNeeded(o,s,u,c);if(!this.willFit(p,c,t))throw new ue("Data too big for requested version")}else c=this.recommendVersion(t,o,s,u);var h=new we;h.appendBitArray(s);var g=o===le.BYTE?u.getSizeInBytes():e.length;this.appendLengthInfo(g,c,o,h),h.appendBitArray(u);var x=c.getECBlocksForLevel(t),C=c.getTotalCodewords()-x.getTotalECCodewords();this.terminateBits(C,h);var m=this.interleaveWithECBytes(h,c.getTotalCodewords(),C,x.getNumBlocks()),w=new hi;w.setECLevel(t),w.setMode(o),w.setVersion(c);var _=c.getDimensionForVersion(),E=new tf(_,_),O=this.chooseMaskPattern(m,t,c,E);return w.setMaskPattern(O),Za.buildMatrix(m,t,c,O,E),w.setMatrix(E),w},r.recommendVersion=function(e,t,n,i){var a=this.calculateBitsNeeded(t,n,i,Ct.getVersionForNumber(1)),o=this.chooseVersion(a,e),s=this.calculateBitsNeeded(t,n,i,o);return this.chooseVersion(s,e)},r.calculateBitsNeeded=function(e,t,n,i){return t.getSize()+e.getCharacterCountBits(i)+n.getSize()},r.getAlphanumericCode=function(e){return e<r.ALPHANUMERIC_TABLE.length?r.ALPHANUMERIC_TABLE[e]:-1},r.chooseMode=function(e,t){if(t===void 0&&(t=null),pe.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return le.KANJI;for(var n=!1,i=!1,a=0,o=e.length;a<o;++a){var s=e.charAt(a);if(r.isDigit(s))n=!0;else if(this.getAlphanumericCode(s.charCodeAt(0))!==-1)i=!0;else return le.BYTE}return i?le.ALPHANUMERIC:n?le.NUMERIC:le.BYTE},r.isOnlyDoubleByteKanji=function(e){var t;try{t=$e.encode(e,pe.SJIS)}catch{return!1}var n=t.length;if(n%2!==0)return!1;for(var i=0;i<n;i+=2){var a=t[i]&255;if((a<129||a>159)&&(a<224||a>235))return!1}return!0},r.chooseMaskPattern=function(e,t,n,i){for(var a=Number.MAX_SAFE_INTEGER,o=-1,s=0;s<hi.NUM_MASK_PATTERNS;s++){Za.buildMatrix(e,t,n,s,i);var l=this.calculateMaskPenalty(i);l<a&&(a=l,o=s)}return o},r.chooseVersion=function(e,t){for(var n=1;n<=40;n++){var i=Ct.getVersionForNumber(n);if(r.willFit(e,i,t))return i}throw new ue("Data too big")},r.willFit=function(e,t,n){var i=t.getTotalCodewords(),a=t.getECBlocksForLevel(n),o=a.getTotalECCodewords(),s=i-o,l=(e+7)/8;return s>=l},r.terminateBits=function(e,t){var n=e*8;if(t.getSize()>n)throw new ue("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(var i=0;i<4&&t.getSize()<n;++i)t.appendBit(!1);var a=t.getSize()&7;if(a>0)for(var i=a;i<8;i++)t.appendBit(!1);for(var o=e-t.getSizeInBytes(),i=0;i<o;++i)t.appendBits((i&1)===0?236:17,8);if(t.getSize()!==n)throw new ue("Bits size does not equal capacity")},r.getNumDataBytesAndNumECBytesForBlockID=function(e,t,n,i,a,o){if(i>=n)throw new ue("Block ID too large");var s=e%n,l=n-s,u=Math.floor(e/n),c=u+1,f=Math.floor(t/n),p=f+1,h=u-f,g=c-p;if(h!==g)throw new ue("EC bytes mismatch");if(n!==l+s)throw new ue("RS blocks mismatch");if(e!==(f+h)*l+(p+g)*s)throw new ue("Total bytes mismatch");i<l?(a[0]=f,o[0]=h):(a[0]=p,o[0]=g)},r.interleaveWithECBytes=function(e,t,n,i){var a,o,s,l;if(e.getSizeInBytes()!==n)throw new ue("Number of bits and data bytes does not match");for(var u=0,c=0,f=0,p=new Array,h=0;h<i;++h){var g=new Int32Array(1),x=new Int32Array(1);r.getNumDataBytesAndNumECBytesForBlockID(t,n,i,h,g,x);var C=g[0],m=new Uint8Array(C);e.toBytes(8*u,m,0,C);var w=r.generateECBytes(m,x[0]);p.push(new nf(m,w)),c=Math.max(c,C),f=Math.max(f,w.length),u+=g[0]}if(n!==u)throw new ue("Data bytes does not match offset");for(var _=new we,h=0;h<c;++h)try{for(var E=(a=void 0,Ka(p)),O=E.next();!O.done;O=E.next()){var T=O.value,m=T.getDataBytes();h<m.length&&_.appendBits(m[h],8)}}catch(V){a={error:V}}finally{try{O&&!O.done&&(o=E.return)&&o.call(E)}finally{if(a)throw a.error}}for(var h=0;h<f;++h)try{for(var D=(s=void 0,Ka(p)),M=D.next();!M.done;M=D.next()){var T=M.value,w=T.getErrorCorrectionBytes();h<w.length&&_.appendBits(w[h],8)}}catch(V){s={error:V}}finally{try{M&&!M.done&&(l=D.return)&&l.call(D)}finally{if(s)throw s.error}}if(t!==_.getSizeInBytes())throw new ue("Interleaving error: "+t+" and "+_.getSizeInBytes()+" differ.");return _},r.generateECBytes=function(e,t){for(var n=e.length,i=new Int32Array(n+t),a=0;a<n;a++)i[a]=e[a]&255;new Ya(He.QR_CODE_FIELD_256).encode(i,t);for(var o=new Uint8Array(t),a=0;a<t;a++)o[a]=i[n+a];return o},r.appendModeInfo=function(e,t){t.appendBits(e.getBits(),4)},r.appendLengthInfo=function(e,t,n,i){var a=n.getCharacterCountBits(t);if(e>=1<<a)throw new ue(e+" is bigger than "+((1<<a)-1));i.appendBits(e,a)},r.appendBytes=function(e,t,n,i){switch(t){case le.NUMERIC:r.appendNumericBytes(e,n);break;case le.ALPHANUMERIC:r.appendAlphanumericBytes(e,n);break;case le.BYTE:r.append8BitBytes(e,n,i);break;case le.KANJI:r.appendKanjiBytes(e,n);break;default:throw new ue("Invalid mode: "+t)}},r.getDigit=function(e){return e.charCodeAt(0)-48},r.isDigit=function(e){var t=r.getDigit(e);return t>=0&&t<=9},r.appendNumericBytes=function(e,t){for(var n=e.length,i=0;i<n;){var a=r.getDigit(e.charAt(i));if(i+2<n){var o=r.getDigit(e.charAt(i+1)),s=r.getDigit(e.charAt(i+2));t.appendBits(a*100+o*10+s,10),i+=3}else if(i+1<n){var o=r.getDigit(e.charAt(i+1));t.appendBits(a*10+o,7),i+=2}else t.appendBits(a,4),i++}},r.appendAlphanumericBytes=function(e,t){for(var n=e.length,i=0;i<n;){var a=r.getAlphanumericCode(e.charCodeAt(i));if(a===-1)throw new ue;if(i+1<n){var o=r.getAlphanumericCode(e.charCodeAt(i+1));if(o===-1)throw new ue;t.appendBits(a*45+o,11),i+=2}else t.appendBits(a,6),i++}},r.append8BitBytes=function(e,t,n){var i;try{i=$e.encode(e,n)}catch(l){throw new ue(l)}for(var a=0,o=i.length;a!==o;a++){var s=i[a];t.appendBits(s,8)}},r.appendKanjiBytes=function(e,t){var n;try{n=$e.encode(e,pe.SJIS)}catch(f){throw new ue(f)}for(var i=n.length,a=0;a<i;a+=2){var o=n[a]&255,s=n[a+1]&255,l=o<<8&4294967295|s,u=-1;if(l>=33088&&l<=40956?u=l-33088:l>=57408&&l<=60351&&(u=l-49472),u===-1)throw new ue("Invalid byte sequence");var c=(u>>8)*192+(u&255);t.appendBits(c,13)}},r.appendECI=function(e,t){t.appendBits(le.ECI.getBits(),4),t.appendBits(e.getValue(),8)},r.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),r.DEFAULT_BYTE_MODE_ENCODING=pe.UTF8.getName(),r})();var af=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){af(e,r);function e(t,n,i,a,o,s,l,u){var c=r.call(this,s,l)||this;if(c.yuvData=t,c.dataWidth=n,c.dataHeight=i,c.left=a,c.top=o,a+s>n||o+l>i)throw new k("Crop rectangle does not fit within image data.");return u&&c.reverseHorizontal(s,l),c}return e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new k("Requested row is outside the image: "+t);var i=this.getWidth();(n==null||n.length<i)&&(n=new Uint8ClampedArray(i));var a=(t+this.top)*this.dataWidth+this.left;return se.arraycopy(this.yuvData,a,n,0,i),n},e.prototype.getMatrix=function(){var t=this.getWidth(),n=this.getHeight();if(t===this.dataWidth&&n===this.dataHeight)return this.yuvData;var i=t*n,a=new Uint8ClampedArray(i),o=this.top*this.dataWidth+this.left;if(t===this.dataWidth)return se.arraycopy(this.yuvData,o,a,0,i),a;for(var s=0;s<n;s++){var l=s*t;se.arraycopy(this.yuvData,o,a,l,t),o+=this.dataWidth}return a},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(t,n,i,a){return new e(this.yuvData,this.dataWidth,this.dataHeight,this.left+t,this.top+n,i,a,!1)},e.prototype.renderThumbnail=function(){for(var t=this.getWidth()/e.THUMBNAIL_SCALE_FACTOR,n=this.getHeight()/e.THUMBNAIL_SCALE_FACTOR,i=new Int32Array(t*n),a=this.yuvData,o=this.top*this.dataWidth+this.left,s=0;s<n;s++){for(var l=s*t,u=0;u<t;u++){var c=a[o+u*e.THUMBNAIL_SCALE_FACTOR]&255;i[l+u]=4278190080|c*65793}o+=this.dataWidth*e.THUMBNAIL_SCALE_FACTOR}return i},e.prototype.getThumbnailWidth=function(){return this.getWidth()/e.THUMBNAIL_SCALE_FACTOR},e.prototype.getThumbnailHeight=function(){return this.getHeight()/e.THUMBNAIL_SCALE_FACTOR},e.prototype.reverseHorizontal=function(t,n){for(var i=this.yuvData,a=0,o=this.top*this.dataWidth+this.left;a<n;a++,o+=this.dataWidth)for(var s=o+t/2,l=o,u=o+t-1;l<s;l++,u--){var c=i[l];i[l]=i[u],i[u]=c}},e.prototype.invert=function(){return new $n(this)},e.THUMBNAIL_SCALE_FACTOR=2,e})(jr);var of=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){of(e,r);function e(t,n,i,a,o,s,l){var u=r.call(this,n,i)||this;if(u.dataWidth=a,u.dataHeight=o,u.left=s,u.top=l,t.BYTES_PER_ELEMENT===4){for(var c=n*i,f=new Uint8ClampedArray(c),p=0;p<c;p++){var h=t[p],g=h>>16&255,x=h>>7&510,C=h&255;f[p]=(g+x+C)/4&255}u.luminances=f}else u.luminances=t;if(a===void 0&&(u.dataWidth=n),o===void 0&&(u.dataHeight=i),s===void 0&&(u.left=0),l===void 0&&(u.top=0),u.left+n>u.dataWidth||u.top+i>u.dataHeight)throw new k("Crop rectangle does not fit within image data.");return u}return e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new k("Requested row is outside the image: "+t);var i=this.getWidth();(n==null||n.length<i)&&(n=new Uint8ClampedArray(i));var a=(t+this.top)*this.dataWidth+this.left;return se.arraycopy(this.luminances,a,n,0,i),n},e.prototype.getMatrix=function(){var t=this.getWidth(),n=this.getHeight();if(t===this.dataWidth&&n===this.dataHeight)return this.luminances;var i=t*n,a=new Uint8ClampedArray(i),o=this.top*this.dataWidth+this.left;if(t===this.dataWidth)return se.arraycopy(this.luminances,o,a,0,i),a;for(var s=0;s<n;s++){var l=s*t;se.arraycopy(this.luminances,o,a,l,t),o+=this.dataWidth}return a},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(t,n,i,a){return new e(this.luminances,i,a,this.dataWidth,this.dataHeight,this.left+t,this.top+n)},e.prototype.invert=function(){return new $n(this)},e})(jr);var sf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),lf=function(r){sf(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.forName=function(t){return this.getCharacterSetECIByName(t)},e}(pe),uf=function(){function r(){}return r.ISO_8859_1=pe.ISO8859_1,r}(),pi,cf=301,ff=function(r,e){for(var t=1,n=0;n<255;n++)e[n]=t,r[t]=n,t*=2,t>=256&&(t^=cf);return{LOG:r,ALOG:e}};pi=ff([],[]),pi.LOG,pi.ALOG;var Qa;(function(r){r[r.FORCE_NONE=0]="FORCE_NONE",r[r.FORCE_SQUARE=1]="FORCE_SQUARE",r[r.FORCE_RECTANGLE=2]="FORCE_RECTANGLE"})(Qa||(Qa={}));var Ja=129,eo=230,df=231,hf=235,pf=236,vf=237,gf=238,xf=239,yf=240,vi=254,Cf=254,to="[)>05",ro="[)>06",no="",ae=0,Ie=1,ze=2,ye=3,_e=4,Te=5,wf=function(){function r(){}return r.prototype.getEncodingMode=function(){return ae},r.prototype.encode=function(e){var t=Je.determineConsecutiveDigitCount(e.getMessage(),e.pos);if(t>=2)e.writeCodeword(this.encodeASCIIDigits(e.getMessage().charCodeAt(e.pos),e.getMessage().charCodeAt(e.pos+1))),e.pos+=2;else{var n=e.getCurrentChar(),i=Je.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(i!==this.getEncodingMode())switch(i){case Te:e.writeCodeword(df),e.signalEncoderChange(Te);return;case Ie:e.writeCodeword(eo),e.signalEncoderChange(Ie);return;case ye:e.writeCodeword(gf),e.signalEncoderChange(ye);break;case ze:e.writeCodeword(xf),e.signalEncoderChange(ze);break;case _e:e.writeCodeword(yf),e.signalEncoderChange(_e);break;default:throw new Error("Illegal mode: "+i)}else Je.isExtendedASCII(n)?(e.writeCodeword(hf),e.writeCodeword(n-128+1),e.pos++):(e.writeCodeword(n+1),e.pos++)}},r.prototype.encodeASCIIDigits=function(e,t){if(Je.isDigit(e)&&Je.isDigit(t)){var n=(e-48)*10+(t-48);return n+130}throw new Error("not digits: "+e+t)},r}(),mf=function(){function r(){}return r.prototype.getEncodingMode=function(){return Te},r.prototype.encode=function(e){var t=new q;for(t.append(0);e.hasMoreCharacters();){var n=e.getCurrentChar();t.append(n),e.pos++;var i=Je.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(i!==this.getEncodingMode()){e.signalEncoderChange(ae);break}}var a=t.length()-1,o=1,s=e.getCodewordCount()+a+o;e.updateSymbolInfo(s);var l=e.getSymbolInfo().getDataCapacity()-s>0;if(e.hasMoreCharacters()||l)if(a<=249)t.setCharAt(0,Y.getCharAt(a));else if(a<=1555)t.setCharAt(0,Y.getCharAt(Math.floor(a/250)+249)),t.insert(1,Y.getCharAt(a%250));else throw new Error("Message length not in valid ranges: "+a);for(var u=0,n=t.length();u<n;u++)e.writeCodeword(this.randomize255State(t.charAt(u).charCodeAt(0),e.getCodewordCount()+1))},r.prototype.randomize255State=function(e,t){var n=149*t%255+1,i=e+n;return i<=255?i:i-256},r}(),gi=function(){function r(){}return r.prototype.getEncodingMode=function(){return Ie},r.prototype.encodeMaximal=function(e){for(var t=new q,n=0,i=e.pos,a=0;e.hasMoreCharacters();){var o=e.getCurrentChar();e.pos++,n=this.encodeChar(o,t),t.length()%3===0&&(i=e.pos,a=t.length())}if(a!==t.length()){var s=Math.floor(t.length()/3*2),l=Math.floor(e.getCodewordCount()+s+1);e.updateSymbolInfo(l);var u=e.getSymbolInfo().getDataCapacity()-l,c=Math.floor(t.length()%3);(c===2&&u!==2||c===1&&(n>3||u!==1))&&(e.pos=i)}t.length()>0&&e.writeCodeword(eo),this.handleEOD(e,t)},r.prototype.encode=function(e){for(var t=new q;e.hasMoreCharacters();){var n=e.getCurrentChar();e.pos++;var i=this.encodeChar(n,t),a=Math.floor(t.length()/3)*2,o=e.getCodewordCount()+a;e.updateSymbolInfo(o);var s=e.getSymbolInfo().getDataCapacity()-o;if(!e.hasMoreCharacters()){var l=new q;for(t.length()%3===2&&s!==2&&(i=this.backtrackOneCharacter(e,t,l,i));t.length()%3===1&&(i>3||s!==1);)i=this.backtrackOneCharacter(e,t,l,i);break}var u=t.length();if(u%3===0){var c=Je.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(c!==this.getEncodingMode()){e.signalEncoderChange(ae);break}}}this.handleEOD(e,t)},r.prototype.backtrackOneCharacter=function(e,t,n,i){var a=t.length(),o=t.toString().substring(0,a-i);t.setLengthToZero(),t.append(o),e.pos--;var s=e.getCurrentChar();return i=this.encodeChar(s,n),e.resetSymbolInfo(),i},r.prototype.writeNextTriplet=function(e,t){e.writeCodewords(this.encodeToCodewords(t.toString()));var n=t.toString().substring(3);t.setLengthToZero(),t.append(n)},r.prototype.handleEOD=function(e,t){var n=Math.floor(t.length()/3*2),i=t.length()%3,a=e.getCodewordCount()+n;e.updateSymbolInfo(a);var o=e.getSymbolInfo().getDataCapacity()-a;if(i===2){for(t.append("\0");t.length()>=3;)this.writeNextTriplet(e,t);e.hasMoreCharacters()&&e.writeCodeword(vi)}else if(o===1&&i===1){for(;t.length()>=3;)this.writeNextTriplet(e,t);e.hasMoreCharacters()&&e.writeCodeword(vi),e.pos--}else if(i===0){for(;t.length()>=3;)this.writeNextTriplet(e,t);(o>0||e.hasMoreCharacters())&&e.writeCodeword(vi)}else throw new Error("Unexpected case. Please report!");e.signalEncoderChange(ae)},r.prototype.encodeChar=function(e,t){if(e===32)return t.append(3),1;if(e>=48&&e<=57)return t.append(e-48+4),1;if(e>=65&&e<=90)return t.append(e-65+14),1;if(e<32)return t.append(0),t.append(e),2;if(e<=47)return t.append(1),t.append(e-33),2;if(e<=64)return t.append(1),t.append(e-58+15),2;if(e<=95)return t.append(1),t.append(e-91+22),2;if(e<=127)return t.append(2),t.append(e-96),2;t.append("1");var n=2;return n+=this.encodeChar(e-128,t),n},r.prototype.encodeToCodewords=function(e){var t=1600*e.charCodeAt(0)+40*e.charCodeAt(1)+e.charCodeAt(2)+1,n=t/256,i=t%256,a=new q;return a.append(n),a.append(i),a.toString()},r}(),_f=function(){function r(){}return r.prototype.getEncodingMode=function(){return _e},r.prototype.encode=function(e){for(var t=new q;e.hasMoreCharacters();){var n=e.getCurrentChar();this.encodeChar(n,t),e.pos++;var i=t.length();if(i>=4){e.writeCodewords(this.encodeToCodewords(t.toString()));var a=t.toString().substring(4);t.setLengthToZero(),t.append(a);var o=Je.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(o!==this.getEncodingMode()){e.signalEncoderChange(ae);break}}}t.append(Y.getCharAt(31)),this.handleEOD(e,t)},r.prototype.handleEOD=function(e,t){try{var n=t.length();if(n===0)return;if(n===1){e.updateSymbolInfo();var i=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount(),a=e.getRemainingCharacters();if(a>i&&(e.updateSymbolInfo(e.getCodewordCount()+1),i=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount()),a<=i&&i<=2)return}if(n>4)throw new Error("Count must not exceed 4");var o=n-1,s=this.encodeToCodewords(t.toString()),l=!e.hasMoreCharacters(),u=l&&o<=2;if(o<=2){e.updateSymbolInfo(e.getCodewordCount()+o);var i=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount();i>=3&&(u=!1,e.updateSymbolInfo(e.getCodewordCount()+s.length))}u?(e.resetSymbolInfo(),e.pos-=o):e.writeCodewords(s)}finally{e.signalEncoderChange(ae)}},r.prototype.encodeChar=function(e,t){e>=32&&e<=63?t.append(e):e>=64&&e<=94?t.append(Y.getCharAt(e-64)):Je.illegalCharacter(Y.getCharAt(e))},r.prototype.encodeToCodewords=function(e){var t=e.length;if(t===0)throw new Error("StringBuilder must not be empty");var n=e.charAt(0).charCodeAt(0),i=t>=2?e.charAt(1).charCodeAt(0):0,a=t>=3?e.charAt(2).charCodeAt(0):0,o=t>=4?e.charAt(3).charCodeAt(0):0,s=(n<<18)+(i<<12)+(a<<6)+o,l=s>>16&255,u=s>>8&255,c=s&255,f=new q;return f.append(l),t>=2&&f.append(u),t>=3&&f.append(c),f.toString()},r}(),Af=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ef=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},te=function(){function r(e,t,n,i,a,o,s,l){s===void 0&&(s=0),l===void 0&&(l=0),this.rectangular=e,this.dataCapacity=t,this.errorCodewords=n,this.matrixWidth=i,this.matrixHeight=a,this.dataRegions=o,this.rsBlockData=s,this.rsBlockError=l}return r.lookup=function(e,t,n,i,a){var o,s;t===void 0&&(t=0),n===void 0&&(n=null),i===void 0&&(i=null),a===void 0&&(a=!0);try{for(var l=Ef(Sf),u=l.next();!u.done;u=l.next()){var c=u.value;if(!(t===1&&c.rectangular)&&!(t===2&&!c.rectangular)&&!(n!=null&&(c.getSymbolWidth()<n.getWidth()||c.getSymbolHeight()<n.getHeight()))&&!(i!=null&&(c.getSymbolWidth()>i.getWidth()||c.getSymbolHeight()>i.getHeight()))&&e<=c.dataCapacity)return c}}catch(f){o={error:f}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(o)throw o.error}}if(a)throw new Error("Can't find a symbol arrangement that matches the message. Data codewords: "+e);return null},r.prototype.getHorizontalDataRegions=function(){switch(this.dataRegions){case 1:return 1;case 2:case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}},r.prototype.getVerticalDataRegions=function(){switch(this.dataRegions){case 1:case 2:return 1;case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}},r.prototype.getSymbolDataWidth=function(){return this.getHorizontalDataRegions()*this.matrixWidth},r.prototype.getSymbolDataHeight=function(){return this.getVerticalDataRegions()*this.matrixHeight},r.prototype.getSymbolWidth=function(){return this.getSymbolDataWidth()+this.getHorizontalDataRegions()*2},r.prototype.getSymbolHeight=function(){return this.getSymbolDataHeight()+this.getVerticalDataRegions()*2},r.prototype.getCodewordCount=function(){return this.dataCapacity+this.errorCodewords},r.prototype.getInterleavedBlockCount=function(){return this.rsBlockData?this.dataCapacity/this.rsBlockData:1},r.prototype.getDataCapacity=function(){return this.dataCapacity},r.prototype.getErrorCodewords=function(){return this.errorCodewords},r.prototype.getDataLengthForInterleavedBlock=function(e){return this.rsBlockData},r.prototype.getErrorLengthForInterleavedBlock=function(e){return this.rsBlockError},r}(),If=function(r){Af(e,r);function e(){return r.call(this,!1,1558,620,22,22,36,-1,62)||this}return e.prototype.getInterleavedBlockCount=function(){return 10},e.prototype.getDataLengthForInterleavedBlock=function(t){return t<=8?156:155},e}(te),Sf=[new te(!1,3,5,8,8,1),new te(!1,5,7,10,10,1),new te(!0,5,7,16,6,1),new te(!1,8,10,12,12,1),new te(!0,10,11,14,6,2),new te(!1,12,12,14,14,1),new te(!0,16,14,24,10,1),new te(!1,18,14,16,16,1),new te(!1,22,18,18,18,1),new te(!0,22,18,16,10,2),new te(!1,30,20,20,20,1),new te(!0,32,24,16,14,2),new te(!1,36,24,22,22,1),new te(!1,44,28,24,24,1),new te(!0,49,28,22,14,2),new te(!1,62,36,14,14,4),new te(!1,86,42,16,16,4),new te(!1,114,48,18,18,4),new te(!1,144,56,20,20,4),new te(!1,174,68,22,22,4),new te(!1,204,84,24,24,4,102,42),new te(!1,280,112,14,14,16,140,56),new te(!1,368,144,16,16,16,92,36),new te(!1,456,192,18,18,16,114,48),new te(!1,576,224,20,20,16,144,56),new te(!1,696,272,22,22,16,174,68),new te(!1,816,336,24,24,16,136,56),new te(!1,1050,408,18,18,36,175,68),new te(!1,1304,496,20,20,36,163,62),new If],Of=function(){function r(e){this.msg=e,this.pos=0,this.skipAtEnd=0;for(var t=e.split("").map(function(s){return s.charCodeAt(0)}),n=new q,i=0,a=t.length;i<a;i++){var o=String.fromCharCode(t[i]&255);if(o==="?"&&e.charAt(i)!=="?")throw new Error("Message contains characters outside ISO-8859-1 encoding.");n.append(o)}this.msg=n.toString(),this.shape=0,this.codewords=new q,this.newEncoding=-1}return r.prototype.setSymbolShape=function(e){this.shape=e},r.prototype.setSizeConstraints=function(e,t){this.minSize=e,this.maxSize=t},r.prototype.getMessage=function(){return this.msg},r.prototype.setSkipAtEnd=function(e){this.skipAtEnd=e},r.prototype.getCurrentChar=function(){return this.msg.charCodeAt(this.pos)},r.prototype.getCurrent=function(){return this.msg.charCodeAt(this.pos)},r.prototype.getCodewords=function(){return this.codewords},r.prototype.writeCodewords=function(e){this.codewords.append(e)},r.prototype.writeCodeword=function(e){this.codewords.append(e)},r.prototype.getCodewordCount=function(){return this.codewords.length()},r.prototype.getNewEncoding=function(){return this.newEncoding},r.prototype.signalEncoderChange=function(e){this.newEncoding=e},r.prototype.resetEncoderSignal=function(){this.newEncoding=-1},r.prototype.hasMoreCharacters=function(){return this.pos<this.getTotalMessageCharCount()},r.prototype.getTotalMessageCharCount=function(){return this.msg.length-this.skipAtEnd},r.prototype.getRemainingCharacters=function(){return this.getTotalMessageCharCount()-this.pos},r.prototype.getSymbolInfo=function(){return this.symbolInfo},r.prototype.updateSymbolInfo=function(e){e===void 0&&(e=this.getCodewordCount()),(this.symbolInfo==null||e>this.symbolInfo.getDataCapacity())&&(this.symbolInfo=te.lookup(e,this.shape,this.minSize,this.maxSize,!0))},r.prototype.resetSymbolInfo=function(){this.symbolInfo=null},r}(),bf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Nf=function(r){bf(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getEncodingMode=function(){return ye},e.prototype.encode=function(t){for(var n=new q;t.hasMoreCharacters();){var i=t.getCurrentChar();t.pos++,this.encodeChar(i,n);var a=n.length();if(a%3===0){this.writeNextTriplet(t,n);var o=Je.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode());if(o!==this.getEncodingMode()){t.signalEncoderChange(ae);break}}}this.handleEOD(t,n)},e.prototype.encodeChar=function(t,n){switch(t){case 13:n.append(0);break;case 42:n.append(1);break;case 62:n.append(2);break;case 32:n.append(3);break;default:t>=48&&t<=57?n.append(t-48+4):t>=65&&t<=90?n.append(t-65+14):Je.illegalCharacter(Y.getCharAt(t));break}return 1},e.prototype.handleEOD=function(t,n){t.updateSymbolInfo();var i=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount(),a=n.length();t.pos-=a,(t.getRemainingCharacters()>1||i>1||t.getRemainingCharacters()!==i)&&t.writeCodeword(Cf),t.getNewEncoding()<0&&t.signalEncoderChange(ae)},e}(gi),Tf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Df=function(r){Tf(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getEncodingMode=function(){return ze},e.prototype.encodeChar=function(t,n){if(t===32)return n.append(3),1;if(t>=48&&t<=57)return n.append(t-48+4),1;if(t>=97&&t<=122)return n.append(t-97+14),1;if(t<32)return n.append(0),n.append(t),2;if(t<=47)return n.append(1),n.append(t-33),2;if(t<=64)return n.append(1),n.append(t-58+15),2;if(t>=91&&t<=95)return n.append(1),n.append(t-91+22),2;if(t===96)return n.append(2),n.append(0),2;if(t<=90)return n.append(2),n.append(t-65+1),2;if(t<=127)return n.append(2),n.append(t-123+27),2;n.append("1");var i=2;return i+=this.encodeChar(t-128,n),i},e}(gi),Je=function(){function r(){}return r.randomize253State=function(e){var t=149*e%253+1,n=Ja+t;return n<=254?n:n-254},r.encodeHighLevel=function(e,t,n,i,a){t===void 0&&(t=0),n===void 0&&(n=null),i===void 0&&(i=null),a===void 0&&(a=!1);var o=new gi,s=[new wf,o,new Df,new Nf,new _f,new mf],l=new Of(e);l.setSymbolShape(t),l.setSizeConstraints(n,i),e.startsWith(to)&&e.endsWith(no)?(l.writeCodeword(pf),l.setSkipAtEnd(2),l.pos+=to.length):e.startsWith(ro)&&e.endsWith(no)&&(l.writeCodeword(vf),l.setSkipAtEnd(2),l.pos+=ro.length);var u=ae;for(a&&(o.encodeMaximal(l),u=l.getNewEncoding(),l.resetEncoderSignal());l.hasMoreCharacters();)s[u].encode(l),l.getNewEncoding()>=0&&(u=l.getNewEncoding(),l.resetEncoderSignal());var c=l.getCodewordCount();l.updateSymbolInfo();var f=l.getSymbolInfo().getDataCapacity();c<f&&u!==ae&&u!==Te&&u!==_e&&l.writeCodeword("þ");var p=l.getCodewords();for(p.length()<f&&p.append(Ja);p.length()<f;)p.append(this.randomize253State(p.length()+1));return l.getCodewords().toString()},r.lookAheadTest=function(e,t,n){var i=this.lookAheadTestIntern(e,t,n);if(n===ye&&i===ye){for(var a=Math.min(t+3,e.length),o=t;o<a;o++)if(!this.isNativeX12(e.charCodeAt(o)))return ae}else if(n===_e&&i===_e){for(var a=Math.min(t+4,e.length),o=t;o<a;o++)if(!this.isNativeEDIFACT(e.charCodeAt(o)))return ae}return i},r.lookAheadTestIntern=function(e,t,n){if(t>=e.length)return n;var i;n===ae?i=[0,1,1,1,1,1.25]:(i=[1,2,2,2,2,2.25],i[n]=0);for(var a=0,o=new Uint8Array(6),s=[];;){if(t+a===e.length){he.fill(o,0),he.fill(s,0);var l=this.findMinimums(i,s,$.MAX_VALUE,o),u=this.getMinimumCount(o);if(s[ae]===l)return ae;if(u===1){if(o[Te]>0)return Te;if(o[_e]>0)return _e;if(o[ze]>0)return ze;if(o[ye]>0)return ye}return Ie}var c=e.charCodeAt(t+a);if(a++,this.isDigit(c)?i[ae]+=.5:this.isExtendedASCII(c)?(i[ae]=Math.ceil(i[ae]),i[ae]+=2):(i[ae]=Math.ceil(i[ae]),i[ae]++),this.isNativeC40(c)?i[Ie]+=2/3:this.isExtendedASCII(c)?i[Ie]+=8/3:i[Ie]+=4/3,this.isNativeText(c)?i[ze]+=2/3:this.isExtendedASCII(c)?i[ze]+=8/3:i[ze]+=4/3,this.isNativeX12(c)?i[ye]+=2/3:this.isExtendedASCII(c)?i[ye]+=13/3:i[ye]+=10/3,this.isNativeEDIFACT(c)?i[_e]+=3/4:this.isExtendedASCII(c)?i[_e]+=17/4:i[_e]+=13/4,this.isSpecialB256(c)?i[Te]+=4:i[Te]++,a>=4){if(he.fill(o,0),he.fill(s,0),this.findMinimums(i,s,$.MAX_VALUE,o),s[ae]<this.min(s[Te],s[Ie],s[ze],s[ye],s[_e]))return ae;if(s[Te]<s[ae]||s[Te]+1<this.min(s[Ie],s[ze],s[ye],s[_e]))return Te;if(s[_e]+1<this.min(s[Te],s[Ie],s[ze],s[ye],s[ae]))return _e;if(s[ze]+1<this.min(s[Te],s[Ie],s[_e],s[ye],s[ae]))return ze;if(s[ye]+1<this.min(s[Te],s[Ie],s[_e],s[ze],s[ae]))return ye;if(s[Ie]+1<this.min(s[ae],s[Te],s[_e],s[ze])){if(s[Ie]<s[ye])return Ie;if(s[Ie]===s[ye]){for(var f=t+a+1;f<e.length;){var p=e.charCodeAt(f);if(this.isX12TermSep(p))return ye;if(!this.isNativeX12(p))break;f++}return Ie}}}}},r.min=function(e,t,n,i,a){var o=Math.min(e,Math.min(t,Math.min(n,i)));return a===void 0?o:Math.min(o,a)},r.findMinimums=function(e,t,n,i){for(var a=0;a<6;a++){var o=t[a]=Math.ceil(e[a]);n>o&&(n=o,he.fill(i,0)),n===o&&(i[a]=i[a]+1)}return n},r.getMinimumCount=function(e){for(var t=0,n=0;n<6;n++)t+=e[n];return t||0},r.isDigit=function(e){return e>=48&&e<=57},r.isExtendedASCII=function(e){return e>=128&&e<=255},r.isNativeC40=function(e){return e===32||e>=48&&e<=57||e>=65&&e<=90},r.isNativeText=function(e){return e===32||e>=48&&e<=57||e>=97&&e<=122},r.isNativeX12=function(e){return this.isX12TermSep(e)||e===32||e>=48&&e<=57||e>=65&&e<=90},r.isX12TermSep=function(e){return e===13||e===42||e===62},r.isNativeEDIFACT=function(e){return e>=32&&e<=94},r.isSpecialB256=function(e){return!1},r.determineConsecutiveDigitCount=function(e,t){t===void 0&&(t=0);for(var n=e.length,i=t;i<n&&this.isDigit(e.charCodeAt(i));)i++;return i-t},r.illegalCharacter=function(e){var t=$.toHexString(e.charCodeAt(0));throw t="0000".substring(0,4-t.length)+t,new Error("Illegal character: "+e+" (0x"+t+")")},r}(),xi=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},io=function(){function r(e){this.charset=e,this.name=e.name}return r.prototype.canEncode=function(e){try{return $e.encode(e,this.charset)!=null}catch{return!1}},r}(),Mf=function(){function r(e,t,n){var i,a,o,s,l,u;this.ENCODERS=["IBM437","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-6","ISO-8859-7","ISO-8859-8","ISO-8859-9","ISO-8859-10","ISO-8859-11","ISO-8859-13","ISO-8859-14","ISO-8859-15","ISO-8859-16","windows-1250","windows-1251","windows-1252","windows-1256","Shift_JIS"].map(function(P){return new io(lf.forName(P))}),this.encoders=[];var c=[];c.push(new io(uf.ISO_8859_1));for(var f=t!=null&&t.name.startsWith("UTF"),p=0;p<e.length;p++){var h=!1;try{for(var g=(i=void 0,xi(c)),x=g.next();!x.done;x=g.next()){var C=x.value,m=e.charAt(p),w=m.charCodeAt(0);if(w===n||C.canEncode(m)){h=!0;break}}}catch(P){i={error:P}}finally{try{x&&!x.done&&(a=g.return)&&a.call(g)}finally{if(i)throw i.error}}if(!h)try{for(var _=(o=void 0,xi(this.ENCODERS)),E=_.next();!E.done;E=_.next()){var C=E.value;if(C.canEncode(e.charAt(p))){c.push(C),h=!0;break}}}catch(P){o={error:P}}finally{try{E&&!E.done&&(s=_.return)&&s.call(_)}finally{if(o)throw o.error}}h||(f=!0)}if(c.length===1&&!f)this.encoders=[c[0]];else{this.encoders=[];var O=0;try{for(var T=xi(c),D=T.next();!D.done;D=T.next()){var C=D.value;this.encoders[O++]=C}}catch(P){l={error:P}}finally{try{D&&!D.done&&(u=T.return)&&u.call(T)}finally{if(l)throw l.error}}}var M=-1;if(t!=null){for(var p=0;p<this.encoders.length;p++)if(this.encoders[p]!=null&&t.name===this.encoders[p].name){M=p;break}}this.priorityEncoderIndex=M}return r.prototype.length=function(){return this.encoders.length},r.prototype.getCharsetName=function(e){if(!(e<this.length()))throw new Error("index must be less than length");return this.encoders[e].name},r.prototype.getCharset=function(e){if(!(e<this.length()))throw new Error("index must be less than length");return this.encoders[e].charset},r.prototype.getECIValue=function(e){return this.encoders[e].charset.getValueIdentifier()},r.prototype.getPriorityEncoderIndex=function(){return this.priorityEncoderIndex},r.prototype.canEncode=function(e,t){if(!(t<this.length()))throw new Error("index must be less than length");return!0},r.prototype.encode=function(e,t){if(!(t<this.length()))throw new Error("index must be less than length");return $e.encode(Y.getCharAt(e),this.encoders[t].name)},r}(),Pf=3,Ff=function(){function r(e,t,n){this.fnc1=n;var i=new Mf(e,t,n);if(i.length()===1)for(var a=0;a<this.bytes.length;a++){var o=e.charAt(a).charCodeAt(0);this.bytes[a]=o===n?1e3:o}else this.bytes=this.encodeMinimally(e,i,n)}return r.prototype.getFNC1Character=function(){return this.fnc1},r.prototype.length=function(){return this.bytes.length},r.prototype.haveNCharacters=function(e,t){if(e+t-1>=this.bytes.length)return!1;for(var n=0;n<t;n++)if(this.isECI(e+n))return!1;return!0},r.prototype.charAt=function(e){if(e<0||e>=this.length())throw new Error(""+e);if(this.isECI(e))throw new Error("value at "+e+" is not a character but an ECI");return this.isFNC1(e)?this.fnc1:this.bytes[e]},r.prototype.subSequence=function(e,t){if(e<0||e>t||t>this.length())throw new Error(""+e);for(var n=new q,i=e;i<t;i++){if(this.isECI(i))throw new Error("value at "+i+" is not a character but an ECI");n.append(this.charAt(i))}return n.toString()},r.prototype.isECI=function(e){if(e<0||e>=this.length())throw new Error(""+e);return this.bytes[e]>255&&this.bytes[e]<=999},r.prototype.isFNC1=function(e){if(e<0||e>=this.length())throw new Error(""+e);return this.bytes[e]===1e3},r.prototype.getECIValue=function(e){if(e<0||e>=this.length())throw new Error(""+e);if(!this.isECI(e))throw new Error("value at "+e+" is not an ECI but a character");return this.bytes[e]-256},r.prototype.addEdge=function(e,t,n){(e[t][n.encoderIndex]==null||e[t][n.encoderIndex].cachedTotalSize>n.cachedTotalSize)&&(e[t][n.encoderIndex]=n)},r.prototype.addEdges=function(e,t,n,i,a,o){var s=e.charAt(i).charCodeAt(0),l=0,u=t.length();t.getPriorityEncoderIndex()>=0&&(s===o||t.canEncode(s,t.getPriorityEncoderIndex()))&&(l=t.getPriorityEncoderIndex(),u=l+1);for(var c=l;c<u;c++)(s===o||t.canEncode(s,c))&&this.addEdge(n,i+1,new ao(s,t,c,a,o))},r.prototype.encodeMinimally=function(e,t,n){var i=e.length,a=new ao[i+1][t.length()];this.addEdges(e,t,a,0,null,n);for(var o=1;o<=i;o++){for(var s=0;s<t.length();s++)a[o][s]!=null&&o<i&&this.addEdges(e,t,a,o,a[o][s],n);for(var s=0;s<t.length();s++)a[o-1][s]=null}for(var l=-1,u=$.MAX_VALUE,s=0;s<t.length();s++)if(a[i][s]!=null){var c=a[i][s];c.cachedTotalSize<u&&(u=c.cachedTotalSize,l=s)}if(l<0)throw new Error('Failed to encode "'+e+'"');for(var f=[],p=a[i][l];p!=null;){if(p.isFNC1())f.unshift(1e3);else for(var h=t.encode(p.c,p.encoderIndex),o=h.length-1;o>=0;o--)f.unshift(h[o]&255);var g=p.previous===null?0:p.previous.encoderIndex;g!==p.encoderIndex&&f.unshift(256+t.getECIValue(p.encoderIndex)),p=p.previous}for(var x=[],o=0;o<x.length;o++)x[o]=f[o];return x},r}(),ao=function(){function r(e,t,n,i,a){this.c=e,this.encoderSet=t,this.encoderIndex=n,this.previous=i,this.fnc1=a,this.c=e===a?1e3:e;var o=this.isFNC1()?1:t.encode(e,n).length,s=i===null?0:i.encoderIndex;s!==n&&(o+=Pf),i!=null&&(o+=i.cachedTotalSize),this.cachedTotalSize=o}return r.prototype.isFNC1=function(){return this.c===1e3},r}(),Vf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Bf=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return a},oo;(function(r){r[r.ASCII=0]="ASCII",r[r.C40=1]="C40",r[r.TEXT=2]="TEXT",r[r.X12=3]="X12",r[r.EDF=4]="EDF",r[r.B256=5]="B256"})(oo||(oo={})),function(r){Vf(e,r);function e(t,n,i,a,o){var s=r.call(this,t,n,i)||this;return s.shape=a,s.macroId=o,s}return e.prototype.getMacroId=function(){return this.macroId},e.prototype.getShapeHint=function(){return this.shape},e}(Ff);var Lf=function(){function r(){}return r.prototype.isCompact=function(){return this.compact},r.prototype.setCompact=function(e){this.compact=e},r.prototype.getSize=function(){return this.size},r.prototype.setSize=function(e){this.size=e},r.prototype.getLayers=function(){return this.layers},r.prototype.setLayers=function(e){this.layers=e},r.prototype.getCodeWords=function(){return this.codeWords},r.prototype.setCodeWords=function(e){this.codeWords=e},r.prototype.getMatrix=function(){return this.matrix},r.prototype.setMatrix=function(e){this.matrix=e},r}(),so=function(){function r(){}return r.singletonList=function(e){return[e]},r.min=function(e,t){return e.sort(t)[0]},r}(),zf=function(){function r(e){this.previous=e}return r.prototype.getPrevious=function(){return this.previous},r}(),kf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),yi=function(r){kf(e,r);function e(t,n,i){var a=r.call(this,t)||this;return a.value=n,a.bitCount=i,a}return e.prototype.appendTo=function(t,n){t.appendBits(this.value,this.bitCount)},e.prototype.add=function(t,n){return new e(this,t,n)},e.prototype.addBinaryShift=function(t,n){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new e(this,t,n)},e.prototype.toString=function(){var t=this.value&(1<<this.bitCount)-1;return t|=1<<this.bitCount,"<"+$.toBinaryString(t|1<<this.bitCount).substring(1)+">"},e}(zf),Rf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Uf=function(r){Rf(e,r);function e(t,n,i){var a=r.call(this,t,0,0)||this;return a.binaryShiftStart=n,a.binaryShiftByteCount=i,a}return e.prototype.appendTo=function(t,n){for(var i=0;i<this.binaryShiftByteCount;i++)(i===0||i===31&&this.binaryShiftByteCount<=62)&&(t.appendBits(31,5),this.binaryShiftByteCount>62?t.appendBits(this.binaryShiftByteCount-31,16):i===0?t.appendBits(Math.min(this.binaryShiftByteCount,31),5):t.appendBits(this.binaryShiftByteCount-31,5)),t.appendBits(n[this.binaryShiftStart+i],8)},e.prototype.addBinaryShift=function(t,n){return new e(this,t,n)},e.prototype.toString=function(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"},e}(yi);function Hf(r,e,t){return new Uf(r,e,t)}function Cr(r,e,t){return new yi(r,e,t)}var Gf=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],ct=0,an=1,je=2,lo=3,rt=4,Xf=new yi(null,0,0),Ci=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])],qf=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function $f(r){var e,t;try{for(var n=qf(r),i=n.next();!i.done;i=n.next()){var a=i.value;he.fill(a,-1)}}catch(o){e={error:o}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r[ct][rt]=0,r[an][rt]=0,r[an][ct]=28,r[lo][rt]=0,r[je][rt]=0,r[je][ct]=15,r}var uo=$f(he.createInt32Array(6,6)),Wf=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},jf=function(){function r(e,t,n,i){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=i}return r.prototype.getMode=function(){return this.mode},r.prototype.getToken=function(){return this.token},r.prototype.getBinaryShiftByteCount=function(){return this.binaryShiftByteCount},r.prototype.getBitCount=function(){return this.bitCount},r.prototype.latchAndAppend=function(e,t){var n=this.bitCount,i=this.token;if(e!==this.mode){var a=Ci[this.mode][e];i=Cr(i,a&65535,a>>16),n+=a>>16}var o=e===je?4:5;return i=Cr(i,t,o),new r(i,e,0,n+o)},r.prototype.shiftAndAppend=function(e,t){var n=this.token,i=this.mode===je?4:5;return n=Cr(n,uo[this.mode][e],i),n=Cr(n,t,5),new r(n,this.mode,0,this.bitCount+i+5)},r.prototype.addBinaryShiftChar=function(e){var t=this.token,n=this.mode,i=this.bitCount;if(this.mode===rt||this.mode===je){var a=Ci[n][ct];t=Cr(t,a&65535,a>>16),i+=a>>16,n=ct}var o=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,s=new r(t,n,this.binaryShiftByteCount+1,i+o);return s.binaryShiftByteCount===2078&&(s=s.endBinaryShift(e+1)),s},r.prototype.endBinaryShift=function(e){if(this.binaryShiftByteCount===0)return this;var t=this.token;return t=Hf(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new r(t,this.mode,0,this.bitCount)},r.prototype.isBetterThanOrEqualTo=function(e){var t=this.bitCount+(Ci[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=r.calculateBinaryShiftCost(e)-r.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount},r.prototype.toBitArray=function(e){for(var t,n,i=[],a=this.endBinaryShift(e.length).token;a!==null;a=a.getPrevious())i.unshift(a);var o=new we;try{for(var s=Wf(i),l=s.next();!l.done;l=s.next()){var u=l.value;u.appendTo(o,e)}}catch(c){t={error:c}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},r.prototype.toString=function(){return Y.format("%s bits=%d bytes=%d",Gf[this.mode],this.bitCount,this.binaryShiftByteCount)},r.calculateBinaryShiftCost=function(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0},r.INITIAL_STATE=new r(Xf,ct,0,0),r}();function Yf(r){var e=Y.getCharCode(" "),t=Y.getCharCode("."),n=Y.getCharCode(",");r[ct][e]=1;for(var i=Y.getCharCode("Z"),a=Y.getCharCode("A"),o=a;o<=i;o++)r[ct][o]=o-a+2;r[an][e]=1;for(var s=Y.getCharCode("z"),l=Y.getCharCode("a"),o=l;o<=s;o++)r[an][o]=o-l+2;r[je][e]=1;for(var u=Y.getCharCode("9"),c=Y.getCharCode("0"),o=c;o<=u;o++)r[je][o]=o-c+2;r[je][n]=12,r[je][t]=13;for(var f=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
239
|
-
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""],p=0;p<
|
|
240
|
-
`),n=so.singletonList(jf.INITIAL_STATE),i=0;i<this.text.length;i++){var a=void 0,o=i+1<this.text.length?this.text[i+1]:0;switch(this.text[i]){case Y.getCharCode("\r"):a=o===t?2:0;break;case Y.getCharCode("."):a=o===e?3:0;break;case Y.getCharCode(","):a=o===e?4:0;break;case Y.getCharCode(":"):a=o===e?5:0;break;default:a=0}a>0?(n=r.updateStateListForPair(n,i,a),i++):n=this.updateStateListForChar(n,i)}var s=so.min(n,function(l,u){return l.getBitCount()-u.getBitCount()});return s.toBitArray(this.text)},r.prototype.updateStateListForChar=function(e,t){var n,i,a=[];try{for(var o=on(e),s=o.next();!s.done;s=o.next()){var l=s.value;this.updateStateForChar(l,t,a)}}catch(u){n={error:u}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r.simplifyStates(a)},r.prototype.updateStateForChar=function(e,t,n){for(var i=this.text[t]&255,a=wi[e.getMode()][i]>0,o=null,s=0;s<=rt;s++){var l=wi[s][i];if(l>0){if(o==null&&(o=e.endBinaryShift(t)),!a||s===e.getMode()||s===je){var u=o.latchAndAppend(s,l);n.push(u)}if(!a&&uo[e.getMode()][s]>=0){var c=o.shiftAndAppend(s,l);n.push(c)}}}if(e.getBinaryShiftByteCount()>0||wi[e.getMode()][i]===0){var f=e.addBinaryShiftChar(t);n.push(f)}},r.updateStateListForPair=function(e,t,n){var i,a,o=[];try{for(var s=on(e),l=s.next();!l.done;l=s.next()){var u=l.value;this.updateStateForPair(u,t,n,o)}}catch(c){i={error:c}}finally{try{l&&!l.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}return this.simplifyStates(o)},r.updateStateForPair=function(e,t,n,i){var a=e.endBinaryShift(t);if(i.push(a.latchAndAppend(rt,n)),e.getMode()!==rt&&i.push(a.shiftAndAppend(rt,n)),n===3||n===4){var o=a.latchAndAppend(je,16-n).latchAndAppend(je,1);i.push(o)}if(e.getBinaryShiftByteCount()>0){var s=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);i.push(s)}},r.simplifyStates=function(e){var t,n,i,a,o=[];try{for(var s=on(e),l=s.next();!l.done;l=s.next()){var u=l.value,c=!0,f=function(C){if(C.isBetterThanOrEqualTo(u))return c=!1,"break";u.isBetterThanOrEqualTo(C)&&(o=o.filter(function(m){return m!==C}))};try{for(var p=(i=void 0,on(o)),h=p.next();!h.done;h=p.next()){var g=h.value,x=f(g);if(x==="break")break}}catch(C){i={error:C}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}c&&o.push(u)}}catch(C){t={error:C}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},r}(),Kf=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};(function(){function r(){}return r.encodeBytes=function(e){return r.encode(e,r.DEFAULT_EC_PERCENT,r.DEFAULT_AZTEC_LAYERS)},r.encode=function(e,t,n){var i=new Zf(e).encode(),a=$.truncDivision(i.getSize()*t,100)+11,o=i.getSize()+a,s,l,u,c,f;if(n!==r.DEFAULT_AZTEC_LAYERS){if(s=n<0,l=Math.abs(n),l>(s?r.MAX_NB_BITS_COMPACT:r.MAX_NB_BITS))throw new k(Y.format("Illegal value %s for layers",n));u=r.totalBitsInLayer(l,s),c=r.WORD_SIZE[l];var p=u-u%c;if(f=r.stuffBits(i,c),f.getSize()+a>p)throw new k("Data to large for user specified layer");if(s&&f.getSize()>c*64)throw new k("Data to large for user specified layer")}else{c=0,f=null;for(var h=0;;h++){if(h>r.MAX_NB_BITS)throw new k("Data too large for an Aztec code");if(s=h<=3,l=s?h+1:h,u=r.totalBitsInLayer(l,s),!(o>u)){(f==null||c!==r.WORD_SIZE[l])&&(c=r.WORD_SIZE[l],f=r.stuffBits(i,c));var p=u-u%c;if(!(s&&f.getSize()>c*64)&&f.getSize()+a<=p)break}}}var g=r.generateCheckWords(f,u,c),x=f.getSize()/c,C=r.generateModeMessage(s,l,x),m=(s?11:14)+l*4,w=new Int32Array(m),_;if(s){_=m;for(var h=0;h<w.length;h++)w[h]=h}else{_=m+1+2*$.truncDivision($.truncDivision(m,2)-1,15);for(var E=$.truncDivision(m,2),O=$.truncDivision(_,2),h=0;h<E;h++){var T=h+$.truncDivision(h,15);w[E-h-1]=O-T-1,w[E+h]=O+T+1}}for(var D=new tt(_),h=0,M=0;h<l;h++){for(var P=(l-h)*4+(s?9:12),V=0;V<P;V++)for(var W=V*2,U=0;U<2;U++)g.get(M+W+U)&&D.set(w[h*2+U],w[h*2+V]),g.get(M+P*2+W+U)&&D.set(w[h*2+V],w[m-1-h*2-U]),g.get(M+P*4+W+U)&&D.set(w[m-1-h*2-U],w[m-1-h*2-V]),g.get(M+P*6+W+U)&&D.set(w[m-1-h*2-V],w[h*2+U]);M+=P*8}if(r.drawModeMessage(D,s,_,C),s)r.drawBullsEye(D,$.truncDivision(_,2),5);else{r.drawBullsEye(D,$.truncDivision(_,2),7);for(var h=0,V=0;h<$.truncDivision(m,2)-1;h+=15,V+=16)for(var U=$.truncDivision(_,2)&1;U<_;U+=2)D.set($.truncDivision(_,2)-V,U),D.set($.truncDivision(_,2)+V,U),D.set(U,$.truncDivision(_,2)-V),D.set(U,$.truncDivision(_,2)+V)}var J=new Lf;return J.setCompact(s),J.setSize(_),J.setLayers(l),J.setCodeWords(x),J.setMatrix(D),J},r.drawBullsEye=function(e,t,n){for(var i=0;i<n;i+=2)for(var a=t-i;a<=t+i;a++)e.set(a,t-i),e.set(a,t+i),e.set(t-i,a),e.set(t+i,a);e.set(t-n,t-n),e.set(t-n+1,t-n),e.set(t-n,t-n+1),e.set(t+n,t-n),e.set(t+n,t-n+1),e.set(t+n,t+n-1)},r.generateModeMessage=function(e,t,n){var i=new we;return e?(i.appendBits(t-1,2),i.appendBits(n-1,6),i=r.generateCheckWords(i,28,4)):(i.appendBits(t-1,5),i.appendBits(n-1,11),i=r.generateCheckWords(i,40,4)),i},r.drawModeMessage=function(e,t,n,i){var a=$.truncDivision(n,2);if(t)for(var o=0;o<7;o++){var s=a-3+o;i.get(o)&&e.set(s,a-5),i.get(o+7)&&e.set(a+5,s),i.get(20-o)&&e.set(s,a+5),i.get(27-o)&&e.set(a-5,s)}else for(var o=0;o<10;o++){var s=a-5+o+$.truncDivision(o,5);i.get(o)&&e.set(s,a-7),i.get(o+10)&&e.set(a+7,s),i.get(29-o)&&e.set(s,a+7),i.get(39-o)&&e.set(a-7,s)}},r.generateCheckWords=function(e,t,n){var i,a,o=e.getSize()/n,s=new Ya(r.getGF(n)),l=$.truncDivision(t,n),u=r.bitsToWords(e,n,l);s.encode(u,l-o);var c=t%n,f=new we;f.appendBits(0,c);try{for(var p=Kf(Array.from(u)),h=p.next();!h.done;h=p.next()){var g=h.value;f.appendBits(g,n)}}catch(x){i={error:x}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}return f},r.bitsToWords=function(e,t,n){var i=new Int32Array(n),a,o;for(a=0,o=e.getSize()/t;a<o;a++){for(var s=0,l=0;l<t;l++)s|=e.get(a*t+l)?1<<t-l-1:0;i[a]=s}return i},r.getGF=function(e){switch(e){case 4:return He.AZTEC_PARAM;case 6:return He.AZTEC_DATA_6;case 8:return He.AZTEC_DATA_8;case 10:return He.AZTEC_DATA_10;case 12:return He.AZTEC_DATA_12;default:throw new k("Unsupported word size "+e)}},r.stuffBits=function(e,t){for(var n=new we,i=e.getSize(),a=(1<<t)-2,o=0;o<i;o+=t){for(var s=0,l=0;l<t;l++)(o+l>=i||e.get(o+l))&&(s|=1<<t-1-l);(s&a)===a?(n.appendBits(s&a,t),o--):(s&a)===0?(n.appendBits(s|1,t),o--):n.appendBits(s,t)}return n},r.totalBitsInLayer=function(e,t){return((t?88:112)+16*e)*e},r.DEFAULT_EC_PERCENT=33,r.DEFAULT_AZTEC_LAYERS=0,r.MAX_NB_BITS=32,r.MAX_NB_BITS_COMPACT=4,r.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]),r})();const Qf=new Map([[Yi.DecodeHintType.POSSIBLE_FORMATS,[B.AZTEC,B.CODABAR,B.CODE_39,B.CODE_93,B.CODE_128,B.DATA_MATRIX,B.EAN_8,B.EAN_13,B.ITF,B.MAXICODE,B.PDF_417,B.QR_CODE,B.RSS_14,B.RSS_EXPANDED,B.UPC_A,B.UPC_E,B.UPC_EAN_EXTENSION]]]),sn=A.memo(r=>{const{children:e,open:t,onOpenChange:n,defaultOpen:i,modal:a,...o}=r;return d.jsxs(v.Overlay.Root,{open:t,onOpenChange:n,defaultOpen:i,modal:a,children:[!!e&&d.jsx(v.Overlay.Trigger,{asChild:!0,children:e}),d.jsxs(v.Overlay.Content,{children:[d.jsx(v.Overlay.Title,{className:"sr-only",children:"Scanner"}),d.jsx(v.Overlay.Description,{className:"sr-only",children:"Scan a barcode or a qr code."}),d.jsx(co,{...o})]})]})});sn.displayName="Scanner";const co=A.memo(r=>{const{paused:e,timeBetweenDecodingAttempts:t,onDecodeResult:n,onDecodeError:i,onError:a}=r,{ref:o}=Yi.useZxing({paused:e,timeBetweenDecodingAttempts:t,onDecodeResult:n,onDecodeError:i,onError:a,hints:Qf});return d.jsxs("div",{className:"flex size-full flex-col justify-center overflow-hidden bg-(--color-background)",children:[d.jsx("div",{className:"flex w-full justify-end p-4",children:d.jsx(v.Overlay.Close,{asChild:!0,children:d.jsx(v.IconButton,{"aria-label":"close",variant:"soft",accentColor:"base",children:d.jsx(v.LuIcon,{icon:nt})})})}),d.jsx("div",{className:"grow w-full max-h-full overflow-hidden p-4",children:d.jsx("video",{className:"size-full",ref:o})})]})});co.displayName="ScannerInternal";const fo=A.memo(r=>{const{children:e}=r,[t,n]=A.useState(null),i=A.useCallback(()=>{n(null)},[]),a=A.useCallback(s=>{n(s(i))},[i]),o=A.useCallback(()=>{t&&(t.onClose&&t.onClose(),i())},[i,t]);return d.jsxs(pa.Provider,{value:a,children:[e,t&&d.jsx(sn,{open:!0,onOpenChange:o,...t})]})});fo.displayName="FileViewerProvider";const mi=A.memo(r=>{const[{inputId:e,labelId:t,label:n,helpText:i,size:a,severity:o,showInputOnly:s,field:l,fieldProps:u,helpers:c,touched:f},{disabled:p}]=be(r),{name:h,onBlur:g,onChange:x,value:C}=u,[m,w]=A.useState(!1),_=s?null:i,E=s?"":n,[O,T]=A.useState("");A.useEffect(()=>{T(C)},[C]);const D=A.useCallback(U=>{const J=U.target.value;T(J),(f||!l.onlyValidateAfterTouched)&&c.setError(l.getError(J))},[l,c,f]),M=A.useCallback(()=>{x(O),g(O)},[O,g,x]),P=A.useCallback(U=>{x(U.getText()),w(!1)},[x]),V=A.useCallback(()=>{w(!0)},[]),W=A.useCallback(()=>{w(!1),g(C)},[g,C]);return d.jsx(Oe,{helpText:_,severity:o,children:d.jsxs(Se,{size:a,severity:o,inputId:e,labelId:t,label:E,image:s?void 0:l.image,className:"flex-col items-start justify-start gap-2",children:[d.jsx(v.TextArea,{className:"w-full field-sizing-content",accentColor:"base",variant:"surface",size:"sm",id:e,name:h,value:O,placeholder:"Enter a qr or barcode",onChange:D,onBlur:M,disabled:p}),d.jsxs(v.Button,{onClick:V,className:"w-max",type:"button",variant:"soft",size:"sm",accentColor:"base",disabled:p,children:[d.jsx(v.LuIcon,{icon:rl}),"Scan"]}),d.jsx(sn,{open:m,onDecodeResult:P,onOpenChange:W})]})})});mi.displayName="QrInput";const nr=class nr extends Ve{constructor(t){super(t);b(this,"type","qr");b(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new nr({...this.getOptions(),identifier:t})}setOptions(t){super.setOptions(t)}static deserialize(t){return new nr(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return d.jsx(mi,{...t,field:this})}isSerializedValueValid(t){return typeof t=="string"}isValueValid(t){return typeof t=="string"}blankValue(){return""}areValuesEqual(t,n){return t===n}};b(nr,"fieldTypeName","Scan"),b(nr,"fieldTypeDescription","Used for scanning/reading QR and barcodes.");let wr=nr;const ln=500,_i=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:f},{disabled:p}]=be(r),{name:h,onBlur:g,onChange:x,value:C}=u,m=a?null:s,w=a?"":l,[_,E]=A.useState("");A.useEffect(()=>{E(C)},[C]);const O=A.useCallback(D=>{const M=D.target.value;E(M),(c||!o.onlyValidateAfterTouched)&&f.setError(o.getError(M))},[o,f,c]),T=A.useCallback(()=>{x(_),g(_)},[_,g,x]);return d.jsx(Oe,{helpText:m,severity:i,children:d.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:w,image:a?void 0:o.image,children:d.jsx(v.Input.Root,{accentColor:"base",variant:"surface",size:"sm",children:d.jsx(v.Input.Field,{id:e,className:"truncate",name:h,value:_,type:"text",placeholder:o.placeholder,onChange:O,onBlur:T,disabled:p})})})})});_i.displayName="StringInput";const ir=class ir extends Pn{constructor(t){const{...n}=t,i=t.maxLength?Math.min(ln,t.maxLength):ln,a=t.minLength?Math.min(t.minLength,i):void 0;super({...n,maxLength:i,minLength:a});b(this,"type","string")}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new ir({...this.getOptions(),identifier:t})}setOptions(t){super.setOptions(t)}static deserialize(t){const{maximum_length:n,minimum_length:i,...a}=t;return new ir({...a,maxLength:n,minLength:i,placeholder:"Enter a short description"})}render(t){return d.jsx(_i,{field:this,...t})}};b(ir,"fieldTypeName","Short Text"),b(ir,"fieldTypeDescription",`Short text fields can hold up to ${ln} characters on a single line.`);let Gt=ir;const Ai=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:f},{disabled:p}]=be(r),{name:h,onBlur:g,onChange:x,value:C}=u,m=a?null:s,w=a?"":l,[_,E]=A.useState("");A.useEffect(()=>{E(C)},[C]);const O=A.useCallback(D=>{const M=D.target.value;E(M),(c||!o.onlyValidateAfterTouched)&&f.setError(o.getError(M))},[o,f,c]),T=A.useCallback(()=>{x(_),g(_)},[_,g,x]);return d.jsx(Oe,{helpText:m,severity:i,children:d.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:w,image:a?void 0:o.image,children:d.jsx(v.TextArea,{id:e,value:_,name:h,onChange:O,onBlur:T,className:"field-sizing-content min-h-12",placeholder:o.placeholder,resize:"vertical",accentColor:"base",variant:"surface",size:"sm",disabled:p})})})});Ai.displayName="TextInput";const ar=class ar extends Pn{constructor(t){const n=t.maxLength?Math.min(Tt,t.maxLength):Tt,i=t.minLength?Math.min(t.minLength,n):void 0;super({...t,maxLength:n,minLength:i});b(this,"type","text")}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new ar({...this.getOptions(),identifier:t})}setOptions(t){super.setOptions(t)}static deserialize(t){const{maximum_length:n,minimum_length:i,...a}=t;return new ar({...a,maxLength:n,minLength:i,placeholder:"Enter a description"})}render(t){return d.jsx(Ai,{field:this,...t})}};b(ar,"fieldTypeName","Paragraph"),b(ar,"fieldTypeDescription",`Paragraph fields can hold up to ${Tt} characters and can have multiple lines.`);let Xt=ar;const Ei=A.memo(r=>{var M;const[{inputId:e,labelId:t,label:n,size:i,severity:a,helpText:o,showInputOnly:s,field:l,fieldProps:u},{disabled:c}]=be(r),{value:f,name:p,onChange:h,onBlur:g}=u,x=A.useRef(null),C=A.useMemo(()=>s?null:o||(l.maxFileSize?`Maximum file size: ${l.maxFileSize}MB`:null),[l.maxFileSize,o,s]),m=A.useCallback(()=>{var P;(P=x.current)==null||P.click()},[]),w=A.useCallback(()=>{if(!x.current)return;const P=x.current.files;if(!P){g([]);return}const V=Array.from(P).map(U=>at.from(G.v4(),U)),W=[...f,...V];h(W),g(W)},[g,h,f]),_=A.useCallback(P=>{const V=[...f];V.splice(P,1),h(V)},[f,h]);A.useEffect(()=>{if(!x.current)return;const P=new AbortController;return x.current.addEventListener("cancel",()=>{g([...f])},{signal:P.signal}),()=>{P.abort()}},[g,f]);const E=s?"":n,D=l.maxFiles>1?"Select files":"Select a file";return d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsx(Oe,{helpText:C,severity:a,children:d.jsxs(Se,{size:i,severity:a,inputId:e,labelId:t,label:E,image:s?void 0:l.image,children:[d.jsxs(v.Button,{className:"w-max",size:"sm",variant:"soft",accentColor:"base",onClick:m,type:"button",disabled:c,children:[d.jsx(v.LuIcon,{icon:Sn}),D]}),d.jsx("input",{id:e,name:p,type:"file",ref:x,accept:(M=l.extensions)==null?void 0:M.join(","),multiple:l.maxFiles>1,className:"hidden",onChange:w,value:""})]})}),Array.isArray(f)&&f.length>0&&d.jsx("div",{className:"flex h-max flex-col gap-2",children:f.map((P,V)=>d.jsx(kn,{file:P,onRemove:()=>{_(V)},disabled:c},V))})]})});Ei.displayName="UploadInput";const or=class or extends Ve{constructor(t){const{extensions:n,maximum_files:i,maximum_size:a,...o}=t;super(o);b(this,"type","upload");b(this,"extensions");b(this,"maxFileSize");b(this,"maxFiles");b(this,"onlyValidateAfterTouched",!1);this.maxFileSize=typeof a=="number"?a:void 0,this.maxFiles=Math.max(typeof i=="number"?i:1,1),this.extensions=n}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new qe({label:"How many files can be uploaded?",description:"By default, only one file can be uploaded.",required:!1,minimum:1,maximum:10,identifier:`${n}maximum_files`,integers:!0}),showDirectly:!1},{field:new qe({label:"What is the maximum size of each file?",description:`Maximum file size in megabytes (between 1MB–${$t}MB).`,required:!1,identifier:`${n}maximum_size`,minimum:1,maximum:$t,integers:!0}),showDirectly:!1},{field:new it({label:"Accepted file types",description:"Types of allowed files to upload. If left blank, all files will be accepted.",required:!1,identifier:`${n}extensions`,options:[{value:"image/*",label:"Images"},{value:"audio/*",label:"Audio files"},{value:"video/*",label:"Videos"},{value:"text/*",label:"Text files"},{value:"application/*",label:"Application files (includes PDFs and Word documents)"}]}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.maxFileSize??$t,i=n*1e3*1e3,a=this.maxFiles||1;return t.push(o=>{if(o&&o.some(s=>s instanceof at&&s.size>i))return`Files must be at most ${n}MB.`}),t.push(o=>{if(o&&o.length>a)return`You can only upload ${a} files.`}),t}serialize(){return{...super.serialize(),extensions:this.extensions,maximum_size:this.maxFileSize,maximum_files:this.maxFiles}}getOptions(){return{...super.getOptions(),extensions:this.extensions,maximum_size:this.maxFileSize,maximum_files:this.maxFiles}}duplicate(t){return new or({...this.getOptions(),identifier:t})}setOptions(t){const{extensions:n,maximum_files:i,maximum_size:a,...o}=t;this.maxFileSize=typeof a=="number"?a:this.maxFileSize,this.maxFiles=typeof i=="number"?i:this.maxFiles,this.extensions=n,super.setOptions(o)}static deserialize(t){return new or(t)}serializeValue(t){return[]}deserializeValue(t){return[]}render(t){return d.jsx(Ei,{field:this,...t})}isSerializedValueValid(t){return Array.isArray(t)&&t.length===0}isValueValid(t){return Array.isArray(t)?t.every(n=>n instanceof Ft||n instanceof at):!1}areValuesEqual(t,n){return $r(t,n)}blankValue(){return[]}};b(or,"fieldTypeName","Upload"),b(or,"fieldTypeDescription","Allows a file to be uploaded.");let qt=or;const un={date:fr,number:qe,boolean:Nt,select:pt,string:Gt,text:Xt,upload:qt,qr:wr,"multi-string":bt,"multi-select":it,radio:Bt,"checkbox-list":Dt,"pass-fail":Vt,otp:Mt,rating:Lt},de={boolean:ol,date:Rs,"multi-string":tl,number:Zs,qr:il,"multi-select":Js,select:el,string:ll,text:Ls,upload:Sn,section:Qs,radio:Hs,"checkbox-list":$s,"pass-fail":qs,otp:nl,rating:ia},$t=50,ho=$t*1e3,po=ho*1e3;class j{constructor(e){b(this,"id");b(this,"label");b(this,"getApplyFn");b(this,"serialize");b(this,"deserialize");const{id:t,getApplyFn:n,label:i,serialize:a,deserialize:o}=e;this.id=t,this.getApplyFn=n,this.label=i,this.serialize=a,this.deserialize=o}static create(e){return new j(e)}}const vo=j.create({id:"nullable-boolean-equals",label:"is",getApplyFn:r=>e=>e===r,serialize:r=>r,deserialize:r=>r}),go=j.create({id:"nullable-boolean-not-equals",label:"is not",getApplyFn:r=>e=>e!==r,serialize:r=>r,deserialize:r=>r}),xo=j.create({id:"date-equals",getApplyFn:r=>e=>e.getTime()===r.getTime(),label:"is",serialize:r=>r.toISOString(),deserialize:r=>new Date(r)}),yo=j.create({id:"date-not-equals",getApplyFn:r=>e=>e.getTime()!==r.getTime(),label:"is not",serialize:r=>r.toISOString(),deserialize:r=>new Date(r)}),Co=j.create({id:"date-before",getApplyFn:r=>e=>e.getTime()<r.getTime(),label:"before",serialize:r=>r.toISOString(),deserialize:r=>new Date(r)}),wo=j.create({id:"date-after",label:"after",getApplyFn:r=>e=>e.getTime()>r.getTime(),serialize:r=>r.toISOString(),deserialize:r=>new Date(r)}),mo=j.create({id:"date-range-in",label:"in between",getApplyFn:r=>e=>!(r!=null&&r.from&&r.from.getTime()>e.getTime()||r!=null&&r.to&&r.to.getTime()<e.getTime()),serialize:r=>{var e,t;return{from:((e=r.from)==null?void 0:e.toISOString())??null,to:((t=r.to)==null?void 0:t.toISOString())??null}},deserialize:r=>({from:r.from?new Date(r.from):void 0,to:r.to?new Date(r.to):void 0})}),_o=j.create({id:"date-range-not-in",label:"not in between",getApplyFn:r=>e=>!!(r!=null&&r.from&&r.from.getTime()>e.getTime()||r!=null&&r.to&&r.to.getTime()<e.getTime()),serialize:r=>{var e,t;return{from:((e=r.from)==null?void 0:e.toISOString())??null,to:((t=r.to)==null?void 0:t.toISOString())??null}},deserialize:r=>({from:r.from?new Date(r.from):void 0,to:r.to?new Date(r.to):void 0})}),Ao=j.create({id:"has-files",label:"is",getApplyFn:r=>e=>e.length>0,serialize:r=>r,deserialize:r=>r}),Eo=j.create({id:"does-not-have-files",label:"is not",getApplyFn:r=>e=>e.length===0,serialize:r=>r,deserialize:r=>r}),Ii=j.create({id:"number-equals",getApplyFn:r=>e=>e===r,label:"is",serialize:r=>r,deserialize:r=>r}),Si=j.create({id:"number-not-equals",getApplyFn:r=>e=>e!==r,label:"is not",serialize:r=>r,deserialize:r=>r}),Oi=j.create({id:"number-less-than",getApplyFn:r=>e=>e<r,label:"is less than",serialize:r=>r,deserialize:r=>r}),bi=j.create({id:"number-less-than-or-equals",getApplyFn:r=>e=>e<=r,label:"is less than or equal to",serialize:r=>r,deserialize:r=>r}),Ni=j.create({id:"number-greater-than",getApplyFn:r=>e=>e>r,label:"is greater than",serialize:r=>r,deserialize:r=>r}),Ti=j.create({id:"number-greater-than-or-equals",getApplyFn:r=>e=>e>=r,label:"is greater than or equal to",serialize:r=>r,deserialize:r=>r}),Di=j.create({id:"number-range-in",getApplyFn:r=>e=>!(r.to&&e>r.to||r.from&&e<r.from),label:"is between",serialize:r=>r,deserialize:r=>r}),Mi=j.create({id:"number-range-not-in",getApplyFn:r=>e=>!!(r.to&&e>r.to||r.from&&e<r.from),label:"is not between",serialize:r=>r,deserialize:r=>r}),Io=j.create({id:"pass-fail-equals",getApplyFn:r=>e=>e===r,label:"is",serialize:r=>r,deserialize:r=>r}),So=j.create({id:"pass-fail-not-equals",getApplyFn:r=>e=>e!==r,label:"is not",serialize:r=>r,deserialize:r=>r}),Oo=j.create({id:"pass-fail-array-includes",getApplyFn:r=>{const e=new Set(r);return t=>e.has(t)},label:"is any of",serialize:r=>r,deserialize:r=>r}),bo=j.create({id:"pass-fail-array-excludes",getApplyFn:r=>{const e=new Set(r);return t=>!e.has(t)},label:"is none of",serialize:r=>r,deserialize:r=>r}),mt=j.create({id:"nullable-string-equals",getApplyFn:r=>e=>e===r,label:"is",serialize:r=>r,deserialize:r=>r}),_t=j.create({id:"nullable-string-not-equals",getApplyFn:r=>e=>e!==r,label:"is not",serialize:r=>r,deserialize:r=>r}),mr=j.create({id:"string-includes",getApplyFn:r=>e=>e.includes(r),label:"includes",serialize:r=>r,deserialize:r=>r}),_r=j.create({id:"string-excludes",getApplyFn:r=>e=>!e.includes(r),label:"does not include",serialize:r=>r,deserialize:r=>r}),Pi=j.create({id:"string-array-includes",getApplyFn:r=>{const e=new Set(r);return t=>e.has(t)},label:"is any of",serialize:r=>r,deserialize:r=>r}),Fi=j.create({id:"string-array-excludes",getApplyFn:r=>{const e=new Set(r);return t=>!e.has(t)},label:"is none of",serialize:r=>r,deserialize:r=>r}),cn=j.create({id:"string-array-every",getApplyFn:r=>{const e=new Set(r);return t=>{const n=new Set(t);return e.isSubsetOf(n)}},label:"has all of",serialize:r=>r,deserialize:r=>r}),fn=j.create({id:"string-array-some",getApplyFn:r=>{const e=new Set(r);return t=>{const n=new Set(t);return!e.isDisjointFrom(n)}},label:"has any of",serialize:r=>r,deserialize:r=>r}),dn=j.create({id:"string-array-none",getApplyFn:r=>{const e=new Set(r);return t=>{const n=new Set(t);return e.isDisjointFrom(n)}},label:"has none of",serialize:r=>r,deserialize:r=>r}),hn=j.create({id:"string-array-equals",getApplyFn:r=>{const e=new Set(r);return t=>{const n=new Set(t);return e.size===n.size&&n.isSubsetOf(e)}},label:"is",serialize:r=>r,deserialize:r=>r}),pn=j.create({id:"string-array-not-equals",getApplyFn:r=>{const e=new Set(r);return t=>{const n=new Set(t);return e.size!==n.size||!n.isSubsetOf(e)}},label:"is not",serialize:r=>r,deserialize:r=>r}),L=r=>r;class De extends lr{constructor(t){const{id:n,field:i,conditionValue:a,conditionModifier:o}=t;super();b(this,"id");b(this,"conditionValue");b(this,"conditionModifier");b(this,"field");b(this,"getConditionValue",()=>this.conditionValue);b(this,"setConditionValue",t=>{const n=this.modifiers[this.conditionModifier];t!==void 0&&!n.isConditionValueValid(t)||(this.conditionValue=t,this.notify(this))});b(this,"getConditionModifier",()=>this.conditionModifier);b(this,"setConditionModifier",t=>{const n=this.modifiers[t],i=this.getConditionValue();i&&!n.isConditionValueValid(i)&&(this.conditionValue=void 0),this.conditionModifier=t,this.notify(this)});b(this,"getConditionModifiers",()=>Object.entries(this.modifiers));b(this,"accessorFn",t=>t[this.field.identifier]);b(this,"getApplyFn",()=>{const t=this.modifiers[this.conditionModifier],n=this.getConditionValue(),i=n!==void 0&&t.isConditionValueValid(n),a=i?t.modifier.getApplyFn(n):null;return o=>{if(!i)return!0;const s=this.transformValue(o);return t.isValueValid(s)?a(s):!1}});this.id=n,this.field=i,this.conditionValue=a,this.conditionModifier=o}serialize(){return{id:this.id,type:this.field.type,fieldId:this.field.identifier,conditionValue:this.conditionValue!==void 0?this.modifiers[this.conditionModifier].modifier.serialize(this.conditionValue):void 0,conditionModifier:this.conditionModifier}}transformValue(t){return t}}const vn="form-builder",Me="Unlabelled",No="Unlabelled",To=A.memo,At=To(function(r){const{ref:e,children:t,...n}=r,i=A.useCallback(a=>typeof t=="function"?d.jsxs(d.Fragment,{children:[t(a),d.jsx(v.Menu.SelectedIndicator,{className:"ml-[auto]",children:d.jsx(v.LuIcon,{icon:Xe})})]}):d.jsxs(d.Fragment,{children:[t,d.jsx(v.Menu.SelectedIndicator,{className:"ml-[auto]",children:d.jsx(v.LuIcon,{icon:Xe})})]}),[t]);return d.jsx(v.Menu.SelectItem,{ref:e,...n,children:i})}),Do=To(function(r){const{ref:e,children:t,...n}=r,i=A.useCallback(a=>typeof t=="function"?d.jsxs(d.Fragment,{children:[t(a),d.jsx(v.Menu.SelectedIndicator,{className:"ml-auto",children:d.jsx(v.LuIcon,{icon:Xe})})]}):d.jsxs(d.Fragment,{children:[t,d.jsx(v.Menu.SelectedIndicator,{className:"ml-auto",children:d.jsx(v.LuIcon,{icon:Xe})})]}),[t]);return d.jsx(v.Menu.MultiSelectItem,{ref:e,...n,children:i})}),Vi=A.memo(r=>{const{ref:e,children:t,...n}=r,i=A.useCallback(a=>typeof t=="function"?d.jsxs(d.Fragment,{children:[t(a),d.jsx(v.Menu.CheckboxItemIndicator,{className:"ml-[auto]",children:o=>o?d.jsx(v.LuIcon,{icon:Gr}):d.jsx(v.LuIcon,{icon:Xe})})]}):d.jsxs(d.Fragment,{children:[t,d.jsx(v.Menu.CheckboxItemIndicator,{className:"ml-[auto]",children:o=>o?d.jsx(v.LuIcon,{icon:Gr}):d.jsx(v.LuIcon,{icon:Xe})})]}),[t]);return d.jsx(v.Menu.SelectAllItem,{ref:e,...n,children:i})});Vi.displayName="SelectAllItemTemplate";const ke=r=>{const{children:e,condition:t,size:n="sm",variant:i,accentColor:a,radius:o}=r,s=A.useCallback(l=>{t.setConditionModifier(l)},[t]);return d.jsxs(v.Menu.Root,{align:"start",children:[d.jsx(v.Menu.ClickTrigger,{children:e}),d.jsx(v.Menu.Content,{size:n,variant:i,radius:o,accentColor:a,children:d.jsx(v.Menu.SelectGroup,{required:!0,value:t.getConditionModifier(),onValueChange:s,children:t.getConditionModifiers().map(([l,u])=>d.jsx(At,{value:l,children:u.modifier.label},l))})})]})},gn=A.memo(r=>{const{children:e,open:t,onOpenChange:n,defaultOpen:i,modal:a,size:o,align:s,accentColor:l="base",...u}=r;return d.jsxs(v.Popover.Root,{open:t,onOpenChange:n,defaultOpen:i,modal:a,children:[d.jsx(v.Popover.Trigger,{asChild:!0,children:e}),d.jsx(v.Popover.Content,{size:o,align:s,children:d.jsx(v.DayPicker,{size:o,accentColor:l,...u})})]})});gn.displayName="DayPickerPopover";const Mo=A.memo(r=>{const{children:e,open:t,onOpenChange:n,defaultOpen:i,modal:a,size:o,accentColor:s="base",values:l,onValuesChange:u,placeholder:c="Enter text",...f}=r,[p,h]=A.useState(""),g=A.useCallback(w=>{h(w.target.value)},[]),x=A.useCallback(w=>{w.key==="Enter"&&(w.preventDefault(),w.stopPropagation(),u([...l,p]),h(""))},[p,u,l]),C=A.useCallback(()=>{u([...l,p]),h("")},[p,u,l]),m=A.useCallback(w=>{const _=[...l];_.splice(w,1),u(_)},[u,l]);return d.jsxs(v.Popover.Root,{open:t,onOpenChange:n,defaultOpen:i,modal:a,children:[d.jsx(v.Popover.Trigger,{asChild:!0,children:e}),d.jsx(v.Popover.Content,{size:o,onClick:v.stopPropagation,accentColor:s,...f,children:d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsx(v.Input.Root,{className:"grow",accentColor:"base",variant:"outline",size:"sm",children:d.jsx(v.Input.Field,{value:p,onChange:g,onKeyDown:x,placeholder:c,...f})}),d.jsx(v.IconButton,{size:"sm",accentColor:"base",variant:"soft",type:"button",onClick:C,children:d.jsx(v.LuIcon,{icon:Ye})})]}),l.length>0&&d.jsx("div",{className:"flex flex-col gap-1",children:l.map((w,_)=>d.jsxs(v.Badge,{className:"flex items-center justify-between gap-2",accentColor:"base",size:"sm",variant:"soft",children:[d.jsx("span",{className:"truncate",children:w}),d.jsx(v.IconButton,{size:"xs",variant:"ghost",type:"button",accentColor:"base",onClick:()=>{m(_)},children:d.jsx(v.LuIcon,{icon:nt})})]},`${w}-${_}`))})]})})]})});Mo.displayName="NumberInputPopover";const Et=A.memo(r=>{const{children:e,open:t,onOpenChange:n,defaultOpen:i,modal:a,size:o,accentColor:s="base",value:l,onValueChange:u,placeholder:c="Enter a number",...f}=r,[p,h]=A.useState(null);A.useEffect(()=>{l!==void 0&&h(l)},[l]);const g=A.useCallback(C=>{const m=C.target.valueAsNumber;h(isNaN(m)?null:m)},[]),x=A.useCallback(C=>{const m=C.target.valueAsNumber;u==null||u(isNaN(m)?null:m)},[u]);return d.jsxs(v.Popover.Root,{open:t,onOpenChange:n,defaultOpen:i,modal:a,children:[d.jsx(v.Popover.Trigger,{asChild:!0,children:e}),d.jsx(v.Popover.Content,{size:o,onClick:v.stopPropagation,...f,children:d.jsx(v.Input.Root,{size:o,accentColor:s,children:d.jsx(v.Input.Field,{placeholder:c,type:"number",value:p??"",onChange:g,onBlur:x})})})]})});Et.displayName="NumberInputPopover";const Pe=r=>{const{condition:e,onClick:t,...n}=r,i=A.useCallback(()=>{t(e)},[e,t]);return d.jsx(v.IconButton,{onClick:i,...n,children:d.jsx(v.LuIcon,{icon:nt})})};Pe.displayName="RemoveConditionButton";const Ar=A.memo(r=>{const{ref:e,selectFieldOptions:t,...n}=r,i=A.useMemo(()=>t.map(a=>typeof a=="string"?{value:a,label:a}:a),[t]);return d.jsxs(v.Menu.MultiSelectGroup,{ref:e,...n,children:[d.jsx(Vi,{children:"Select all"}),i.map(a=>d.jsx(Do,{value:a.value,children:d.jsx("span",{className:"truncate",children:a.label})},a.value))]})});Ar.displayName="SelectFieldOptionMultiSelectGroup";const Bi=A.memo(r=>{const{ref:e,selectFieldOptions:t,...n}=r,i=A.useMemo(()=>t.map(a=>typeof a=="string"?{value:a,label:a}:a),[t]);return d.jsx(v.Menu.SelectGroup,{ref:e,...n,children:i.map(a=>d.jsx(At,{value:a.value,children:d.jsx("span",{className:"truncate",children:a.label})},a.value))})});Bi.displayName="SelectFieldOptionSelectGroup";const Er=A.memo(r=>{const{children:e,open:t,onOpenChange:n,defaultOpen:i,modal:a,size:o,accentColor:s="base",value:l,onValueChange:u,placeholder:c="Enter text",...f}=r,[p,h]=A.useState(""),g=A.useCallback(C=>{h(C.target.value)},[]),x=A.useCallback(C=>{const m=C.target.value;u==null||u(m)},[u]);return A.useEffect(()=>{l&&h(l)},[l]),d.jsxs(v.Popover.Root,{open:t,onOpenChange:n,defaultOpen:i,modal:a,children:[d.jsx(v.Popover.Trigger,{asChild:!0,children:e}),d.jsx(v.Popover.Content,{size:o,onClick:v.stopPropagation,...f,children:d.jsx(v.Input.Root,{size:o,accentColor:s,children:d.jsx(v.Input.Field,{placeholder:c,type:"text",value:p,onChange:g,onBlur:x})})})]})});Er.displayName="TextInputPopover";const Po=r=>{const{condition:e,onRemove:t}=r,n=e.getConditionValue(),i=e.getConditionModifier(),a=()=>{switch(n){case void 0:return"...";case!0:return"true";case!1:return"false";case null:return"empty"}};return d.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:de[e.field.type]}),d.jsx("span",{className:"truncate",children:e.field.label||Me})]}),d.jsx(ke,{condition:e,children:d.jsx(v.Button,{type:"button",children:e.modifiers[i].modifier.label})}),d.jsxs(v.Menu.Root,{children:[d.jsx(v.Menu.ClickTrigger,{children:d.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:a()})}),d.jsx(v.Menu.Content,{size:"sm",children:d.jsxs(v.Menu.SelectGroup,{required:!0,value:n,onValueChange:e.setConditionValue,children:[d.jsx(At,{value:!0,children:"true"}),d.jsx(At,{value:!1,children:"false"})]})})]}),d.jsx(Pe,{condition:e,onClick:t})]})},Fo={equals:L({modifier:vo,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:go,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class Ir extends De{constructor(t){super(t);b(this,"modifiers",Fo)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=Fo[a];let l;return i!==void 0&&(l=s.modifier.deserialize(i)),new Ir({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return d.jsx(Po,{condition:this,...t},this.id)}}const Vo=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=A.useCallback(l=>{l.length>0?e.setConditionValue(l):e.setConditionValue(void 0)},[e]),s=()=>{if(i===void 0)return"...";if(i===null)return"empty";switch(i.length){case 0:return"...";default:return`${i.length} options`}};return d.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"soft",accentColor:"base",children:[d.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"soft",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:de[n.type]}),d.jsx("span",{className:"truncate",children:n.label||Me})]}),d.jsx(ke,{condition:e,children:d.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),d.jsxs(v.Menu.Root,{children:[d.jsx(v.Menu.ClickTrigger,{children:d.jsx(v.Button,{type:"button",className:"truncate",children:s()})}),d.jsx(v.Menu.Content,{size:"sm",children:d.jsx(Ar,{values:i??[],selectFieldOptions:e.field.options,onValuesChange:o})})]}),d.jsx(Pe,{condition:e,onClick:t})]})},Bo={equals:L({modifier:hn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:pn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),every:L({modifier:cn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),some:L({modifier:fn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),none:L({modifier:dn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class Sr extends De{constructor(t){super(t);b(this,"modifiers",Bo)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=Bo[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Sr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return d.jsx(Vo,{condition:this,...t},this.id)}}class xn extends lr{constructor(t){super();b(this,"conditions");b(this,"conditionObserver",()=>{this.conditions=[...this.conditions],this.notify(this)});b(this,"initConditions",t=>{for(const n of t)n.observe(this.conditionObserver);return t});this.conditions=this.initConditions(t)}getConditions(){return this.conditions}addCondition(t){this.conditions=this.initConditions([...this.conditions,t]),this.notify(this)}addConditions(t){this.conditions=this.initConditions([...this.conditions,...t]),this.notify(this)}removeCondition(t){this.conditions=this.initConditions(this.conditions.filter(n=>n.id!==t.id)),this.notify(this)}removeConditions(t){const n=new Set(t.map(i=>i.id));this.conditions=this.initConditions(this.conditions.filter(i=>!n.has(i.id))),this.notify(this)}applyConditions(t){return this.conditions.length===0?!0:this.conditions.map(i=>[i.getApplyFn(),i.accessorFn]).every(([i,a])=>i(a(t)))}}const Jf=(r,e)=>A.useMemo(()=>{const t=new xn(r);return t.observe(n=>e(n.getConditions())),t},[r,e]),Lo=r=>{const{condition:e,onRemove:t}=r,n=e.getConditionValue(),i=e.getConditionModifier(),a=()=>{var o,s;switch(i){case"equals":case"notEquals":{const l=e.modifiers.equals,u=n!==void 0&&l.isConditionValueValid(n)?n:void 0;return d.jsx(gn,{required:!1,size:"sm",mode:"single",selected:u??void 0,onSelect:c=>e.setConditionValue(c),children:d.jsx(v.Button,{type:"button",className:"truncate",children:u!==void 0?(u==null?void 0:u.toLocaleDateString())??"empty":"..."})})}case"before":case"after":{const l=e.modifiers.after,u=n!==void 0&&l.isConditionValueValid(n)?n:void 0;return d.jsx(gn,{required:!0,size:"sm",mode:"single",selected:u,onSelect:e.setConditionValue,children:d.jsx(v.Button,{type:"button",className:"truncate",children:u?u.toLocaleDateString():"..."})})}case"in":case"notIn":{const l=e.modifiers.in,u=n!==void 0&&l.isConditionValueValid(n)?n:void 0;return d.jsx(gn,{required:!0,mode:"range",size:"sm",selected:u,onSelect:e.setConditionValue,children:d.jsx(v.Button,{className:"truncate",children:u?`${(o=u.from)==null?void 0:o.toLocaleDateString()} - ${(s=u.to)==null?void 0:s.toLocaleDateString()}`:"..."})})}}};return d.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:de[e.field.type]}),d.jsx("span",{className:"truncate",children:e.field.label||Me})]}),d.jsx(ke,{condition:e,children:d.jsx(v.Button,{type:"button",children:e.modifiers[i].modifier.label})}),a(),d.jsx(Pe,{condition:e,onClick:t})]})},zo={equals:L({modifier:xo,isValueValid:r=>r instanceof Date,isConditionValueValid:r=>r instanceof Date,isSerializedValueValid:r=>typeof r=="string"}),notEquals:L({modifier:yo,isValueValid:r=>r instanceof Date,isConditionValueValid:r=>r instanceof Date,isSerializedValueValid:r=>typeof r=="string"}),before:L({modifier:Co,isValueValid:r=>r instanceof Date,isConditionValueValid:r=>r instanceof Date,isSerializedValueValid:r=>typeof r=="string"}),after:L({modifier:wo,isValueValid:r=>r instanceof Date,isConditionValueValid:r=>r instanceof Date,isSerializedValueValid:r=>typeof r=="string"}),in:L({modifier:mo,isValueValid:r=>r instanceof Date,isConditionValueValid:r=>"to"in(r??{})&&"from"in(r??{}),isSerializedValueValid:r=>typeof r=="object"&&"to"in r&&"from"in r}),notIn:L({modifier:_o,isValueValid:r=>r instanceof Date,isConditionValueValid:r=>"to"in(r??{})&&"from"in(r??{}),isSerializedValueValid:r=>typeof r=="object"&&"to"in r&&"from"in r})};class Or extends De{constructor(t){super(t);b(this,"modifiers",zo)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=zo[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Or({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return d.jsx(Lo,{condition:this,...t},this.id)}}const ko=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=A.useCallback(l=>{l.length>0?e.setConditionValue(l):e.setConditionValue(void 0)},[e]),s=()=>{if(i===void 0)return"...";if(i===null)return"empty";switch(i.length){case 0:return"...";default:return`${i.length} options`}};return d.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:de[n.type]}),d.jsx("span",{className:"truncate",children:n.label||Me})]}),d.jsx(ke,{condition:e,children:d.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),d.jsxs(v.Menu.Root,{children:[d.jsx(v.Menu.ClickTrigger,{children:d.jsx(v.Button,{type:"button",className:"truncate",children:s()})}),d.jsx(v.Menu.Content,{size:"sm",children:d.jsx(Ar,{values:i??[],selectFieldOptions:n.options,onValuesChange:o})})]}),d.jsx(Pe,{condition:e,onClick:t})]})},Ro={equals:L({modifier:hn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:pn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),every:L({modifier:cn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),some:L({modifier:fn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),none:L({modifier:dn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class br extends De{constructor(t){super(t);b(this,"modifiers",Ro)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=Ro[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new br({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return d.jsx(ko,{condition:this,...t},this.id)}}const Li=[],Uo=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=A.useCallback(l=>{e.setConditionValue(l.length>0?l:void 0)},[e]),s=()=>{if(i===void 0)return"...";if(i===null)return"empty";switch(i.length){case 0:return"...";case 1:return i[0].toString();default:return`${i.length} values`}};return d.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:de[n.type]}),d.jsx("span",{className:"truncate",children:n.label||Me})]}),d.jsx(ke,{condition:e,children:d.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),d.jsx(Mo,{values:i??Li,onValuesChange:o,children:d.jsx(v.Button,{type:"button",className:"truncate",children:s()})}),d.jsx(Pe,{condition:e,onClick:t})]})},Ho={equals:L({modifier:hn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:pn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),every:L({modifier:cn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),some:L({modifier:fn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),none:L({modifier:dn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class Nr extends De{constructor(t){super(t);b(this,"modifiers",Ho)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=Ho[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Nr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return d.jsx(Uo,{condition:this,...t},this.id)}}const Go=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(a){case"equals":case"greaterThanOrEquals":case"lessThanOrEquals":case"greaterThan":case"lessThan":{const s=e.modifiers.greaterThan,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return d.jsx(Et,{value:l??null,onValueChange:u=>e.setConditionValue(u??void 0),size:"sm",children:d.jsx(v.Button,{type:"button",className:"truncate",children:l!==void 0?l??"empty":"..."})})}case"inRange":case"notInRange":{const s=e.modifiers.inRange,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return d.jsxs(d.Fragment,{children:[d.jsx(Et,{value:(l==null?void 0:l.from)??null,onValueChange:u=>{e.setConditionValue({from:u,to:(l==null?void 0:l.to)??null})},size:"sm",children:d.jsx(v.Button,{className:"truncate",children:(l==null?void 0:l.from)??"..."})}),d.jsx(Et,{value:(l==null?void 0:l.to)??null,onValueChange:u=>{e.setConditionValue({from:(l==null?void 0:l.from)??null,to:u})},size:"sm",children:d.jsx(v.Button,{className:"truncate",children:(l==null?void 0:l.to)??"..."})})]})}}};return d.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:de[n.type]}),d.jsx("span",{className:"truncate",children:n.label||Me})]}),d.jsx(ke,{condition:e,children:d.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),o(),d.jsx(Pe,{condition:e,onClick:t})]})},Xo={equals:L({modifier:Ii,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),notEquals:L({modifier:Si,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),lessThan:L({modifier:Oi,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),lessThanOrEquals:L({modifier:bi,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),greaterThan:L({modifier:Ni,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),greaterThanOrEquals:L({modifier:Ti,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),inRange:L({modifier:Di,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="object",isSerializedValueValid:r=>typeof r=="object"}),notInRange:L({modifier:Mi,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="object",isSerializedValueValid:r=>typeof r=="object"})};class Tr extends De{constructor(t){super(t);b(this,"modifiers",Xo)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=Xo[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Tr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return d.jsx(Go,{condition:this,...t},this.id)}}const qo=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(a){case"equals":case"notEquals":case"includes":case"excludes":return d.jsx(Er,{value:i??"",onValueChange:e.setConditionValue,size:"sm",children:d.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:d.jsx("span",{className:"truncate",children:i||"..."})})})}};return d.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:de[n.type]}),d.jsx("span",{className:"truncate",children:n.label||Me})]}),d.jsx(ke,{condition:e,children:d.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),o(),d.jsx(Pe,{condition:e,onClick:t})]})},$o={equals:L({modifier:mt,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:_t,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),includes:L({modifier:mr,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),excludes:L({modifier:_r,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class Dr extends De{constructor(t){super(t);b(this,"modifiers",$o)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=$o[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Dr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return d.jsx(qo,{condition:this,...t},this.id)}}const Wo=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(a){case"equals":case"notEquals":{const s=e.modifiers.equals,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return d.jsxs(v.Menu.Root,{children:[d.jsx(v.Menu.ClickTrigger,{children:d.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:d.jsx("span",{className:"truncate",children:l!==void 0?l?vt[l].label:"empty":"..."})})}),d.jsx(v.Menu.Content,{size:"sm",children:d.jsx(v.Menu.SelectGroup,{required:!1,value:l,onValueChange:e.setConditionValue,children:Pt.map(u=>{const{label:c}=vt[u];return d.jsx(At,{value:u,children:d.jsx("span",{className:"truncate",children:c})},u)})})})]})}case"includes":case"excludes":{const s=e.modifiers.includes,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return d.jsxs(v.Menu.Root,{children:[d.jsx(v.Menu.ClickTrigger,{children:d.jsx(v.Button,{type:"button",children:l?`${l.length} statuses`:"..."})}),d.jsx(v.Menu.Content,{size:"sm",children:d.jsxs(v.Menu.MultiSelectGroup,{values:l??Li,onValuesChange:e.setConditionValue,children:[d.jsx(Vi,{children:"Select all"}),Pt.map(u=>{const{label:c,icon:f}=vt[u];return d.jsxs(Do,{value:u,children:[d.jsx(v.LuIcon,{icon:f}),d.jsx("span",{className:"truncate",children:c})]},u)})]})})]})}}};return d.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:de[n.type]}),d.jsx("span",{className:"truncate",children:n.label||Me})]}),d.jsx(ke,{condition:e,children:d.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),o(),d.jsx(Pe,{condition:e,onClick:t})]})},jo={equals:L({modifier:Io,isValueValid:r=>r!==null,isConditionValueValid:r=>typeof r=="string",isSerializedValueValid:r=>typeof r=="string"}),notEquals:L({modifier:So,isValueValid:r=>r!==null,isConditionValueValid:r=>typeof r=="string",isSerializedValueValid:r=>typeof r=="string"}),includes:L({modifier:Oo,isValueValid:r=>r!==null,isConditionValueValid:r=>Array.isArray(r),isSerializedValueValid:r=>Array.isArray(r)}),excludes:L({modifier:bo,isValueValid:r=>r!==null,isConditionValueValid:r=>Array.isArray(r),isSerializedValueValid:r=>Array.isArray(r)})};class Mr extends De{constructor(t){super(t);b(this,"modifiers",jo)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=jo[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Mr({field:n,conditionModifier:a,conditionValue:l,...o})}transformValue(t){return t.status}render(t){return d.jsx(Wo,{condition:this,...t},this.id)}}const Yo=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=A.useMemo(()=>n.options.map(u=>typeof u=="string"?{value:u,label:u}:u),[n.options]),s=A.useMemo(()=>{const u={};for(const c of o)u[c.value]=c.label;return u},[o]),l=()=>{switch(a){case"equals":case"notEquals":{const u=e.modifiers.equals,c=i!==void 0&&u.isConditionValueValid(i)?i:void 0;return d.jsxs(v.Menu.Root,{children:[d.jsx(v.Menu.ClickTrigger,{children:d.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:d.jsx("span",{className:"truncate",children:c!==void 0?c?s[c]:"empty":"..."})})}),d.jsx(v.Menu.Content,{size:"sm",children:d.jsx(Bi,{required:!0,selectFieldOptions:n.options,value:c??void 0,onValueChange:e.setConditionValue})})]})}case"includes":case"excludes":{const u=e.modifiers.includes,c=i!==void 0&&u.isConditionValueValid(i)?i:void 0;return d.jsxs(v.Menu.Root,{children:[d.jsx(v.Menu.ClickTrigger,{children:d.jsx(v.Button,{type:"button",children:c?`${c.length} options`:"..."})}),d.jsx(v.Menu.Content,{size:"sm",children:d.jsx(Ar,{selectFieldOptions:n.options,values:c??Li,onValuesChange:e.setConditionValue})})]})}}};return d.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:de[n.type]}),d.jsx("span",{className:"truncate",children:n.label||Me})]}),d.jsx(ke,{condition:e,children:d.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),l(),d.jsx(Pe,{condition:e,onClick:t})]})},Zo={equals:L({modifier:mt,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>!Array.isArray(r),isSerializedValueValid:r=>!Array.isArray(r)}),notEquals:L({modifier:_t,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>!Array.isArray(r),isSerializedValueValid:r=>!Array.isArray(r)}),includes:L({modifier:Pi,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>Array.isArray(r),isSerializedValueValid:r=>Array.isArray(r)}),excludes:L({modifier:Fi,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>Array.isArray(r),isSerializedValueValid:r=>Array.isArray(r)})};class Pr extends De{constructor(t){super(t);b(this,"modifiers",Zo)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=Zo[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Pr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return d.jsx(Yo,{condition:this,...t},this.id)}}const Ko=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(a){case"equals":case"notEquals":case"greaterThanOrEquals":case"lessThanOrEquals":case"greaterThan":case"lessThan":{const s=e.modifiers[a],l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return d.jsx(Et,{value:l??null,onValueChange:u=>e.setConditionValue(u??void 0),size:"sm",children:d.jsx(v.Button,{type:"button",className:"truncate",children:l!==void 0?l:"..."})})}case"inRange":case"notInRange":{const s=e.modifiers.inRange,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return d.jsxs(d.Fragment,{children:[d.jsx(Et,{value:(l==null?void 0:l.from)??null,onValueChange:u=>{e.setConditionValue({from:u,to:(l==null?void 0:l.to)??null})},size:"sm",children:d.jsx(v.Button,{className:"truncate",children:(l==null?void 0:l.from)??"..."})}),d.jsx(Et,{value:(l==null?void 0:l.to)??null,onValueChange:u=>{e.setConditionValue({from:(l==null?void 0:l.from)??null,to:u})},size:"sm",children:d.jsx(v.Button,{className:"truncate",children:(l==null?void 0:l.to)??"..."})})]})}}};return d.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:de[n.type]}),d.jsx("span",{className:"truncate",children:n.label||Me})]}),d.jsx(ke,{condition:e,children:d.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),o(),d.jsx(Pe,{condition:e,onClick:t})]})},Qo={equals:L({modifier:Ii,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),notEquals:L({modifier:Si,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),lessThan:L({modifier:Oi,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),lessThanOrEquals:L({modifier:bi,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),greaterThan:L({modifier:Ni,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),greaterThanOrEquals:L({modifier:Ti,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),inRange:L({modifier:Di,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="object",isSerializedValueValid:r=>typeof r=="object"}),notInRange:L({modifier:Mi,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="object",isSerializedValueValid:r=>typeof r=="object"})};class Fr extends De{constructor(t){super(t);b(this,"modifiers",Qo)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=Qo[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Fr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return d.jsx(Ko,{condition:this,...t},this.id)}}const Jo=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(a){case"equals":case"notEquals":case"includes":case"excludes":return d.jsx(Er,{value:i??"",onValueChange:e.setConditionValue,size:"sm",children:d.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:d.jsx("span",{className:"truncate",children:i||"..."})})})}};return d.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:de[n.type]}),d.jsx("span",{className:"truncate",children:n.label||Me})]}),d.jsx(ke,{condition:e,children:d.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),o(),d.jsx(Pe,{condition:e,onClick:t})]})},es={equals:L({modifier:mt,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:_t,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),includes:L({modifier:mr,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),excludes:L({modifier:_r,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class Vr extends De{constructor(t){super(t);b(this,"modifiers",es)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=es[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Vr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return d.jsx(Jo,{condition:this,...t},this.id)}}const ts=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=A.useMemo(()=>n.options.map(c=>typeof c=="string"?{value:c,label:c}:c),[n.options]),s=A.useMemo(()=>{const c={};for(const f of o)c[f.value]=f.label;return c},[o]),l=A.useCallback(c=>{c.length>0?e.setConditionValue(c):e.setConditionValue([])},[e]),u=()=>{switch(a){case"equals":case"notEquals":{const c=e.modifiers.equals,f=i!==void 0&&c.isConditionValueValid(i)?i:void 0;return d.jsxs(v.Menu.Root,{children:[d.jsx(v.Menu.ClickTrigger,{children:d.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:d.jsx("span",{className:"truncate",children:f!==void 0?f?s[f]:"empty":"..."})})}),d.jsx(v.Menu.Content,{size:"sm",children:d.jsx(Bi,{required:!1,selectFieldOptions:n.options,value:f??void 0,onValueChange:e.setConditionValue})})]})}case"includes":case"excludes":{const c=e.modifiers.includes,f=i!==void 0&&c.isConditionValueValid(i)?i:void 0;return d.jsxs(v.Menu.Root,{children:[d.jsx(v.Menu.ClickTrigger,{children:d.jsx(v.Button,{type:"button",children:f?`${f.length} options`:"..."})}),d.jsx(v.Menu.Content,{size:"sm",children:d.jsx(Ar,{selectFieldOptions:n.options,values:f??[],onValuesChange:l})})]})}}};return d.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:de[n.type]}),d.jsx("span",{className:"truncate",children:n.label||Me})]}),d.jsx(ke,{condition:e,children:d.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),u(),d.jsx(Pe,{condition:e,onClick:t})]})},rs={equals:L({modifier:mt,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>!Array.isArray(r),isSerializedValueValid:r=>!Array.isArray(r)}),notEquals:L({modifier:_t,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>!Array.isArray(r),isSerializedValueValid:r=>!Array.isArray(r)}),includes:L({modifier:Pi,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>Array.isArray(r),isSerializedValueValid:r=>Array.isArray(r)}),excludes:L({modifier:Fi,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>Array.isArray(r),isSerializedValueValid:r=>Array.isArray(r)})};class Br extends De{constructor(t){super(t);b(this,"modifiers",rs)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=rs[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Br({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return d.jsx(ts,{condition:this,...t},this.id)}}const ns=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(a){case"equals":case"notEquals":case"includes":case"excludes":return d.jsx(Er,{value:i??"",onValueChange:e.setConditionValue,size:"sm",children:d.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:d.jsx("span",{className:"truncate",children:i||"..."})})})}};return d.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:de[n.type]}),d.jsx("span",{className:"truncate",children:n.label||Me})]}),d.jsx(ke,{condition:e,children:d.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),o(),d.jsx(Pe,{condition:e,onClick:t})]})},is={equals:L({modifier:mt,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:_t,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),includes:L({modifier:mr,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),excludes:L({modifier:_r,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class Lr extends De{constructor(t){super(t);b(this,"modifiers",is)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=is[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Lr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return d.jsx(ns,{condition:this,...t},this.id)}}const as=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(a){case"equals":case"notEquals":case"includes":case"excludes":return d.jsx(Er,{value:i??"",onValueChange:e.setConditionValue,size:"sm",children:d.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:d.jsx("span",{className:"truncate",children:i||"..."})})})}};return d.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:de[n.type]}),d.jsx("span",{className:"truncate",children:n.label||Me})]}),d.jsx(ke,{condition:e,children:d.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),o(),d.jsx(Pe,{condition:e,onClick:t})]})},os={equals:L({modifier:mt,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:_t,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),includes:L({modifier:mr,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),excludes:L({modifier:_r,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class zr extends De{constructor(t){super(t);b(this,"modifiers",os)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=os[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new zr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return d.jsx(as,{condition:this,...t},this.id)}}const ss=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(i){case void 0:return"...";case!0:return"true";case!1:return"false";case null:return"empty"}};return d.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:de[n.type]}),d.jsx("span",{className:"truncate",children:n.label||Me})]}),d.jsx(ke,{condition:e,children:d.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),d.jsxs(v.Menu.Root,{children:[d.jsx(v.Menu.ClickTrigger,{children:d.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:o()})}),d.jsx(v.Menu.Content,{size:"sm",children:d.jsxs(v.Menu.SelectGroup,{required:!0,value:i,onValueChange:e.setConditionValue,children:[d.jsx(At,{value:!0,children:"empty"}),d.jsx(At,{value:!1,children:"not empty"})]})})]}),d.jsx(Pe,{condition:e,onClick:t})]})},ls={equals:L({modifier:Ao,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:Eo,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class kr extends De{constructor(t){super(t);b(this,"modifiers",ls)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=ls[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new kr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return d.jsx(ss,{condition:this,...t},this.id)}}const ed={date:Or,number:Tr,boolean:Ir,select:Br,string:Lr,text:zr,upload:kr,qr:Vr,"multi-string":Nr,"multi-select":br,radio:Pr,"checkbox-list":Sr,"pass-fail":Mr,otp:Dr,rating:Fr},us=(r,e)=>{if(r.type!==e.type)throw new Error(`field and condition type mismatch ${r.type} !== ${e.type}`);return ed[e.type].deserialize(e,r)},zi=(r,e)=>{const t={};for(const n of r)t[n.identifier]=n;return e.map(n=>us(t[n.fieldId],n))},yn=r=>un[r.type].deserialize(r);function td(r){return r.map(cs)}const cs=r=>r.type==="section"?et.deserialize(r):yn(r);function rd(r){return r.map(yn)}function Cn(r){const e=[];for(const t of r)if(t instanceof et)for(const n of t.fields)e.push(n);else e.push(t);return e}function fs(r){const e=Cn(r),t={};for(const n of e)t[n.identifier]=n;return t}function ds(r,e){const t=ki(r,e),n={};for(const i of r){if(!(i.identifier in t))continue;const a=t[i.identifier];n[i.identifier]=i.serializeValue(a)}return n}function hs(r,e){const t=ps(r,e),n={};for(const i of r){if(!(i.identifier in t))continue;const a=t[i.identifier];n[i.identifier]=i.deserializeValue(a)}return n}function ki(r,e){const t={};for(const n of r){if(!(n.identifier in e))continue;const i=e[n.identifier];n.isValueValid(i)&&(t[n.identifier]=i)}return t}function ps(r,e){const t={};for(const n of r){if(!(n.identifier in e))continue;const i=e[n.identifier];n.isSerializedValueValid(i)&&(t[n.identifier]=i)}return t}function nd(r,e){const t=ki(r,e),n={},i={};for(const a of r){if(!(a.identifier in t))continue;const o=t[a.identifier];switch(a.type){case"upload":if(!a.isValueValid(o))break;i[a.identifier]=o,n[a.identifier]=[];break;case"pass-fail":if(!a.isValueValid(o))break;i[a.identifier]=o.files,n[a.identifier]={...o,files:[]};break;default:n[a.identifier]=e[a.identifier]}}return[n,i]}function id(r,e,t){const n={};for(const i of r){if(!(i.identifier in e))continue;const a=e[i.identifier];switch(i.type){case"upload":if(!i.isValueValid(a))break;n[i.identifier]=t[i.identifier]??[];break;case"pass-fail":if(!i.isValueValid(a))break;n[i.identifier]={...a,files:t[i.identifier]??[]};break;default:if(!i.isValueValid(a))break;n[i.identifier]=a}}return n}const Ri=(r,e)=>{const t={};for(const n of r){const i=e[n.identifier];t[n.identifier]=i!==void 0?i:n.blankValue()}return t},vs=(r,e,t)=>{const n={};for(const i of r){const a=e[i.identifier],o=t[i.identifier];i.areValuesEqual(a,o)||(n[i.identifier]=o)}return n},ad=(r,e,t)=>{const n={};for(const i of r){const a=e[i.identifier],o=t[i.identifier];i.areValuesEqual(a,o)&&(n[i.identifier]=o)}return n},gs=A.createContext({}),Ui=A.memo(r=>{const{fieldSection:e,...t}=r,{label:n,description:i}=e,{values:a}=Re.useFormikContext(),{fields:o}=A.use(gs),s=A.useMemo(()=>o.filter(f=>f.type==="section"),[o]),l=A.useMemo(()=>s.filter(f=>e.identifier in f.conditions),[s,e.identifier]),u=A.useMemo(()=>l.length===0?!0:l.some(f=>{const p=f.getConditions(e.identifier);return new xn(p).applyConditions(a)}),[l,e,a]),c=ur(e.fields,t);return u?d.jsxs(v.Card,{variant:"soft",className:"flex flex-col gap-4",children:[(n||i)&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx(v.Heading,{size:"md",children:n}),i&&d.jsx(v.Text,{accentColor:"base",children:i})]}),d.jsx(v.Separator,{size:"full"})]}),c]}):null});Ui.displayName="FieldSectionLayout";const St=class St extends bn{constructor(t){const{label:n=null,description:i=null,fields:a,conditions:o={},...s}=t;super(s);b(this,"type","section");b(this,"label");b(this,"description");b(this,"conditions");b(this,"fields",[]);b(this,"fieldObserver",()=>{this.notify(this)});b(this,"initFields",t=>{for(const n of t)n.observe(this.fieldObserver);return t});b(this,"conditionObserver",()=>{this.notify(this)});b(this,"initConditions",t=>{for(const n of Object.values(t).flat())n.observe(this.conditionObserver);return t});this.label=n,this.description=i,this.fields=this.initFields(a),this.conditions=this.initConditions(o)}serialize(){const t={};for(const[n,i]of Object.entries(this.conditions))t[n]=i.map(a=>a.serialize());return{...super.serialize(),label:this.label,description:this.description,conditions:t,fields:this.fields.map(n=>n.serialize())}}getOptions(){return{...super.getOptions(),label:this.label,description:this.description,fields:this.fields,conditions:this.conditions}}duplicate(t){return new St({...this.getOptions(),identifier:t,fields:this.fields.map(n=>n.duplicate(G.v4()))})}setOptions(t){const{label:n,description:i,fields:a,conditions:o,...s}=t;this.label=n??this.label,this.description=i??this.description,this.fields=a||this.fields,this.conditions=o||this.conditions,super.setOptions(s)}getErrors(t){const n={};for(const i of this.fields){const a=i.getError(t[i.identifier]);a&&(n[i.identifier]=a)}return n}getFields(){return this.fields}addField(t,n){const i=[...this.fields];i.splice(n??this.fields.length,0,t),this.fields=this.initFields(i),this.notify(this)}moveField(t,n){const i=[...this.fields],[a]=i.splice(t,1);i.splice(n,0,a),this.fields=i,this.notify(this)}removeField(t){this.fields=this.initFields(this.fields.filter(({identifier:i})=>i!==t.identifier));const n={};for(const[i,a]of Object.entries(this.conditions))n[i]=a.filter(o=>o.field.identifier!==t.identifier);this.conditions=n,this.notify(this)}getConditions(t){return this.conditions[t]}addCondition(t,n){this.conditions=this.initConditions({...this.conditions,[t]:[...this.conditions[t]??[],n]}),this.notify(this)}addConditions(t,n){this.conditions=this.initConditions({...this.conditions,[t]:[...this.conditions[t]??[],...n]}),this.notify(this)}removeCondition(t,n){this.conditions=this.initConditions({...this.conditions,[t]:(this.conditions[t]??[]).filter(i=>i.id!==n.id)}),this.notify(this)}removeConditions(t,n){const i=new Set(n.map(a=>a.id));this.conditions=this.initConditions({...this.conditions,[t]:(this.conditions[t]??[]).filter(a=>!i.has(a.id))}),this.notify(this)}getConditionals(){return new Set(Object.keys(this.conditions))}addConditional(t){this.conditions=this.initConditions({...this.conditions,[t]:[]}),this.notify(this)}removeConditional(t){const n={...this.conditions};delete n[t],this.conditions=this.initConditions(n),this.notify(this)}render(t){return d.jsx(Ui,{fieldSection:this,...t})}};b(St,"fieldTypeName","Section"),b(St,"fieldTypeDescription","Sections can be useful for grouping fields together. They can also be conditionally shown or hidden."),b(St,"deserialize",t=>{const n=t.fields.map(yn),i={};for(const[a,o]of Object.entries(t.conditions))i[a]=zi(n,o);return new St({...t,fields:n,conditions:i})});let et=St;class Rr extends lr{constructor(t){super();b(this,"fieldSections");b(this,"fieldObserver",()=>{this.notify(this)});b(this,"initFields",t=>{for(const n of t)n.observe(this.fieldObserver);return t});this.fieldSections=this.initFields(t)}serialize(){return this.fieldSections.map(t=>t.serialize())}static deserialize(t){return new Rr(t.map(et.deserialize))}getFields(){return this.fieldSections.flatMap(t=>t.getFields())}getFieldSections(){return this.fieldSections}addFieldSection(t,n){const i=[...this.fieldSections];i.splice(n??this.fieldSections.length,0,t),this.fieldSections=this.initFields(i),this.notify(this)}removeFieldSection(t){const n=this.fieldSections.filter(i=>i.identifier!==t.identifier);for(const i of n)i.removeConditional(i.identifier);this.fieldSections=this.initFields(n),this.notify(this)}moveFieldSection(t,n){const i=[...this.fieldSections],[a]=i.splice(t,1);i.splice(n,0,a),this.fieldSections=this.initFields(i),this.notify(this)}deserializeValues(t){return hs(this.getFields(),t)}serializeValues(t){return ds(this.getFields(),t)}deserializeConditions(t){return zi(this.getFields(),t)}initializeValues(t){return Ri(this.getFields(),t)}}const It=A.createContext(new Rr([])),wn=A.createContext({}),od=(r=()=>null)=>A.useMemo(()=>Object.entries(un).map(([t,n])=>({children:n.fieldTypeName,icon:d.jsx(v.LuIcon,{icon:de[t]}),value:t,onSelect:()=>{r(t)}})),[r]),mn=A.memo(r=>{const{children:e,variant:t,size:n,accentColor:i,onSelectFieldType:a,...o}=r,s=od(a);return d.jsxs(v.Menu.Root,{...o,children:[d.jsx(v.Menu.ClickTrigger,{children:e}),d.jsx(v.Menu.Content,{variant:t,size:n,accentColor:i,children:d.jsx(v.Menu.Scroll,{children:s.flat().map(l=>d.jsxs(v.Menu.Item,{onSelect:l.onSelect,children:[l.icon,l.children]},l.value))})})]})});mn.displayName="CreateFieldDropdownMenu";const _n=r=>{switch(r){case"text":return new Xt({label:"",required:!1,identifier:G.v4()});case"boolean":return new Nt({label:"",required:!1,identifier:G.v4()});case"number":return new qe({label:"",required:!1,identifier:G.v4()});case"date":return new fr({label:"",required:!1,identifier:G.v4()});case"string":return new Gt({label:"",required:!1,identifier:G.v4()});case"select":return new pt({label:"",options:[],required:!1,identifier:G.v4()});case"multi-string":return new bt({label:"",required:!1,identifier:G.v4()});case"multi-select":return new it({label:"",options:[],required:!1,identifier:G.v4()});case"upload":return new qt({label:"",required:!1,identifier:G.v4(),maximum_files:6,maximum_size:$t});case"qr":return new wr({label:"",required:!1,identifier:G.v4()});case"radio":return new Bt({label:"",options:[],required:!1,identifier:G.v4()});case"checkbox-list":return new Dt({label:"",options:[],required:!1,identifier:G.v4()});case"pass-fail":return new Vt({label:"",required:!1,identifier:G.v4(),showNotesAndFilesOn:["fail"]});case"otp":return new Mt({label:"",validationType:"none",required:!1,identifier:G.v4(),length:6});case"rating":return new Lt({label:"",required:!1,identifier:G.v4(),maxRating:5})}},Hi=r=>{switch(r.type){case"text":return new zr({id:G.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"boolean":return new Ir({id:G.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"number":return new Tr({id:G.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"date":return new Or({id:G.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"string":return new Lr({id:G.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"select":return new Br({id:G.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"multi-string":return new Nr({id:G.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"multi-select":return new br({id:G.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"upload":return new kr({id:G.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"qr":return new Vr({id:G.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"radio":return new Pr({id:G.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"checkbox-list":return new Sr({id:G.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"pass-fail":return new Mr({id:G.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"otp":return new Dr({id:G.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"rating":return new Fr({id:G.v4(),conditionValue:void 0,conditionModifier:"equals",field:r})}},xs=(r,e)=>{switch(r){case"checkbox-list":return Dt.getFieldCreationSchema(e);case"multi-select":return it.getFieldCreationSchema(e);case"number":return qe.getFieldCreationSchema(e);case"radio":return Bt.getFieldCreationSchema(e);case"select":return pt.getFieldCreationSchema(e);case"string":return Gt.getFieldCreationSchema(e);case"text":return Xt.getFieldCreationSchema(e);case"upload":return qt.getFieldCreationSchema(e);case"pass-fail":return Vt.getFieldCreationSchema(e);case"otp":return Mt.getFieldCreationSchema(e);case"rating":return Lt.getFieldCreationSchema(e);default:return}},ys=A.memo(r=>{const{popoverInputs:e,hasError:t,...n}=r;return d.jsxs(v.Popover.Root,{children:[d.jsx(v.Popover.Trigger,{asChild:!0,children:d.jsxs(v.Button,{variant:"soft",type:"button",size:"sm","aria-label":"settings",accentColor:"base",...t&&{color:Ot.danger},children:[d.jsx(v.LuIcon,{icon:al}),"Settings"]},"settings")}),d.jsx(v.Popover.Content,{size:"sm",...n,children:d.jsx("div",{className:"flex w-full max-w-[350px] flex-col",children:e})})]})});ys.displayName="FieldSettingsPopover";const Cs=A.memo(r=>{const{parentPath:e,fieldIndex:t,field:n}=r,{errors:i}=Re.useFormikContext(),a=qr(),{disableRequiredFields:o}=A.use(wn),[s,l]=A.useState(void 0);A.useEffect(()=>{n.image instanceof Promise?n.image.then(l).catch(console.error):l(n.image)},[n]);const u=s?URL.createObjectURL(s):void 0,c=A.useCallback(()=>{n.setOptions({image:void 0})},[n]),[f,p]=A.useMemo(()=>{const _=[],E=[],O=xs(n.type,`${e}.${t}`)??[];for(const T of O)T.showDirectly?_.push(T.field):E.push(T.field);return[_,E]},[n,e,t]),h=ur(f,{formId:vn,disabled:!1}),g=ur(p,{formId:vn,disabled:!1}),x=p.length>0,C=p.some(_=>{const E=En(i,_.identifier);return E&&(typeof E!="object"||Object.values(E).length>0)}),m=A.useCallback(()=>{s&&a(()=>({file:s}))},[a,s]),{fieldTypeName:w}=un[n.type];return d.jsxs("div",{className:"flex grow w-full flex-col gap-4",children:[d.jsxs("div",{className:"flex gap-2 w-full justify-between",children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsxs(v.Badge,{accentColor:"base",variant:"soft",size:"sm",children:[d.jsx(v.LuIcon,{icon:de[n.type]}),w]}),!o&&d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(v.Checkbox.Root,{checked:n.required,onCheckedChange:_=>n.setOptions({required:!!_}),size:"sm",children:d.jsx(v.Checkbox.Indicator,{children:d.jsx(v.LuIcon,{icon:Xe})})}),d.jsx(v.Text,{size:"sm",accentColor:"base",children:"Required"})]})]}),x&&d.jsx(ys,{popoverInputs:g,hasError:C,align:"end"})]}),s&&d.jsxs("div",{className:"group relative inline-block w-full min-w-[300px]",children:[d.jsx("img",{className:"h-[100px] w-full min-w-[300px] cursor-pointer rounded-md object-cover",src:u,alt:s.name,onClick:m}),d.jsx(v.IconButton,{type:"button",className:"absolute top-2 right-2 hidden group-hover:not-disabled:flex",variant:"solid",accentColor:"base","aria-label":"delete",onClick:c,size:"sm",children:d.jsx(v.LuIcon,{icon:dt})})]}),d.jsxs("div",{className:"flex flex-col gap-2 w-full overflow-hidden",children:[d.jsx(v.Input.Root,{variant:"outline",size:"md",children:d.jsx(v.Input.Field,{placeholder:"Enter your question",value:n.label??"",onChange:_=>n.setOptions({label:_.target.value}),maxLength:200})}),d.jsx(v.TextArea,{className:"field-sizing-content",placeholder:"Enter a field description (optional)",value:n.description??"",onChange:_=>n.setOptions({description:_.target.value}),maxLength:1e3,resize:"vertical",size:"md"})]}),f.length>0&&d.jsx("div",{className:"w-full",children:h})]})});Cs.displayName="FieldBuilder";const Gi=A.memo(r=>{const{field:e,fieldSection:t,fieldIndex:n,sectionIndex:i}=r,a=A.useRef(null),o=`fields.${i}.fields`,s=A.useCallback(x=>{t.addField(_n(x),n+1)},[n,t]),l=A.useCallback(()=>{t.addField(e.duplicate(G.v4()))},[e,t]),u=A.useCallback(x=>{const C=x==="up"?i-1:i+1;t.moveField(n,C)},[t,n,i]),c=A.useCallback(x=>{const{files:C}=x.target;if(!C||C.length!==1)return;const m=C.item(0);if(m){if(m.size>po){v.toast.error({title:"File upload error",description:`The file ${m.name} exceeded the maximum file size`});return}e.setOptions({image:m})}},[e]),f=A.useCallback(()=>{u("up")},[u]),p=A.useCallback(()=>{u("down")},[u]),h=A.useCallback(()=>{var x;(x=a.current)==null||x.click()},[]),g=A.useCallback(()=>{t.removeField(e)},[e,t]);return d.jsxs(v.Card,{className:"flex items-center justify-between gap-4 w-full",children:[d.jsx(Cs,{fieldIndex:n,field:e,parentPath:o}),d.jsxs(v.ButtonGroup,{className:"flex-col gap-0.5 flex",variant:"ghost",accentColor:"base",size:"sm",children:[d.jsx(mn,{onSelectFieldType:s,children:d.jsx(v.IconButton,{type:"button",children:d.jsx(v.LuIcon,{icon:Ye})})}),d.jsx(v.IconButton,{type:"button",onClick:f,children:d.jsx(v.LuIcon,{icon:na})}),d.jsx(v.IconButton,{type:"button",onClick:p,children:d.jsx(v.LuIcon,{icon:ra})}),d.jsx(v.IconButton,{type:"button",onClick:l,children:d.jsx(v.LuIcon,{icon:Hr})}),d.jsx(v.IconButton,{type:"button",onClick:h,children:d.jsx(v.LuIcon,{icon:Ks})}),d.jsx(v.IconButton,{type:"button",onClick:g,children:d.jsx(v.LuIcon,{icon:dt})})]}),d.jsx("input",{className:"hidden",ref:a,type:"file",accept:"image/*",onChange:c})]})});Gi.displayName="FieldBuilderWithActions";const Xi=A.memo(r=>{const{children:e,variant:t,size:n,accentColor:i,fields:a,onSelectField:o,...s}=r;return d.jsxs(v.Menu.Root,{...s,children:[d.jsx(v.Menu.ClickTrigger,{children:e}),d.jsx(v.Menu.Content,{variant:t,size:n,accentColor:i,children:d.jsx(v.Menu.Scroll,{children:a.map(l=>d.jsxs(v.Menu.Item,{onSelect:()=>o(l),children:[d.jsx(v.LuIcon,{icon:de[l.type]}),l.label||Me]},l.identifier))})})]})});Xi.displayName="IssueDataFilterMenu";const ws=A.memo(r=>{const{children:e,variant:t,size:n,accentColor:i,fieldSections:a,onSelectFieldCondition:o,...s}=r;return d.jsxs(v.Menu.Root,{...s,children:[d.jsx(v.Menu.ClickTrigger,{children:e}),d.jsx(v.Menu.Content,{variant:t,size:n,accentColor:i,children:a.map(l=>d.jsxs(v.Menu.Item,{onSelect:()=>o(l),children:[d.jsx(v.LuIcon,{icon:de[l.type]}),l.label||No]},l.identifier))})]})});ws.displayName="IssueDataFilterMenu";const ms=A.memo(r=>{const{id:e,sourceX:t,sourceY:n,targetX:i,targetY:a,style:o,markerEnd:s,data:l}=r,{targetSection:u,sourceSection:c,layoutDirection:f}=l,p=A.useMemo(()=>c.getConditions(u.identifier),[c,u.identifier]),h=A.useCallback(()=>{c.removeConditional(u.identifier)},[c,u.identifier]),g=A.useCallback(_=>{c.addCondition(u.identifier,Hi(_))},[c,u.identifier]),x=A.useCallback(_=>{c.removeCondition(u.identifier,_)},[c,u.identifier]),[C,m,w]=fe.getBezierPath({sourceX:t,sourceY:n,sourcePosition:f==="LR"?fe.Position.Right:fe.Position.Bottom,targetX:i,targetY:a,targetPosition:f==="LR"?fe.Position.Left:fe.Position.Top});return d.jsxs(d.Fragment,{children:[d.jsx(fe.BaseEdge,{id:e,path:C,style:o,markerEnd:s,labelX:m,labelY:w}),d.jsx(fe.EdgeLabelRenderer,{children:d.jsxs(v.Card,{size:"xs",variant:"surface",className:"absolute nodrag nopan pointer-events-auto inline-flex flex-col gap-2 bg-(--base-2)",onMouseDown:_=>_.stopPropagation(),onClick:_=>_.stopPropagation(),"data-floating-content":"",style:{transform:`translate(-50%, -50%) translate(${m}px, ${w}px)`},children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(v.Text,{size:"xs",className:"truncate max-w-[280px]",children:c.label||"Untitled section"}),d.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[d.jsx(Xi,{fields:c.fields,onSelectField:g,children:d.jsx(v.IconButton,{"aria-label":"Add condition",type:"button",variant:"surface",size:"xs",accentColor:"base",children:d.jsx(v.LuIcon,{icon:Ye})})}),d.jsxs(v.Tooltip.Root,{children:[d.jsx(v.Tooltip.Trigger,{asChild:!0,children:d.jsx(v.IconButton,{"aria-label":"Remove conditional logic",type:"button",variant:"surface",size:"xs",accentColor:"base",color:"danger",onClick:h,children:d.jsx(v.LuIcon,{icon:dt})})}),d.jsx(v.Tooltip.Content,{size:"sm",children:"Remove conditional logic"})]})]})]}),p.length>0&&d.jsx("div",{className:"flex flex-col h-max w-full flex-wrap gap-1",children:p.map(_=>d.jsx(A.Fragment,{children:_.render({onRemove:x})},_.id))})]})})]})});ms.displayName="FieldSectionConditionEdgeComponent";const _s=A.memo(r=>{const{data:e,selected:t}=r,{fieldSection:n,index:i,layoutDirection:a}=e,o=A.use(It),s=A.useCallback(()=>{o.removeFieldSection(n)},[o,n]),l=A.useCallback(f=>{n.addField(_n(f))},[n]),u=A.useCallback(()=>{const f=new et({identifier:G.v4(),fields:[]});o.addFieldSection(f),n.addConditional(f.identifier)},[o,n]),c=A.useCallback(()=>{o.addFieldSection(n.duplicate(G.v4()))},[o,n]);return d.jsxs(v.Card,{variant:"surface",className:"cursor-pointer relative bg-(--base-2)","data-selected":t?"true":void 0,children:[d.jsxs("div",{className:"flex flex-col gap-3",children:[d.jsxs("div",{className:"flex flex-col gap-2 w-full overflow-hidden",children:[d.jsx(v.Input.Root,{variant:"outline",size:"md",accentColor:"base",children:d.jsx(v.Input.Field,{placeholder:"Enter a section label (optional)",value:n.label??"",onChange:f=>n.setOptions({label:f.target.value}),maxLength:200})}),d.jsx(v.TextArea,{className:"field-sizing-content",placeholder:"Enter a section description (optional)",value:n.description??"",onChange:f=>n.setOptions({description:f.target.value}),maxLength:1e3,resize:"vertical",size:"md"})]}),d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(v.Text,{weight:"bold",children:"Fields"}),d.jsx(mn,{onSelectFieldType:l,children:d.jsxs(v.Button,{type:"button",variant:"soft",size:"sm",accentColor:"base",children:[d.jsx(v.LuIcon,{icon:Ye})," Add field"]})})]}),d.jsx("div",{className:"flex flex-col gap-3",children:n.fields.map((f,p)=>d.jsx(Gi,{field:f,fieldSection:n,fieldIndex:p,sectionIndex:i},f.identifier))})]}),d.jsx(fe.NodeToolbar,{isVisible:!0,position:fe.Position.Right,align:"start",offset:8,onMouseDown:f=>f.stopPropagation(),children:d.jsx(v.Card,{variant:"surface",className:"flex flex-col items-center gap-1 p-1 bg-(--base-2)",size:"xs",onClick:f=>f.stopPropagation(),children:d.jsxs(v.ButtonGroup,{className:"flex flex-col gap-2",variant:"surface",size:"xs",accentColor:"base",children:[d.jsx(v.IconButton,{type:"button",onClick:u,children:d.jsx(v.LuIcon,{icon:Ys})}),d.jsx(v.IconButton,{type:"button",onClick:c,children:d.jsx(v.LuIcon,{icon:Hr})}),d.jsx(v.IconButton,{type:"button",onClick:s,children:d.jsx(v.LuIcon,{icon:dt})})]})})}),d.jsx(fe.Handle,{type:"target",className:"size-4! bg-(--base-3)! border-(--base-7)!",position:a==="LR"?fe.Position.Left:fe.Position.Top}),d.jsx(fe.Handle,{type:"source",className:"size-4! bg-(--base-3)! border-(--base-7)!",position:a==="LR"?fe.Position.Right:fe.Position.Bottom})]})});_s.displayName="CustomNode";const sd={fieldSection:_s},ld={fieldSectionCondition:ms},ud=(r,e,t)=>{const n=new Zi.graphlib.Graph().setDefaultEdgeLabel(()=>({}));return n.setGraph({rankdir:t,nodesep:200,edgesep:500,ranksep:500}),e.forEach(i=>n.setEdge(i.source,i.target,{width:500,height:200,labelpos:"c"})),r.forEach(i=>{var a,o;return n.setNode(i.id,{...i,width:((a=i.measured)==null?void 0:a.width)??0,height:((o=i.measured)==null?void 0:o.height)??0})}),Zi.layout(n),[r.map(i=>{var l,u;const a=n.node(i.id),o=a.x-(((l=i.measured)==null?void 0:l.width)??0)/2,s=a.y-(((u=i.measured)==null?void 0:u.height)??0)/2;return{...i,position:{x:o,y:s}}}),e]},cd={hideAttribution:!0},As=A.memo(()=>{const{handleSubmit:r,errors:e}=Re.useFormikContext(),{hideTitle:t,hideDescription:n,onCancel:i}=A.use(wn),a=A.use(It),o=A.useRef(null),[s,l]=A.useState(),[u,c]=A.useState("TB");A.useLayoutEffect(()=>{o.current&&o.current.classList.remove("light")},[]);const f=A.useMemo(()=>a.fieldSections.map((R,Z)=>({id:R.identifier,position:{x:0,y:0},data:{index:Z,fieldSection:R,layoutDirection:u},draggable:!0,type:"fieldSection"})),[a.fieldSections,u]),p=A.useMemo(()=>{const R=[],Z={};for(const H of a.fieldSections)Z[H.identifier]=H;for(const H of a.fieldSections){const re=H.conditions;for(const[Fe,Ur]of Object.entries(re))R.push({id:`${H.identifier}-${Fe}`,source:H.identifier,target:Fe,data:{targetSection:Z[Fe],sourceSection:H,layoutDirection:u},animated:Ur.length>0,markerEnd:fe.MarkerType.Arrow,style:{strokeWidth:2,stroke:"var(--base-a8)"},type:"fieldSectionCondition"})}return R},[a.fieldSections,u]),[h,g,x]=fe.useNodesState(f),[C,m,w]=fe.useEdgesState(p);A.useEffect(()=>{g(f)},[f,g]),A.useEffect(()=>{m(p)},[p,m]);const[_,E]=A.useMemo(()=>ud(h,C,u),[C,u,h]),O=A.useCallback(()=>{a.addFieldSection(new et({identifier:G.v4(),fields:[]}))},[a]),T=A.useCallback(R=>{const{source:Z,target:H}=R,re=a.fieldSections.find(({identifier:Fe})=>Fe===Z);re.setOptions({conditions:{...re.conditions,[H]:[]}})},[a.fieldSections]),D=A.useCallback(R=>{const Z=new $i.DirectedGraph({});for(const H of a.fieldSections)for(const re of Object.keys(H.conditions))Z.mergeEdge(H.identifier,re);return!Wi.willCreateCycle(Z,R.source,R.target)},[a.fieldSections]),[M,P,V]=Re.useField("title"),[W,U,J]=Re.useField("description");return d.jsxs("form",{className:"size-full flex flex-col gap-4",id:vn,onSubmit:r,children:[!t&&d.jsx(Xr,{severity:"danger",helpText:P.error??null,children:d.jsx(v.Input.Root,{variant:"outline",size:"md",accentColor:P.error?Ot.danger:"primary",children:d.jsx(v.Input.Field,{placeholder:"Enter a title",value:M.value??"",onChange:R=>{V.setValue(R.target.value)},maxLength:100})})}),!n&&d.jsx(v.TextArea,{className:"field-sizing-content",placeholder:"Explain a description",value:W.value??"",onChange:R=>{J.setValue(R.target.value)},resize:"vertical",maxLength:1e3,size:"md"}),d.jsxs(v.Card,{className:"size-full relative",variant:"outline",children:[d.jsx(fe.ReactFlow,{ref:o,onInit:l,nodes:_,onNodesChange:x,edges:E,onEdgesChange:w,nodeTypes:sd,edgeTypes:ld,onConnect:T,attributionPosition:"bottom-left",fitView:!0,minZoom:0,isValidConnection:D,proOptions:cd}),d.jsx(fe.Panel,{position:"top-left",children:d.jsx(v.ButtonGroup,{className:"flex items-center justify-end gap-2",size:"sm",children:d.jsxs(v.Button,{type:"button",variant:"surface",onClick:O,children:[d.jsx(v.LuIcon,{icon:Ye})," Add section"]})})}),d.jsxs(fe.Panel,{position:"top-right",className:"flex flex-col items-center gap-2",children:[d.jsxs(v.ToggleGroup.Root,{className:"flex flex-col",type:"single",accentColor:"base",size:"sm",value:u,onValueChange:c,children:[d.jsx(v.ToggleGroup.IconItem,{className:"rounded-b-none",value:"LR",type:"button",children:d.jsx(v.LuIcon,{icon:ks})}),d.jsx(v.ToggleGroup.IconItem,{className:"rounded-t-none",value:"TB",type:"button",children:d.jsx(v.LuIcon,{icon:zs})})]}),d.jsx(v.Separator,{size:"sm"}),d.jsxs(v.ButtonGroup,{className:"flex flex-col ",size:"sm",accentColor:"base",variant:"soft",children:[d.jsx(v.IconButton,{className:"rounded-b-none",onClick:()=>s==null?void 0:s.zoomIn(),type:"button",children:d.jsx(v.LuIcon,{icon:Ye})}),d.jsx(v.IconButton,{onClick:()=>s==null?void 0:s.zoomOut(),radius:"none",type:"button",children:d.jsx(v.LuIcon,{icon:Gr})}),d.jsx(v.IconButton,{className:"rounded-t-none",onClick:()=>s==null?void 0:s.fitView(),type:"button",children:d.jsx(v.LuIcon,{icon:sl})})]})]}),d.jsx(fe.Panel,{position:"bottom-right",children:d.jsxs(v.ButtonGroup,{className:"flex items-center justify-end gap-2",size:"sm",children:[i&&d.jsx(v.Button,{type:"button",variant:"soft",accentColor:"base",onClick:i,children:"Cancel"}),d.jsx(v.Button,{type:"submit",variant:"surface",children:"Save"})]})})]}),!!e.fields&&d.jsx(v.Text,{size:"xs",accentColor:"danger",children:typeof e.fields=="string"&&e.fields})]})});As.displayName="FormBuilderFlowBuilder";const Es=A.memo(r=>{const{sourceFieldSection:e,targetFieldSection:t}=r,n=A.useMemo(()=>e.getConditions(t.identifier),[e,t.identifier]),i=A.useCallback(()=>{e.removeConditional(t.identifier)},[e,t.identifier]),a=A.useCallback(s=>{e.addCondition(t.identifier,Hi(s))},[e,t.identifier]),o=A.useCallback(s=>{e.removeCondition(t.identifier,s)},[e,t.identifier]);return d.jsxs(v.Card,{className:"flex flex-col gap-2",children:[d.jsxs(v.ButtonGroup,{className:"justify-between gap-2 flex",size:"sm",accentColor:"base",variant:"soft",children:[d.jsxs(v.Badge,{accentColor:"base",variant:"soft",size:"sm",children:[d.jsx(v.LuIcon,{icon:de.section}),e.label??No]}),d.jsx(v.IconButton,{type:"button",onClick:i,variant:"ghost",children:d.jsx(v.LuIcon,{icon:dt})})]}),d.jsxs("div",{className:"flex h-max w-full flex-wrap gap-2",children:[n.map(s=>s.render({onRemove:o})),d.jsx(Xi,{fields:e.fields,onSelectField:a,align:"start",children:d.jsx(v.IconButton,{type:"button",size:"sm",variant:"soft",accentColor:"base",children:d.jsx(v.LuIcon,{icon:Ye})})})]})]})});Es.displayName="FieldSectionConditionalItem";const Is=A.memo(r=>{const{fieldSection:e}=r,t=A.use(It),n=A.useMemo(()=>t.fieldSections.filter(o=>e.identifier in o.conditions),[t.fieldSections,e.identifier]),i=A.useCallback(o=>{o.addConditional(e.identifier)},[e.identifier]),a=A.useMemo(()=>{const o=new $i.DirectedGraph({});for(const s of t.fieldSections)for(const l of Object.keys(s.conditions))o.mergeEdge(s.identifier,l);return t.fieldSections.filter(s=>!Wi.willCreateCycle(o,s.identifier,e.identifier))},[t.fieldSections,e.identifier]);return d.jsxs("div",{className:"flex grow w-full flex-col gap-4",children:[d.jsxs("div",{className:"flex flex-col gap-2 w-full overflow-hidden",children:[d.jsx(v.Input.Root,{variant:"outline",size:"md",children:d.jsx(v.Input.Field,{placeholder:"Enter a section label (optional)",value:e.label??"",onChange:o=>e.setOptions({label:o.target.value}),maxLength:200})}),d.jsx(v.TextArea,{className:"field-sizing-content",placeholder:"Enter a section description (optional)",value:e.description??"",onChange:o=>e.setOptions({description:o.target.value}),maxLength:1e3,resize:"vertical",size:"md"})]}),d.jsx(v.Separator,{size:"full"}),d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsxs("div",{className:"flex gap-2 justify-between",children:[d.jsx(v.Text,{accentColor:"base",children:"Conditions"}),d.jsx(ws,{fieldSections:a,onSelectFieldCondition:i,children:d.jsxs(v.Button,{type:"button",variant:"soft",size:"sm",className:"w-max",children:[d.jsx(v.LuIcon,{icon:Ye}),"Add condition"]})})]}),n.map(o=>d.jsx(Es,{sourceFieldSection:o,targetFieldSection:e},o.identifier))]}),d.jsx(v.Separator,{size:"full"})]})});Is.displayName="FieldSectionBuilder";const Ss=A.memo(r=>{const{fieldSection:e,sectionIndex:t}=r,n=A.use(It),i=A.useCallback(()=>{n.removeFieldSection(e)},[n,e]),a=A.useCallback(c=>{const f=c==="up"?t-1:t+1;n.moveFieldSection(t,f)},[n,t]),o=A.useCallback(()=>{n.addFieldSection(e.duplicate(G.v4()))},[n,e]),s=A.useCallback(c=>{e.addField(_n(c))},[e]),l=A.useCallback(()=>{a("up")},[a]),u=A.useCallback(()=>{a("down")},[a]);return d.jsxs(v.Card,{variant:"outline",className:"flex items-center justify-between gap-4 w-full",children:[d.jsxs("div",{className:"flex grow flex-col gap-4 w-full",children:[d.jsx(Is,{fieldSection:e}),d.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[d.jsxs("div",{className:"flex gap-2 justify-between",children:[d.jsx(v.Text,{accentColor:"base",size:"md",children:"Fields"}),d.jsx(mn,{onSelectFieldType:s,children:d.jsxs(v.Button,{type:"button",variant:"soft",size:"sm",children:[d.jsx(v.LuIcon,{icon:Ye})," Add field"]})})]}),e.fields.map((c,f)=>d.jsx(Gi,{field:c,fieldSection:e,fieldIndex:f,sectionIndex:t},c.identifier))]})]}),d.jsxs(v.ButtonGroup,{className:"flex-col gap-0.5 flex",variant:"ghost",accentColor:"base",size:"sm",children:[d.jsx(v.IconButton,{type:"button",onClick:l,children:d.jsx(v.LuIcon,{icon:na})}),d.jsx(v.IconButton,{type:"button",onClick:u,children:d.jsx(v.LuIcon,{icon:ra})}),d.jsx(v.IconButton,{type:"button",onClick:o,children:d.jsx(v.LuIcon,{icon:Hr})}),d.jsx(v.IconButton,{type:"button",onClick:i,children:d.jsx(v.LuIcon,{icon:dt})})]})]})});Ss.displayName="FieldSectionWithActions";const Os=A.memo(()=>{const{handleSubmit:r,errors:e}=Re.useFormikContext(),{hideTitle:t,hideDescription:n,onCancel:i}=A.use(wn),a=A.use(It),o=A.useCallback(()=>{a.addFieldSection(new et({identifier:G.v4(),fields:[]}))},[a]),[s,l,u]=Re.useField("title"),[c,f,p]=Re.useField("description");return d.jsxs("form",{className:"flex flex-col gap-4",id:vn,onSubmit:r,children:[!t&&d.jsx(Xr,{severity:"danger",helpText:l.error??null,children:d.jsx(v.Input.Root,{variant:"outline",size:"md",accentColor:l.error?Ot.danger:"primary",children:d.jsx(v.Input.Field,{placeholder:"Enter a title",value:s.value??"",onChange:h=>{u.setValue(h.target.value)},maxLength:100})})}),!n&&d.jsx(v.TextArea,{className:"field-sizing-content",placeholder:"Explain a description",value:c.value??"",onChange:h=>{p.setValue(h.target.value)},resize:"vertical",maxLength:1e3,size:"md"}),d.jsxs("div",{className:"flex flex-col gap-4",children:[a.fieldSections.map((h,g)=>d.jsx(Ss,{fieldSection:h,sectionIndex:g},h.identifier)),d.jsxs(v.Button,{className:"mb-4",type:"button",variant:"soft",accentColor:"base",size:"sm",onClick:o,children:[d.jsx(v.LuIcon,{icon:Ye})," Add section"]})]}),!!e.fields&&d.jsx(v.Text,{size:"xs",accentColor:"danger",children:typeof e.fields=="string"&&e.fields}),d.jsxs(v.ButtonGroup,{className:"flex items-center justify-end gap-2",size:"sm",children:[i&&d.jsx(v.Button,{type:"button",variant:"soft",accentColor:"base",onClick:i,children:"Cancel"}),d.jsx(v.Button,{type:"submit",variant:"surface",children:"Save"})]})]})});Os.displayName="FormBuilderListBuilder";const qi=(r,e)=>{const t={},n=r.filter(i=>i instanceof et);for(const i of r)if(i instanceof et){const a=n.filter(s=>i.identifier in s.conditions);if(a.length===0||!a.some(s=>{const l=s.getConditions(i.identifier);return new xn(l).applyConditions(e)}))continue;Object.assign(t,i.getErrors(e))}else{if(!(i instanceof Ve))throw new Error("Invalid field type");const a=i.identifier,o=i.getError(En(e,a));o&&Ds(t,a,o)}if(Object.keys(t).length>0)return t},fd=async r=>{const e={},t=[];for(const n of r){const{fields:i}=n,a=[];for(const o of i){if(o.image){if(o.image instanceof Promise)try{e[o.identifier]=await o.image}catch(s){console.error("Failed to get image from promise",s)}else e[o.identifier]=o.image;delete o.image}a.push(o)}t.push({...n,fields:a})}return{fields:t,images:e}};async function dd(r){const e={};for(const[t,n]of Object.entries(r))e[t]=await Promise.all(n);return e}const bs=A.memo(A.forwardRef((r,e)=>{const{schema:t,values:n={},onValuesChange:i,onSubmit:a,submitText:o="Submit",cancelText:s,onCancel:l,onDirty:u,onDirtyChange:c,hideTitle:f=!t.title,hideDescription:p,className:h,buttonProps:g,enableReinitialize:x=!1,excludeUnchangedFields:C=!1}=r,{readonly:m}=t.meta,w=A.useId(),_=A.useMemo(()=>Ri(Cn(t.fields),n),[t.fields,n]),E=A.useCallback(V=>{a==null||a(C?vs(Cn(t.fields),_,V):V)},[C,_,a,t.fields]),O=Re.useFormik({initialValues:_,onSubmit:E,validate:V=>qi(t.fields,V),validateOnBlur:!1,validateOnChange:!1,enableReinitialize:!1});A.useLayoutEffect(()=>{x&&O.resetForm({values:_})},[x,_]);const{dirty:T}=O,D=A.useCallback((V,W)=>{fs(t.fields)[V].areValuesEqual(_[V],W)||i==null||i({...O.values,[V]:W},{[V]:W})},[O.values,_,i,t.fields]),M=A.useMemo(()=>({formId:w,disabled:m,onValuesChange:D}),[w,D,m]),P=ur(t.fields,M);return A.useEffect(()=>{T&&u&&u(),c&&c(T)},[T,u,c]),d.jsx(Re.FormikProvider,{value:O,children:d.jsx(gs,{value:t,children:d.jsxs("form",{id:w,ref:e,className:sr.cx(h,"flex flex-col gap-4"),onSubmit:O.handleSubmit,children:[!f&&d.jsxs(v.Card,{variant:"soft",className:"flex flex-col gap-1",children:[d.jsx(v.Heading,{size:"md",children:t.title}),!p&&d.jsx(v.Text,{accentColor:"base",children:t.description})]}),P,!m&&d.jsxs(v.ButtonGroup,{className:"flex items-center justify-end gap-2",size:"sm",children:[l&&d.jsxs(v.Button,{accentColor:"base",...g,type:"button",variant:"soft",onClick:l,children:[d.jsx(v.LuIcon,{icon:nt}),s]}),d.jsxs(v.Button,{...g,type:"submit",accentColor:"primary",variant:"surface",children:[d.jsx(v.LuIcon,{icon:Xe}),o]})]})]})})})})),Ns=A.memo(r=>{const{showFormTitle:e}=r,{values:t}=Re.useFormikContext(),n=A.use(It),i=A.useMemo(()=>({title:t.title,description:t.description,fields:n.fieldSections,meta:{readonly:!1}}),[n.fieldSections,t.description,t.title]);return d.jsx(bs,{schema:i,hideTitle:!e})});Ns.displayName="FormBuilderPreview";const Ts=A.memo(r=>{const{children:e,initialTitle:t,initialDescription:n,initialFields:i,onSave:a,onCancel:o,hideTitle:s=!1,hideDescription:l=!1,enableReinitialize:u=!1,disableRequiredFields:c=!1}=r,f=A.useCallback(m=>{var T;const w={};m.title||(w.title="Title is required."),(!m.fields||m.fields.length===0)&&(w.fields="At least one field is required.");const _=[];for(const[D,M]of m.fields.entries())for(const[P,V]of M.fields.entries()){const W=((T=xs(V.type,`fields.${D}.fields.${P}`))==null?void 0:T.map(({field:U})=>U))??[];_.push(...W)}const E={};for(const D of _)E[D.identifier]=En(m,D.identifier);const O=qi(_,E);if(O&&(w.fields=O.fields),Object.keys(w).length>0)return v.toast.error({title:"Some form settings are invalid",description:"Please check settings highlighted in red."}),w},[]),p=A.useMemo(()=>({title:t??"",description:n??"",fields:i??[]}),[n,i,t]),h=Re.useFormik({initialValues:p,validate:f,onSubmit:a,validateOnChange:!1,validateOnBlur:!1,enableReinitialize:u}),g=A.useCallback(m=>{h.setFieldValue("fields",m.serialize())},[h]),x=A.useMemo(()=>{const m=Rr.deserialize(h.values.fields);return m.observe(g),m},[h.values.fields,g]),C=A.useMemo(()=>({hideTitle:s,hideDescription:l,disableRequiredFields:c,onCancel:o}),[c,l,s,o]);return d.jsx(wn,{value:C,children:d.jsx(It,{value:x,children:d.jsx(Re.FormikProvider,{value:h,children:e})})})});Ts.displayName="FormBuilderRoot";const hd={Root:Ts,FlowBuilder:As,ListBuilder:Os,Preview:Ns};I.BaseCondition=De,I.BaseField=Ve,I.BaseFormElement=bn,I.BaseOptionsField=cr,I.BaseStringField=Pn,I.BooleanEqualsConditionModifier=vo,I.BooleanField=Nt,I.BooleanFieldCondition=Ir,I.BooleanFieldConditionCell=Po,I.BooleanInput=Dn,I.BooleanNotEqualsConditionModifier=go,I.CheckboxListField=Dt,I.CheckboxListFieldCondition=Sr,I.CheckboxListFieldConditionCell=Vo,I.CheckboxListInput=Fn,I.ConditionManager=xn,I.DateAfterConditionModifier=wo,I.DateBeforeConditionModifier=Co,I.DateEqualsConditionModifier=xo,I.DateField=fr,I.DateFieldCondition=Or,I.DateFieldConditionCell=Lo,I.DateInput=Vn,I.DateNotEqualsConditionModifier=yo,I.DateRangeInConditionModifier=mo,I.DateRangeNotInConditionModifier=_o,I.DoesNotHaveFilesConditionModifier=Eo,I.FieldSchema=Rr,I.FieldSection=et,I.FieldSectionLayout=Ui,I.FieldTypeToClsMapping=un,I.FileCard=On,I.FormBuilder=hd,I.FormRenderer=bs,I.HasFilesConditionModifier=Ao,I.ImageCard=la,I.ImageViewer=Nn,I.ImageViewerProvider=oa,I.InputWithHelpText=Xr,I.InputWithLabel=Se,I.InputWithLabelAndHelpText=Oe,I.LONG_TEXT_FIELD_MAX_LENGTH=Tt,I.MultiSelectField=it,I.MultiSelectFieldCondition=br,I.MultiSelectFieldConditionCell=ko,I.MultiSelectInput=Bn,I.MultiStringField=bt,I.MultiStringFieldCondition=Nr,I.MultiStringFieldConditionCell=Uo,I.MultiStringInput=Tn,I.NumberEqualsConditionModifier=Ii,I.NumberField=qe,I.NumberFieldCondition=Tr,I.NumberFieldConditionCell=Go,I.NumberGreaterThanConditionModifier=Ni,I.NumberGreaterThanOrEqualsConditionModifier=Ti,I.NumberInput=Mn,I.NumberLessThanConditionModifier=Oi,I.NumberLessThanOrEqualsConditionModifier=bi,I.NumberNotEqualsConditionModifier=Si,I.NumberRangeInConditionModifier=Di,I.NumberRangeNotInConditionModifier=Mi,I.OTPField=Mt,I.OTPFieldCondition=Dr,I.OTPFieldConditionCell=qo,I.OTPInput=zn,I.Observable=lr,I.PassFailArrayExcludesConditionModifier=bo,I.PassFailArrayIncludesConditionModifier=Oo,I.PassFailEqualsConditionModifier=Io,I.PassFailField=Vt,I.PassFailFieldCondition=Mr,I.PassFailFieldConditionCell=Wo,I.PassFailInput=Rn,I.PassFailNotEqualsConditionModifier=So,I.RadioField=Bt,I.RadioFieldCondition=Pr,I.RadioFieldConditionCell=Yo,I.RadioInput=Hn,I.RatingField=Lt,I.RatingFieldCondition=Fr,I.RatingFieldConditionCell=Ko,I.RatingInput=Gn,I.SEVERITY_COLOR_MAPPING=Ot,I.SHORT_TEXT_FIELD_MAX_LENGTH=ln,I.ScanField=wr,I.ScanFieldCondition=Vr,I.ScanFieldConditionCell=Jo,I.ScanInput=mi,I.Scanner=sn,I.ScannerProvider=fo,I.SelectField=pt,I.SelectFieldCondition=Br,I.SelectFieldConditionCell=ts,I.SelectInput=Ln,I.StringArrayEqualsConditionModifier=hn,I.StringArrayEveryConditionModifier=cn,I.StringArrayExcludesConditionModifier=Fi,I.StringArrayIncludesConditionModifier=Pi,I.StringArrayNoneConditionModifier=dn,I.StringArrayNotEqualsConditionModifier=pn,I.StringArraySomeConditionModifier=fn,I.StringEqualsConditionModifier=mt,I.StringExcludesConditionModifier=_r,I.StringField=Gt,I.StringFieldCondition=Lr,I.StringFieldConditionCell=ns,I.StringIncludesConditionModifier=mr,I.StringInput=_i,I.StringNotEqualsConditionModifier=_t,I.TextField=Xt,I.TextFieldCondition=zr,I.TextFieldConditionCell=as,I.TextInput=Ai,I.UUIDFile=at,I.UUIDPromise=Ft,I.UploadField=qt,I.UploadFieldCondition=kr,I.UploadFieldConditionCell=ss,I.UploadInput=Ei,I.areFileAndPromiseArraysEqual=$r,I.arePassFieldValuesEqual=ha,I.awaitFilesAndPromises=dd,I.changedFieldValues=vs,I.cleanFieldValues=ki,I.cleanSerializedFieldValues=ps,I.createCondition=Hi,I.createConditionModifierConfig=L,I.createField=_n,I.deserialize=cs,I.deserializeCondition=us,I.deserializeConditions=zi,I.deserializeField=yn,I.deserializeFieldValues=hs,I.deserializeFields=td,I.deserializeOnlyFields=rd,I.deserializePassFailFieldValue=da,I.extractFilesAndPromisesFromFieldValues=nd,I.fieldIcons=de,I.flattenFields=Cn,I.getFieldsMapping=fs,I.initializeFieldValues=Ri,I.insertFilesAndPromisesToFieldValues=id,I.isFileAndPromiseArray=sa,I.isPassFailFieldStatus=Un,I.isPassFailFieldValue=ca,I.isSerializedPassFailFieldValue=ua,I.isStringArray=ht,I.maxFileSizeB=po,I.maxFileSizeKB=ho,I.maxFileSizeMB=$t,I.passFailFieldStatusMapping=vt,I.passFailFieldStatuses=Pt,I.separateImagesFromFields=fd,I.serializeFieldValues=ds,I.serializePassFailFieldValue=fa,I.unchangedFieldValues=ad,I.useConditionManager=Jf,I.useFieldInput=ul,I.useFieldInputs=ur,I.useFormikInput=be,I.useImageViewer=qr,I.useScanner=fl,I.validateFields=qi,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})});
|
|
253
|
+
`),e.toString()},r.prototype.setMode=function(e){this.mode=e},r.prototype.setECLevel=function(e){this.ecLevel=e},r.prototype.setVersion=function(e){this.version=e},r.prototype.setMaskPattern=function(e){this.maskPattern=e},r.prototype.setMatrix=function(e){this.matrix=e},r.isValidMaskPattern=function(e){return e>=0&&e<r.NUM_MASK_PATTERNS},r.NUM_MASK_PATTERNS=8,r}(),od=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ue=function(r){od(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="WriterException",e}(Ue),Za=function(){function r(){}return r.clearMatrix=function(e){e.clear(255)},r.buildMatrix=function(e,t,n,i,a){r.clearMatrix(a),r.embedBasicPatterns(n,a),r.embedTypeInfo(t,i,a),r.maybeEmbedVersionInfo(n,a),r.embedDataBits(e,i,a)},r.embedBasicPatterns=function(e,t){r.embedPositionDetectionPatternsAndSeparators(t),r.embedDarkDotAtLeftBottomCorner(t),r.maybeEmbedPositionAdjustmentPatterns(e,t),r.embedTimingPatterns(t)},r.embedTypeInfo=function(e,t,n){var i=new we;r.makeTypeInfoBits(e,t,i);for(var a=0,o=i.getSize();a<o;++a){var s=i.get(i.getSize()-1-a),l=r.TYPE_INFO_COORDINATES[a],u=l[0],c=l[1];if(n.setBoolean(u,c,s),a<8){var d=n.getWidth()-a-1,p=8;n.setBoolean(d,p,s)}else{var d=8,p=n.getHeight()-7+(a-8);n.setBoolean(d,p,s)}}},r.maybeEmbedVersionInfo=function(e,t){if(!(e.getVersionNumber()<7)){var n=new we;r.makeVersionInfoBits(e,n);for(var i=17,a=0;a<6;++a)for(var o=0;o<3;++o){var s=n.get(i);i--,t.setBoolean(a,t.getHeight()-11+o,s),t.setBoolean(t.getHeight()-11+o,a,s)}}},r.embedDataBits=function(e,t,n){for(var i=0,a=-1,o=n.getWidth()-1,s=n.getHeight()-1;o>0;){for(o===6&&(o-=1);s>=0&&s<n.getHeight();){for(var l=0;l<2;++l){var u=o-l;if(r.isEmpty(n.get(u,s))){var c=void 0;i<e.getSize()?(c=e.get(i),++i):c=!1,t!==255&&Cr.getDataMaskBit(t,u,s)&&(c=!c),n.setBoolean(u,s,c)}}s+=a}a=-a,s+=a,o-=2}if(i!==e.getSize())throw new ue("Not all bits consumed: "+i+"/"+e.getSize())},r.findMSBSet=function(e){return 32-q.numberOfLeadingZeros(e)},r.calculateBCHCode=function(e,t){if(t===0)throw new k("0 polynomial");var n=r.findMSBSet(t);for(e<<=n-1;r.findMSBSet(e)>=n;)e^=t<<r.findMSBSet(e)-n;return e},r.makeTypeInfoBits=function(e,t,n){if(!hi.isValidMaskPattern(t))throw new ue("Invalid mask pattern");var i=e.getBits()<<3|t;n.appendBits(i,5);var a=r.calculateBCHCode(i,r.TYPE_INFO_POLY);n.appendBits(a,10);var o=new we;if(o.appendBits(r.TYPE_INFO_MASK_PATTERN,15),n.xor(o),n.getSize()!==15)throw new ue("should not happen but we got: "+n.getSize())},r.makeVersionInfoBits=function(e,t){t.appendBits(e.getVersionNumber(),6);var n=r.calculateBCHCode(e.getVersionNumber(),r.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new ue("should not happen but we got: "+t.getSize())},r.isEmpty=function(e){return e===255},r.embedTimingPatterns=function(e){for(var t=8;t<e.getWidth()-8;++t){var n=(t+1)%2;r.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),r.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}},r.embedDarkDotAtLeftBottomCorner=function(e){if(e.get(8,e.getHeight()-8)===0)throw new ue;e.setNumber(8,e.getHeight()-8,1)},r.embedHorizontalSeparationPattern=function(e,t,n){for(var i=0;i<8;++i){if(!r.isEmpty(n.get(e+i,t)))throw new ue;n.setNumber(e+i,t,0)}},r.embedVerticalSeparationPattern=function(e,t,n){for(var i=0;i<7;++i){if(!r.isEmpty(n.get(e,t+i)))throw new ue;n.setNumber(e,t+i,0)}},r.embedPositionAdjustmentPattern=function(e,t,n){for(var i=0;i<5;++i)for(var a=r.POSITION_ADJUSTMENT_PATTERN[i],o=0;o<5;++o)n.setNumber(e+o,t+i,a[o])},r.embedPositionDetectionPattern=function(e,t,n){for(var i=0;i<7;++i)for(var a=r.POSITION_DETECTION_PATTERN[i],o=0;o<7;++o)n.setNumber(e+o,t+i,a[o])},r.embedPositionDetectionPatternsAndSeparators=function(e){var t=r.POSITION_DETECTION_PATTERN[0].length;r.embedPositionDetectionPattern(0,0,e),r.embedPositionDetectionPattern(e.getWidth()-t,0,e),r.embedPositionDetectionPattern(0,e.getWidth()-t,e);var n=8;r.embedHorizontalSeparationPattern(0,n-1,e),r.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),r.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);var i=7;r.embedVerticalSeparationPattern(i,0,e),r.embedVerticalSeparationPattern(e.getHeight()-i-1,0,e),r.embedVerticalSeparationPattern(i,e.getHeight()-i,e)},r.maybeEmbedPositionAdjustmentPatterns=function(e,t){if(!(e.getVersionNumber()<2))for(var n=e.getVersionNumber()-1,i=r.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n],a=0,o=i.length;a!==o;a++){var s=i[a];if(s>=0)for(var l=0;l!==o;l++){var u=i[l];u>=0&&r.isEmpty(t.get(u,s))&&r.embedPositionAdjustmentPattern(u-2,s-2,t)}}},r.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),r.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),r.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),r.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),r.VERSION_INFO_POLY=7973,r.TYPE_INFO_POLY=1335,r.TYPE_INFO_MASK_PATTERN=21522,r}(),sd=function(){function r(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}return r.prototype.getDataBytes=function(){return this.dataBytes},r.prototype.getErrorCorrectionBytes=function(){return this.errorCorrectionBytes},r}(),Ka=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};(function(){function r(){}return r.calculateMaskPenalty=function(e){return Cr.applyMaskPenaltyRule1(e)+Cr.applyMaskPenaltyRule2(e)+Cr.applyMaskPenaltyRule3(e)+Cr.applyMaskPenaltyRule4(e)},r.encode=function(e,t,n){n===void 0&&(n=null);var i=r.DEFAULT_BYTE_MODE_ENCODING,a=n!==null&&n.get(nn.CHARACTER_SET)!==void 0;a&&(i=n.get(nn.CHARACTER_SET).toString());var o=this.chooseMode(e,i),s=new we;if(o===le.BYTE&&(a||r.DEFAULT_BYTE_MODE_ENCODING!==i)){var l=pe.getCharacterSetECIByName(i);l!==void 0&&this.appendECI(l,s)}this.appendModeInfo(o,s);var u=new we;this.appendBytes(e,o,u,i);var c;if(n!==null&&n.get(nn.QR_VERSION)!==void 0){var d=Number.parseInt(n.get(nn.QR_VERSION).toString(),10);c=wt.getVersionForNumber(d);var p=this.calculateBitsNeeded(o,s,u,c);if(!this.willFit(p,c,t))throw new ue("Data too big for requested version")}else c=this.recommendVersion(t,o,s,u);var h=new we;h.appendBitArray(s);var g=o===le.BYTE?u.getSizeInBytes():e.length;this.appendLengthInfo(g,c,o,h),h.appendBitArray(u);var x=c.getECBlocksForLevel(t),C=c.getTotalCodewords()-x.getTotalECCodewords();this.terminateBits(C,h);var w=this.interleaveWithECBytes(h,c.getTotalCodewords(),C,x.getNumBlocks()),m=new hi;m.setECLevel(t),m.setMode(o),m.setVersion(c);var _=c.getDimensionForVersion(),E=new ad(_,_),S=this.chooseMaskPattern(w,t,c,E);return m.setMaskPattern(S),Za.buildMatrix(w,t,c,S,E),m.setMatrix(E),m},r.recommendVersion=function(e,t,n,i){var a=this.calculateBitsNeeded(t,n,i,wt.getVersionForNumber(1)),o=this.chooseVersion(a,e),s=this.calculateBitsNeeded(t,n,i,o);return this.chooseVersion(s,e)},r.calculateBitsNeeded=function(e,t,n,i){return t.getSize()+e.getCharacterCountBits(i)+n.getSize()},r.getAlphanumericCode=function(e){return e<r.ALPHANUMERIC_TABLE.length?r.ALPHANUMERIC_TABLE[e]:-1},r.chooseMode=function(e,t){if(t===void 0&&(t=null),pe.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return le.KANJI;for(var n=!1,i=!1,a=0,o=e.length;a<o;++a){var s=e.charAt(a);if(r.isDigit(s))n=!0;else if(this.getAlphanumericCode(s.charCodeAt(0))!==-1)i=!0;else return le.BYTE}return i?le.ALPHANUMERIC:n?le.NUMERIC:le.BYTE},r.isOnlyDoubleByteKanji=function(e){var t;try{t=qe.encode(e,pe.SJIS)}catch{return!1}var n=t.length;if(n%2!==0)return!1;for(var i=0;i<n;i+=2){var a=t[i]&255;if((a<129||a>159)&&(a<224||a>235))return!1}return!0},r.chooseMaskPattern=function(e,t,n,i){for(var a=Number.MAX_SAFE_INTEGER,o=-1,s=0;s<hi.NUM_MASK_PATTERNS;s++){Za.buildMatrix(e,t,n,s,i);var l=this.calculateMaskPenalty(i);l<a&&(a=l,o=s)}return o},r.chooseVersion=function(e,t){for(var n=1;n<=40;n++){var i=wt.getVersionForNumber(n);if(r.willFit(e,i,t))return i}throw new ue("Data too big")},r.willFit=function(e,t,n){var i=t.getTotalCodewords(),a=t.getECBlocksForLevel(n),o=a.getTotalECCodewords(),s=i-o,l=(e+7)/8;return s>=l},r.terminateBits=function(e,t){var n=e*8;if(t.getSize()>n)throw new ue("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(var i=0;i<4&&t.getSize()<n;++i)t.appendBit(!1);var a=t.getSize()&7;if(a>0)for(var i=a;i<8;i++)t.appendBit(!1);for(var o=e-t.getSizeInBytes(),i=0;i<o;++i)t.appendBits((i&1)===0?236:17,8);if(t.getSize()!==n)throw new ue("Bits size does not equal capacity")},r.getNumDataBytesAndNumECBytesForBlockID=function(e,t,n,i,a,o){if(i>=n)throw new ue("Block ID too large");var s=e%n,l=n-s,u=Math.floor(e/n),c=u+1,d=Math.floor(t/n),p=d+1,h=u-d,g=c-p;if(h!==g)throw new ue("EC bytes mismatch");if(n!==l+s)throw new ue("RS blocks mismatch");if(e!==(d+h)*l+(p+g)*s)throw new ue("Total bytes mismatch");i<l?(a[0]=d,o[0]=h):(a[0]=p,o[0]=g)},r.interleaveWithECBytes=function(e,t,n,i){var a,o,s,l;if(e.getSizeInBytes()!==n)throw new ue("Number of bits and data bytes does not match");for(var u=0,c=0,d=0,p=new Array,h=0;h<i;++h){var g=new Int32Array(1),x=new Int32Array(1);r.getNumDataBytesAndNumECBytesForBlockID(t,n,i,h,g,x);var C=g[0],w=new Uint8Array(C);e.toBytes(8*u,w,0,C);var m=r.generateECBytes(w,x[0]);p.push(new sd(w,m)),c=Math.max(c,C),d=Math.max(d,m.length),u+=g[0]}if(n!==u)throw new ue("Data bytes does not match offset");for(var _=new we,h=0;h<c;++h)try{for(var E=(a=void 0,Ka(p)),S=E.next();!S.done;S=E.next()){var T=S.value,w=T.getDataBytes();h<w.length&&_.appendBits(w[h],8)}}catch(V){a={error:V}}finally{try{S&&!S.done&&(o=E.return)&&o.call(E)}finally{if(a)throw a.error}}for(var h=0;h<d;++h)try{for(var D=(s=void 0,Ka(p)),M=D.next();!M.done;M=D.next()){var T=M.value,m=T.getErrorCorrectionBytes();h<m.length&&_.appendBits(m[h],8)}}catch(V){s={error:V}}finally{try{M&&!M.done&&(l=D.return)&&l.call(D)}finally{if(s)throw s.error}}if(t!==_.getSizeInBytes())throw new ue("Interleaving error: "+t+" and "+_.getSizeInBytes()+" differ.");return _},r.generateECBytes=function(e,t){for(var n=e.length,i=new Int32Array(n+t),a=0;a<n;a++)i[a]=e[a]&255;new Ya(He.QR_CODE_FIELD_256).encode(i,t);for(var o=new Uint8Array(t),a=0;a<t;a++)o[a]=i[n+a];return o},r.appendModeInfo=function(e,t){t.appendBits(e.getBits(),4)},r.appendLengthInfo=function(e,t,n,i){var a=n.getCharacterCountBits(t);if(e>=1<<a)throw new ue(e+" is bigger than "+((1<<a)-1));i.appendBits(e,a)},r.appendBytes=function(e,t,n,i){switch(t){case le.NUMERIC:r.appendNumericBytes(e,n);break;case le.ALPHANUMERIC:r.appendAlphanumericBytes(e,n);break;case le.BYTE:r.append8BitBytes(e,n,i);break;case le.KANJI:r.appendKanjiBytes(e,n);break;default:throw new ue("Invalid mode: "+t)}},r.getDigit=function(e){return e.charCodeAt(0)-48},r.isDigit=function(e){var t=r.getDigit(e);return t>=0&&t<=9},r.appendNumericBytes=function(e,t){for(var n=e.length,i=0;i<n;){var a=r.getDigit(e.charAt(i));if(i+2<n){var o=r.getDigit(e.charAt(i+1)),s=r.getDigit(e.charAt(i+2));t.appendBits(a*100+o*10+s,10),i+=3}else if(i+1<n){var o=r.getDigit(e.charAt(i+1));t.appendBits(a*10+o,7),i+=2}else t.appendBits(a,4),i++}},r.appendAlphanumericBytes=function(e,t){for(var n=e.length,i=0;i<n;){var a=r.getAlphanumericCode(e.charCodeAt(i));if(a===-1)throw new ue;if(i+1<n){var o=r.getAlphanumericCode(e.charCodeAt(i+1));if(o===-1)throw new ue;t.appendBits(a*45+o,11),i+=2}else t.appendBits(a,6),i++}},r.append8BitBytes=function(e,t,n){var i;try{i=qe.encode(e,n)}catch(l){throw new ue(l)}for(var a=0,o=i.length;a!==o;a++){var s=i[a];t.appendBits(s,8)}},r.appendKanjiBytes=function(e,t){var n;try{n=qe.encode(e,pe.SJIS)}catch(d){throw new ue(d)}for(var i=n.length,a=0;a<i;a+=2){var o=n[a]&255,s=n[a+1]&255,l=o<<8&4294967295|s,u=-1;if(l>=33088&&l<=40956?u=l-33088:l>=57408&&l<=60351&&(u=l-49472),u===-1)throw new ue("Invalid byte sequence");var c=(u>>8)*192+(u&255);t.appendBits(c,13)}},r.appendECI=function(e,t){t.appendBits(le.ECI.getBits(),4),t.appendBits(e.getValue(),8)},r.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),r.DEFAULT_BYTE_MODE_ENCODING=pe.UTF8.getName(),r})();var ld=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){ld(e,r);function e(t,n,i,a,o,s,l,u){var c=r.call(this,s,l)||this;if(c.yuvData=t,c.dataWidth=n,c.dataHeight=i,c.left=a,c.top=o,a+s>n||o+l>i)throw new k("Crop rectangle does not fit within image data.");return u&&c.reverseHorizontal(s,l),c}return e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new k("Requested row is outside the image: "+t);var i=this.getWidth();(n==null||n.length<i)&&(n=new Uint8ClampedArray(i));var a=(t+this.top)*this.dataWidth+this.left;return se.arraycopy(this.yuvData,a,n,0,i),n},e.prototype.getMatrix=function(){var t=this.getWidth(),n=this.getHeight();if(t===this.dataWidth&&n===this.dataHeight)return this.yuvData;var i=t*n,a=new Uint8ClampedArray(i),o=this.top*this.dataWidth+this.left;if(t===this.dataWidth)return se.arraycopy(this.yuvData,o,a,0,i),a;for(var s=0;s<n;s++){var l=s*t;se.arraycopy(this.yuvData,o,a,l,t),o+=this.dataWidth}return a},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(t,n,i,a){return new e(this.yuvData,this.dataWidth,this.dataHeight,this.left+t,this.top+n,i,a,!1)},e.prototype.renderThumbnail=function(){for(var t=this.getWidth()/e.THUMBNAIL_SCALE_FACTOR,n=this.getHeight()/e.THUMBNAIL_SCALE_FACTOR,i=new Int32Array(t*n),a=this.yuvData,o=this.top*this.dataWidth+this.left,s=0;s<n;s++){for(var l=s*t,u=0;u<t;u++){var c=a[o+u*e.THUMBNAIL_SCALE_FACTOR]&255;i[l+u]=4278190080|c*65793}o+=this.dataWidth*e.THUMBNAIL_SCALE_FACTOR}return i},e.prototype.getThumbnailWidth=function(){return this.getWidth()/e.THUMBNAIL_SCALE_FACTOR},e.prototype.getThumbnailHeight=function(){return this.getHeight()/e.THUMBNAIL_SCALE_FACTOR},e.prototype.reverseHorizontal=function(t,n){for(var i=this.yuvData,a=0,o=this.top*this.dataWidth+this.left;a<n;a++,o+=this.dataWidth)for(var s=o+t/2,l=o,u=o+t-1;l<s;l++,u--){var c=i[l];i[l]=i[u],i[u]=c}},e.prototype.invert=function(){return new qn(this)},e.THUMBNAIL_SCALE_FACTOR=2,e})(jr);var ud=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();(function(r){ud(e,r);function e(t,n,i,a,o,s,l){var u=r.call(this,n,i)||this;if(u.dataWidth=a,u.dataHeight=o,u.left=s,u.top=l,t.BYTES_PER_ELEMENT===4){for(var c=n*i,d=new Uint8ClampedArray(c),p=0;p<c;p++){var h=t[p],g=h>>16&255,x=h>>7&510,C=h&255;d[p]=(g+x+C)/4&255}u.luminances=d}else u.luminances=t;if(a===void 0&&(u.dataWidth=n),o===void 0&&(u.dataHeight=i),s===void 0&&(u.left=0),l===void 0&&(u.top=0),u.left+n>u.dataWidth||u.top+i>u.dataHeight)throw new k("Crop rectangle does not fit within image data.");return u}return e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new k("Requested row is outside the image: "+t);var i=this.getWidth();(n==null||n.length<i)&&(n=new Uint8ClampedArray(i));var a=(t+this.top)*this.dataWidth+this.left;return se.arraycopy(this.luminances,a,n,0,i),n},e.prototype.getMatrix=function(){var t=this.getWidth(),n=this.getHeight();if(t===this.dataWidth&&n===this.dataHeight)return this.luminances;var i=t*n,a=new Uint8ClampedArray(i),o=this.top*this.dataWidth+this.left;if(t===this.dataWidth)return se.arraycopy(this.luminances,o,a,0,i),a;for(var s=0;s<n;s++){var l=s*t;se.arraycopy(this.luminances,o,a,l,t),o+=this.dataWidth}return a},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(t,n,i,a){return new e(this.luminances,i,a,this.dataWidth,this.dataHeight,this.left+t,this.top+n)},e.prototype.invert=function(){return new qn(this)},e})(jr);var cd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),dd=function(r){cd(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.forName=function(t){return this.getCharacterSetECIByName(t)},e}(pe),fd=function(){function r(){}return r.ISO_8859_1=pe.ISO8859_1,r}(),pi,hd=301,pd=function(r,e){for(var t=1,n=0;n<255;n++)e[n]=t,r[t]=n,t*=2,t>=256&&(t^=hd);return{LOG:r,ALOG:e}};pi=pd([],[]),pi.LOG,pi.ALOG;var Qa;(function(r){r[r.FORCE_NONE=0]="FORCE_NONE",r[r.FORCE_SQUARE=1]="FORCE_SQUARE",r[r.FORCE_RECTANGLE=2]="FORCE_RECTANGLE"})(Qa||(Qa={}));var Ja=129,eo=230,vd=231,gd=235,xd=236,yd=237,Cd=238,wd=239,md=240,vi=254,_d=254,to="[)>05",ro="[)>06",no="",ie=0,Ie=1,ze=2,ye=3,_e=4,Te=5,Ad=function(){function r(){}return r.prototype.getEncodingMode=function(){return ie},r.prototype.encode=function(e){var t=et.determineConsecutiveDigitCount(e.getMessage(),e.pos);if(t>=2)e.writeCodeword(this.encodeASCIIDigits(e.getMessage().charCodeAt(e.pos),e.getMessage().charCodeAt(e.pos+1))),e.pos+=2;else{var n=e.getCurrentChar(),i=et.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(i!==this.getEncodingMode())switch(i){case Te:e.writeCodeword(vd),e.signalEncoderChange(Te);return;case Ie:e.writeCodeword(eo),e.signalEncoderChange(Ie);return;case ye:e.writeCodeword(Cd),e.signalEncoderChange(ye);break;case ze:e.writeCodeword(wd),e.signalEncoderChange(ze);break;case _e:e.writeCodeword(md),e.signalEncoderChange(_e);break;default:throw new Error("Illegal mode: "+i)}else et.isExtendedASCII(n)?(e.writeCodeword(gd),e.writeCodeword(n-128+1),e.pos++):(e.writeCodeword(n+1),e.pos++)}},r.prototype.encodeASCIIDigits=function(e,t){if(et.isDigit(e)&&et.isDigit(t)){var n=(e-48)*10+(t-48);return n+130}throw new Error("not digits: "+e+t)},r}(),Ed=function(){function r(){}return r.prototype.getEncodingMode=function(){return Te},r.prototype.encode=function(e){var t=new $;for(t.append(0);e.hasMoreCharacters();){var n=e.getCurrentChar();t.append(n),e.pos++;var i=et.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(i!==this.getEncodingMode()){e.signalEncoderChange(ie);break}}var a=t.length()-1,o=1,s=e.getCodewordCount()+a+o;e.updateSymbolInfo(s);var l=e.getSymbolInfo().getDataCapacity()-s>0;if(e.hasMoreCharacters()||l)if(a<=249)t.setCharAt(0,Y.getCharAt(a));else if(a<=1555)t.setCharAt(0,Y.getCharAt(Math.floor(a/250)+249)),t.insert(1,Y.getCharAt(a%250));else throw new Error("Message length not in valid ranges: "+a);for(var u=0,n=t.length();u<n;u++)e.writeCodeword(this.randomize255State(t.charAt(u).charCodeAt(0),e.getCodewordCount()+1))},r.prototype.randomize255State=function(e,t){var n=149*t%255+1,i=e+n;return i<=255?i:i-256},r}(),gi=function(){function r(){}return r.prototype.getEncodingMode=function(){return Ie},r.prototype.encodeMaximal=function(e){for(var t=new $,n=0,i=e.pos,a=0;e.hasMoreCharacters();){var o=e.getCurrentChar();e.pos++,n=this.encodeChar(o,t),t.length()%3===0&&(i=e.pos,a=t.length())}if(a!==t.length()){var s=Math.floor(t.length()/3*2),l=Math.floor(e.getCodewordCount()+s+1);e.updateSymbolInfo(l);var u=e.getSymbolInfo().getDataCapacity()-l,c=Math.floor(t.length()%3);(c===2&&u!==2||c===1&&(n>3||u!==1))&&(e.pos=i)}t.length()>0&&e.writeCodeword(eo),this.handleEOD(e,t)},r.prototype.encode=function(e){for(var t=new $;e.hasMoreCharacters();){var n=e.getCurrentChar();e.pos++;var i=this.encodeChar(n,t),a=Math.floor(t.length()/3)*2,o=e.getCodewordCount()+a;e.updateSymbolInfo(o);var s=e.getSymbolInfo().getDataCapacity()-o;if(!e.hasMoreCharacters()){var l=new $;for(t.length()%3===2&&s!==2&&(i=this.backtrackOneCharacter(e,t,l,i));t.length()%3===1&&(i>3||s!==1);)i=this.backtrackOneCharacter(e,t,l,i);break}var u=t.length();if(u%3===0){var c=et.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(c!==this.getEncodingMode()){e.signalEncoderChange(ie);break}}}this.handleEOD(e,t)},r.prototype.backtrackOneCharacter=function(e,t,n,i){var a=t.length(),o=t.toString().substring(0,a-i);t.setLengthToZero(),t.append(o),e.pos--;var s=e.getCurrentChar();return i=this.encodeChar(s,n),e.resetSymbolInfo(),i},r.prototype.writeNextTriplet=function(e,t){e.writeCodewords(this.encodeToCodewords(t.toString()));var n=t.toString().substring(3);t.setLengthToZero(),t.append(n)},r.prototype.handleEOD=function(e,t){var n=Math.floor(t.length()/3*2),i=t.length()%3,a=e.getCodewordCount()+n;e.updateSymbolInfo(a);var o=e.getSymbolInfo().getDataCapacity()-a;if(i===2){for(t.append("\0");t.length()>=3;)this.writeNextTriplet(e,t);e.hasMoreCharacters()&&e.writeCodeword(vi)}else if(o===1&&i===1){for(;t.length()>=3;)this.writeNextTriplet(e,t);e.hasMoreCharacters()&&e.writeCodeword(vi),e.pos--}else if(i===0){for(;t.length()>=3;)this.writeNextTriplet(e,t);(o>0||e.hasMoreCharacters())&&e.writeCodeword(vi)}else throw new Error("Unexpected case. Please report!");e.signalEncoderChange(ie)},r.prototype.encodeChar=function(e,t){if(e===32)return t.append(3),1;if(e>=48&&e<=57)return t.append(e-48+4),1;if(e>=65&&e<=90)return t.append(e-65+14),1;if(e<32)return t.append(0),t.append(e),2;if(e<=47)return t.append(1),t.append(e-33),2;if(e<=64)return t.append(1),t.append(e-58+15),2;if(e<=95)return t.append(1),t.append(e-91+22),2;if(e<=127)return t.append(2),t.append(e-96),2;t.append("1");var n=2;return n+=this.encodeChar(e-128,t),n},r.prototype.encodeToCodewords=function(e){var t=1600*e.charCodeAt(0)+40*e.charCodeAt(1)+e.charCodeAt(2)+1,n=t/256,i=t%256,a=new $;return a.append(n),a.append(i),a.toString()},r}(),Id=function(){function r(){}return r.prototype.getEncodingMode=function(){return _e},r.prototype.encode=function(e){for(var t=new $;e.hasMoreCharacters();){var n=e.getCurrentChar();this.encodeChar(n,t),e.pos++;var i=t.length();if(i>=4){e.writeCodewords(this.encodeToCodewords(t.toString()));var a=t.toString().substring(4);t.setLengthToZero(),t.append(a);var o=et.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(o!==this.getEncodingMode()){e.signalEncoderChange(ie);break}}}t.append(Y.getCharAt(31)),this.handleEOD(e,t)},r.prototype.handleEOD=function(e,t){try{var n=t.length();if(n===0)return;if(n===1){e.updateSymbolInfo();var i=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount(),a=e.getRemainingCharacters();if(a>i&&(e.updateSymbolInfo(e.getCodewordCount()+1),i=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount()),a<=i&&i<=2)return}if(n>4)throw new Error("Count must not exceed 4");var o=n-1,s=this.encodeToCodewords(t.toString()),l=!e.hasMoreCharacters(),u=l&&o<=2;if(o<=2){e.updateSymbolInfo(e.getCodewordCount()+o);var i=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount();i>=3&&(u=!1,e.updateSymbolInfo(e.getCodewordCount()+s.length))}u?(e.resetSymbolInfo(),e.pos-=o):e.writeCodewords(s)}finally{e.signalEncoderChange(ie)}},r.prototype.encodeChar=function(e,t){e>=32&&e<=63?t.append(e):e>=64&&e<=94?t.append(Y.getCharAt(e-64)):et.illegalCharacter(Y.getCharAt(e))},r.prototype.encodeToCodewords=function(e){var t=e.length;if(t===0)throw new Error("StringBuilder must not be empty");var n=e.charAt(0).charCodeAt(0),i=t>=2?e.charAt(1).charCodeAt(0):0,a=t>=3?e.charAt(2).charCodeAt(0):0,o=t>=4?e.charAt(3).charCodeAt(0):0,s=(n<<18)+(i<<12)+(a<<6)+o,l=s>>16&255,u=s>>8&255,c=s&255,d=new $;return d.append(l),t>=2&&d.append(u),t>=3&&d.append(c),d.toString()},r}(),Sd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Od=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},te=function(){function r(e,t,n,i,a,o,s,l){s===void 0&&(s=0),l===void 0&&(l=0),this.rectangular=e,this.dataCapacity=t,this.errorCodewords=n,this.matrixWidth=i,this.matrixHeight=a,this.dataRegions=o,this.rsBlockData=s,this.rsBlockError=l}return r.lookup=function(e,t,n,i,a){var o,s;t===void 0&&(t=0),n===void 0&&(n=null),i===void 0&&(i=null),a===void 0&&(a=!0);try{for(var l=Od(Nd),u=l.next();!u.done;u=l.next()){var c=u.value;if(!(t===1&&c.rectangular)&&!(t===2&&!c.rectangular)&&!(n!=null&&(c.getSymbolWidth()<n.getWidth()||c.getSymbolHeight()<n.getHeight()))&&!(i!=null&&(c.getSymbolWidth()>i.getWidth()||c.getSymbolHeight()>i.getHeight()))&&e<=c.dataCapacity)return c}}catch(d){o={error:d}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(o)throw o.error}}if(a)throw new Error("Can't find a symbol arrangement that matches the message. Data codewords: "+e);return null},r.prototype.getHorizontalDataRegions=function(){switch(this.dataRegions){case 1:return 1;case 2:case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}},r.prototype.getVerticalDataRegions=function(){switch(this.dataRegions){case 1:case 2:return 1;case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}},r.prototype.getSymbolDataWidth=function(){return this.getHorizontalDataRegions()*this.matrixWidth},r.prototype.getSymbolDataHeight=function(){return this.getVerticalDataRegions()*this.matrixHeight},r.prototype.getSymbolWidth=function(){return this.getSymbolDataWidth()+this.getHorizontalDataRegions()*2},r.prototype.getSymbolHeight=function(){return this.getSymbolDataHeight()+this.getVerticalDataRegions()*2},r.prototype.getCodewordCount=function(){return this.dataCapacity+this.errorCodewords},r.prototype.getInterleavedBlockCount=function(){return this.rsBlockData?this.dataCapacity/this.rsBlockData:1},r.prototype.getDataCapacity=function(){return this.dataCapacity},r.prototype.getErrorCodewords=function(){return this.errorCodewords},r.prototype.getDataLengthForInterleavedBlock=function(e){return this.rsBlockData},r.prototype.getErrorLengthForInterleavedBlock=function(e){return this.rsBlockError},r}(),bd=function(r){Sd(e,r);function e(){return r.call(this,!1,1558,620,22,22,36,-1,62)||this}return e.prototype.getInterleavedBlockCount=function(){return 10},e.prototype.getDataLengthForInterleavedBlock=function(t){return t<=8?156:155},e}(te),Nd=[new te(!1,3,5,8,8,1),new te(!1,5,7,10,10,1),new te(!0,5,7,16,6,1),new te(!1,8,10,12,12,1),new te(!0,10,11,14,6,2),new te(!1,12,12,14,14,1),new te(!0,16,14,24,10,1),new te(!1,18,14,16,16,1),new te(!1,22,18,18,18,1),new te(!0,22,18,16,10,2),new te(!1,30,20,20,20,1),new te(!0,32,24,16,14,2),new te(!1,36,24,22,22,1),new te(!1,44,28,24,24,1),new te(!0,49,28,22,14,2),new te(!1,62,36,14,14,4),new te(!1,86,42,16,16,4),new te(!1,114,48,18,18,4),new te(!1,144,56,20,20,4),new te(!1,174,68,22,22,4),new te(!1,204,84,24,24,4,102,42),new te(!1,280,112,14,14,16,140,56),new te(!1,368,144,16,16,16,92,36),new te(!1,456,192,18,18,16,114,48),new te(!1,576,224,20,20,16,144,56),new te(!1,696,272,22,22,16,174,68),new te(!1,816,336,24,24,16,136,56),new te(!1,1050,408,18,18,36,175,68),new te(!1,1304,496,20,20,36,163,62),new bd],Td=function(){function r(e){this.msg=e,this.pos=0,this.skipAtEnd=0;for(var t=e.split("").map(function(s){return s.charCodeAt(0)}),n=new $,i=0,a=t.length;i<a;i++){var o=String.fromCharCode(t[i]&255);if(o==="?"&&e.charAt(i)!=="?")throw new Error("Message contains characters outside ISO-8859-1 encoding.");n.append(o)}this.msg=n.toString(),this.shape=0,this.codewords=new $,this.newEncoding=-1}return r.prototype.setSymbolShape=function(e){this.shape=e},r.prototype.setSizeConstraints=function(e,t){this.minSize=e,this.maxSize=t},r.prototype.getMessage=function(){return this.msg},r.prototype.setSkipAtEnd=function(e){this.skipAtEnd=e},r.prototype.getCurrentChar=function(){return this.msg.charCodeAt(this.pos)},r.prototype.getCurrent=function(){return this.msg.charCodeAt(this.pos)},r.prototype.getCodewords=function(){return this.codewords},r.prototype.writeCodewords=function(e){this.codewords.append(e)},r.prototype.writeCodeword=function(e){this.codewords.append(e)},r.prototype.getCodewordCount=function(){return this.codewords.length()},r.prototype.getNewEncoding=function(){return this.newEncoding},r.prototype.signalEncoderChange=function(e){this.newEncoding=e},r.prototype.resetEncoderSignal=function(){this.newEncoding=-1},r.prototype.hasMoreCharacters=function(){return this.pos<this.getTotalMessageCharCount()},r.prototype.getTotalMessageCharCount=function(){return this.msg.length-this.skipAtEnd},r.prototype.getRemainingCharacters=function(){return this.getTotalMessageCharCount()-this.pos},r.prototype.getSymbolInfo=function(){return this.symbolInfo},r.prototype.updateSymbolInfo=function(e){e===void 0&&(e=this.getCodewordCount()),(this.symbolInfo==null||e>this.symbolInfo.getDataCapacity())&&(this.symbolInfo=te.lookup(e,this.shape,this.minSize,this.maxSize,!0))},r.prototype.resetSymbolInfo=function(){this.symbolInfo=null},r}(),Dd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Md=function(r){Dd(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getEncodingMode=function(){return ye},e.prototype.encode=function(t){for(var n=new $;t.hasMoreCharacters();){var i=t.getCurrentChar();t.pos++,this.encodeChar(i,n);var a=n.length();if(a%3===0){this.writeNextTriplet(t,n);var o=et.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode());if(o!==this.getEncodingMode()){t.signalEncoderChange(ie);break}}}this.handleEOD(t,n)},e.prototype.encodeChar=function(t,n){switch(t){case 13:n.append(0);break;case 42:n.append(1);break;case 62:n.append(2);break;case 32:n.append(3);break;default:t>=48&&t<=57?n.append(t-48+4):t>=65&&t<=90?n.append(t-65+14):et.illegalCharacter(Y.getCharAt(t));break}return 1},e.prototype.handleEOD=function(t,n){t.updateSymbolInfo();var i=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount(),a=n.length();t.pos-=a,(t.getRemainingCharacters()>1||i>1||t.getRemainingCharacters()!==i)&&t.writeCodeword(_d),t.getNewEncoding()<0&&t.signalEncoderChange(ie)},e}(gi),Pd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Fd=function(r){Pd(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getEncodingMode=function(){return ze},e.prototype.encodeChar=function(t,n){if(t===32)return n.append(3),1;if(t>=48&&t<=57)return n.append(t-48+4),1;if(t>=97&&t<=122)return n.append(t-97+14),1;if(t<32)return n.append(0),n.append(t),2;if(t<=47)return n.append(1),n.append(t-33),2;if(t<=64)return n.append(1),n.append(t-58+15),2;if(t>=91&&t<=95)return n.append(1),n.append(t-91+22),2;if(t===96)return n.append(2),n.append(0),2;if(t<=90)return n.append(2),n.append(t-65+1),2;if(t<=127)return n.append(2),n.append(t-123+27),2;n.append("1");var i=2;return i+=this.encodeChar(t-128,n),i},e}(gi),et=function(){function r(){}return r.randomize253State=function(e){var t=149*e%253+1,n=Ja+t;return n<=254?n:n-254},r.encodeHighLevel=function(e,t,n,i,a){t===void 0&&(t=0),n===void 0&&(n=null),i===void 0&&(i=null),a===void 0&&(a=!1);var o=new gi,s=[new Ad,o,new Fd,new Md,new Id,new Ed],l=new Td(e);l.setSymbolShape(t),l.setSizeConstraints(n,i),e.startsWith(to)&&e.endsWith(no)?(l.writeCodeword(xd),l.setSkipAtEnd(2),l.pos+=to.length):e.startsWith(ro)&&e.endsWith(no)&&(l.writeCodeword(yd),l.setSkipAtEnd(2),l.pos+=ro.length);var u=ie;for(a&&(o.encodeMaximal(l),u=l.getNewEncoding(),l.resetEncoderSignal());l.hasMoreCharacters();)s[u].encode(l),l.getNewEncoding()>=0&&(u=l.getNewEncoding(),l.resetEncoderSignal());var c=l.getCodewordCount();l.updateSymbolInfo();var d=l.getSymbolInfo().getDataCapacity();c<d&&u!==ie&&u!==Te&&u!==_e&&l.writeCodeword("þ");var p=l.getCodewords();for(p.length()<d&&p.append(Ja);p.length()<d;)p.append(this.randomize253State(p.length()+1));return l.getCodewords().toString()},r.lookAheadTest=function(e,t,n){var i=this.lookAheadTestIntern(e,t,n);if(n===ye&&i===ye){for(var a=Math.min(t+3,e.length),o=t;o<a;o++)if(!this.isNativeX12(e.charCodeAt(o)))return ie}else if(n===_e&&i===_e){for(var a=Math.min(t+4,e.length),o=t;o<a;o++)if(!this.isNativeEDIFACT(e.charCodeAt(o)))return ie}return i},r.lookAheadTestIntern=function(e,t,n){if(t>=e.length)return n;var i;n===ie?i=[0,1,1,1,1,1.25]:(i=[1,2,2,2,2,2.25],i[n]=0);for(var a=0,o=new Uint8Array(6),s=[];;){if(t+a===e.length){he.fill(o,0),he.fill(s,0);var l=this.findMinimums(i,s,q.MAX_VALUE,o),u=this.getMinimumCount(o);if(s[ie]===l)return ie;if(u===1){if(o[Te]>0)return Te;if(o[_e]>0)return _e;if(o[ze]>0)return ze;if(o[ye]>0)return ye}return Ie}var c=e.charCodeAt(t+a);if(a++,this.isDigit(c)?i[ie]+=.5:this.isExtendedASCII(c)?(i[ie]=Math.ceil(i[ie]),i[ie]+=2):(i[ie]=Math.ceil(i[ie]),i[ie]++),this.isNativeC40(c)?i[Ie]+=2/3:this.isExtendedASCII(c)?i[Ie]+=8/3:i[Ie]+=4/3,this.isNativeText(c)?i[ze]+=2/3:this.isExtendedASCII(c)?i[ze]+=8/3:i[ze]+=4/3,this.isNativeX12(c)?i[ye]+=2/3:this.isExtendedASCII(c)?i[ye]+=13/3:i[ye]+=10/3,this.isNativeEDIFACT(c)?i[_e]+=3/4:this.isExtendedASCII(c)?i[_e]+=17/4:i[_e]+=13/4,this.isSpecialB256(c)?i[Te]+=4:i[Te]++,a>=4){if(he.fill(o,0),he.fill(s,0),this.findMinimums(i,s,q.MAX_VALUE,o),s[ie]<this.min(s[Te],s[Ie],s[ze],s[ye],s[_e]))return ie;if(s[Te]<s[ie]||s[Te]+1<this.min(s[Ie],s[ze],s[ye],s[_e]))return Te;if(s[_e]+1<this.min(s[Te],s[Ie],s[ze],s[ye],s[ie]))return _e;if(s[ze]+1<this.min(s[Te],s[Ie],s[_e],s[ye],s[ie]))return ze;if(s[ye]+1<this.min(s[Te],s[Ie],s[_e],s[ze],s[ie]))return ye;if(s[Ie]+1<this.min(s[ie],s[Te],s[_e],s[ze])){if(s[Ie]<s[ye])return Ie;if(s[Ie]===s[ye]){for(var d=t+a+1;d<e.length;){var p=e.charCodeAt(d);if(this.isX12TermSep(p))return ye;if(!this.isNativeX12(p))break;d++}return Ie}}}}},r.min=function(e,t,n,i,a){var o=Math.min(e,Math.min(t,Math.min(n,i)));return a===void 0?o:Math.min(o,a)},r.findMinimums=function(e,t,n,i){for(var a=0;a<6;a++){var o=t[a]=Math.ceil(e[a]);n>o&&(n=o,he.fill(i,0)),n===o&&(i[a]=i[a]+1)}return n},r.getMinimumCount=function(e){for(var t=0,n=0;n<6;n++)t+=e[n];return t||0},r.isDigit=function(e){return e>=48&&e<=57},r.isExtendedASCII=function(e){return e>=128&&e<=255},r.isNativeC40=function(e){return e===32||e>=48&&e<=57||e>=65&&e<=90},r.isNativeText=function(e){return e===32||e>=48&&e<=57||e>=97&&e<=122},r.isNativeX12=function(e){return this.isX12TermSep(e)||e===32||e>=48&&e<=57||e>=65&&e<=90},r.isX12TermSep=function(e){return e===13||e===42||e===62},r.isNativeEDIFACT=function(e){return e>=32&&e<=94},r.isSpecialB256=function(e){return!1},r.determineConsecutiveDigitCount=function(e,t){t===void 0&&(t=0);for(var n=e.length,i=t;i<n&&this.isDigit(e.charCodeAt(i));)i++;return i-t},r.illegalCharacter=function(e){var t=q.toHexString(e.charCodeAt(0));throw t="0000".substring(0,4-t.length)+t,new Error("Illegal character: "+e+" (0x"+t+")")},r}(),xi=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},io=function(){function r(e){this.charset=e,this.name=e.name}return r.prototype.canEncode=function(e){try{return qe.encode(e,this.charset)!=null}catch{return!1}},r}(),Vd=function(){function r(e,t,n){var i,a,o,s,l,u;this.ENCODERS=["IBM437","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-6","ISO-8859-7","ISO-8859-8","ISO-8859-9","ISO-8859-10","ISO-8859-11","ISO-8859-13","ISO-8859-14","ISO-8859-15","ISO-8859-16","windows-1250","windows-1251","windows-1252","windows-1256","Shift_JIS"].map(function(P){return new io(dd.forName(P))}),this.encoders=[];var c=[];c.push(new io(fd.ISO_8859_1));for(var d=t!=null&&t.name.startsWith("UTF"),p=0;p<e.length;p++){var h=!1;try{for(var g=(i=void 0,xi(c)),x=g.next();!x.done;x=g.next()){var C=x.value,w=e.charAt(p),m=w.charCodeAt(0);if(m===n||C.canEncode(w)){h=!0;break}}}catch(P){i={error:P}}finally{try{x&&!x.done&&(a=g.return)&&a.call(g)}finally{if(i)throw i.error}}if(!h)try{for(var _=(o=void 0,xi(this.ENCODERS)),E=_.next();!E.done;E=_.next()){var C=E.value;if(C.canEncode(e.charAt(p))){c.push(C),h=!0;break}}}catch(P){o={error:P}}finally{try{E&&!E.done&&(s=_.return)&&s.call(_)}finally{if(o)throw o.error}}h||(d=!0)}if(c.length===1&&!d)this.encoders=[c[0]];else{this.encoders=[];var S=0;try{for(var T=xi(c),D=T.next();!D.done;D=T.next()){var C=D.value;this.encoders[S++]=C}}catch(P){l={error:P}}finally{try{D&&!D.done&&(u=T.return)&&u.call(T)}finally{if(l)throw l.error}}}var M=-1;if(t!=null){for(var p=0;p<this.encoders.length;p++)if(this.encoders[p]!=null&&t.name===this.encoders[p].name){M=p;break}}this.priorityEncoderIndex=M}return r.prototype.length=function(){return this.encoders.length},r.prototype.getCharsetName=function(e){if(!(e<this.length()))throw new Error("index must be less than length");return this.encoders[e].name},r.prototype.getCharset=function(e){if(!(e<this.length()))throw new Error("index must be less than length");return this.encoders[e].charset},r.prototype.getECIValue=function(e){return this.encoders[e].charset.getValueIdentifier()},r.prototype.getPriorityEncoderIndex=function(){return this.priorityEncoderIndex},r.prototype.canEncode=function(e,t){if(!(t<this.length()))throw new Error("index must be less than length");return!0},r.prototype.encode=function(e,t){if(!(t<this.length()))throw new Error("index must be less than length");return qe.encode(Y.getCharAt(e),this.encoders[t].name)},r}(),Bd=3,Ld=function(){function r(e,t,n){this.fnc1=n;var i=new Vd(e,t,n);if(i.length()===1)for(var a=0;a<this.bytes.length;a++){var o=e.charAt(a).charCodeAt(0);this.bytes[a]=o===n?1e3:o}else this.bytes=this.encodeMinimally(e,i,n)}return r.prototype.getFNC1Character=function(){return this.fnc1},r.prototype.length=function(){return this.bytes.length},r.prototype.haveNCharacters=function(e,t){if(e+t-1>=this.bytes.length)return!1;for(var n=0;n<t;n++)if(this.isECI(e+n))return!1;return!0},r.prototype.charAt=function(e){if(e<0||e>=this.length())throw new Error(""+e);if(this.isECI(e))throw new Error("value at "+e+" is not a character but an ECI");return this.isFNC1(e)?this.fnc1:this.bytes[e]},r.prototype.subSequence=function(e,t){if(e<0||e>t||t>this.length())throw new Error(""+e);for(var n=new $,i=e;i<t;i++){if(this.isECI(i))throw new Error("value at "+i+" is not a character but an ECI");n.append(this.charAt(i))}return n.toString()},r.prototype.isECI=function(e){if(e<0||e>=this.length())throw new Error(""+e);return this.bytes[e]>255&&this.bytes[e]<=999},r.prototype.isFNC1=function(e){if(e<0||e>=this.length())throw new Error(""+e);return this.bytes[e]===1e3},r.prototype.getECIValue=function(e){if(e<0||e>=this.length())throw new Error(""+e);if(!this.isECI(e))throw new Error("value at "+e+" is not an ECI but a character");return this.bytes[e]-256},r.prototype.addEdge=function(e,t,n){(e[t][n.encoderIndex]==null||e[t][n.encoderIndex].cachedTotalSize>n.cachedTotalSize)&&(e[t][n.encoderIndex]=n)},r.prototype.addEdges=function(e,t,n,i,a,o){var s=e.charAt(i).charCodeAt(0),l=0,u=t.length();t.getPriorityEncoderIndex()>=0&&(s===o||t.canEncode(s,t.getPriorityEncoderIndex()))&&(l=t.getPriorityEncoderIndex(),u=l+1);for(var c=l;c<u;c++)(s===o||t.canEncode(s,c))&&this.addEdge(n,i+1,new ao(s,t,c,a,o))},r.prototype.encodeMinimally=function(e,t,n){var i=e.length,a=new ao[i+1][t.length()];this.addEdges(e,t,a,0,null,n);for(var o=1;o<=i;o++){for(var s=0;s<t.length();s++)a[o][s]!=null&&o<i&&this.addEdges(e,t,a,o,a[o][s],n);for(var s=0;s<t.length();s++)a[o-1][s]=null}for(var l=-1,u=q.MAX_VALUE,s=0;s<t.length();s++)if(a[i][s]!=null){var c=a[i][s];c.cachedTotalSize<u&&(u=c.cachedTotalSize,l=s)}if(l<0)throw new Error('Failed to encode "'+e+'"');for(var d=[],p=a[i][l];p!=null;){if(p.isFNC1())d.unshift(1e3);else for(var h=t.encode(p.c,p.encoderIndex),o=h.length-1;o>=0;o--)d.unshift(h[o]&255);var g=p.previous===null?0:p.previous.encoderIndex;g!==p.encoderIndex&&d.unshift(256+t.getECIValue(p.encoderIndex)),p=p.previous}for(var x=[],o=0;o<x.length;o++)x[o]=d[o];return x},r}(),ao=function(){function r(e,t,n,i,a){this.c=e,this.encoderSet=t,this.encoderIndex=n,this.previous=i,this.fnc1=a,this.c=e===a?1e3:e;var o=this.isFNC1()?1:t.encode(e,n).length,s=i===null?0:i.encoderIndex;s!==n&&(o+=Bd),i!=null&&(o+=i.cachedTotalSize),this.cachedTotalSize=o}return r.prototype.isFNC1=function(){return this.c===1e3},r}(),zd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),kd=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return a},oo;(function(r){r[r.ASCII=0]="ASCII",r[r.C40=1]="C40",r[r.TEXT=2]="TEXT",r[r.X12=3]="X12",r[r.EDF=4]="EDF",r[r.B256=5]="B256"})(oo||(oo={})),function(r){zd(e,r);function e(t,n,i,a,o){var s=r.call(this,t,n,i)||this;return s.shape=a,s.macroId=o,s}return e.prototype.getMacroId=function(){return this.macroId},e.prototype.getShapeHint=function(){return this.shape},e}(Ld);var Rd=function(){function r(){}return r.prototype.isCompact=function(){return this.compact},r.prototype.setCompact=function(e){this.compact=e},r.prototype.getSize=function(){return this.size},r.prototype.setSize=function(e){this.size=e},r.prototype.getLayers=function(){return this.layers},r.prototype.setLayers=function(e){this.layers=e},r.prototype.getCodeWords=function(){return this.codeWords},r.prototype.setCodeWords=function(e){this.codeWords=e},r.prototype.getMatrix=function(){return this.matrix},r.prototype.setMatrix=function(e){this.matrix=e},r}(),so=function(){function r(){}return r.singletonList=function(e){return[e]},r.min=function(e,t){return e.sort(t)[0]},r}(),Ud=function(){function r(e){this.previous=e}return r.prototype.getPrevious=function(){return this.previous},r}(),Hd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),yi=function(r){Hd(e,r);function e(t,n,i){var a=r.call(this,t)||this;return a.value=n,a.bitCount=i,a}return e.prototype.appendTo=function(t,n){t.appendBits(this.value,this.bitCount)},e.prototype.add=function(t,n){return new e(this,t,n)},e.prototype.addBinaryShift=function(t,n){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new e(this,t,n)},e.prototype.toString=function(){var t=this.value&(1<<this.bitCount)-1;return t|=1<<this.bitCount,"<"+q.toBinaryString(t|1<<this.bitCount).substring(1)+">"},e}(Ud),Gd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Xd=function(r){Gd(e,r);function e(t,n,i){var a=r.call(this,t,0,0)||this;return a.binaryShiftStart=n,a.binaryShiftByteCount=i,a}return e.prototype.appendTo=function(t,n){for(var i=0;i<this.binaryShiftByteCount;i++)(i===0||i===31&&this.binaryShiftByteCount<=62)&&(t.appendBits(31,5),this.binaryShiftByteCount>62?t.appendBits(this.binaryShiftByteCount-31,16):i===0?t.appendBits(Math.min(this.binaryShiftByteCount,31),5):t.appendBits(this.binaryShiftByteCount-31,5)),t.appendBits(n[this.binaryShiftStart+i],8)},e.prototype.addBinaryShift=function(t,n){return new e(this,t,n)},e.prototype.toString=function(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"},e}(yi);function $d(r,e,t){return new Xd(r,e,t)}function wr(r,e,t){return new yi(r,e,t)}var qd=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],ct=0,an=1,je=2,lo=3,rt=4,Wd=new yi(null,0,0),Ci=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])],jd=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function Yd(r){var e,t;try{for(var n=jd(r),i=n.next();!i.done;i=n.next()){var a=i.value;he.fill(a,-1)}}catch(o){e={error:o}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r[ct][rt]=0,r[an][rt]=0,r[an][ct]=28,r[lo][rt]=0,r[je][rt]=0,r[je][ct]=15,r}var uo=Yd(he.createInt32Array(6,6)),Zd=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Kd=function(){function r(e,t,n,i){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=i}return r.prototype.getMode=function(){return this.mode},r.prototype.getToken=function(){return this.token},r.prototype.getBinaryShiftByteCount=function(){return this.binaryShiftByteCount},r.prototype.getBitCount=function(){return this.bitCount},r.prototype.latchAndAppend=function(e,t){var n=this.bitCount,i=this.token;if(e!==this.mode){var a=Ci[this.mode][e];i=wr(i,a&65535,a>>16),n+=a>>16}var o=e===je?4:5;return i=wr(i,t,o),new r(i,e,0,n+o)},r.prototype.shiftAndAppend=function(e,t){var n=this.token,i=this.mode===je?4:5;return n=wr(n,uo[this.mode][e],i),n=wr(n,t,5),new r(n,this.mode,0,this.bitCount+i+5)},r.prototype.addBinaryShiftChar=function(e){var t=this.token,n=this.mode,i=this.bitCount;if(this.mode===rt||this.mode===je){var a=Ci[n][ct];t=wr(t,a&65535,a>>16),i+=a>>16,n=ct}var o=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,s=new r(t,n,this.binaryShiftByteCount+1,i+o);return s.binaryShiftByteCount===2078&&(s=s.endBinaryShift(e+1)),s},r.prototype.endBinaryShift=function(e){if(this.binaryShiftByteCount===0)return this;var t=this.token;return t=$d(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new r(t,this.mode,0,this.bitCount)},r.prototype.isBetterThanOrEqualTo=function(e){var t=this.bitCount+(Ci[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=r.calculateBinaryShiftCost(e)-r.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount},r.prototype.toBitArray=function(e){for(var t,n,i=[],a=this.endBinaryShift(e.length).token;a!==null;a=a.getPrevious())i.unshift(a);var o=new we;try{for(var s=Zd(i),l=s.next();!l.done;l=s.next()){var u=l.value;u.appendTo(o,e)}}catch(c){t={error:c}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},r.prototype.toString=function(){return Y.format("%s bits=%d bytes=%d",qd[this.mode],this.bitCount,this.binaryShiftByteCount)},r.calculateBinaryShiftCost=function(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0},r.INITIAL_STATE=new r(Wd,ct,0,0),r}();function Qd(r){var e=Y.getCharCode(" "),t=Y.getCharCode("."),n=Y.getCharCode(",");r[ct][e]=1;for(var i=Y.getCharCode("Z"),a=Y.getCharCode("A"),o=a;o<=i;o++)r[ct][o]=o-a+2;r[an][e]=1;for(var s=Y.getCharCode("z"),l=Y.getCharCode("a"),o=l;o<=s;o++)r[an][o]=o-l+2;r[je][e]=1;for(var u=Y.getCharCode("9"),c=Y.getCharCode("0"),o=c;o<=u;o++)r[je][o]=o-c+2;r[je][n]=12,r[je][t]=13;for(var d=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
254
|
+
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""],p=0;p<d.length;p++)r[lo][Y.getCharCode(d[p])]=p;for(var h=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"],p=0;p<h.length;p++)Y.getCharCode(h[p])>0&&(r[rt][Y.getCharCode(h[p])]=p);return r}var wi=Qd(he.createInt32Array(5,256)),on=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Jd=function(){function r(e){this.text=e}return r.prototype.encode=function(){for(var e=Y.getCharCode(" "),t=Y.getCharCode(`
|
|
255
|
+
`),n=so.singletonList(Kd.INITIAL_STATE),i=0;i<this.text.length;i++){var a=void 0,o=i+1<this.text.length?this.text[i+1]:0;switch(this.text[i]){case Y.getCharCode("\r"):a=o===t?2:0;break;case Y.getCharCode("."):a=o===e?3:0;break;case Y.getCharCode(","):a=o===e?4:0;break;case Y.getCharCode(":"):a=o===e?5:0;break;default:a=0}a>0?(n=r.updateStateListForPair(n,i,a),i++):n=this.updateStateListForChar(n,i)}var s=so.min(n,function(l,u){return l.getBitCount()-u.getBitCount()});return s.toBitArray(this.text)},r.prototype.updateStateListForChar=function(e,t){var n,i,a=[];try{for(var o=on(e),s=o.next();!s.done;s=o.next()){var l=s.value;this.updateStateForChar(l,t,a)}}catch(u){n={error:u}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r.simplifyStates(a)},r.prototype.updateStateForChar=function(e,t,n){for(var i=this.text[t]&255,a=wi[e.getMode()][i]>0,o=null,s=0;s<=rt;s++){var l=wi[s][i];if(l>0){if(o==null&&(o=e.endBinaryShift(t)),!a||s===e.getMode()||s===je){var u=o.latchAndAppend(s,l);n.push(u)}if(!a&&uo[e.getMode()][s]>=0){var c=o.shiftAndAppend(s,l);n.push(c)}}}if(e.getBinaryShiftByteCount()>0||wi[e.getMode()][i]===0){var d=e.addBinaryShiftChar(t);n.push(d)}},r.updateStateListForPair=function(e,t,n){var i,a,o=[];try{for(var s=on(e),l=s.next();!l.done;l=s.next()){var u=l.value;this.updateStateForPair(u,t,n,o)}}catch(c){i={error:c}}finally{try{l&&!l.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}return this.simplifyStates(o)},r.updateStateForPair=function(e,t,n,i){var a=e.endBinaryShift(t);if(i.push(a.latchAndAppend(rt,n)),e.getMode()!==rt&&i.push(a.shiftAndAppend(rt,n)),n===3||n===4){var o=a.latchAndAppend(je,16-n).latchAndAppend(je,1);i.push(o)}if(e.getBinaryShiftByteCount()>0){var s=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);i.push(s)}},r.simplifyStates=function(e){var t,n,i,a,o=[];try{for(var s=on(e),l=s.next();!l.done;l=s.next()){var u=l.value,c=!0,d=function(C){if(C.isBetterThanOrEqualTo(u))return c=!1,"break";u.isBetterThanOrEqualTo(C)&&(o=o.filter(function(w){return w!==C}))};try{for(var p=(i=void 0,on(o)),h=p.next();!h.done;h=p.next()){var g=h.value,x=d(g);if(x==="break")break}}catch(C){i={error:C}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}c&&o.push(u)}}catch(C){t={error:C}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},r}(),ef=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};(function(){function r(){}return r.encodeBytes=function(e){return r.encode(e,r.DEFAULT_EC_PERCENT,r.DEFAULT_AZTEC_LAYERS)},r.encode=function(e,t,n){var i=new Jd(e).encode(),a=q.truncDivision(i.getSize()*t,100)+11,o=i.getSize()+a,s,l,u,c,d;if(n!==r.DEFAULT_AZTEC_LAYERS){if(s=n<0,l=Math.abs(n),l>(s?r.MAX_NB_BITS_COMPACT:r.MAX_NB_BITS))throw new k(Y.format("Illegal value %s for layers",n));u=r.totalBitsInLayer(l,s),c=r.WORD_SIZE[l];var p=u-u%c;if(d=r.stuffBits(i,c),d.getSize()+a>p)throw new k("Data to large for user specified layer");if(s&&d.getSize()>c*64)throw new k("Data to large for user specified layer")}else{c=0,d=null;for(var h=0;;h++){if(h>r.MAX_NB_BITS)throw new k("Data too large for an Aztec code");if(s=h<=3,l=s?h+1:h,u=r.totalBitsInLayer(l,s),!(o>u)){(d==null||c!==r.WORD_SIZE[l])&&(c=r.WORD_SIZE[l],d=r.stuffBits(i,c));var p=u-u%c;if(!(s&&d.getSize()>c*64)&&d.getSize()+a<=p)break}}}var g=r.generateCheckWords(d,u,c),x=d.getSize()/c,C=r.generateModeMessage(s,l,x),w=(s?11:14)+l*4,m=new Int32Array(w),_;if(s){_=w;for(var h=0;h<m.length;h++)m[h]=h}else{_=w+1+2*q.truncDivision(q.truncDivision(w,2)-1,15);for(var E=q.truncDivision(w,2),S=q.truncDivision(_,2),h=0;h<E;h++){var T=h+q.truncDivision(h,15);m[E-h-1]=S-T-1,m[E+h]=S+T+1}}for(var D=new tt(_),h=0,M=0;h<l;h++){for(var P=(l-h)*4+(s?9:12),V=0;V<P;V++)for(var W=V*2,U=0;U<2;U++)g.get(M+W+U)&&D.set(m[h*2+U],m[h*2+V]),g.get(M+P*2+W+U)&&D.set(m[h*2+V],m[w-1-h*2-U]),g.get(M+P*4+W+U)&&D.set(m[w-1-h*2-U],m[w-1-h*2-V]),g.get(M+P*6+W+U)&&D.set(m[w-1-h*2-V],m[h*2+U]);M+=P*8}if(r.drawModeMessage(D,s,_,C),s)r.drawBullsEye(D,q.truncDivision(_,2),5);else{r.drawBullsEye(D,q.truncDivision(_,2),7);for(var h=0,V=0;h<q.truncDivision(w,2)-1;h+=15,V+=16)for(var U=q.truncDivision(_,2)&1;U<_;U+=2)D.set(q.truncDivision(_,2)-V,U),D.set(q.truncDivision(_,2)+V,U),D.set(U,q.truncDivision(_,2)-V),D.set(U,q.truncDivision(_,2)+V)}var J=new Rd;return J.setCompact(s),J.setSize(_),J.setLayers(l),J.setCodeWords(x),J.setMatrix(D),J},r.drawBullsEye=function(e,t,n){for(var i=0;i<n;i+=2)for(var a=t-i;a<=t+i;a++)e.set(a,t-i),e.set(a,t+i),e.set(t-i,a),e.set(t+i,a);e.set(t-n,t-n),e.set(t-n+1,t-n),e.set(t-n,t-n+1),e.set(t+n,t-n),e.set(t+n,t-n+1),e.set(t+n,t+n-1)},r.generateModeMessage=function(e,t,n){var i=new we;return e?(i.appendBits(t-1,2),i.appendBits(n-1,6),i=r.generateCheckWords(i,28,4)):(i.appendBits(t-1,5),i.appendBits(n-1,11),i=r.generateCheckWords(i,40,4)),i},r.drawModeMessage=function(e,t,n,i){var a=q.truncDivision(n,2);if(t)for(var o=0;o<7;o++){var s=a-3+o;i.get(o)&&e.set(s,a-5),i.get(o+7)&&e.set(a+5,s),i.get(20-o)&&e.set(s,a+5),i.get(27-o)&&e.set(a-5,s)}else for(var o=0;o<10;o++){var s=a-5+o+q.truncDivision(o,5);i.get(o)&&e.set(s,a-7),i.get(o+10)&&e.set(a+7,s),i.get(29-o)&&e.set(s,a+7),i.get(39-o)&&e.set(a-7,s)}},r.generateCheckWords=function(e,t,n){var i,a,o=e.getSize()/n,s=new Ya(r.getGF(n)),l=q.truncDivision(t,n),u=r.bitsToWords(e,n,l);s.encode(u,l-o);var c=t%n,d=new we;d.appendBits(0,c);try{for(var p=ef(Array.from(u)),h=p.next();!h.done;h=p.next()){var g=h.value;d.appendBits(g,n)}}catch(x){i={error:x}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}return d},r.bitsToWords=function(e,t,n){var i=new Int32Array(n),a,o;for(a=0,o=e.getSize()/t;a<o;a++){for(var s=0,l=0;l<t;l++)s|=e.get(a*t+l)?1<<t-l-1:0;i[a]=s}return i},r.getGF=function(e){switch(e){case 4:return He.AZTEC_PARAM;case 6:return He.AZTEC_DATA_6;case 8:return He.AZTEC_DATA_8;case 10:return He.AZTEC_DATA_10;case 12:return He.AZTEC_DATA_12;default:throw new k("Unsupported word size "+e)}},r.stuffBits=function(e,t){for(var n=new we,i=e.getSize(),a=(1<<t)-2,o=0;o<i;o+=t){for(var s=0,l=0;l<t;l++)(o+l>=i||e.get(o+l))&&(s|=1<<t-1-l);(s&a)===a?(n.appendBits(s&a,t),o--):(s&a)===0?(n.appendBits(s|1,t),o--):n.appendBits(s,t)}return n},r.totalBitsInLayer=function(e,t){return((t?88:112)+16*e)*e},r.DEFAULT_EC_PERCENT=33,r.DEFAULT_AZTEC_LAYERS=0,r.MAX_NB_BITS=32,r.MAX_NB_BITS_COMPACT=4,r.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]),r})();const tf=new Map([[ji.DecodeHintType.POSSIBLE_FORMATS,[B.AZTEC,B.CODABAR,B.CODE_39,B.CODE_93,B.CODE_128,B.DATA_MATRIX,B.EAN_8,B.EAN_13,B.ITF,B.MAXICODE,B.PDF_417,B.QR_CODE,B.RSS_14,B.RSS_EXPANDED,B.UPC_A,B.UPC_E,B.UPC_EAN_EXTENSION]]]),sn=A.memo(r=>{const{children:e,open:t,onOpenChange:n,defaultOpen:i,modal:a,...o}=r;return f.jsxs(v.Overlay.Root,{open:t,onOpenChange:n,defaultOpen:i,modal:a,children:[!!e&&f.jsx(v.Overlay.Trigger,{asChild:!0,children:e}),f.jsxs(v.Overlay.Content,{children:[f.jsx(v.Overlay.Title,{className:"sr-only",children:"Scanner"}),f.jsx(v.Overlay.Description,{className:"sr-only",children:"Scan a barcode or a qr code."}),f.jsx(co,{...o})]})]})});sn.displayName="Scanner";const co=A.memo(r=>{const{paused:e,timeBetweenDecodingAttempts:t,onDecodeResult:n,onDecodeError:i,onError:a}=r,{ref:o}=ji.useZxing({paused:e,timeBetweenDecodingAttempts:t,onDecodeResult:n,onDecodeError:i,onError:a,hints:tf});return f.jsxs("div",{className:"flex size-full flex-col justify-center overflow-hidden bg-(--color-background)",children:[f.jsx("div",{className:"flex w-full justify-end p-4",children:f.jsx(v.Overlay.Close,{asChild:!0,children:f.jsx(v.IconButton,{"aria-label":"close",variant:"soft",accentColor:"base",children:f.jsx(v.LuIcon,{icon:nt})})})}),f.jsx("div",{className:"grow w-full max-h-full overflow-hidden p-4",children:f.jsx("video",{className:"size-full",ref:o})})]})});co.displayName="ScannerInternal";const fo=A.memo(r=>{const{children:e}=r,[t,n]=A.useState(null),i=A.useCallback(()=>{n(null)},[]),a=A.useCallback(s=>{n(s(i))},[i]),o=A.useCallback(()=>{t&&(t.onClose&&t.onClose(),i())},[i,t]);return f.jsxs(pa.Provider,{value:a,children:[e,t&&f.jsx(sn,{open:!0,onOpenChange:o,...t})]})});fo.displayName="FileViewerProvider";const mi=A.memo(r=>{const[{inputId:e,labelId:t,label:n,helpText:i,size:a,severity:o,showInputOnly:s,field:l,fieldProps:u,helpers:c,touched:d},{disabled:p}]=be(r),{name:h,onBlur:g,onChange:x,value:C}=u,[w,m]=A.useState(!1),_=s?null:i,E=s?"":n,[S,T]=A.useState("");A.useEffect(()=>{T(C)},[C]);const D=A.useCallback(U=>{const J=U.target.value;T(J),(d||!l.onlyValidateAfterTouched)&&c.setError(l.getError(J))},[l,c,d]),M=A.useCallback(()=>{x(S),g(S)},[S,g,x]),P=A.useCallback(U=>{x(U.getText()),m(!1)},[x]),V=A.useCallback(()=>{m(!0)},[]),W=A.useCallback(()=>{m(!1),g(C)},[g,C]);return f.jsx(Oe,{helpText:_,severity:o,children:f.jsxs(Se,{size:a,severity:o,inputId:e,labelId:t,label:E,image:s?void 0:l.image,className:"flex-col items-start justify-start gap-2",children:[f.jsx(v.TextArea,{className:"w-full field-sizing-content",accentColor:"base",variant:"surface",size:"sm",id:e,name:h,value:S,placeholder:"Enter a qr or barcode",onChange:D,onBlur:M,disabled:p}),f.jsxs(v.Button,{onClick:V,className:"w-max",type:"button",variant:"soft",size:"sm",accentColor:"base",disabled:p,children:[f.jsx(v.LuIcon,{icon:ol}),"Scan"]}),f.jsx(sn,{open:w,onDecodeResult:P,onOpenChange:W})]})})});mi.displayName="QrInput";const ir=class ir extends Ve{constructor(t){super(t);b(this,"type","qr");b(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new ir({...this.getOptions(),identifier:t})}setOptions(t){super.setOptions(t)}static deserialize(t){return new ir(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(mi,{...t,field:this})}isSerializedValueValid(t){return typeof t=="string"}isValueValid(t){return typeof t=="string"}blankValue(){return""}areValuesEqual(t,n){return t===n}};b(ir,"fieldTypeName","Scan"),b(ir,"fieldTypeDescription","Used for scanning/reading QR and barcodes.");let mr=ir;const ln=500,_i=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:d},{disabled:p}]=be(r),{name:h,onBlur:g,onChange:x,value:C}=u,w=a?null:s,m=a?"":l,[_,E]=A.useState("");A.useEffect(()=>{E(C)},[C]);const S=A.useCallback(D=>{const M=D.target.value;E(M),(c||!o.onlyValidateAfterTouched)&&d.setError(o.getError(M))},[o,d,c]),T=A.useCallback(()=>{x(_),g(_)},[_,g,x]);return f.jsx(Oe,{helpText:w,severity:i,children:f.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:m,image:a?void 0:o.image,children:f.jsx(v.Input.Root,{accentColor:"base",variant:"surface",size:"sm",children:f.jsx(v.Input.Field,{id:e,className:"truncate",name:h,value:_,type:"text",placeholder:o.placeholder,onChange:S,onBlur:T,disabled:p})})})})});_i.displayName="StringInput";const ar=class ar extends Pn{constructor(t){const{...n}=t,i=t.maxLength?Math.min(ln,t.maxLength):ln,a=t.minLength?Math.min(t.minLength,i):void 0;super({...n,maxLength:i,minLength:a});b(this,"type","string")}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new ar({...this.getOptions(),identifier:t})}setOptions(t){super.setOptions(t)}static deserialize(t){const{maximum_length:n,minimum_length:i,...a}=t;return new ar({...a,maxLength:n,minLength:i,placeholder:"Enter a short description"})}render(t){return f.jsx(_i,{field:this,...t})}};b(ar,"fieldTypeName","Short Text"),b(ar,"fieldTypeDescription",`Short text fields can hold up to ${ln} characters on a single line.`);let Xt=ar;const Ai=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:d},{disabled:p}]=be(r),{name:h,onBlur:g,onChange:x,value:C}=u,w=a?null:s,m=a?"":l,[_,E]=A.useState("");A.useEffect(()=>{E(C)},[C]);const S=A.useCallback(D=>{const M=D.target.value;E(M),(c||!o.onlyValidateAfterTouched)&&d.setError(o.getError(M))},[o,d,c]),T=A.useCallback(()=>{x(_),g(_)},[_,g,x]);return f.jsx(Oe,{helpText:w,severity:i,children:f.jsx(Se,{size:n,severity:i,inputId:e,labelId:t,label:m,image:a?void 0:o.image,children:f.jsx(v.TextArea,{id:e,value:_,name:h,onChange:S,onBlur:T,className:"field-sizing-content min-h-12",placeholder:o.placeholder,resize:"vertical",accentColor:"base",variant:"surface",size:"sm",disabled:p})})})});Ai.displayName="TextInput";const or=class or extends Pn{constructor(t){const n=t.maxLength?Math.min(Dt,t.maxLength):Dt,i=t.minLength?Math.min(t.minLength,n):void 0;super({...t,maxLength:n,minLength:i});b(this,"type","text")}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new or({...this.getOptions(),identifier:t})}setOptions(t){super.setOptions(t)}static deserialize(t){const{maximum_length:n,minimum_length:i,...a}=t;return new or({...a,maxLength:n,minLength:i,placeholder:"Enter a description"})}render(t){return f.jsx(Ai,{field:this,...t})}};b(or,"fieldTypeName","Paragraph"),b(or,"fieldTypeDescription",`Paragraph fields can hold up to ${Dt} characters and can have multiple lines.`);let $t=or;const Ei=A.memo(r=>{var M;const[{inputId:e,labelId:t,label:n,size:i,severity:a,helpText:o,showInputOnly:s,field:l,fieldProps:u},{disabled:c}]=be(r),{value:d,name:p,onChange:h,onBlur:g}=u,x=A.useRef(null),C=A.useMemo(()=>s?null:o||(l.maxFileSize?`Maximum file size: ${l.maxFileSize}MB`:null),[l.maxFileSize,o,s]),w=A.useCallback(()=>{var P;(P=x.current)==null||P.click()},[]),m=A.useCallback(()=>{if(!x.current)return;const P=x.current.files;if(!P){g([]);return}const V=Array.from(P).map(U=>at.from(H.v4(),U)),W=[...d,...V];h(W),g(W)},[g,h,d]),_=A.useCallback(P=>{const V=[...d];V.splice(P,1),h(V)},[d,h]);A.useEffect(()=>{if(!x.current)return;const P=new AbortController;return x.current.addEventListener("cancel",()=>{g([...d])},{signal:P.signal}),()=>{P.abort()}},[g,d]);const E=s?"":n,D=l.maxFiles>1?"Select files":"Select a file";return f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx(Oe,{helpText:C,severity:a,children:f.jsxs(Se,{size:i,severity:a,inputId:e,labelId:t,label:E,image:s?void 0:l.image,children:[f.jsxs(v.Button,{className:"w-max",size:"sm",variant:"soft",accentColor:"base",onClick:w,type:"button",disabled:c,children:[f.jsx(v.LuIcon,{icon:Sn}),D]}),f.jsx("input",{id:e,name:p,type:"file",ref:x,accept:(M=l.extensions)==null?void 0:M.join(","),multiple:l.maxFiles>1,className:"hidden",onChange:m,value:""})]})}),Array.isArray(d)&&d.length>0&&f.jsx("div",{className:"flex h-max flex-col gap-2",children:d.map((P,V)=>f.jsx(kn,{file:P,onRemove:()=>{_(V)},disabled:c},V))})]})});Ei.displayName="UploadInput";const sr=class sr extends Ve{constructor(t){const{extensions:n,maximum_files:i,maximum_size:a,...o}=t;super(o);b(this,"type","upload");b(this,"extensions");b(this,"maxFileSize");b(this,"maxFiles");b(this,"onlyValidateAfterTouched",!1);this.maxFileSize=typeof a=="number"?a:void 0,this.maxFiles=Math.max(typeof i=="number"?i:1,1),this.extensions=n}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new $e({label:"How many files can be uploaded?",description:"By default, only one file can be uploaded.",required:!1,minimum:1,maximum:10,identifier:`${n}maximum_files`,integers:!0}),showDirectly:!1},{field:new $e({label:"What is the maximum size of each file?",description:`Maximum file size in megabytes (between 1MB–${Wt}MB).`,required:!1,identifier:`${n}maximum_size`,minimum:1,maximum:Wt,integers:!0}),showDirectly:!1},{field:new it({label:"Accepted file types",description:"Types of allowed files to upload. If left blank, all files will be accepted.",required:!1,identifier:`${n}extensions`,options:[{value:"image/*",label:"Images"},{value:"audio/*",label:"Audio files"},{value:"video/*",label:"Videos"},{value:"text/*",label:"Text files"},{value:"application/*",label:"Application files (includes PDFs and Word documents)"}]}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.maxFileSize??Wt,i=n*1e3*1e3,a=this.maxFiles||1;return t.push(o=>{if(o&&o.some(s=>s instanceof at&&s.size>i))return`Files must be at most ${n}MB.`}),t.push(o=>{if(o&&o.length>a)return`You can only upload ${a} files.`}),t}serialize(){return{...super.serialize(),extensions:this.extensions,maximum_size:this.maxFileSize,maximum_files:this.maxFiles}}getOptions(){return{...super.getOptions(),extensions:this.extensions,maximum_size:this.maxFileSize,maximum_files:this.maxFiles}}duplicate(t){return new sr({...this.getOptions(),identifier:t})}setOptions(t){const{extensions:n,maximum_files:i,maximum_size:a,...o}=t;this.maxFileSize=typeof a=="number"?a:this.maxFileSize,this.maxFiles=typeof i=="number"?i:this.maxFiles,this.extensions=n,super.setOptions(o)}static deserialize(t){return new sr(t)}serializeValue(t){return[]}deserializeValue(t){return[]}render(t){return f.jsx(Ei,{field:this,...t})}isSerializedValueValid(t){return Array.isArray(t)&&t.length===0}isValueValid(t){return Array.isArray(t)?t.every(n=>n instanceof Vt||n instanceof at):!1}areValuesEqual(t,n){return qr(t,n)}blankValue(){return[]}};b(sr,"fieldTypeName","Upload"),b(sr,"fieldTypeDescription","Allows a file to be uploaded.");let qt=sr;const un={date:fr,number:$e,boolean:Tt,select:vt,string:Xt,text:$t,upload:qt,qr:mr,"multi-string":Nt,"multi-select":it,radio:Lt,"checkbox-list":Mt,"pass-fail":Bt,otp:Pt,rating:zt},fe={boolean:cl,date:Hs,"multi-string":al,number:el,qr:ll,"multi-select":nl,select:il,string:fl,text:ks,upload:Sn,section:rl,radio:Xs,"checkbox-list":Ys,"pass-fail":Ws,otp:sl,rating:ia},Wt=50,ho=Wt*1e3,po=ho*1e3;class j{constructor(e){b(this,"id");b(this,"label");b(this,"getApplyFn");b(this,"serialize");b(this,"deserialize");const{id:t,getApplyFn:n,label:i,serialize:a,deserialize:o}=e;this.id=t,this.getApplyFn=n,this.label=i,this.serialize=a,this.deserialize=o}static create(e){return new j(e)}}const vo=j.create({id:"nullable-boolean-equals",label:"is",getApplyFn:r=>e=>e===r,serialize:r=>r,deserialize:r=>r}),go=j.create({id:"nullable-boolean-not-equals",label:"is not",getApplyFn:r=>e=>e!==r,serialize:r=>r,deserialize:r=>r}),xo=j.create({id:"date-equals",getApplyFn:r=>e=>e.getTime()===r.getTime(),label:"is",serialize:r=>r.toISOString(),deserialize:r=>new Date(r)}),yo=j.create({id:"date-not-equals",getApplyFn:r=>e=>e.getTime()!==r.getTime(),label:"is not",serialize:r=>r.toISOString(),deserialize:r=>new Date(r)}),Co=j.create({id:"date-before",getApplyFn:r=>e=>e.getTime()<r.getTime(),label:"before",serialize:r=>r.toISOString(),deserialize:r=>new Date(r)}),wo=j.create({id:"date-after",label:"after",getApplyFn:r=>e=>e.getTime()>r.getTime(),serialize:r=>r.toISOString(),deserialize:r=>new Date(r)}),mo=j.create({id:"date-range-in",label:"in between",getApplyFn:r=>e=>!(r!=null&&r.from&&r.from.getTime()>e.getTime()||r!=null&&r.to&&r.to.getTime()<e.getTime()),serialize:r=>{var e,t;return{from:((e=r.from)==null?void 0:e.toISOString())??null,to:((t=r.to)==null?void 0:t.toISOString())??null}},deserialize:r=>({from:r.from?new Date(r.from):void 0,to:r.to?new Date(r.to):void 0})}),_o=j.create({id:"date-range-not-in",label:"not in between",getApplyFn:r=>e=>!!(r!=null&&r.from&&r.from.getTime()>e.getTime()||r!=null&&r.to&&r.to.getTime()<e.getTime()),serialize:r=>{var e,t;return{from:((e=r.from)==null?void 0:e.toISOString())??null,to:((t=r.to)==null?void 0:t.toISOString())??null}},deserialize:r=>({from:r.from?new Date(r.from):void 0,to:r.to?new Date(r.to):void 0})}),Ao=j.create({id:"has-files",label:"is",getApplyFn:r=>e=>e.length>0,serialize:r=>r,deserialize:r=>r}),Eo=j.create({id:"does-not-have-files",label:"is not",getApplyFn:r=>e=>e.length===0,serialize:r=>r,deserialize:r=>r}),Ii=j.create({id:"number-equals",getApplyFn:r=>e=>e===r,label:"is",serialize:r=>r,deserialize:r=>r}),Si=j.create({id:"number-not-equals",getApplyFn:r=>e=>e!==r,label:"is not",serialize:r=>r,deserialize:r=>r}),Oi=j.create({id:"number-less-than",getApplyFn:r=>e=>e<r,label:"is less than",serialize:r=>r,deserialize:r=>r}),bi=j.create({id:"number-less-than-or-equals",getApplyFn:r=>e=>e<=r,label:"is less than or equal to",serialize:r=>r,deserialize:r=>r}),Ni=j.create({id:"number-greater-than",getApplyFn:r=>e=>e>r,label:"is greater than",serialize:r=>r,deserialize:r=>r}),Ti=j.create({id:"number-greater-than-or-equals",getApplyFn:r=>e=>e>=r,label:"is greater than or equal to",serialize:r=>r,deserialize:r=>r}),Di=j.create({id:"number-range-in",getApplyFn:r=>e=>!(r.to&&e>r.to||r.from&&e<r.from),label:"is between",serialize:r=>r,deserialize:r=>r}),Mi=j.create({id:"number-range-not-in",getApplyFn:r=>e=>!!(r.to&&e>r.to||r.from&&e<r.from),label:"is not between",serialize:r=>r,deserialize:r=>r}),Io=j.create({id:"pass-fail-equals",getApplyFn:r=>e=>e===r,label:"is",serialize:r=>r,deserialize:r=>r}),So=j.create({id:"pass-fail-not-equals",getApplyFn:r=>e=>e!==r,label:"is not",serialize:r=>r,deserialize:r=>r}),Oo=j.create({id:"pass-fail-array-includes",getApplyFn:r=>{const e=new Set(r);return t=>e.has(t)},label:"is any of",serialize:r=>r,deserialize:r=>r}),bo=j.create({id:"pass-fail-array-excludes",getApplyFn:r=>{const e=new Set(r);return t=>!e.has(t)},label:"is none of",serialize:r=>r,deserialize:r=>r}),_t=j.create({id:"nullable-string-equals",getApplyFn:r=>e=>e===r,label:"is",serialize:r=>r,deserialize:r=>r}),At=j.create({id:"nullable-string-not-equals",getApplyFn:r=>e=>e!==r,label:"is not",serialize:r=>r,deserialize:r=>r}),_r=j.create({id:"string-includes",getApplyFn:r=>e=>e.includes(r),label:"includes",serialize:r=>r,deserialize:r=>r}),Ar=j.create({id:"string-excludes",getApplyFn:r=>e=>!e.includes(r),label:"does not include",serialize:r=>r,deserialize:r=>r}),Pi=j.create({id:"string-array-includes",getApplyFn:r=>{const e=new Set(r);return t=>e.has(t)},label:"is any of",serialize:r=>r,deserialize:r=>r}),Fi=j.create({id:"string-array-excludes",getApplyFn:r=>{const e=new Set(r);return t=>!e.has(t)},label:"is none of",serialize:r=>r,deserialize:r=>r}),cn=j.create({id:"string-array-every",getApplyFn:r=>{const e=new Set(r);return t=>{const n=new Set(t);return e.isSubsetOf(n)}},label:"has all of",serialize:r=>r,deserialize:r=>r}),dn=j.create({id:"string-array-some",getApplyFn:r=>{const e=new Set(r);return t=>{const n=new Set(t);return!e.isDisjointFrom(n)}},label:"has any of",serialize:r=>r,deserialize:r=>r}),fn=j.create({id:"string-array-none",getApplyFn:r=>{const e=new Set(r);return t=>{const n=new Set(t);return e.isDisjointFrom(n)}},label:"has none of",serialize:r=>r,deserialize:r=>r}),hn=j.create({id:"string-array-equals",getApplyFn:r=>{const e=new Set(r);return t=>{const n=new Set(t);return e.size===n.size&&n.isSubsetOf(e)}},label:"is",serialize:r=>r,deserialize:r=>r}),pn=j.create({id:"string-array-not-equals",getApplyFn:r=>{const e=new Set(r);return t=>{const n=new Set(t);return e.size!==n.size||!n.isSubsetOf(e)}},label:"is not",serialize:r=>r,deserialize:r=>r}),L=r=>r;class De extends ur{constructor(t){const{id:n,field:i,conditionValue:a,conditionModifier:o}=t;super();b(this,"id");b(this,"conditionValue");b(this,"conditionModifier");b(this,"field");b(this,"getConditionValue",()=>this.conditionValue);b(this,"setConditionValue",t=>{const n=this.modifiers[this.conditionModifier];t!==void 0&&!n.isConditionValueValid(t)||(this.conditionValue=t,this.notify(this))});b(this,"getConditionModifier",()=>this.conditionModifier);b(this,"setConditionModifier",t=>{const n=this.modifiers[t],i=this.getConditionValue();i&&!n.isConditionValueValid(i)&&(this.conditionValue=void 0),this.conditionModifier=t,this.notify(this)});b(this,"getConditionModifiers",()=>Object.entries(this.modifiers));b(this,"accessorFn",t=>t[this.field.identifier]);b(this,"getApplyFn",()=>{const t=this.modifiers[this.conditionModifier],n=this.getConditionValue(),i=n!==void 0&&t.isConditionValueValid(n),a=i?t.modifier.getApplyFn(n):null;return o=>{if(!i)return!0;const s=this.transformValue(o);return t.isValueValid(s)?a(s):!1}});this.id=n,this.field=i,this.conditionValue=a,this.conditionModifier=o}serialize(){return{id:this.id,type:this.field.type,fieldId:this.field.identifier,conditionValue:this.conditionValue!==void 0?this.modifiers[this.conditionModifier].modifier.serialize(this.conditionValue):void 0,conditionModifier:this.conditionModifier}}transformValue(t){return t}}const vn="form-builder",Me="Unlabelled",No="Unlabelled",To=A.memo,Et=To(function(r){const{ref:e,children:t,...n}=r,i=A.useCallback(a=>typeof t=="function"?f.jsxs(f.Fragment,{children:[t(a),f.jsx(v.Menu.SelectedIndicator,{className:"ml-[auto]",children:f.jsx(v.LuIcon,{icon:Xe})})]}):f.jsxs(f.Fragment,{children:[t,f.jsx(v.Menu.SelectedIndicator,{className:"ml-[auto]",children:f.jsx(v.LuIcon,{icon:Xe})})]}),[t]);return f.jsx(v.Menu.SelectItem,{ref:e,...n,children:i})}),Do=To(function(r){const{ref:e,children:t,...n}=r,i=A.useCallback(a=>typeof t=="function"?f.jsxs(f.Fragment,{children:[t(a),f.jsx(v.Menu.SelectedIndicator,{className:"ml-auto",children:f.jsx(v.LuIcon,{icon:Xe})})]}):f.jsxs(f.Fragment,{children:[t,f.jsx(v.Menu.SelectedIndicator,{className:"ml-auto",children:f.jsx(v.LuIcon,{icon:Xe})})]}),[t]);return f.jsx(v.Menu.MultiSelectItem,{ref:e,...n,children:i})}),Vi=A.memo(r=>{const{ref:e,children:t,...n}=r,i=A.useCallback(a=>typeof t=="function"?f.jsxs(f.Fragment,{children:[t(a),f.jsx(v.Menu.CheckboxItemIndicator,{className:"ml-[auto]",children:o=>o?f.jsx(v.LuIcon,{icon:Gr}):f.jsx(v.LuIcon,{icon:Xe})})]}):f.jsxs(f.Fragment,{children:[t,f.jsx(v.Menu.CheckboxItemIndicator,{className:"ml-[auto]",children:o=>o?f.jsx(v.LuIcon,{icon:Gr}):f.jsx(v.LuIcon,{icon:Xe})})]}),[t]);return f.jsx(v.Menu.SelectAllItem,{ref:e,...n,children:i})});Vi.displayName="SelectAllItemTemplate";const ke=r=>{const{children:e,condition:t,size:n="sm",variant:i,accentColor:a,radius:o}=r,s=A.useCallback(l=>{t.setConditionModifier(l)},[t]);return f.jsxs(v.Menu.Root,{align:"start",children:[f.jsx(v.Menu.ClickTrigger,{children:e}),f.jsx(v.Menu.Content,{size:n,variant:i,radius:o,accentColor:a,children:f.jsx(v.Menu.SelectGroup,{required:!0,value:t.getConditionModifier(),onValueChange:s,children:t.getConditionModifiers().map(([l,u])=>f.jsx(Et,{value:l,children:u.modifier.label},l))})})]})},gn=A.memo(r=>{const{children:e,open:t,onOpenChange:n,defaultOpen:i,modal:a,size:o,align:s,accentColor:l="base",...u}=r;return f.jsxs(v.Popover.Root,{open:t,onOpenChange:n,defaultOpen:i,modal:a,children:[f.jsx(v.Popover.Trigger,{asChild:!0,children:e}),f.jsx(v.Popover.Content,{size:o,align:s,children:f.jsx(v.DayPicker,{size:o,accentColor:l,...u})})]})});gn.displayName="DayPickerPopover";const Mo=A.memo(r=>{const{children:e,open:t,onOpenChange:n,defaultOpen:i,modal:a,size:o,accentColor:s="base",values:l,onValuesChange:u,placeholder:c="Enter text",...d}=r,[p,h]=A.useState(""),g=A.useCallback(m=>{h(m.target.value)},[]),x=A.useCallback(m=>{m.key==="Enter"&&(m.preventDefault(),m.stopPropagation(),u([...l,p]),h(""))},[p,u,l]),C=A.useCallback(()=>{u([...l,p]),h("")},[p,u,l]),w=A.useCallback(m=>{const _=[...l];_.splice(m,1),u(_)},[u,l]);return f.jsxs(v.Popover.Root,{open:t,onOpenChange:n,defaultOpen:i,modal:a,children:[f.jsx(v.Popover.Trigger,{asChild:!0,children:e}),f.jsx(v.Popover.Content,{size:o,onClick:v.stopPropagation,accentColor:s,...d,children:f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsxs("div",{className:"flex gap-2",children:[f.jsx(v.Input.Root,{className:"grow",accentColor:"base",variant:"outline",size:"sm",children:f.jsx(v.Input.Field,{value:p,onChange:g,onKeyDown:x,placeholder:c,...d})}),f.jsx(v.IconButton,{size:"sm",accentColor:"base",variant:"soft",type:"button",onClick:C,children:f.jsx(v.LuIcon,{icon:Ze})})]}),l.length>0&&f.jsx("div",{className:"flex flex-col gap-1",children:l.map((m,_)=>f.jsxs(v.Badge,{className:"flex items-center justify-between gap-2",accentColor:"base",size:"sm",variant:"soft",children:[f.jsx("span",{className:"truncate",children:m}),f.jsx(v.IconButton,{size:"xs",variant:"ghost",type:"button",accentColor:"base",onClick:()=>{w(_)},children:f.jsx(v.LuIcon,{icon:nt})})]},`${m}-${_}`))})]})})]})});Mo.displayName="NumberInputPopover";const It=A.memo(r=>{const{children:e,open:t,onOpenChange:n,defaultOpen:i,modal:a,size:o,accentColor:s="base",value:l,onValueChange:u,placeholder:c="Enter a number",...d}=r,[p,h]=A.useState(null);A.useEffect(()=>{l!==void 0&&h(l)},[l]);const g=A.useCallback(C=>{const w=C.target.valueAsNumber;h(isNaN(w)?null:w)},[]),x=A.useCallback(C=>{const w=C.target.valueAsNumber;u==null||u(isNaN(w)?null:w)},[u]);return f.jsxs(v.Popover.Root,{open:t,onOpenChange:n,defaultOpen:i,modal:a,children:[f.jsx(v.Popover.Trigger,{asChild:!0,children:e}),f.jsx(v.Popover.Content,{size:o,onClick:v.stopPropagation,...d,children:f.jsx(v.Input.Root,{size:o,accentColor:s,children:f.jsx(v.Input.Field,{placeholder:c,type:"number",value:p??"",onChange:g,onBlur:x})})})]})});It.displayName="NumberInputPopover";const Pe=r=>{const{condition:e,onClick:t,...n}=r,i=A.useCallback(()=>{t(e)},[e,t]);return f.jsx(v.IconButton,{onClick:i,...n,children:f.jsx(v.LuIcon,{icon:nt})})};Pe.displayName="RemoveConditionButton";const Er=A.memo(r=>{const{ref:e,selectFieldOptions:t,...n}=r,i=A.useMemo(()=>t.map(a=>typeof a=="string"?{value:a,label:a}:a),[t]);return f.jsxs(v.Menu.MultiSelectGroup,{ref:e,...n,children:[f.jsx(Vi,{children:"Select all"}),i.map(a=>f.jsx(Do,{value:a.value,children:f.jsx("span",{className:"truncate",children:a.label})},a.value))]})});Er.displayName="SelectFieldOptionMultiSelectGroup";const Bi=A.memo(r=>{const{ref:e,selectFieldOptions:t,...n}=r,i=A.useMemo(()=>t.map(a=>typeof a=="string"?{value:a,label:a}:a),[t]);return f.jsx(v.Menu.SelectGroup,{ref:e,...n,children:i.map(a=>f.jsx(Et,{value:a.value,children:f.jsx("span",{className:"truncate",children:a.label})},a.value))})});Bi.displayName="SelectFieldOptionSelectGroup";const Ir=A.memo(r=>{const{children:e,open:t,onOpenChange:n,defaultOpen:i,modal:a,size:o,accentColor:s="base",value:l,onValueChange:u,placeholder:c="Enter text",...d}=r,[p,h]=A.useState(""),g=A.useCallback(C=>{h(C.target.value)},[]),x=A.useCallback(C=>{const w=C.target.value;u==null||u(w)},[u]);return A.useEffect(()=>{l&&h(l)},[l]),f.jsxs(v.Popover.Root,{open:t,onOpenChange:n,defaultOpen:i,modal:a,children:[f.jsx(v.Popover.Trigger,{asChild:!0,children:e}),f.jsx(v.Popover.Content,{size:o,onClick:v.stopPropagation,...d,children:f.jsx(v.Input.Root,{size:o,accentColor:s,children:f.jsx(v.Input.Field,{placeholder:c,type:"text",value:p,onChange:g,onBlur:x})})})]})});Ir.displayName="TextInputPopover";const Po=r=>{const{condition:e,onRemove:t}=r,n=e.getConditionValue(),i=e.getConditionModifier(),a=()=>{switch(n){case void 0:return"...";case!0:return"true";case!1:return"false";case null:return"empty"}};return f.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[f.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:fe[e.field.type]}),f.jsx("span",{className:"truncate",children:e.field.label||Me})]}),f.jsx(ke,{condition:e,children:f.jsx(v.Button,{type:"button",children:e.modifiers[i].modifier.label})}),f.jsxs(v.Menu.Root,{children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:a()})}),f.jsx(v.Menu.Content,{size:"sm",children:f.jsxs(v.Menu.SelectGroup,{required:!0,value:n,onValueChange:e.setConditionValue,children:[f.jsx(Et,{value:!0,children:"true"}),f.jsx(Et,{value:!1,children:"false"})]})})]}),f.jsx(Pe,{condition:e,onClick:t})]})},Fo={equals:L({modifier:vo,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:go,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class Sr extends De{constructor(t){super(t);b(this,"modifiers",Fo)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=Fo[a];let l;return i!==void 0&&(l=s.modifier.deserialize(i)),new Sr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return f.jsx(Po,{condition:this,...t},this.id)}}const Vo=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=A.useCallback(l=>{l.length>0?e.setConditionValue(l):e.setConditionValue(void 0)},[e]),s=()=>{if(i===void 0)return"...";if(i===null)return"empty";switch(i.length){case 0:return"...";default:return`${i.length} options`}};return f.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"soft",accentColor:"base",children:[f.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"soft",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:fe[n.type]}),f.jsx("span",{className:"truncate",children:n.label||Me})]}),f.jsx(ke,{condition:e,children:f.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),f.jsxs(v.Menu.Root,{children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsx(v.Button,{type:"button",className:"truncate",children:s()})}),f.jsx(v.Menu.Content,{size:"sm",children:f.jsx(Er,{values:i??[],selectFieldOptions:e.field.options,onValuesChange:o})})]}),f.jsx(Pe,{condition:e,onClick:t})]})},Bo={equals:L({modifier:hn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:pn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),every:L({modifier:cn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),some:L({modifier:dn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),none:L({modifier:fn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class Or extends De{constructor(t){super(t);b(this,"modifiers",Bo)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=Bo[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Or({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return f.jsx(Vo,{condition:this,...t},this.id)}}class xn extends ur{constructor(t){super();b(this,"conditions");b(this,"conditionObserver",()=>{this.conditions=[...this.conditions],this.notify(this)});b(this,"initConditions",t=>{for(const n of t)n.observe(this.conditionObserver);return t});this.conditions=this.initConditions(t)}getConditions(){return this.conditions}addCondition(t){this.conditions=this.initConditions([...this.conditions,t]),this.notify(this)}addConditions(t){this.conditions=this.initConditions([...this.conditions,...t]),this.notify(this)}removeCondition(t){this.conditions=this.initConditions(this.conditions.filter(n=>n.id!==t.id)),this.notify(this)}removeConditions(t){const n=new Set(t.map(i=>i.id));this.conditions=this.initConditions(this.conditions.filter(i=>!n.has(i.id))),this.notify(this)}applyConditions(t){return this.conditions.length===0?!0:this.conditions.map(i=>[i.getApplyFn(),i.accessorFn]).every(([i,a])=>i(a(t)))}}const rf=(r,e)=>A.useMemo(()=>{const t=new xn(r);return t.observe(n=>e(n.getConditions())),t},[r,e]),Lo=r=>{const{condition:e,onRemove:t}=r,n=e.getConditionValue(),i=e.getConditionModifier(),a=()=>{var o,s;switch(i){case"equals":case"notEquals":{const l=e.modifiers.equals,u=n!==void 0&&l.isConditionValueValid(n)?n:void 0;return f.jsx(gn,{required:!1,size:"sm",mode:"single",selected:u??void 0,onSelect:c=>e.setConditionValue(c),children:f.jsx(v.Button,{type:"button",className:"truncate",children:u!==void 0?(u==null?void 0:u.toLocaleDateString())??"empty":"..."})})}case"before":case"after":{const l=e.modifiers.after,u=n!==void 0&&l.isConditionValueValid(n)?n:void 0;return f.jsx(gn,{required:!0,size:"sm",mode:"single",selected:u,onSelect:e.setConditionValue,children:f.jsx(v.Button,{type:"button",className:"truncate",children:u?u.toLocaleDateString():"..."})})}case"in":case"notIn":{const l=e.modifiers.in,u=n!==void 0&&l.isConditionValueValid(n)?n:void 0;return f.jsx(gn,{required:!0,mode:"range",size:"sm",selected:u,onSelect:e.setConditionValue,children:f.jsx(v.Button,{className:"truncate",children:u?`${(o=u.from)==null?void 0:o.toLocaleDateString()} - ${(s=u.to)==null?void 0:s.toLocaleDateString()}`:"..."})})}}};return f.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[f.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:fe[e.field.type]}),f.jsx("span",{className:"truncate",children:e.field.label||Me})]}),f.jsx(ke,{condition:e,children:f.jsx(v.Button,{type:"button",children:e.modifiers[i].modifier.label})}),a(),f.jsx(Pe,{condition:e,onClick:t})]})},zo={equals:L({modifier:xo,isValueValid:r=>r instanceof Date,isConditionValueValid:r=>r instanceof Date,isSerializedValueValid:r=>typeof r=="string"}),notEquals:L({modifier:yo,isValueValid:r=>r instanceof Date,isConditionValueValid:r=>r instanceof Date,isSerializedValueValid:r=>typeof r=="string"}),before:L({modifier:Co,isValueValid:r=>r instanceof Date,isConditionValueValid:r=>r instanceof Date,isSerializedValueValid:r=>typeof r=="string"}),after:L({modifier:wo,isValueValid:r=>r instanceof Date,isConditionValueValid:r=>r instanceof Date,isSerializedValueValid:r=>typeof r=="string"}),in:L({modifier:mo,isValueValid:r=>r instanceof Date,isConditionValueValid:r=>"to"in(r??{})&&"from"in(r??{}),isSerializedValueValid:r=>typeof r=="object"&&"to"in r&&"from"in r}),notIn:L({modifier:_o,isValueValid:r=>r instanceof Date,isConditionValueValid:r=>"to"in(r??{})&&"from"in(r??{}),isSerializedValueValid:r=>typeof r=="object"&&"to"in r&&"from"in r})};class br extends De{constructor(t){super(t);b(this,"modifiers",zo)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=zo[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new br({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return f.jsx(Lo,{condition:this,...t},this.id)}}const ko=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=A.useCallback(l=>{l.length>0?e.setConditionValue(l):e.setConditionValue(void 0)},[e]),s=()=>{if(i===void 0)return"...";if(i===null)return"empty";switch(i.length){case 0:return"...";default:return`${i.length} options`}};return f.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[f.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:fe[n.type]}),f.jsx("span",{className:"truncate",children:n.label||Me})]}),f.jsx(ke,{condition:e,children:f.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),f.jsxs(v.Menu.Root,{children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsx(v.Button,{type:"button",className:"truncate",children:s()})}),f.jsx(v.Menu.Content,{size:"sm",children:f.jsx(Er,{values:i??[],selectFieldOptions:n.options,onValuesChange:o})})]}),f.jsx(Pe,{condition:e,onClick:t})]})},Ro={equals:L({modifier:hn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:pn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),every:L({modifier:cn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),some:L({modifier:dn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),none:L({modifier:fn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class Nr extends De{constructor(t){super(t);b(this,"modifiers",Ro)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=Ro[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Nr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return f.jsx(ko,{condition:this,...t},this.id)}}const Li=[],Uo=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=A.useCallback(l=>{e.setConditionValue(l.length>0?l:void 0)},[e]),s=()=>{if(i===void 0)return"...";if(i===null)return"empty";switch(i.length){case 0:return"...";case 1:return i[0].toString();default:return`${i.length} values`}};return f.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[f.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:fe[n.type]}),f.jsx("span",{className:"truncate",children:n.label||Me})]}),f.jsx(ke,{condition:e,children:f.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),f.jsx(Mo,{values:i??Li,onValuesChange:o,children:f.jsx(v.Button,{type:"button",className:"truncate",children:s()})}),f.jsx(Pe,{condition:e,onClick:t})]})},Ho={equals:L({modifier:hn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:pn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),every:L({modifier:cn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),some:L({modifier:dn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),none:L({modifier:fn,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class Tr extends De{constructor(t){super(t);b(this,"modifiers",Ho)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=Ho[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Tr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return f.jsx(Uo,{condition:this,...t},this.id)}}const Go=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(a){case"equals":case"greaterThanOrEquals":case"lessThanOrEquals":case"greaterThan":case"lessThan":{const s=e.modifiers.greaterThan,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return f.jsx(It,{value:l??null,onValueChange:u=>e.setConditionValue(u??void 0),size:"sm",children:f.jsx(v.Button,{type:"button",className:"truncate",children:l!==void 0?l??"empty":"..."})})}case"inRange":case"notInRange":{const s=e.modifiers.inRange,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return f.jsxs(f.Fragment,{children:[f.jsx(It,{value:(l==null?void 0:l.from)??null,onValueChange:u=>{e.setConditionValue({from:u,to:(l==null?void 0:l.to)??null})},size:"sm",children:f.jsx(v.Button,{className:"truncate",children:(l==null?void 0:l.from)??"..."})}),f.jsx(It,{value:(l==null?void 0:l.to)??null,onValueChange:u=>{e.setConditionValue({from:(l==null?void 0:l.from)??null,to:u})},size:"sm",children:f.jsx(v.Button,{className:"truncate",children:(l==null?void 0:l.to)??"..."})})]})}}};return f.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[f.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:fe[n.type]}),f.jsx("span",{className:"truncate",children:n.label||Me})]}),f.jsx(ke,{condition:e,children:f.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),o(),f.jsx(Pe,{condition:e,onClick:t})]})},Xo={equals:L({modifier:Ii,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),notEquals:L({modifier:Si,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),lessThan:L({modifier:Oi,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),lessThanOrEquals:L({modifier:bi,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),greaterThan:L({modifier:Ni,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),greaterThanOrEquals:L({modifier:Ti,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),inRange:L({modifier:Di,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="object",isSerializedValueValid:r=>typeof r=="object"}),notInRange:L({modifier:Mi,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="object",isSerializedValueValid:r=>typeof r=="object"})};class Dr extends De{constructor(t){super(t);b(this,"modifiers",Xo)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=Xo[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Dr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return f.jsx(Go,{condition:this,...t},this.id)}}const $o=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(a){case"equals":case"notEquals":case"includes":case"excludes":return f.jsx(Ir,{value:i??"",onValueChange:e.setConditionValue,size:"sm",children:f.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:f.jsx("span",{className:"truncate",children:i||"..."})})})}};return f.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[f.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:fe[n.type]}),f.jsx("span",{className:"truncate",children:n.label||Me})]}),f.jsx(ke,{condition:e,children:f.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),o(),f.jsx(Pe,{condition:e,onClick:t})]})},qo={equals:L({modifier:_t,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:At,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),includes:L({modifier:_r,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),excludes:L({modifier:Ar,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class Mr extends De{constructor(t){super(t);b(this,"modifiers",qo)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=qo[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Mr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return f.jsx($o,{condition:this,...t},this.id)}}const Wo=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(a){case"equals":case"notEquals":{const s=e.modifiers.equals,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return f.jsxs(v.Menu.Root,{children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:f.jsx("span",{className:"truncate",children:l!==void 0?l?gt[l].label:"empty":"..."})})}),f.jsx(v.Menu.Content,{size:"sm",children:f.jsx(v.Menu.SelectGroup,{required:!1,value:l,onValueChange:e.setConditionValue,children:Ft.map(u=>{const{label:c}=gt[u];return f.jsx(Et,{value:u,children:f.jsx("span",{className:"truncate",children:c})},u)})})})]})}case"includes":case"excludes":{const s=e.modifiers.includes,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return f.jsxs(v.Menu.Root,{children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsx(v.Button,{type:"button",children:l?`${l.length} statuses`:"..."})}),f.jsx(v.Menu.Content,{size:"sm",children:f.jsxs(v.Menu.MultiSelectGroup,{values:l??Li,onValuesChange:e.setConditionValue,children:[f.jsx(Vi,{children:"Select all"}),Ft.map(u=>{const{label:c,icon:d}=gt[u];return f.jsxs(Do,{value:u,children:[f.jsx(v.LuIcon,{icon:d}),f.jsx("span",{className:"truncate",children:c})]},u)})]})})]})}}};return f.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[f.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:fe[n.type]}),f.jsx("span",{className:"truncate",children:n.label||Me})]}),f.jsx(ke,{condition:e,children:f.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),o(),f.jsx(Pe,{condition:e,onClick:t})]})},jo={equals:L({modifier:Io,isValueValid:r=>r!==null,isConditionValueValid:r=>typeof r=="string",isSerializedValueValid:r=>typeof r=="string"}),notEquals:L({modifier:So,isValueValid:r=>r!==null,isConditionValueValid:r=>typeof r=="string",isSerializedValueValid:r=>typeof r=="string"}),includes:L({modifier:Oo,isValueValid:r=>r!==null,isConditionValueValid:r=>Array.isArray(r),isSerializedValueValid:r=>Array.isArray(r)}),excludes:L({modifier:bo,isValueValid:r=>r!==null,isConditionValueValid:r=>Array.isArray(r),isSerializedValueValid:r=>Array.isArray(r)})};class Pr extends De{constructor(t){super(t);b(this,"modifiers",jo)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=jo[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Pr({field:n,conditionModifier:a,conditionValue:l,...o})}transformValue(t){return t.status}render(t){return f.jsx(Wo,{condition:this,...t},this.id)}}const Yo=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=A.useMemo(()=>n.options.map(u=>typeof u=="string"?{value:u,label:u}:u),[n.options]),s=A.useMemo(()=>{const u={};for(const c of o)u[c.value]=c.label;return u},[o]),l=()=>{switch(a){case"equals":case"notEquals":{const u=e.modifiers.equals,c=i!==void 0&&u.isConditionValueValid(i)?i:void 0;return f.jsxs(v.Menu.Root,{children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:f.jsx("span",{className:"truncate",children:c!==void 0?c?s[c]:"empty":"..."})})}),f.jsx(v.Menu.Content,{size:"sm",children:f.jsx(Bi,{required:!0,selectFieldOptions:n.options,value:c??void 0,onValueChange:e.setConditionValue})})]})}case"includes":case"excludes":{const u=e.modifiers.includes,c=i!==void 0&&u.isConditionValueValid(i)?i:void 0;return f.jsxs(v.Menu.Root,{children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsx(v.Button,{type:"button",children:c?`${c.length} options`:"..."})}),f.jsx(v.Menu.Content,{size:"sm",children:f.jsx(Er,{selectFieldOptions:n.options,values:c??Li,onValuesChange:e.setConditionValue})})]})}}};return f.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[f.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:fe[n.type]}),f.jsx("span",{className:"truncate",children:n.label||Me})]}),f.jsx(ke,{condition:e,children:f.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),l(),f.jsx(Pe,{condition:e,onClick:t})]})},Zo={equals:L({modifier:_t,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>!Array.isArray(r),isSerializedValueValid:r=>!Array.isArray(r)}),notEquals:L({modifier:At,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>!Array.isArray(r),isSerializedValueValid:r=>!Array.isArray(r)}),includes:L({modifier:Pi,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>Array.isArray(r),isSerializedValueValid:r=>Array.isArray(r)}),excludes:L({modifier:Fi,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>Array.isArray(r),isSerializedValueValid:r=>Array.isArray(r)})};class Fr extends De{constructor(t){super(t);b(this,"modifiers",Zo)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=Zo[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Fr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return f.jsx(Yo,{condition:this,...t},this.id)}}const Ko=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(a){case"equals":case"notEquals":case"greaterThanOrEquals":case"lessThanOrEquals":case"greaterThan":case"lessThan":{const s=e.modifiers[a],l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return f.jsx(It,{value:l??null,onValueChange:u=>e.setConditionValue(u??void 0),size:"sm",children:f.jsx(v.Button,{type:"button",className:"truncate",children:l!==void 0?l:"..."})})}case"inRange":case"notInRange":{const s=e.modifiers.inRange,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return f.jsxs(f.Fragment,{children:[f.jsx(It,{value:(l==null?void 0:l.from)??null,onValueChange:u=>{e.setConditionValue({from:u,to:(l==null?void 0:l.to)??null})},size:"sm",children:f.jsx(v.Button,{className:"truncate",children:(l==null?void 0:l.from)??"..."})}),f.jsx(It,{value:(l==null?void 0:l.to)??null,onValueChange:u=>{e.setConditionValue({from:(l==null?void 0:l.from)??null,to:u})},size:"sm",children:f.jsx(v.Button,{className:"truncate",children:(l==null?void 0:l.to)??"..."})})]})}}};return f.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[f.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:fe[n.type]}),f.jsx("span",{className:"truncate",children:n.label||Me})]}),f.jsx(ke,{condition:e,children:f.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),o(),f.jsx(Pe,{condition:e,onClick:t})]})},Qo={equals:L({modifier:Ii,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),notEquals:L({modifier:Si,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),lessThan:L({modifier:Oi,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),lessThanOrEquals:L({modifier:bi,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),greaterThan:L({modifier:Ni,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),greaterThanOrEquals:L({modifier:Ti,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="number",isSerializedValueValid:r=>typeof r=="number"}),inRange:L({modifier:Di,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="object",isSerializedValueValid:r=>typeof r=="object"}),notInRange:L({modifier:Mi,isValueValid:r=>typeof r=="number",isConditionValueValid:r=>typeof r=="object",isSerializedValueValid:r=>typeof r=="object"})};class Vr extends De{constructor(t){super(t);b(this,"modifiers",Qo)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=Qo[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Vr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return f.jsx(Ko,{condition:this,...t},this.id)}}const Jo=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(a){case"equals":case"notEquals":case"includes":case"excludes":return f.jsx(Ir,{value:i??"",onValueChange:e.setConditionValue,size:"sm",children:f.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:f.jsx("span",{className:"truncate",children:i||"..."})})})}};return f.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[f.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:fe[n.type]}),f.jsx("span",{className:"truncate",children:n.label||Me})]}),f.jsx(ke,{condition:e,children:f.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),o(),f.jsx(Pe,{condition:e,onClick:t})]})},es={equals:L({modifier:_t,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:At,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),includes:L({modifier:_r,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),excludes:L({modifier:Ar,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class Br extends De{constructor(t){super(t);b(this,"modifiers",es)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=es[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Br({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return f.jsx(Jo,{condition:this,...t},this.id)}}const ts=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=A.useMemo(()=>n.options.map(c=>typeof c=="string"?{value:c,label:c}:c),[n.options]),s=A.useMemo(()=>{const c={};for(const d of o)c[d.value]=d.label;return c},[o]),l=A.useCallback(c=>{c.length>0?e.setConditionValue(c):e.setConditionValue([])},[e]),u=()=>{switch(a){case"equals":case"notEquals":{const c=e.modifiers.equals,d=i!==void 0&&c.isConditionValueValid(i)?i:void 0;return f.jsxs(v.Menu.Root,{children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:f.jsx("span",{className:"truncate",children:d!==void 0?d?s[d]:"empty":"..."})})}),f.jsx(v.Menu.Content,{size:"sm",children:f.jsx(Bi,{required:!1,selectFieldOptions:n.options,value:d??void 0,onValueChange:e.setConditionValue})})]})}case"includes":case"excludes":{const c=e.modifiers.includes,d=i!==void 0&&c.isConditionValueValid(i)?i:void 0;return f.jsxs(v.Menu.Root,{children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsx(v.Button,{type:"button",children:d?`${d.length} options`:"..."})}),f.jsx(v.Menu.Content,{size:"sm",children:f.jsx(Er,{selectFieldOptions:n.options,values:d??[],onValuesChange:l})})]})}}};return f.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[f.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:fe[n.type]}),f.jsx("span",{className:"truncate",children:n.label||Me})]}),f.jsx(ke,{condition:e,children:f.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),u(),f.jsx(Pe,{condition:e,onClick:t})]})},rs={equals:L({modifier:_t,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>!Array.isArray(r),isSerializedValueValid:r=>!Array.isArray(r)}),notEquals:L({modifier:At,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>!Array.isArray(r),isSerializedValueValid:r=>!Array.isArray(r)}),includes:L({modifier:Pi,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>Array.isArray(r),isSerializedValueValid:r=>Array.isArray(r)}),excludes:L({modifier:Fi,isValueValid:r=>typeof r=="string",isConditionValueValid:r=>Array.isArray(r),isSerializedValueValid:r=>Array.isArray(r)})};class Lr extends De{constructor(t){super(t);b(this,"modifiers",rs)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=rs[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Lr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return f.jsx(ts,{condition:this,...t},this.id)}}const ns=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(a){case"equals":case"notEquals":case"includes":case"excludes":return f.jsx(Ir,{value:i??"",onValueChange:e.setConditionValue,size:"sm",children:f.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:f.jsx("span",{className:"truncate",children:i||"..."})})})}};return f.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[f.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:fe[n.type]}),f.jsx("span",{className:"truncate",children:n.label||Me})]}),f.jsx(ke,{condition:e,children:f.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),o(),f.jsx(Pe,{condition:e,onClick:t})]})},is={equals:L({modifier:_t,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:At,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),includes:L({modifier:_r,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),excludes:L({modifier:Ar,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class zr extends De{constructor(t){super(t);b(this,"modifiers",is)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=is[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new zr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return f.jsx(ns,{condition:this,...t},this.id)}}const as=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(a){case"equals":case"notEquals":case"includes":case"excludes":return f.jsx(Ir,{value:i??"",onValueChange:e.setConditionValue,size:"sm",children:f.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:f.jsx("span",{className:"truncate",children:i||"..."})})})}};return f.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[f.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:fe[n.type]}),f.jsx("span",{className:"truncate",children:n.label||Me})]}),f.jsx(ke,{condition:e,children:f.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),o(),f.jsx(Pe,{condition:e,onClick:t})]})},os={equals:L({modifier:_t,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:At,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),includes:L({modifier:_r,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),excludes:L({modifier:Ar,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class kr extends De{constructor(t){super(t);b(this,"modifiers",os)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=os[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new kr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return f.jsx(as,{condition:this,...t},this.id)}}const ss=r=>{const{condition:e,onRemove:t}=r,n=e.field,i=e.getConditionValue(),a=e.getConditionModifier(),o=()=>{switch(i){case void 0:return"...";case!0:return"true";case!1:return"false";case null:return"empty"}};return f.jsxs(v.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[f.jsxs(v.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:fe[n.type]}),f.jsx("span",{className:"truncate",children:n.label||Me})]}),f.jsx(ke,{condition:e,children:f.jsx(v.Button,{type:"button",children:e.modifiers[a].modifier.label})}),f.jsxs(v.Menu.Root,{children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsx(v.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:o()})}),f.jsx(v.Menu.Content,{size:"sm",children:f.jsxs(v.Menu.SelectGroup,{required:!0,value:i,onValueChange:e.setConditionValue,children:[f.jsx(Et,{value:!0,children:"empty"}),f.jsx(Et,{value:!1,children:"not empty"})]})})]}),f.jsx(Pe,{condition:e,onClick:t})]})},ls={equals:L({modifier:Ao,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0}),notEquals:L({modifier:Eo,isValueValid:r=>!0,isConditionValueValid:r=>!0,isSerializedValueValid:r=>!0})};class Rr extends De{constructor(t){super(t);b(this,"modifiers",ls)}static deserialize(t,n){const{conditionValue:i,conditionModifier:a,...o}=t,s=ls[a],l=i!==void 0&&s.isSerializedValueValid(i)?s.modifier.deserialize(i):void 0;return new Rr({field:n,conditionModifier:a,conditionValue:l,...o})}render(t){return f.jsx(ss,{condition:this,...t},this.id)}}const nf={date:br,number:Dr,boolean:Sr,select:Lr,string:zr,text:kr,upload:Rr,qr:Br,"multi-string":Tr,"multi-select":Nr,radio:Fr,"checkbox-list":Or,"pass-fail":Pr,otp:Mr,rating:Vr},us=(r,e)=>{if(r.type!==e.type)throw new Error(`field and condition type mismatch ${r.type} !== ${e.type}`);return nf[e.type].deserialize(e,r)},zi=(r,e)=>{const t={};for(const n of r)t[n.identifier]=n;return e.map(n=>us(t[n.fieldId],n))},yn=r=>un[r.type].deserialize(r);function af(r){return r.map(cs)}const cs=r=>r.type==="section"?Ye.deserialize(r):yn(r);function of(r){return r.map(yn)}function Cn(r){const e=[];for(const t of r)if(t instanceof Ye)for(const n of t.fields)e.push(n);else e.push(t);return e}function ds(r){const e=Cn(r),t={};for(const n of e)t[n.identifier]=n;return t}function fs(r,e){const t=ki(r,e),n={};for(const i of r){if(!(i.identifier in t))continue;const a=t[i.identifier];n[i.identifier]=i.serializeValue(a)}return n}function hs(r,e){const t=ps(r,e),n={};for(const i of r){if(!(i.identifier in t))continue;const a=t[i.identifier];n[i.identifier]=i.deserializeValue(a)}return n}function ki(r,e){const t={};for(const n of r){if(!(n.identifier in e))continue;const i=e[n.identifier];n.isValueValid(i)&&(t[n.identifier]=i)}return t}function ps(r,e){const t={};for(const n of r){if(!(n.identifier in e))continue;const i=e[n.identifier];n.isSerializedValueValid(i)&&(t[n.identifier]=i)}return t}function sf(r,e){const t=ki(r,e),n={},i={};for(const a of r){if(!(a.identifier in t))continue;const o=t[a.identifier];switch(a.type){case"upload":if(!a.isValueValid(o))break;i[a.identifier]=o,n[a.identifier]=[];break;case"pass-fail":if(!a.isValueValid(o))break;i[a.identifier]=o.files,n[a.identifier]={...o,files:[]};break;default:n[a.identifier]=e[a.identifier]}}return[n,i]}function lf(r,e,t){const n={};for(const i of r){if(!(i.identifier in e))continue;const a=e[i.identifier];switch(i.type){case"upload":if(!i.isValueValid(a))break;n[i.identifier]=t[i.identifier]??[];break;case"pass-fail":if(!i.isValueValid(a))break;n[i.identifier]={...a,files:t[i.identifier]??[]};break;default:if(!i.isValueValid(a))break;n[i.identifier]=a}}return n}const Ri=(r,e)=>{const t={};for(const n of r){const i=e[n.identifier];t[n.identifier]=i!==void 0?i:n.blankValue()}return t},vs=(r,e,t)=>{const n={};for(const i of r){const a=e[i.identifier],o=t[i.identifier];i.areValuesEqual(a,o)||(n[i.identifier]=o)}return n},uf=(r,e,t)=>{const n={};for(const i of r){const a=e[i.identifier],o=t[i.identifier];i.areValuesEqual(a,o)&&(n[i.identifier]=o)}return n},gs=A.createContext({}),Ui=A.memo(r=>{const{fieldSection:e,...t}=r,{label:n,description:i}=e,{values:a}=Re.useFormikContext(),{fields:o}=A.use(gs),s=A.useMemo(()=>o.filter(d=>d.type==="section"),[o]),l=A.useMemo(()=>s.filter(d=>e.identifier in d.conditions),[s,e.identifier]),u=A.useMemo(()=>l.length===0?!0:l.some(d=>{const p=d.getConditions(e.identifier);return new xn(p).applyConditions(a)}),[l,e,a]),c=cr(e.fields,t);return u?f.jsxs(v.Card,{variant:"soft",className:"flex flex-col gap-4",children:[(n||i)&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"flex flex-col gap-1",children:[f.jsx(v.Heading,{size:"md",children:n}),i&&f.jsx(v.Text,{accentColor:"base",children:i})]}),f.jsx(v.Separator,{size:"full"})]}),c]}):null});Ui.displayName="FieldSectionLayout";const Ot=class Ot extends bn{constructor(t){const{label:n=null,description:i=null,fields:a,conditions:o={},...s}=t;super(s);b(this,"type","section");b(this,"label");b(this,"description");b(this,"conditions");b(this,"fields",[]);b(this,"fieldObserver",()=>{this.notify(this)});b(this,"initFields",t=>{for(const n of t)n.observe(this.fieldObserver);return t});b(this,"conditionObserver",()=>{this.notify(this)});b(this,"initConditions",t=>{for(const n of Object.values(t).flat())n.observe(this.conditionObserver);return t});this.label=n,this.description=i,this.fields=this.initFields(a),this.conditions=this.initConditions(o)}serialize(){const t={};for(const[n,i]of Object.entries(this.conditions))t[n]=i.map(a=>a.serialize());return{...super.serialize(),label:this.label,description:this.description,conditions:t,fields:this.fields.map(n=>n.serialize())}}getOptions(){return{...super.getOptions(),label:this.label,description:this.description,fields:this.fields,conditions:this.conditions}}duplicate(t){return new Ot({...this.getOptions(),identifier:t,fields:this.fields.map(n=>n.duplicate(H.v4()))})}setOptions(t){const{label:n,description:i,fields:a,conditions:o,...s}=t;this.label=n??this.label,this.description=i??this.description,this.fields=a||this.fields,this.conditions=o||this.conditions,super.setOptions(s)}getErrors(t){const n={};for(const i of this.fields){const a=i.getError(t[i.identifier]);a&&(n[i.identifier]=a)}return n}getFields(){return this.fields}addField(t,n){const i=[...this.fields];i.splice(n??this.fields.length,0,t),this.fields=this.initFields(i),this.notify(this)}moveField(t,n){const i=[...this.fields],[a]=i.splice(t,1);i.splice(n,0,a),this.fields=i,this.notify(this)}removeField(t){this.fields=this.initFields(this.fields.filter(({identifier:i})=>i!==t.identifier));const n={};for(const[i,a]of Object.entries(this.conditions))n[i]=a.filter(o=>o.field.identifier!==t.identifier);this.conditions=n,this.notify(this)}getConditions(t){return this.conditions[t]}addCondition(t,n){this.conditions=this.initConditions({...this.conditions,[t]:[...this.conditions[t]??[],n]}),this.notify(this)}addConditions(t,n){this.conditions=this.initConditions({...this.conditions,[t]:[...this.conditions[t]??[],...n]}),this.notify(this)}removeCondition(t,n){this.conditions=this.initConditions({...this.conditions,[t]:(this.conditions[t]??[]).filter(i=>i.id!==n.id)}),this.notify(this)}removeConditions(t,n){const i=new Set(n.map(a=>a.id));this.conditions=this.initConditions({...this.conditions,[t]:(this.conditions[t]??[]).filter(a=>!i.has(a.id))}),this.notify(this)}getConditionals(){return new Set(Object.keys(this.conditions))}addConditional(t){this.conditions=this.initConditions({...this.conditions,[t]:[]}),this.notify(this)}removeConditional(t){const n={...this.conditions};delete n[t],this.conditions=this.initConditions(n),this.notify(this)}render(t){return f.jsx(Ui,{fieldSection:this,...t})}};b(Ot,"fieldTypeName","Section"),b(Ot,"fieldTypeDescription","Sections can be useful for grouping fields together. They can also be conditionally shown or hidden."),b(Ot,"deserialize",t=>{const n=t.fields.map(yn),i={};for(const[a,o]of Object.entries(t.conditions))i[a]=zi(n,o);return new Ot({...t,fields:n,conditions:i})});let Ye=Ot;const cf=(r,e,t={})=>{const{conditions:n=!1}=t,i=r.get(e.identifier);if(!i)throw new Error(`Attempting to reseed serialized section with identifier ${e.identifier} which is not present in the reseeded identifier map`);const a=new Map,o=e.fields.map(l=>{const u=H.v4(),{image:c,...d}=l;return a.set(l.identifier,u),{...d,identifier:u}}),s={};if(n)for(const[l,u]of Object.entries(e.conditions??{})){const c=r.get(l);if(!c)continue;const d=u.map(p=>{const h=a.get(p.fieldId);if(!h)throw new Error(`Serialized condition referencing undefined field with identifier: ${p.fieldId}`);return{...p,fieldId:h}});s[c]=d}return{...e,identifier:i,conditions:s,fields:o}},df=(r,e={})=>{const t=new Map(r.map(n=>[n.identifier,H.v4()]));return r.map(n=>cf(t,n,e))};class dt extends ur{constructor(t){super();b(this,"fieldSections");b(this,"fieldObserver",()=>{this.notify(this)});b(this,"initFields",t=>{for(const n of t)n.observe(this.fieldObserver);return t});this.fieldSections=this.initFields(t)}serialize(){return this.fieldSections.map(t=>t.serialize())}static deserialize(t){return new dt(t.map(Ye.deserialize))}static reseedFieldSections(t,n){return df(t,n)}getFields(){return this.fieldSections.flatMap(t=>t.getFields())}getFieldSections(){return this.fieldSections}addFieldSection(t,n){const i=[...this.fieldSections];i.splice(n??this.fieldSections.length,0,t),this.fieldSections=this.initFields(i),this.notify(this)}removeFieldSection(t){const n=this.fieldSections.filter(i=>i.identifier!==t.identifier);for(const i of n)i.removeConditional(i.identifier);this.fieldSections=this.initFields(n),this.notify(this)}moveFieldSection(t,n){const i=[...this.fieldSections],[a]=i.splice(t,1);i.splice(n,0,a),this.fieldSections=this.initFields(i),this.notify(this)}deserializeValues(t){return hs(this.getFields(),t)}serializeValues(t){return fs(this.getFields(),t)}deserializeConditions(t){return zi(this.getFields(),t)}initializeValues(t){return Ri(this.getFields(),t)}getSectionDependencyGraph(){const t=new Ds.DirectedGraph({type:"directed"});for(const n of this.fieldSections)for(const i of Object.keys(n.conditions))t.mergeEdge(n.identifier,i);return t}getDependenciesOfSection(t){const n=this.getSectionDependencyGraph(),i=new Map(this.fieldSections.map(o=>[o.identifier,o])),a=[];return Ms.bfsFromNode(n,t,(o,s,l)=>{a.push(i.get(o))},{mode:"in"}),a}}const St=A.createContext(new dt([])),wn=A.createContext({}),ff=(r=()=>null)=>A.useMemo(()=>Object.entries(un).map(([t,n])=>({children:n.fieldTypeName,icon:f.jsx(v.LuIcon,{icon:fe[t]}),value:t,onSelect:()=>{r(t)}})),[r]),mn=A.memo(r=>{const{children:e,variant:t,size:n,accentColor:i,onSelectFieldType:a,...o}=r,s=ff(a);return f.jsxs(v.Menu.Root,{...o,children:[f.jsx(v.Menu.ClickTrigger,{children:e}),f.jsx(v.Menu.Content,{variant:t,size:n,accentColor:i,children:f.jsx(v.Menu.Scroll,{children:s.flat().map(l=>f.jsxs(v.Menu.Item,{onSelect:l.onSelect,children:[l.icon,l.children]},l.value))})})]})});mn.displayName="CreateFieldDropdownMenu";const _n=r=>{switch(r){case"text":return new $t({label:"",required:!1,identifier:H.v4()});case"boolean":return new Tt({label:"",required:!1,identifier:H.v4()});case"number":return new $e({label:"",required:!1,identifier:H.v4()});case"date":return new fr({label:"",required:!1,identifier:H.v4()});case"string":return new Xt({label:"",required:!1,identifier:H.v4()});case"select":return new vt({label:"",options:[],required:!1,identifier:H.v4()});case"multi-string":return new Nt({label:"",required:!1,identifier:H.v4()});case"multi-select":return new it({label:"",options:[],required:!1,identifier:H.v4()});case"upload":return new qt({label:"",required:!1,identifier:H.v4(),maximum_files:6,maximum_size:Wt});case"qr":return new mr({label:"",required:!1,identifier:H.v4()});case"radio":return new Lt({label:"",options:[],required:!1,identifier:H.v4()});case"checkbox-list":return new Mt({label:"",options:[],required:!1,identifier:H.v4()});case"pass-fail":return new Bt({label:"",required:!1,identifier:H.v4(),showNotesAndFilesOn:["fail"]});case"otp":return new Pt({label:"",validationType:"none",required:!1,identifier:H.v4(),length:6});case"rating":return new zt({label:"",required:!1,identifier:H.v4(),maxRating:5})}},Hi=r=>{switch(r.type){case"text":return new kr({id:H.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"boolean":return new Sr({id:H.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"number":return new Dr({id:H.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"date":return new br({id:H.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"string":return new zr({id:H.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"select":return new Lr({id:H.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"multi-string":return new Tr({id:H.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"multi-select":return new Nr({id:H.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"upload":return new Rr({id:H.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"qr":return new Br({id:H.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"radio":return new Fr({id:H.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"checkbox-list":return new Or({id:H.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"pass-fail":return new Pr({id:H.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"otp":return new Mr({id:H.v4(),conditionValue:void 0,conditionModifier:"equals",field:r});case"rating":return new Vr({id:H.v4(),conditionValue:void 0,conditionModifier:"equals",field:r})}},xs=(r,e)=>{switch(r){case"checkbox-list":return Mt.getFieldCreationSchema(e);case"multi-select":return it.getFieldCreationSchema(e);case"number":return $e.getFieldCreationSchema(e);case"radio":return Lt.getFieldCreationSchema(e);case"select":return vt.getFieldCreationSchema(e);case"string":return Xt.getFieldCreationSchema(e);case"text":return $t.getFieldCreationSchema(e);case"upload":return qt.getFieldCreationSchema(e);case"pass-fail":return Bt.getFieldCreationSchema(e);case"otp":return Pt.getFieldCreationSchema(e);case"rating":return zt.getFieldCreationSchema(e);default:return}},ys=A.memo(r=>{const{popoverInputs:e,hasError:t,...n}=r;return f.jsxs(v.Popover.Root,{children:[f.jsx(v.Popover.Trigger,{asChild:!0,children:f.jsxs(v.Button,{variant:"soft",type:"button",size:"sm","aria-label":"settings",accentColor:"base",...t&&{color:bt.danger},children:[f.jsx(v.LuIcon,{icon:ul}),"Settings"]},"settings")}),f.jsx(v.Popover.Content,{size:"sm",...n,children:f.jsx("div",{className:"flex w-full max-w-[350px] flex-col",children:e})})]})});ys.displayName="FieldSettingsPopover";const Cs=A.memo(r=>{const{parentPath:e,fieldIndex:t,field:n}=r,{errors:i}=Re.useFormikContext(),a=$r(),{disableRequiredFields:o}=A.use(wn),[s,l]=A.useState(void 0);A.useEffect(()=>{n.image instanceof Promise?n.image.then(l).catch(console.error):l(n.image)},[n]);const u=s?URL.createObjectURL(s):void 0,c=A.useCallback(()=>{n.setOptions({image:void 0})},[n]),[d,p]=A.useMemo(()=>{const _=[],E=[],S=xs(n.type,`${e}.${t}`)??[];for(const T of S)T.showDirectly?_.push(T.field):E.push(T.field);return[_,E]},[n,e,t]),h=cr(d,{formId:vn,disabled:!1}),g=cr(p,{formId:vn,disabled:!1}),x=p.length>0,C=p.some(_=>{const E=En(i,_.identifier);return E&&(typeof E!="object"||Object.values(E).length>0)}),w=A.useCallback(()=>{s&&a(()=>({file:s}))},[a,s]),{fieldTypeName:m}=un[n.type];return f.jsxs("div",{className:"flex grow w-full flex-col gap-4",children:[f.jsxs("div",{className:"flex gap-2 w-full justify-between",children:[f.jsxs("div",{className:"flex gap-2 items-center",children:[f.jsxs(v.Badge,{accentColor:"base",variant:"soft",size:"sm",children:[f.jsx(v.LuIcon,{icon:fe[n.type]}),m]}),!o&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(v.Checkbox.Root,{checked:n.required,onCheckedChange:_=>n.setOptions({required:!!_}),size:"sm",children:f.jsx(v.Checkbox.Indicator,{children:f.jsx(v.LuIcon,{icon:Xe})})}),f.jsx(v.Text,{size:"sm",accentColor:"base",children:"Required"})]})]}),x&&f.jsx(ys,{popoverInputs:g,hasError:C,align:"end"})]}),s&&f.jsxs("div",{className:"group relative inline-block w-full min-w-[300px]",children:[f.jsx("img",{className:"h-[100px] w-full min-w-[300px] cursor-pointer rounded-md object-cover",src:u,alt:s.name,onClick:w}),f.jsx(v.IconButton,{type:"button",className:"absolute top-2 right-2 hidden group-hover:not-disabled:flex",variant:"solid",accentColor:"base","aria-label":"delete",onClick:c,size:"sm",children:f.jsx(v.LuIcon,{icon:ht})})]}),f.jsxs("div",{className:"flex flex-col gap-2 w-full overflow-hidden",children:[f.jsx(v.Input.Root,{variant:"outline",size:"md",children:f.jsx(v.Input.Field,{placeholder:"Enter your question",value:n.label??"",onChange:_=>n.setOptions({label:_.target.value}),maxLength:200})}),f.jsx(v.TextArea,{className:"field-sizing-content",placeholder:"Enter a field description (optional)",value:n.description??"",onChange:_=>n.setOptions({description:_.target.value}),maxLength:1e3,resize:"vertical",size:"md"})]}),d.length>0&&f.jsx("div",{className:"w-full",children:h})]})});Cs.displayName="FieldBuilder";const Gi=A.memo(r=>{const{field:e,fieldSection:t,fieldIndex:n,sectionIndex:i}=r,a=A.useRef(null),o=`fields.${i}.fields`,s=A.useCallback(x=>{t.addField(_n(x),n+1)},[n,t]),l=A.useCallback(()=>{t.addField(e.duplicate(H.v4()))},[e,t]),u=A.useCallback(x=>{const C=x==="up"?i-1:i+1;t.moveField(n,C)},[t,n,i]),c=A.useCallback(x=>{const{files:C}=x.target;if(!C||C.length!==1)return;const w=C.item(0);if(w){if(w.size>po){v.toast.error({title:"File upload error",description:`The file ${w.name} exceeded the maximum file size`});return}e.setOptions({image:w})}},[e]),d=A.useCallback(()=>{u("up")},[u]),p=A.useCallback(()=>{u("down")},[u]),h=A.useCallback(()=>{var x;(x=a.current)==null||x.click()},[]),g=A.useCallback(()=>{t.removeField(e)},[e,t]);return f.jsxs(v.Card,{className:"flex items-center justify-between gap-4 w-full",children:[f.jsx(Cs,{fieldIndex:n,field:e,parentPath:o}),f.jsxs(v.ButtonGroup,{className:"flex-col gap-0.5 flex",variant:"ghost",accentColor:"base",size:"sm",children:[f.jsx(mn,{onSelectFieldType:s,children:f.jsx(v.IconButton,{type:"button",children:f.jsx(v.LuIcon,{icon:Ze})})}),f.jsx(v.IconButton,{type:"button",onClick:d,children:f.jsx(v.LuIcon,{icon:na})}),f.jsx(v.IconButton,{type:"button",onClick:p,children:f.jsx(v.LuIcon,{icon:ra})}),f.jsx(v.IconButton,{type:"button",onClick:l,children:f.jsx(v.LuIcon,{icon:Hr})}),f.jsx(v.IconButton,{type:"button",onClick:h,children:f.jsx(v.LuIcon,{icon:tl})}),f.jsx(v.IconButton,{type:"button",onClick:g,children:f.jsx(v.LuIcon,{icon:ht})})]}),f.jsx("input",{className:"hidden",ref:a,type:"file",accept:"image/*",onChange:c})]})});Gi.displayName="FieldBuilderWithActions";const Xi=A.memo(r=>{const{children:e,variant:t,size:n,accentColor:i,fields:a,onSelectField:o,...s}=r;return f.jsxs(v.Menu.Root,{...s,children:[f.jsx(v.Menu.ClickTrigger,{children:e}),f.jsx(v.Menu.Content,{variant:t,size:n,accentColor:i,children:f.jsx(v.Menu.Scroll,{children:a.map(l=>f.jsxs(v.Menu.Item,{onSelect:()=>o(l),children:[f.jsx(v.LuIcon,{icon:fe[l.type]}),l.label||Me]},l.identifier))})})]})});Xi.displayName="IssueDataFilterMenu";const ws=A.memo(r=>{const{children:e,variant:t,size:n,accentColor:i,fieldSections:a,onSelectFieldCondition:o,...s}=r;return f.jsxs(v.Menu.Root,{...s,children:[f.jsx(v.Menu.ClickTrigger,{children:e}),f.jsx(v.Menu.Content,{variant:t,size:n,accentColor:i,children:a.map(l=>f.jsxs(v.Menu.Item,{onSelect:()=>o(l),children:[f.jsx(v.LuIcon,{icon:fe[l.type]}),l.label||No]},l.identifier))})]})});ws.displayName="IssueDataFilterMenu";const ms=A.memo(r=>{const{id:e,sourceX:t,sourceY:n,targetX:i,targetY:a,style:o,markerEnd:s,data:l}=r,{targetSection:u,sourceSection:c,layoutDirection:d}=l,p=A.useMemo(()=>c.getConditions(u.identifier),[c,u.identifier]),h=A.useCallback(()=>{c.removeConditional(u.identifier)},[c,u.identifier]),g=A.useCallback(_=>{c.addCondition(u.identifier,Hi(_))},[c,u.identifier]),x=A.useCallback(_=>{c.removeCondition(u.identifier,_)},[c,u.identifier]),[C,w,m]=de.getBezierPath({sourceX:t,sourceY:n,sourcePosition:d==="LR"?de.Position.Right:de.Position.Bottom,targetX:i,targetY:a,targetPosition:d==="LR"?de.Position.Left:de.Position.Top});return f.jsxs(f.Fragment,{children:[f.jsx(de.BaseEdge,{id:e,path:C,style:o,markerEnd:s,labelX:w,labelY:m}),f.jsx(de.EdgeLabelRenderer,{children:f.jsxs(v.Card,{size:"xs",variant:"surface",className:"absolute nodrag nopan pointer-events-auto inline-flex flex-col gap-2 bg-(--base-2)",onMouseDown:_=>_.stopPropagation(),onClick:_=>_.stopPropagation(),"data-floating-content":"",style:{transform:`translate(-50%, -50%) translate(${w}px, ${m}px)`},children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(v.Text,{size:"xs",className:"truncate max-w-[280px]",children:c.label||"Untitled section"}),f.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[f.jsx(Xi,{fields:c.fields,onSelectField:g,children:f.jsx(v.IconButton,{"aria-label":"Add condition",type:"button",variant:"surface",size:"xs",accentColor:"base",children:f.jsx(v.LuIcon,{icon:Ze})})}),f.jsxs(v.Tooltip.Root,{children:[f.jsx(v.Tooltip.Trigger,{asChild:!0,children:f.jsx(v.IconButton,{"aria-label":"Remove conditional logic",type:"button",variant:"surface",size:"xs",accentColor:"base",color:"danger",onClick:h,children:f.jsx(v.LuIcon,{icon:ht})})}),f.jsx(v.Tooltip.Content,{size:"sm",children:"Remove conditional logic"})]})]})]}),p.length>0&&f.jsx("div",{className:"flex flex-col h-max w-full flex-wrap gap-1",children:p.map(_=>f.jsx(A.Fragment,{children:_.render({onRemove:x})},_.id))})]})})]})});ms.displayName="FieldSectionConditionEdgeComponent";const _s=A.memo(r=>{const{data:e,selected:t}=r,{fieldSection:n,index:i,layoutDirection:a}=e,o=A.use(St),s=A.useCallback(()=>{o.removeFieldSection(n)},[o,n]),l=A.useCallback(d=>{n.addField(_n(d))},[n]),u=A.useCallback(()=>{const d=new Ye({identifier:H.v4(),fields:[]});o.addFieldSection(d),n.addConditional(d.identifier)},[o,n]),c=A.useCallback(()=>{o.addFieldSection(n.duplicate(H.v4()))},[o,n]);return f.jsxs(v.Card,{variant:"surface",className:"cursor-pointer relative bg-(--base-2)","data-selected":t?"true":void 0,children:[f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsxs("div",{className:"flex flex-col gap-2 w-full overflow-hidden",children:[f.jsx(v.Input.Root,{variant:"outline",size:"md",accentColor:"base",children:f.jsx(v.Input.Field,{placeholder:"Enter a section label (optional)",value:n.label??"",onChange:d=>n.setOptions({label:d.target.value}),maxLength:200})}),f.jsx(v.TextArea,{className:"field-sizing-content",placeholder:"Enter a section description (optional)",value:n.description??"",onChange:d=>n.setOptions({description:d.target.value}),maxLength:1e3,resize:"vertical",size:"md"})]}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(v.Text,{weight:"bold",children:"Fields"}),f.jsx(mn,{onSelectFieldType:l,children:f.jsxs(v.Button,{type:"button",variant:"soft",size:"sm",accentColor:"base",children:[f.jsx(v.LuIcon,{icon:Ze})," Add field"]})})]}),f.jsx("div",{className:"flex flex-col gap-3",children:n.fields.map((d,p)=>f.jsx(Gi,{field:d,fieldSection:n,fieldIndex:p,sectionIndex:i},d.identifier))})]}),f.jsx(de.NodeToolbar,{isVisible:!0,position:de.Position.Right,align:"start",offset:8,onMouseDown:d=>d.stopPropagation(),children:f.jsx(v.Card,{variant:"surface",className:"flex flex-col items-center gap-1 p-1 bg-(--base-2)",size:"xs",onClick:d=>d.stopPropagation(),children:f.jsxs(v.ButtonGroup,{className:"flex flex-col gap-2",variant:"surface",size:"xs",accentColor:"base",children:[f.jsx(v.IconButton,{type:"button",onClick:u,children:f.jsx(v.LuIcon,{icon:Js})}),f.jsx(v.IconButton,{type:"button",onClick:c,children:f.jsx(v.LuIcon,{icon:Hr})}),f.jsx(v.IconButton,{type:"button",onClick:s,children:f.jsx(v.LuIcon,{icon:ht})})]})})}),f.jsx(de.Handle,{type:"target",className:"size-4! bg-(--base-3)! border-(--base-7)!",position:a==="LR"?de.Position.Left:de.Position.Top}),f.jsx(de.Handle,{type:"source",className:"size-4! bg-(--base-3)! border-(--base-7)!",position:a==="LR"?de.Position.Right:de.Position.Bottom})]})});_s.displayName="CustomNode";const hf={fieldSection:_s},pf={fieldSectionCondition:ms},vf=(r,e,t)=>{const n=new Yi.graphlib.Graph().setDefaultEdgeLabel(()=>({}));return n.setGraph({rankdir:t,nodesep:200,edgesep:500,ranksep:500}),e.forEach(i=>n.setEdge(i.source,i.target,{width:500,height:200,labelpos:"c"})),r.forEach(i=>{var a,o;return n.setNode(i.id,{...i,width:((a=i.measured)==null?void 0:a.width)??0,height:((o=i.measured)==null?void 0:o.height)??0})}),Yi.layout(n),[r.map(i=>{var l,u;const a=n.node(i.id),o=a.x-(((l=i.measured)==null?void 0:l.width)??0)/2,s=a.y-(((u=i.measured)==null?void 0:u.height)??0)/2;return{...i,position:{x:o,y:s}}}),e]},gf={hideAttribution:!0},As=A.memo(()=>{const{handleSubmit:r,errors:e}=Re.useFormikContext(),{hideTitle:t,hideDescription:n,onCancel:i}=A.use(wn),a=A.use(St),o=A.useRef(null),[s,l]=A.useState(),[u,c]=A.useState("TB");A.useLayoutEffect(()=>{o.current&&o.current.classList.remove("light")},[]);const d=A.useMemo(()=>a.fieldSections.map((R,K)=>({id:R.identifier,position:{x:0,y:0},data:{index:K,fieldSection:R,layoutDirection:u},draggable:!0,type:"fieldSection"})),[a.fieldSections,u]),p=A.useMemo(()=>{const R=[],K={};for(const X of a.fieldSections)K[X.identifier]=X;for(const X of a.fieldSections){const ae=X.conditions;for(const[Fe,Ur]of Object.entries(ae))R.push({id:`${X.identifier}-${Fe}`,source:X.identifier,target:Fe,data:{targetSection:K[Fe],sourceSection:X,layoutDirection:u},animated:Ur.length>0,markerEnd:de.MarkerType.Arrow,style:{strokeWidth:2,stroke:"var(--base-a8)"},type:"fieldSectionCondition"})}return R},[a.fieldSections,u]),[h,g,x]=de.useNodesState(d),[C,w,m]=de.useEdgesState(p);A.useEffect(()=>{g(d)},[d,g]),A.useEffect(()=>{w(p)},[p,w]);const[_,E]=A.useMemo(()=>vf(h,C,u),[C,u,h]),S=A.useCallback(()=>{a.addFieldSection(new Ye({identifier:H.v4(),fields:[]}))},[a]),T=A.useCallback(R=>{const{source:K,target:X}=R,ae=a.fieldSections.find(({identifier:Fe})=>Fe===K);ae.setOptions({conditions:{...ae.conditions,[X]:[]}})},[a.fieldSections]),D=A.useCallback(R=>{const K=a.getSectionDependencyGraph();return!qi.willCreateCycle(K,R.source,R.target)},[a]),[M,P,V]=Re.useField("title"),[W,U,J]=Re.useField("description");return f.jsxs("form",{className:"size-full flex flex-col gap-4",id:vn,onSubmit:r,children:[!t&&f.jsx(Xr,{severity:"danger",helpText:P.error??null,children:f.jsx(v.Input.Root,{variant:"outline",size:"md",accentColor:P.error?bt.danger:"primary",children:f.jsx(v.Input.Field,{placeholder:"Enter a title",value:M.value??"",onChange:R=>{V.setValue(R.target.value)},maxLength:100})})}),!n&&f.jsx(v.TextArea,{className:"field-sizing-content",placeholder:"Explain a description",value:W.value??"",onChange:R=>{J.setValue(R.target.value)},resize:"vertical",maxLength:1e3,size:"md"}),f.jsxs(v.Card,{className:"size-full relative",variant:"outline",children:[f.jsx(de.ReactFlow,{ref:o,onInit:l,nodes:_,onNodesChange:x,edges:E,onEdgesChange:m,nodeTypes:hf,edgeTypes:pf,onConnect:T,attributionPosition:"bottom-left",fitView:!0,minZoom:0,isValidConnection:D,proOptions:gf}),f.jsx(de.Panel,{position:"top-left",children:f.jsx(v.ButtonGroup,{className:"flex items-center justify-end gap-2",size:"sm",children:f.jsxs(v.Button,{type:"button",variant:"surface",onClick:S,children:[f.jsx(v.LuIcon,{icon:Ze})," Add section"]})})}),f.jsxs(de.Panel,{position:"top-right",className:"flex flex-col items-center gap-2",children:[f.jsxs(v.ToggleGroup.Root,{className:"flex flex-col",type:"single",accentColor:"base",size:"sm",value:u,onValueChange:c,children:[f.jsx(v.ToggleGroup.IconItem,{className:"rounded-b-none",value:"LR",type:"button",children:f.jsx(v.LuIcon,{icon:Us})}),f.jsx(v.ToggleGroup.IconItem,{className:"rounded-t-none",value:"TB",type:"button",children:f.jsx(v.LuIcon,{icon:Rs})})]}),f.jsx(v.Separator,{size:"sm"}),f.jsxs(v.ButtonGroup,{className:"flex flex-col ",size:"sm",accentColor:"base",variant:"soft",children:[f.jsx(v.IconButton,{className:"rounded-b-none",onClick:()=>s==null?void 0:s.zoomIn(),type:"button",children:f.jsx(v.LuIcon,{icon:Ze})}),f.jsx(v.IconButton,{onClick:()=>s==null?void 0:s.zoomOut(),radius:"none",type:"button",children:f.jsx(v.LuIcon,{icon:Gr})}),f.jsx(v.IconButton,{className:"rounded-t-none",onClick:()=>s==null?void 0:s.fitView(),type:"button",children:f.jsx(v.LuIcon,{icon:dl})})]})]}),f.jsx(de.Panel,{position:"bottom-right",children:f.jsxs(v.ButtonGroup,{className:"flex items-center justify-end gap-2",size:"sm",children:[i&&f.jsx(v.Button,{type:"button",variant:"soft",accentColor:"base",onClick:i,children:"Cancel"}),f.jsx(v.Button,{type:"submit",variant:"surface",children:"Save"})]})})]}),!!e.fields&&f.jsx(v.Text,{size:"xs",accentColor:"danger",children:typeof e.fields=="string"&&e.fields})]})});As.displayName="FormBuilderFlowBuilder";const Es=A.memo(r=>{const{sourceFieldSection:e,targetFieldSection:t}=r,n=A.useMemo(()=>e.getConditions(t.identifier),[e,t.identifier]),i=A.useCallback(()=>{e.removeConditional(t.identifier)},[e,t.identifier]),a=A.useCallback(s=>{e.addCondition(t.identifier,Hi(s))},[e,t.identifier]),o=A.useCallback(s=>{e.removeCondition(t.identifier,s)},[e,t.identifier]);return f.jsxs(v.Card,{className:"flex flex-col gap-2",children:[f.jsxs(v.ButtonGroup,{className:"justify-between gap-2 flex",size:"sm",accentColor:"base",variant:"soft",children:[f.jsxs(v.Badge,{accentColor:"base",variant:"soft",size:"sm",children:[f.jsx(v.LuIcon,{icon:fe.section}),e.label??No]}),f.jsx(v.IconButton,{type:"button",onClick:i,variant:"ghost",children:f.jsx(v.LuIcon,{icon:ht})})]}),f.jsxs("div",{className:"flex h-max w-full flex-wrap gap-2",children:[n.map(s=>s.render({onRemove:o})),f.jsx(Xi,{fields:e.fields,onSelectField:a,align:"start",children:f.jsx(v.IconButton,{type:"button",size:"sm",variant:"soft",accentColor:"base",children:f.jsx(v.LuIcon,{icon:Ze})})})]})]})});Es.displayName="FieldSectionConditionalItem";const Is=A.memo(r=>{const{fieldSection:e}=r,t=A.use(St),n=A.useMemo(()=>t.fieldSections.filter(o=>e.identifier in o.conditions),[t.fieldSections,e.identifier]),i=A.useCallback(o=>{o.addConditional(e.identifier)},[e.identifier]),a=A.useMemo(()=>{const o=t.getSectionDependencyGraph();return t.fieldSections.filter(s=>!qi.willCreateCycle(o,s.identifier,e.identifier))},[e.identifier,t]);return f.jsxs("div",{className:"flex grow w-full flex-col gap-4",children:[f.jsxs("div",{className:"flex flex-col gap-2 w-full overflow-hidden",children:[f.jsx(v.Input.Root,{variant:"outline",size:"md",children:f.jsx(v.Input.Field,{placeholder:"Enter a section label (optional)",value:e.label??"",onChange:o=>e.setOptions({label:o.target.value}),maxLength:200})}),f.jsx(v.TextArea,{className:"field-sizing-content",placeholder:"Enter a section description (optional)",value:e.description??"",onChange:o=>e.setOptions({description:o.target.value}),maxLength:1e3,resize:"vertical",size:"md"})]}),f.jsx(v.Separator,{size:"full"}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsxs("div",{className:"flex gap-2 justify-between",children:[f.jsx(v.Text,{accentColor:"base",children:"Conditions"}),f.jsx(ws,{fieldSections:a,onSelectFieldCondition:i,children:f.jsxs(v.Button,{type:"button",variant:"soft",size:"sm",className:"w-max",children:[f.jsx(v.LuIcon,{icon:Ze}),"Add condition"]})})]}),n.map(o=>f.jsx(Es,{sourceFieldSection:o,targetFieldSection:e},o.identifier))]}),f.jsx(v.Separator,{size:"full"})]})});Is.displayName="FieldSectionBuilder";const Ss=A.memo(r=>{const{fieldSection:e,sectionIndex:t}=r,n=A.use(St),i=v.useAlertDialog(),a=A.useCallback(()=>{n.removeFieldSection(e)},[n,e]),o=A.useCallback(x=>{const C=x==="up"?t-1:t+1;n.moveFieldSection(t,C)},[n,t]),s=A.useCallback(()=>{n.addFieldSection(e.duplicate(H.v4()))},[n,e]),l=A.useCallback(x=>{e.addField(_n(x))},[e]),u=A.useCallback(()=>{o("up")},[o]),c=A.useCallback(()=>{o("down")},[o]),d=A.useCallback(async()=>{const x=[e.serialize()],C=dt.reseedFieldSections(x,{conditions:!1}),w=JSON.stringify(C);await navigator.clipboard.writeText(w),v.toast.success({title:"Section copied"})},[e]),p=A.useCallback(async()=>{const C=n.getDependenciesOfSection(e.identifier).map(_=>_.serialize()),w=dt.reseedFieldSections(C,{conditions:!0}),m=JSON.stringify(w);await navigator.clipboard.writeText(m),v.toast.success({title:"Section copied"})},[e,n]),h=A.useCallback(async()=>{const x=n.getDependenciesOfSection(e.identifier),C=x.length>1,w=x.length-1;C?i({title:"Copy section dependencies?",description:`This section has ${w} dependent section${w>1?"s":""} that will also be copied to maintain the conditions. Do you want to include these dependencies?`,action:"Include",onAction:p,cancel:"Dont include",onCancel:d}):d()},[e,n,i,p,d]),g=A.useCallback(async()=>{let x="";try{x=await navigator.clipboard.readText()}catch{v.toast.error({title:"Paste failed",description:"Unable to read clipboard contents."});return}const C=x.trim();if(!C){v.toast.error({title:"Paste failed",description:"Clipboard is empty."});return}let w;try{w=JSON.parse(C)}catch{v.toast.error({title:"Invalid JSON",description:"Check the JSON and try again."});return}const m=Array.isArray(w)?w:[w],_=[];for(const E of m){if(!E||typeof E!="object")continue;const S=E;if(S.type!=="section"||!Array.isArray(S.fields))continue;const T={type:"section",identifier:typeof S.identifier=="string"?S.identifier:H.v4(),label:typeof S.label=="string"||S.label===null?S.label:null,description:typeof S.description=="string"||S.description===null?S.description:null,conditions:S.conditions&&typeof S.conditions=="object"?S.conditions:{},fields:S.fields};try{_.push(Ye.deserialize(T))}catch{}}if(_.length===0){v.toast.error({title:"Paste failed",description:"No valid sections found in the JSON."});return}_.forEach((E,S)=>{n.addFieldSection(E,t+1+S)}),v.toast.success({title:"Section pasted",description:"Serialized JSON imported successfully."})},[n,t]);return f.jsxs(v.Card,{variant:"outline",className:"flex items-center justify-between gap-4 w-full",children:[f.jsxs("div",{className:"flex grow flex-col gap-4 w-full",children:[f.jsx(Is,{fieldSection:e}),f.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[f.jsxs("div",{className:"flex gap-2 justify-between",children:[f.jsx(v.Text,{accentColor:"base",size:"md",children:"Fields"}),f.jsx(mn,{onSelectFieldType:l,children:f.jsxs(v.Button,{type:"button",variant:"soft",size:"sm",children:[f.jsx(v.LuIcon,{icon:Ze})," Add field"]})})]}),e.fields.map((x,C)=>f.jsx(Gi,{field:x,fieldSection:e,fieldIndex:C,sectionIndex:t},x.identifier))]})]}),f.jsxs(v.ButtonGroup,{className:"flex-col gap-0.5 flex",variant:"ghost",accentColor:"base",size:"sm",children:[f.jsx(v.IconButton,{type:"button",onClick:u,children:f.jsx(v.LuIcon,{icon:na})}),f.jsx(v.IconButton,{type:"button",onClick:c,children:f.jsx(v.LuIcon,{icon:ra})}),f.jsxs(v.Menu.Root,{align:"end",children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsx(v.IconButton,{type:"button",children:f.jsx(v.LuIcon,{icon:Zs})})}),f.jsxs(v.Menu.Content,{size:"sm",children:[f.jsxs(v.Menu.Item,{onSelect:s,children:[f.jsx(v.LuIcon,{icon:Hr}),"Duplicate section"]}),f.jsxs(v.Menu.Item,{onSelect:h,children:[f.jsx(v.LuIcon,{icon:Ji}),"Copy JSON"]}),f.jsxs(v.Menu.Item,{onSelect:g,children:[f.jsx(v.LuIcon,{icon:js}),"Paste JSON"]}),f.jsxs(v.Menu.Item,{onSelect:a,children:[f.jsx(v.LuIcon,{icon:ht}),"Delete section"]})]})]})]})]})});Ss.displayName="FieldSectionWithActions";const Os=A.memo(()=>{const{handleSubmit:r,errors:e}=Re.useFormikContext(),{hideTitle:t,hideDescription:n,onCancel:i}=A.use(wn),a=A.use(St),o=A.useCallback(()=>{a.addFieldSection(new Ye({identifier:H.v4(),fields:[]}))},[a]),s=A.useCallback(async()=>{try{const g=a.serialize(),x=dt.reseedFieldSections(g),C=JSON.stringify(x);await navigator.clipboard.writeText(C),v.toast.success({title:"Sections copied",description:"All sections JSON copied to clipboard."})}catch{v.toast.error({title:"Copy failed",description:"Unable to copy the sections JSON."})}},[a]),[l,u,c]=Re.useField("title"),[d,p,h]=Re.useField("description");return f.jsxs("form",{className:"flex flex-col gap-4",id:vn,onSubmit:r,children:[!t&&f.jsx(Xr,{severity:"danger",helpText:u.error??null,children:f.jsx(v.Input.Root,{variant:"outline",size:"md",accentColor:u.error?bt.danger:"primary",children:f.jsx(v.Input.Field,{placeholder:"Enter a title",value:l.value??"",onChange:g=>{c.setValue(g.target.value)},maxLength:100})})}),!n&&f.jsx(v.TextArea,{className:"field-sizing-content",placeholder:"Explain a description",value:d.value??"",onChange:g=>{h.setValue(g.target.value)},resize:"vertical",maxLength:1e3,size:"md"}),f.jsxs("div",{className:"flex flex-col gap-4",children:[f.jsx("div",{className:"flex items-center justify-end",children:f.jsxs(v.Button,{type:"button",variant:"soft",size:"sm",onClick:s,children:[f.jsx(v.LuIcon,{icon:Ji})," Copy all sections"]})}),a.fieldSections.map((g,x)=>f.jsx(Ss,{fieldSection:g,sectionIndex:x},g.identifier)),f.jsxs(v.Button,{className:"mb-4",type:"button",variant:"soft",accentColor:"base",size:"sm",onClick:o,children:[f.jsx(v.LuIcon,{icon:Ze})," Add section"]})]}),!!e.fields&&f.jsx(v.Text,{size:"xs",accentColor:"danger",children:typeof e.fields=="string"&&e.fields}),f.jsxs(v.ButtonGroup,{className:"flex items-center justify-end gap-2",size:"sm",children:[i&&f.jsx(v.Button,{type:"button",variant:"soft",accentColor:"base",onClick:i,children:"Cancel"}),f.jsx(v.Button,{type:"submit",variant:"surface",children:"Save"})]})]})});Os.displayName="FormBuilderListBuilder";const $i=(r,e)=>{const t={},n=r.filter(i=>i instanceof Ye);for(const i of r)if(i instanceof Ye){const a=n.filter(s=>i.identifier in s.conditions);if(a.length===0||!a.some(s=>{const l=s.getConditions(i.identifier);return new xn(l).applyConditions(e)}))continue;Object.assign(t,i.getErrors(e))}else{if(!(i instanceof Ve))throw new Error("Invalid field type");const a=i.identifier,o=i.getError(En(e,a));o&&Ps(t,a,o)}if(Object.keys(t).length>0)return t},xf=async r=>{const e={},t=[];for(const n of r){const{fields:i}=n,a=[];for(const o of i){if(o.image){if(o.image instanceof Promise)try{e[o.identifier]=await o.image}catch(s){console.error("Failed to get image from promise",s)}else e[o.identifier]=o.image;delete o.image}a.push(o)}t.push({...n,fields:a})}return{fields:t,images:e}};async function yf(r){const e={};for(const[t,n]of Object.entries(r))e[t]=await Promise.all(n);return e}const bs=A.memo(A.forwardRef((r,e)=>{const{schema:t,values:n={},onValuesChange:i,onSubmit:a,submitText:o="Submit",cancelText:s,onCancel:l,onDirty:u,onDirtyChange:c,hideTitle:d=!t.title,hideDescription:p,className:h,buttonProps:g,enableReinitialize:x=!1,excludeUnchangedFields:C=!1}=r,{readonly:w}=t.meta,m=A.useId(),_=A.useMemo(()=>Ri(Cn(t.fields),n),[t.fields,n]),E=A.useCallback(V=>{a==null||a(C?vs(Cn(t.fields),_,V):V)},[C,_,a,t.fields]),S=Re.useFormik({initialValues:_,onSubmit:E,validate:V=>$i(t.fields,V),validateOnBlur:!1,validateOnChange:!1,enableReinitialize:!1});A.useLayoutEffect(()=>{x&&S.resetForm({values:_})},[x,_]);const{dirty:T}=S,D=A.useCallback((V,W)=>{ds(t.fields)[V].areValuesEqual(_[V],W)||i==null||i({...S.values,[V]:W},{[V]:W})},[S.values,_,i,t.fields]),M=A.useMemo(()=>({formId:m,disabled:w,onValuesChange:D}),[m,D,w]),P=cr(t.fields,M);return A.useEffect(()=>{T&&u&&u(),c&&c(T)},[T,u,c]),f.jsx(Re.FormikProvider,{value:S,children:f.jsx(gs,{value:t,children:f.jsxs("form",{id:m,ref:e,className:lr.cx(h,"flex flex-col gap-4"),onSubmit:S.handleSubmit,children:[!d&&f.jsxs(v.Card,{variant:"soft",className:"flex flex-col gap-1",children:[f.jsx(v.Heading,{size:"md",children:t.title}),!p&&f.jsx(v.Text,{accentColor:"base",children:t.description})]}),P,!w&&f.jsxs(v.ButtonGroup,{className:"flex items-center justify-end gap-2",size:"sm",children:[l&&f.jsxs(v.Button,{accentColor:"base",...g,type:"button",variant:"soft",onClick:l,children:[f.jsx(v.LuIcon,{icon:nt}),s]}),f.jsxs(v.Button,{...g,type:"submit",accentColor:"primary",variant:"surface",children:[f.jsx(v.LuIcon,{icon:Xe}),o]})]})]})})})})),Ns=A.memo(r=>{const{showFormTitle:e}=r,{values:t}=Re.useFormikContext(),n=A.use(St),i=A.useMemo(()=>({title:t.title,description:t.description,fields:n.fieldSections,meta:{readonly:!1}}),[n.fieldSections,t.description,t.title]);return f.jsx(bs,{schema:i,hideTitle:!e})});Ns.displayName="FormBuilderPreview";const Ts=A.memo(r=>{const{children:e,initialTitle:t,initialDescription:n,initialFields:i,onSave:a,onCancel:o,hideTitle:s=!1,hideDescription:l=!1,enableReinitialize:u=!1,disableRequiredFields:c=!1}=r,d=A.useCallback(w=>{var T;const m={};w.title||(m.title="Title is required."),(!w.fields||w.fields.length===0)&&(m.fields="At least one field is required.");const _=[];for(const[D,M]of w.fields.entries())for(const[P,V]of M.fields.entries()){const W=((T=xs(V.type,`fields.${D}.fields.${P}`))==null?void 0:T.map(({field:U})=>U))??[];_.push(...W)}const E={};for(const D of _)E[D.identifier]=En(w,D.identifier);const S=$i(_,E);if(S&&(m.fields=S.fields),Object.keys(m).length>0)return v.toast.error({title:"Some form settings are invalid",description:"Please check settings highlighted in red."}),m},[]),p=A.useMemo(()=>({title:t??"",description:n??"",fields:i??[]}),[n,i,t]),h=Re.useFormik({initialValues:p,validate:d,onSubmit:a,validateOnChange:!1,validateOnBlur:!1,enableReinitialize:u}),g=A.useCallback(w=>{h.setFieldValue("fields",w.serialize())},[h]),x=A.useMemo(()=>{const w=dt.deserialize(h.values.fields);return w.observe(g),w},[h.values.fields,g]),C=A.useMemo(()=>({hideTitle:s,hideDescription:l,disableRequiredFields:c,onCancel:o}),[c,l,s,o]);return f.jsx(wn,{value:C,children:f.jsx(St,{value:x,children:f.jsx(Re.FormikProvider,{value:h,children:e})})})});Ts.displayName="FormBuilderRoot";const Cf={Root:Ts,FlowBuilder:As,ListBuilder:Os,Preview:Ns};I.BaseCondition=De,I.BaseField=Ve,I.BaseFormElement=bn,I.BaseOptionsField=dr,I.BaseStringField=Pn,I.BooleanEqualsConditionModifier=vo,I.BooleanField=Tt,I.BooleanFieldCondition=Sr,I.BooleanFieldConditionCell=Po,I.BooleanInput=Dn,I.BooleanNotEqualsConditionModifier=go,I.CheckboxListField=Mt,I.CheckboxListFieldCondition=Or,I.CheckboxListFieldConditionCell=Vo,I.CheckboxListInput=Fn,I.ConditionManager=xn,I.DateAfterConditionModifier=wo,I.DateBeforeConditionModifier=Co,I.DateEqualsConditionModifier=xo,I.DateField=fr,I.DateFieldCondition=br,I.DateFieldConditionCell=Lo,I.DateInput=Vn,I.DateNotEqualsConditionModifier=yo,I.DateRangeInConditionModifier=mo,I.DateRangeNotInConditionModifier=_o,I.DoesNotHaveFilesConditionModifier=Eo,I.FieldSchema=dt,I.FieldSection=Ye,I.FieldSectionLayout=Ui,I.FieldTypeToClsMapping=un,I.FileCard=On,I.FormBuilder=Cf,I.FormRenderer=bs,I.HasFilesConditionModifier=Ao,I.ImageCard=la,I.ImageViewer=Nn,I.ImageViewerProvider=oa,I.InputWithHelpText=Xr,I.InputWithLabel=Se,I.InputWithLabelAndHelpText=Oe,I.LONG_TEXT_FIELD_MAX_LENGTH=Dt,I.MultiSelectField=it,I.MultiSelectFieldCondition=Nr,I.MultiSelectFieldConditionCell=ko,I.MultiSelectInput=Bn,I.MultiStringField=Nt,I.MultiStringFieldCondition=Tr,I.MultiStringFieldConditionCell=Uo,I.MultiStringInput=Tn,I.NumberEqualsConditionModifier=Ii,I.NumberField=$e,I.NumberFieldCondition=Dr,I.NumberFieldConditionCell=Go,I.NumberGreaterThanConditionModifier=Ni,I.NumberGreaterThanOrEqualsConditionModifier=Ti,I.NumberInput=Mn,I.NumberLessThanConditionModifier=Oi,I.NumberLessThanOrEqualsConditionModifier=bi,I.NumberNotEqualsConditionModifier=Si,I.NumberRangeInConditionModifier=Di,I.NumberRangeNotInConditionModifier=Mi,I.OTPField=Pt,I.OTPFieldCondition=Mr,I.OTPFieldConditionCell=$o,I.OTPInput=zn,I.Observable=ur,I.PassFailArrayExcludesConditionModifier=bo,I.PassFailArrayIncludesConditionModifier=Oo,I.PassFailEqualsConditionModifier=Io,I.PassFailField=Bt,I.PassFailFieldCondition=Pr,I.PassFailFieldConditionCell=Wo,I.PassFailInput=Rn,I.PassFailNotEqualsConditionModifier=So,I.RadioField=Lt,I.RadioFieldCondition=Fr,I.RadioFieldConditionCell=Yo,I.RadioInput=Hn,I.RatingField=zt,I.RatingFieldCondition=Vr,I.RatingFieldConditionCell=Ko,I.RatingInput=Gn,I.SEVERITY_COLOR_MAPPING=bt,I.SHORT_TEXT_FIELD_MAX_LENGTH=ln,I.ScanField=mr,I.ScanFieldCondition=Br,I.ScanFieldConditionCell=Jo,I.ScanInput=mi,I.Scanner=sn,I.ScannerProvider=fo,I.SelectField=vt,I.SelectFieldCondition=Lr,I.SelectFieldConditionCell=ts,I.SelectInput=Ln,I.StringArrayEqualsConditionModifier=hn,I.StringArrayEveryConditionModifier=cn,I.StringArrayExcludesConditionModifier=Fi,I.StringArrayIncludesConditionModifier=Pi,I.StringArrayNoneConditionModifier=fn,I.StringArrayNotEqualsConditionModifier=pn,I.StringArraySomeConditionModifier=dn,I.StringEqualsConditionModifier=_t,I.StringExcludesConditionModifier=Ar,I.StringField=Xt,I.StringFieldCondition=zr,I.StringFieldConditionCell=ns,I.StringIncludesConditionModifier=_r,I.StringInput=_i,I.StringNotEqualsConditionModifier=At,I.TextField=$t,I.TextFieldCondition=kr,I.TextFieldConditionCell=as,I.TextInput=Ai,I.UUIDFile=at,I.UUIDPromise=Vt,I.UploadField=qt,I.UploadFieldCondition=Rr,I.UploadFieldConditionCell=ss,I.UploadInput=Ei,I.areFileAndPromiseArraysEqual=qr,I.arePassFieldValuesEqual=ha,I.awaitFilesAndPromises=yf,I.changedFieldValues=vs,I.cleanFieldValues=ki,I.cleanSerializedFieldValues=ps,I.createCondition=Hi,I.createConditionModifierConfig=L,I.createField=_n,I.deserialize=cs,I.deserializeCondition=us,I.deserializeConditions=zi,I.deserializeField=yn,I.deserializeFieldValues=hs,I.deserializeFields=af,I.deserializeOnlyFields=of,I.deserializePassFailFieldValue=fa,I.extractFilesAndPromisesFromFieldValues=sf,I.fieldIcons=fe,I.flattenFields=Cn,I.getFieldsMapping=ds,I.initializeFieldValues=Ri,I.insertFilesAndPromisesToFieldValues=lf,I.isFileAndPromiseArray=sa,I.isPassFailFieldStatus=Un,I.isPassFailFieldValue=ca,I.isSerializedPassFailFieldValue=ua,I.isStringArray=pt,I.maxFileSizeB=po,I.maxFileSizeKB=ho,I.maxFileSizeMB=Wt,I.passFailFieldStatusMapping=gt,I.passFailFieldStatuses=Ft,I.separateImagesFromFields=xf,I.serializeFieldValues=fs,I.serializePassFailFieldValue=da,I.unchangedFieldValues=uf,I.useConditionManager=rf,I.useFieldInput=hl,I.useFieldInputs=cr,I.useFormikInput=be,I.useImageViewer=$r,I.useScanner=vl,I.validateFields=$i,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})});
|