wj-elements 0.7.6 → 0.8.0
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/animations.js +28 -51
- package/dist/animations.js.map +1 -1
- package/dist/base-path.js +19 -31
- package/dist/base-path.js.map +1 -1
- package/dist/custom-elements.json +9053 -9048
- package/dist/dark.css +1 -302
- package/dist/date.js +16 -36
- package/dist/date.js.map +1 -1
- package/dist/element-utils.js +20 -81
- package/dist/element-utils.js.map +1 -1
- package/dist/event.js +49 -165
- package/dist/event.js.map +1 -1
- package/dist/form-associated-element-BjeJn7j8.js +101 -0
- package/dist/{form-associated-element-DEQ4y-jn.js.map → form-associated-element-BjeJn7j8.js.map} +1 -1
- package/dist/icon-DmsqtDpL.js +102 -0
- package/dist/{icon-CReYMzAK.js.map → icon-DmsqtDpL.js.map} +1 -1
- package/dist/light.css +1 -731
- package/dist/localize.js +36 -111
- package/dist/localize.js.map +1 -1
- package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +3 -2
- package/dist/packages/wje-img/img.element.d.ts +4 -4
- package/dist/permissions.js +14 -41
- package/dist/permissions.js.map +1 -1
- package/dist/popup.element-CbkhthPP.js +806 -0
- package/dist/{popup.element-CwXvVFK7.js.map → popup.element-CbkhthPP.js.map} +1 -1
- package/dist/router-links-CNsJ-elb.js +105 -0
- package/dist/{router-links-wjqCnncc.js.map → router-links-CNsJ-elb.js.map} +1 -1
- package/dist/skeleton.css +1 -197
- package/dist/styles.css +1 -866
- package/dist/universal-service.js +48 -109
- package/dist/universal-service.js.map +1 -1
- package/dist/utils.js +11 -18
- package/dist/utils.js.map +1 -1
- package/dist/web-types.json +698 -698
- package/dist/wje-accordion-item.js +33 -106
- package/dist/wje-accordion-item.js.map +1 -1
- package/dist/wje-accordion.js +19 -84
- package/dist/wje-accordion.js.map +1 -1
- package/dist/wje-animation.js +37 -4258
- package/dist/wje-animation.js.map +1 -1
- package/dist/wje-aside.js +9 -34
- package/dist/wje-aside.js.map +1 -1
- package/dist/wje-avatar.js +36 -126
- package/dist/wje-avatar.js.map +1 -1
- package/dist/wje-badge.js +10 -52
- package/dist/wje-badge.js.map +1 -1
- package/dist/wje-breadcrumb.js +205 -668
- package/dist/wje-breadcrumb.js.map +1 -1
- package/dist/wje-breadcrumbs.js +177 -633
- package/dist/wje-breadcrumbs.js.map +1 -1
- package/dist/wje-button-group.js +48 -153
- package/dist/wje-button-group.js.map +1 -1
- package/dist/wje-button.js +92 -413
- package/dist/wje-button.js.map +1 -1
- package/dist/wje-card-content.js +7 -30
- package/dist/wje-card-content.js.map +1 -1
- package/dist/wje-card-controls.js +7 -30
- package/dist/wje-card-controls.js.map +1 -1
- package/dist/wje-card-header.js +7 -30
- package/dist/wje-card-header.js.map +1 -1
- package/dist/wje-card-subtitle.js +7 -34
- package/dist/wje-card-subtitle.js.map +1 -1
- package/dist/wje-card-title.js +7 -34
- package/dist/wje-card-title.js.map +1 -1
- package/dist/wje-card.js +15 -71
- package/dist/wje-card.js.map +1 -1
- package/dist/wje-carousel-item.js +12 -56
- package/dist/wje-carousel-item.js.map +1 -1
- package/dist/wje-carousel.js +154 -509
- package/dist/wje-carousel.js.map +1 -1
- package/dist/wje-checkbox.js +50 -227
- package/dist/wje-checkbox.js.map +1 -1
- package/dist/wje-chip.js +43 -160
- package/dist/wje-chip.js.map +1 -1
- package/dist/wje-col.js +7 -20
- package/dist/wje-col.js.map +1 -1
- package/dist/wje-color-picker.js +445 -1464
- package/dist/wje-color-picker.js.map +1 -1
- package/dist/wje-container.js +9 -35
- package/dist/wje-container.js.map +1 -1
- package/dist/wje-copy-button.js +64 -204
- package/dist/wje-copy-button.js.map +1 -1
- package/dist/wje-dialog.js +85 -553
- package/dist/wje-dialog.js.map +1 -1
- package/dist/wje-divider.js +7 -34
- package/dist/wje-divider.js.map +1 -1
- package/dist/wje-dropdown.js +78 -305
- package/dist/wje-dropdown.js.map +1 -1
- package/dist/wje-element.js +191 -700
- package/dist/wje-element.js.map +1 -1
- package/dist/wje-file-upload-item.js +51 -156
- package/dist/wje-file-upload-item.js.map +1 -1
- package/dist/wje-file-upload.js +181 -619
- package/dist/wje-file-upload.js.map +1 -1
- package/dist/wje-footer.js +7 -31
- package/dist/wje-footer.js.map +1 -1
- package/dist/wje-form.js +7 -32
- package/dist/wje-form.js.map +1 -1
- package/dist/wje-format-digital.js +26 -118
- package/dist/wje-format-digital.js.map +1 -1
- package/dist/wje-grid.js +7 -33
- package/dist/wje-grid.js.map +1 -1
- package/dist/wje-header.js +9 -35
- package/dist/wje-header.js.map +1 -1
- package/dist/wje-icon-library.js +12 -18
- package/dist/wje-icon-library.js.map +1 -1
- package/dist/wje-icon-picker.js +65 -320
- package/dist/wje-icon-picker.js.map +1 -1
- package/dist/wje-icon.js +1 -1
- package/dist/wje-img-comparer.js +37 -114
- package/dist/wje-img-comparer.js.map +1 -1
- package/dist/wje-img.js +50 -197
- package/dist/wje-img.js.map +1 -1
- package/dist/wje-infinite-scroll.js +94 -346
- package/dist/wje-infinite-scroll.js.map +1 -1
- package/dist/wje-input-file.js +23 -84
- package/dist/wje-input-file.js.map +1 -1
- package/dist/wje-input.js +78 -392
- package/dist/wje-input.js.map +1 -1
- package/dist/wje-item.js +11 -64
- package/dist/wje-item.js.map +1 -1
- package/dist/wje-kanban.js +124 -401
- package/dist/wje-kanban.js.map +1 -1
- package/dist/wje-label.js +9 -32
- package/dist/wje-label.js.map +1 -1
- package/dist/wje-level-indicator.js +38 -157
- package/dist/wje-level-indicator.js.map +1 -1
- package/dist/wje-list.js +10 -40
- package/dist/wje-list.js.map +1 -1
- package/dist/wje-main.js +7 -31
- package/dist/wje-main.js.map +1 -1
- package/dist/wje-masonry.js +66 -211
- package/dist/wje-masonry.js.map +1 -1
- package/dist/wje-master.js +45 -161
- package/dist/wje-master.js.map +1 -1
- package/dist/wje-menu-button.js +10 -38
- package/dist/wje-menu-button.js.map +1 -1
- package/dist/wje-menu-item.js +127 -577
- package/dist/wje-menu-item.js.map +1 -1
- package/dist/wje-menu-label.js +9 -35
- package/dist/wje-menu-label.js.map +1 -1
- package/dist/wje-menu.js +14 -49
- package/dist/wje-menu.js.map +1 -1
- package/dist/wje-option.js +48 -279
- package/dist/wje-option.js.map +1 -1
- package/dist/wje-options.js +130 -384
- package/dist/wje-options.js.map +1 -1
- package/dist/wje-orgchart-group.js +16 -52
- package/dist/wje-orgchart-group.js.map +1 -1
- package/dist/wje-orgchart-item.js +24 -93
- package/dist/wje-orgchart-item.js.map +1 -1
- package/dist/wje-orgchart.js +18 -68
- package/dist/wje-orgchart.js.map +1 -1
- package/dist/wje-pagination.js +113 -397
- package/dist/wje-pagination.js.map +1 -1
- package/dist/wje-popup.js +3 -3
- package/dist/wje-popup.js.map +1 -1
- package/dist/wje-progress-bar.js +53 -205
- package/dist/wje-progress-bar.js.map +1 -1
- package/dist/wje-qr-code.js +398 -2980
- package/dist/wje-qr-code.js.map +1 -1
- package/dist/wje-radio-group.js +52 -190
- package/dist/wje-radio-group.js.map +1 -1
- package/dist/wje-radio.js +24 -118
- package/dist/wje-radio.js.map +1 -1
- package/dist/wje-rate.js +62 -266
- package/dist/wje-rate.js.map +1 -1
- package/dist/wje-relative-time.js +24 -99
- package/dist/wje-relative-time.js.map +1 -1
- package/dist/wje-reorder-dropzone.js +9 -31
- package/dist/wje-reorder-dropzone.js.map +1 -1
- package/dist/wje-reorder-handle.js +67 -204
- package/dist/wje-reorder-handle.js.map +1 -1
- package/dist/wje-reorder-item.js +14 -44
- package/dist/wje-reorder-item.js.map +1 -1
- package/dist/wje-reorder.js +61 -246
- package/dist/wje-reorder.js.map +1 -1
- package/dist/wje-route.js +6 -24
- package/dist/wje-route.js.map +1 -1
- package/dist/wje-router-link.js +11 -39
- package/dist/wje-router-link.js.map +1 -1
- package/dist/wje-router-outlet.js +76 -172
- package/dist/wje-router-outlet.js.map +1 -1
- package/dist/wje-routerx.js +537 -1331
- package/dist/wje-routerx.js.map +1 -1
- package/dist/wje-row.js +9 -31
- package/dist/wje-row.js.map +1 -1
- package/dist/wje-select.js +326 -1152
- package/dist/wje-select.js.map +1 -1
- package/dist/wje-slider.js +44 -225
- package/dist/wje-slider.js.map +1 -1
- package/dist/wje-sliding-container.js +295 -1319
- package/dist/wje-sliding-container.js.map +1 -1
- package/dist/wje-split-view.js +35 -121
- package/dist/wje-split-view.js.map +1 -1
- package/dist/wje-status.js +14 -45
- package/dist/wje-status.js.map +1 -1
- package/dist/wje-step.js +9 -32
- package/dist/wje-step.js.map +1 -1
- package/dist/wje-stepper.js +109 -357
- package/dist/wje-stepper.js.map +1 -1
- package/dist/wje-store.js +67 -360
- package/dist/wje-store.js.map +1 -1
- package/dist/wje-tab-group.js +85 -314
- package/dist/wje-tab-group.js.map +1 -1
- package/dist/wje-tab-panel.js +7 -28
- package/dist/wje-tab-panel.js.map +1 -1
- package/dist/wje-tab.js +21 -198
- package/dist/wje-tab.js.map +1 -1
- package/dist/wje-textarea.js +64 -264
- package/dist/wje-textarea.js.map +1 -1
- package/dist/wje-thumbnail.js +10 -51
- package/dist/wje-thumbnail.js.map +1 -1
- package/dist/wje-toast.js +127 -632
- package/dist/wje-toast.js.map +1 -1
- package/dist/wje-toggle.js +52 -177
- package/dist/wje-toggle.js.map +1 -1
- package/dist/wje-toolbar-action.js +128 -456
- package/dist/wje-toolbar-action.js.map +1 -1
- package/dist/wje-toolbar.js +75 -270
- package/dist/wje-toolbar.js.map +1 -1
- package/dist/wje-tooltip.js +50 -161
- package/dist/wje-tooltip.js.map +1 -1
- package/dist/wje-tree-item.js +70 -301
- package/dist/wje-tree-item.js.map +1 -1
- package/dist/wje-tree.js +145 -489
- package/dist/wje-tree.js.map +1 -1
- package/dist/wje-visually-hidden.js +7 -34
- package/dist/wje-visually-hidden.js.map +1 -1
- package/package.json +4 -2
- package/dist/form-associated-element-DEQ4y-jn.js +0 -245
- package/dist/icon-CReYMzAK.js +0 -245
- package/dist/popup.element-CwXvVFK7.js +0 -2133
- package/dist/router-links-wjqCnncc.js +0 -156
package/dist/wje-qr-code.js
CHANGED
|
@@ -1,3034 +1,452 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
4
|
+
import t from "./wje-element.js";
|
|
5
|
+
function e(t2) {
|
|
6
|
+
return t2 && t2.__esModule && Object.prototype.hasOwnProperty.call(t2, "default") ? t2.default : t2;
|
|
8
7
|
}
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
this.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
0,
|
|
335
|
-
28,
|
|
336
|
-
16,
|
|
337
|
-
1,
|
|
338
|
-
0,
|
|
339
|
-
22,
|
|
340
|
-
22,
|
|
341
|
-
1,
|
|
342
|
-
0,
|
|
343
|
-
16,
|
|
344
|
-
28,
|
|
345
|
-
1,
|
|
346
|
-
0,
|
|
347
|
-
55,
|
|
348
|
-
15,
|
|
349
|
-
1,
|
|
350
|
-
0,
|
|
351
|
-
44,
|
|
352
|
-
26,
|
|
353
|
-
2,
|
|
354
|
-
0,
|
|
355
|
-
17,
|
|
356
|
-
18,
|
|
357
|
-
2,
|
|
358
|
-
0,
|
|
359
|
-
13,
|
|
360
|
-
22,
|
|
361
|
-
1,
|
|
362
|
-
0,
|
|
363
|
-
80,
|
|
364
|
-
20,
|
|
365
|
-
2,
|
|
366
|
-
0,
|
|
367
|
-
32,
|
|
368
|
-
18,
|
|
369
|
-
2,
|
|
370
|
-
0,
|
|
371
|
-
24,
|
|
372
|
-
26,
|
|
373
|
-
4,
|
|
374
|
-
0,
|
|
375
|
-
9,
|
|
376
|
-
16,
|
|
377
|
-
1,
|
|
378
|
-
0,
|
|
379
|
-
108,
|
|
380
|
-
26,
|
|
381
|
-
2,
|
|
382
|
-
0,
|
|
383
|
-
43,
|
|
384
|
-
24,
|
|
385
|
-
2,
|
|
386
|
-
2,
|
|
387
|
-
15,
|
|
388
|
-
18,
|
|
389
|
-
2,
|
|
390
|
-
2,
|
|
391
|
-
11,
|
|
392
|
-
22,
|
|
393
|
-
2,
|
|
394
|
-
0,
|
|
395
|
-
68,
|
|
396
|
-
18,
|
|
397
|
-
4,
|
|
398
|
-
0,
|
|
399
|
-
27,
|
|
400
|
-
16,
|
|
401
|
-
4,
|
|
402
|
-
0,
|
|
403
|
-
19,
|
|
404
|
-
24,
|
|
405
|
-
4,
|
|
406
|
-
0,
|
|
407
|
-
15,
|
|
408
|
-
28,
|
|
409
|
-
2,
|
|
410
|
-
0,
|
|
411
|
-
78,
|
|
412
|
-
20,
|
|
413
|
-
4,
|
|
414
|
-
0,
|
|
415
|
-
31,
|
|
416
|
-
18,
|
|
417
|
-
2,
|
|
418
|
-
4,
|
|
419
|
-
14,
|
|
420
|
-
18,
|
|
421
|
-
4,
|
|
422
|
-
1,
|
|
423
|
-
13,
|
|
424
|
-
26,
|
|
425
|
-
2,
|
|
426
|
-
0,
|
|
427
|
-
97,
|
|
428
|
-
24,
|
|
429
|
-
2,
|
|
430
|
-
2,
|
|
431
|
-
38,
|
|
432
|
-
22,
|
|
433
|
-
4,
|
|
434
|
-
2,
|
|
435
|
-
18,
|
|
436
|
-
22,
|
|
437
|
-
4,
|
|
438
|
-
2,
|
|
439
|
-
14,
|
|
440
|
-
26,
|
|
441
|
-
2,
|
|
442
|
-
0,
|
|
443
|
-
116,
|
|
444
|
-
30,
|
|
445
|
-
3,
|
|
446
|
-
2,
|
|
447
|
-
36,
|
|
448
|
-
22,
|
|
449
|
-
4,
|
|
450
|
-
4,
|
|
451
|
-
16,
|
|
452
|
-
20,
|
|
453
|
-
4,
|
|
454
|
-
4,
|
|
455
|
-
12,
|
|
456
|
-
24,
|
|
457
|
-
2,
|
|
458
|
-
2,
|
|
459
|
-
68,
|
|
460
|
-
18,
|
|
461
|
-
4,
|
|
462
|
-
1,
|
|
463
|
-
43,
|
|
464
|
-
26,
|
|
465
|
-
6,
|
|
466
|
-
2,
|
|
467
|
-
19,
|
|
468
|
-
24,
|
|
469
|
-
6,
|
|
470
|
-
2,
|
|
471
|
-
15,
|
|
472
|
-
28,
|
|
473
|
-
4,
|
|
474
|
-
0,
|
|
475
|
-
81,
|
|
476
|
-
20,
|
|
477
|
-
1,
|
|
478
|
-
4,
|
|
479
|
-
50,
|
|
480
|
-
30,
|
|
481
|
-
4,
|
|
482
|
-
4,
|
|
483
|
-
22,
|
|
484
|
-
28,
|
|
485
|
-
3,
|
|
486
|
-
8,
|
|
487
|
-
12,
|
|
488
|
-
24,
|
|
489
|
-
2,
|
|
490
|
-
2,
|
|
491
|
-
92,
|
|
492
|
-
24,
|
|
493
|
-
6,
|
|
494
|
-
2,
|
|
495
|
-
36,
|
|
496
|
-
22,
|
|
497
|
-
4,
|
|
498
|
-
6,
|
|
499
|
-
20,
|
|
500
|
-
26,
|
|
501
|
-
7,
|
|
502
|
-
4,
|
|
503
|
-
14,
|
|
504
|
-
28,
|
|
505
|
-
4,
|
|
506
|
-
0,
|
|
507
|
-
107,
|
|
508
|
-
26,
|
|
509
|
-
8,
|
|
510
|
-
1,
|
|
511
|
-
37,
|
|
512
|
-
22,
|
|
513
|
-
8,
|
|
514
|
-
4,
|
|
515
|
-
20,
|
|
516
|
-
24,
|
|
517
|
-
12,
|
|
518
|
-
4,
|
|
519
|
-
11,
|
|
520
|
-
22,
|
|
521
|
-
3,
|
|
522
|
-
1,
|
|
523
|
-
115,
|
|
524
|
-
30,
|
|
525
|
-
4,
|
|
526
|
-
5,
|
|
527
|
-
40,
|
|
528
|
-
24,
|
|
529
|
-
11,
|
|
530
|
-
5,
|
|
531
|
-
16,
|
|
532
|
-
20,
|
|
533
|
-
11,
|
|
534
|
-
5,
|
|
535
|
-
12,
|
|
536
|
-
24,
|
|
537
|
-
5,
|
|
538
|
-
1,
|
|
539
|
-
87,
|
|
540
|
-
22,
|
|
541
|
-
5,
|
|
542
|
-
5,
|
|
543
|
-
41,
|
|
544
|
-
24,
|
|
545
|
-
5,
|
|
546
|
-
7,
|
|
547
|
-
24,
|
|
548
|
-
30,
|
|
549
|
-
11,
|
|
550
|
-
7,
|
|
551
|
-
12,
|
|
552
|
-
24,
|
|
553
|
-
5,
|
|
554
|
-
1,
|
|
555
|
-
98,
|
|
556
|
-
24,
|
|
557
|
-
7,
|
|
558
|
-
3,
|
|
559
|
-
45,
|
|
560
|
-
28,
|
|
561
|
-
15,
|
|
562
|
-
2,
|
|
563
|
-
19,
|
|
564
|
-
24,
|
|
565
|
-
3,
|
|
566
|
-
13,
|
|
567
|
-
15,
|
|
568
|
-
30,
|
|
569
|
-
1,
|
|
570
|
-
5,
|
|
571
|
-
107,
|
|
572
|
-
28,
|
|
573
|
-
10,
|
|
574
|
-
1,
|
|
575
|
-
46,
|
|
576
|
-
28,
|
|
577
|
-
1,
|
|
578
|
-
15,
|
|
579
|
-
22,
|
|
580
|
-
28,
|
|
581
|
-
2,
|
|
582
|
-
17,
|
|
583
|
-
14,
|
|
584
|
-
28,
|
|
585
|
-
5,
|
|
586
|
-
1,
|
|
587
|
-
120,
|
|
588
|
-
30,
|
|
589
|
-
9,
|
|
590
|
-
4,
|
|
591
|
-
43,
|
|
592
|
-
26,
|
|
593
|
-
17,
|
|
594
|
-
1,
|
|
595
|
-
22,
|
|
596
|
-
28,
|
|
597
|
-
2,
|
|
598
|
-
19,
|
|
599
|
-
14,
|
|
600
|
-
28,
|
|
601
|
-
3,
|
|
602
|
-
4,
|
|
603
|
-
113,
|
|
604
|
-
28,
|
|
605
|
-
3,
|
|
606
|
-
11,
|
|
607
|
-
44,
|
|
608
|
-
26,
|
|
609
|
-
17,
|
|
610
|
-
4,
|
|
611
|
-
21,
|
|
612
|
-
26,
|
|
613
|
-
9,
|
|
614
|
-
16,
|
|
615
|
-
13,
|
|
616
|
-
26,
|
|
617
|
-
3,
|
|
618
|
-
5,
|
|
619
|
-
107,
|
|
620
|
-
28,
|
|
621
|
-
3,
|
|
622
|
-
13,
|
|
623
|
-
41,
|
|
624
|
-
26,
|
|
625
|
-
15,
|
|
626
|
-
5,
|
|
627
|
-
24,
|
|
628
|
-
30,
|
|
629
|
-
15,
|
|
630
|
-
10,
|
|
631
|
-
15,
|
|
632
|
-
28,
|
|
633
|
-
4,
|
|
634
|
-
4,
|
|
635
|
-
116,
|
|
636
|
-
28,
|
|
637
|
-
17,
|
|
638
|
-
0,
|
|
639
|
-
42,
|
|
640
|
-
26,
|
|
641
|
-
17,
|
|
642
|
-
6,
|
|
643
|
-
22,
|
|
644
|
-
28,
|
|
645
|
-
19,
|
|
646
|
-
6,
|
|
647
|
-
16,
|
|
648
|
-
30,
|
|
649
|
-
2,
|
|
650
|
-
7,
|
|
651
|
-
111,
|
|
652
|
-
28,
|
|
653
|
-
17,
|
|
654
|
-
0,
|
|
655
|
-
46,
|
|
656
|
-
28,
|
|
657
|
-
7,
|
|
658
|
-
16,
|
|
659
|
-
24,
|
|
660
|
-
30,
|
|
661
|
-
34,
|
|
662
|
-
0,
|
|
663
|
-
13,
|
|
664
|
-
24,
|
|
665
|
-
4,
|
|
666
|
-
5,
|
|
667
|
-
121,
|
|
668
|
-
30,
|
|
669
|
-
4,
|
|
670
|
-
14,
|
|
671
|
-
47,
|
|
672
|
-
28,
|
|
673
|
-
11,
|
|
674
|
-
14,
|
|
675
|
-
24,
|
|
676
|
-
30,
|
|
677
|
-
16,
|
|
678
|
-
14,
|
|
679
|
-
15,
|
|
680
|
-
30,
|
|
681
|
-
6,
|
|
682
|
-
4,
|
|
683
|
-
117,
|
|
684
|
-
30,
|
|
685
|
-
6,
|
|
686
|
-
14,
|
|
687
|
-
45,
|
|
688
|
-
28,
|
|
689
|
-
11,
|
|
690
|
-
16,
|
|
691
|
-
24,
|
|
692
|
-
30,
|
|
693
|
-
30,
|
|
694
|
-
2,
|
|
695
|
-
16,
|
|
696
|
-
30,
|
|
697
|
-
8,
|
|
698
|
-
4,
|
|
699
|
-
106,
|
|
700
|
-
26,
|
|
701
|
-
8,
|
|
702
|
-
13,
|
|
703
|
-
47,
|
|
704
|
-
28,
|
|
705
|
-
7,
|
|
706
|
-
22,
|
|
707
|
-
24,
|
|
708
|
-
30,
|
|
709
|
-
22,
|
|
710
|
-
13,
|
|
711
|
-
15,
|
|
712
|
-
30,
|
|
713
|
-
10,
|
|
714
|
-
2,
|
|
715
|
-
114,
|
|
716
|
-
28,
|
|
717
|
-
19,
|
|
718
|
-
4,
|
|
719
|
-
46,
|
|
720
|
-
28,
|
|
721
|
-
28,
|
|
722
|
-
6,
|
|
723
|
-
22,
|
|
724
|
-
28,
|
|
725
|
-
33,
|
|
726
|
-
4,
|
|
727
|
-
16,
|
|
728
|
-
30,
|
|
729
|
-
8,
|
|
730
|
-
4,
|
|
731
|
-
122,
|
|
732
|
-
30,
|
|
733
|
-
22,
|
|
734
|
-
3,
|
|
735
|
-
45,
|
|
736
|
-
28,
|
|
737
|
-
8,
|
|
738
|
-
26,
|
|
739
|
-
23,
|
|
740
|
-
30,
|
|
741
|
-
12,
|
|
742
|
-
28,
|
|
743
|
-
15,
|
|
744
|
-
30,
|
|
745
|
-
3,
|
|
746
|
-
10,
|
|
747
|
-
117,
|
|
748
|
-
30,
|
|
749
|
-
3,
|
|
750
|
-
23,
|
|
751
|
-
45,
|
|
752
|
-
28,
|
|
753
|
-
4,
|
|
754
|
-
31,
|
|
755
|
-
24,
|
|
756
|
-
30,
|
|
757
|
-
11,
|
|
758
|
-
31,
|
|
759
|
-
15,
|
|
760
|
-
30,
|
|
761
|
-
7,
|
|
762
|
-
7,
|
|
763
|
-
116,
|
|
764
|
-
30,
|
|
765
|
-
21,
|
|
766
|
-
7,
|
|
767
|
-
45,
|
|
768
|
-
28,
|
|
769
|
-
1,
|
|
770
|
-
37,
|
|
771
|
-
23,
|
|
772
|
-
30,
|
|
773
|
-
19,
|
|
774
|
-
26,
|
|
775
|
-
15,
|
|
776
|
-
30,
|
|
777
|
-
5,
|
|
778
|
-
10,
|
|
779
|
-
115,
|
|
780
|
-
30,
|
|
781
|
-
19,
|
|
782
|
-
10,
|
|
783
|
-
47,
|
|
784
|
-
28,
|
|
785
|
-
15,
|
|
786
|
-
25,
|
|
787
|
-
24,
|
|
788
|
-
30,
|
|
789
|
-
23,
|
|
790
|
-
25,
|
|
791
|
-
15,
|
|
792
|
-
30,
|
|
793
|
-
13,
|
|
794
|
-
3,
|
|
795
|
-
115,
|
|
796
|
-
30,
|
|
797
|
-
2,
|
|
798
|
-
29,
|
|
799
|
-
46,
|
|
800
|
-
28,
|
|
801
|
-
42,
|
|
802
|
-
1,
|
|
803
|
-
24,
|
|
804
|
-
30,
|
|
805
|
-
23,
|
|
806
|
-
28,
|
|
807
|
-
15,
|
|
808
|
-
30,
|
|
809
|
-
17,
|
|
810
|
-
0,
|
|
811
|
-
115,
|
|
812
|
-
30,
|
|
813
|
-
10,
|
|
814
|
-
23,
|
|
815
|
-
46,
|
|
816
|
-
28,
|
|
817
|
-
10,
|
|
818
|
-
35,
|
|
819
|
-
24,
|
|
820
|
-
30,
|
|
821
|
-
19,
|
|
822
|
-
35,
|
|
823
|
-
15,
|
|
824
|
-
30,
|
|
825
|
-
17,
|
|
826
|
-
1,
|
|
827
|
-
115,
|
|
828
|
-
30,
|
|
829
|
-
14,
|
|
830
|
-
21,
|
|
831
|
-
46,
|
|
832
|
-
28,
|
|
833
|
-
29,
|
|
834
|
-
19,
|
|
835
|
-
24,
|
|
836
|
-
30,
|
|
837
|
-
11,
|
|
838
|
-
46,
|
|
839
|
-
15,
|
|
840
|
-
30,
|
|
841
|
-
13,
|
|
842
|
-
6,
|
|
843
|
-
115,
|
|
844
|
-
30,
|
|
845
|
-
14,
|
|
846
|
-
23,
|
|
847
|
-
46,
|
|
848
|
-
28,
|
|
849
|
-
44,
|
|
850
|
-
7,
|
|
851
|
-
24,
|
|
852
|
-
30,
|
|
853
|
-
59,
|
|
854
|
-
1,
|
|
855
|
-
16,
|
|
856
|
-
30,
|
|
857
|
-
12,
|
|
858
|
-
7,
|
|
859
|
-
121,
|
|
860
|
-
30,
|
|
861
|
-
12,
|
|
862
|
-
26,
|
|
863
|
-
47,
|
|
864
|
-
28,
|
|
865
|
-
39,
|
|
866
|
-
14,
|
|
867
|
-
24,
|
|
868
|
-
30,
|
|
869
|
-
22,
|
|
870
|
-
41,
|
|
871
|
-
15,
|
|
872
|
-
30,
|
|
873
|
-
6,
|
|
874
|
-
14,
|
|
875
|
-
121,
|
|
876
|
-
30,
|
|
877
|
-
6,
|
|
878
|
-
34,
|
|
879
|
-
47,
|
|
880
|
-
28,
|
|
881
|
-
46,
|
|
882
|
-
10,
|
|
883
|
-
24,
|
|
884
|
-
30,
|
|
885
|
-
2,
|
|
886
|
-
64,
|
|
887
|
-
15,
|
|
888
|
-
30,
|
|
889
|
-
17,
|
|
890
|
-
4,
|
|
891
|
-
122,
|
|
892
|
-
30,
|
|
893
|
-
29,
|
|
894
|
-
14,
|
|
895
|
-
46,
|
|
896
|
-
28,
|
|
897
|
-
49,
|
|
898
|
-
10,
|
|
899
|
-
24,
|
|
900
|
-
30,
|
|
901
|
-
24,
|
|
902
|
-
46,
|
|
903
|
-
15,
|
|
904
|
-
30,
|
|
905
|
-
4,
|
|
906
|
-
18,
|
|
907
|
-
122,
|
|
908
|
-
30,
|
|
909
|
-
13,
|
|
910
|
-
32,
|
|
911
|
-
46,
|
|
912
|
-
28,
|
|
913
|
-
48,
|
|
914
|
-
14,
|
|
915
|
-
24,
|
|
916
|
-
30,
|
|
917
|
-
42,
|
|
918
|
-
32,
|
|
919
|
-
15,
|
|
920
|
-
30,
|
|
921
|
-
20,
|
|
922
|
-
4,
|
|
923
|
-
117,
|
|
924
|
-
30,
|
|
925
|
-
40,
|
|
926
|
-
7,
|
|
927
|
-
47,
|
|
928
|
-
28,
|
|
929
|
-
43,
|
|
930
|
-
22,
|
|
931
|
-
24,
|
|
932
|
-
30,
|
|
933
|
-
10,
|
|
934
|
-
67,
|
|
935
|
-
15,
|
|
936
|
-
30,
|
|
937
|
-
19,
|
|
938
|
-
6,
|
|
939
|
-
118,
|
|
940
|
-
30,
|
|
941
|
-
18,
|
|
942
|
-
31,
|
|
943
|
-
47,
|
|
944
|
-
28,
|
|
945
|
-
34,
|
|
946
|
-
34,
|
|
947
|
-
24,
|
|
948
|
-
30,
|
|
949
|
-
20,
|
|
950
|
-
61,
|
|
951
|
-
15,
|
|
952
|
-
30
|
|
953
|
-
],
|
|
954
|
-
/**
|
|
955
|
-
* The final format bits with mask (level << 3 | mask).
|
|
956
|
-
*
|
|
957
|
-
* @public
|
|
958
|
-
* @static
|
|
959
|
-
* @type {number[]}
|
|
960
|
-
* @memberof ErrorCorrection
|
|
961
|
-
*/
|
|
962
|
-
FINAL_FORMAT: [
|
|
963
|
-
// L
|
|
964
|
-
30660,
|
|
965
|
-
29427,
|
|
966
|
-
32170,
|
|
967
|
-
30877,
|
|
968
|
-
26159,
|
|
969
|
-
25368,
|
|
970
|
-
27713,
|
|
971
|
-
26998,
|
|
972
|
-
// M
|
|
973
|
-
21522,
|
|
974
|
-
20773,
|
|
975
|
-
24188,
|
|
976
|
-
23371,
|
|
977
|
-
17913,
|
|
978
|
-
16590,
|
|
979
|
-
20375,
|
|
980
|
-
19104,
|
|
981
|
-
// Q
|
|
982
|
-
13663,
|
|
983
|
-
12392,
|
|
984
|
-
16177,
|
|
985
|
-
14854,
|
|
986
|
-
9396,
|
|
987
|
-
8579,
|
|
988
|
-
11994,
|
|
989
|
-
11245,
|
|
990
|
-
// H
|
|
991
|
-
5769,
|
|
992
|
-
5054,
|
|
993
|
-
7399,
|
|
994
|
-
6608,
|
|
995
|
-
1890,
|
|
996
|
-
597,
|
|
997
|
-
3340,
|
|
998
|
-
2107
|
|
999
|
-
],
|
|
1000
|
-
/**
|
|
1001
|
-
* A map of human-readable ECC levels.
|
|
1002
|
-
*
|
|
1003
|
-
* @public
|
|
1004
|
-
* @static
|
|
1005
|
-
* @type {Object.<string, number>}
|
|
1006
|
-
* @memberof ErrorCorrection
|
|
1007
|
-
*/
|
|
1008
|
-
LEVELS: {
|
|
1009
|
-
L: 1,
|
|
1010
|
-
M: 2,
|
|
1011
|
-
Q: 3,
|
|
1012
|
-
H: 4
|
|
1013
|
-
}
|
|
1014
|
-
});
|
|
1015
|
-
var ErrorCorrection_1 = ErrorCorrection;
|
|
1016
|
-
var Galois = lite.extend(null, {
|
|
1017
|
-
/**
|
|
1018
|
-
* The Galois field exponent table.
|
|
1019
|
-
*
|
|
1020
|
-
* @public
|
|
1021
|
-
* @static
|
|
1022
|
-
* @type {number[]}
|
|
1023
|
-
* @memberof Galois
|
|
1024
|
-
*/
|
|
1025
|
-
EXPONENT: [
|
|
1026
|
-
1,
|
|
1027
|
-
2,
|
|
1028
|
-
4,
|
|
1029
|
-
8,
|
|
1030
|
-
16,
|
|
1031
|
-
32,
|
|
1032
|
-
64,
|
|
1033
|
-
128,
|
|
1034
|
-
29,
|
|
1035
|
-
58,
|
|
1036
|
-
116,
|
|
1037
|
-
232,
|
|
1038
|
-
205,
|
|
1039
|
-
135,
|
|
1040
|
-
19,
|
|
1041
|
-
38,
|
|
1042
|
-
76,
|
|
1043
|
-
152,
|
|
1044
|
-
45,
|
|
1045
|
-
90,
|
|
1046
|
-
180,
|
|
1047
|
-
117,
|
|
1048
|
-
234,
|
|
1049
|
-
201,
|
|
1050
|
-
143,
|
|
1051
|
-
3,
|
|
1052
|
-
6,
|
|
1053
|
-
12,
|
|
1054
|
-
24,
|
|
1055
|
-
48,
|
|
1056
|
-
96,
|
|
1057
|
-
192,
|
|
1058
|
-
157,
|
|
1059
|
-
39,
|
|
1060
|
-
78,
|
|
1061
|
-
156,
|
|
1062
|
-
37,
|
|
1063
|
-
74,
|
|
1064
|
-
148,
|
|
1065
|
-
53,
|
|
1066
|
-
106,
|
|
1067
|
-
212,
|
|
1068
|
-
181,
|
|
1069
|
-
119,
|
|
1070
|
-
238,
|
|
1071
|
-
193,
|
|
1072
|
-
159,
|
|
1073
|
-
35,
|
|
1074
|
-
70,
|
|
1075
|
-
140,
|
|
1076
|
-
5,
|
|
1077
|
-
10,
|
|
1078
|
-
20,
|
|
1079
|
-
40,
|
|
1080
|
-
80,
|
|
1081
|
-
160,
|
|
1082
|
-
93,
|
|
1083
|
-
186,
|
|
1084
|
-
105,
|
|
1085
|
-
210,
|
|
1086
|
-
185,
|
|
1087
|
-
111,
|
|
1088
|
-
222,
|
|
1089
|
-
161,
|
|
1090
|
-
95,
|
|
1091
|
-
190,
|
|
1092
|
-
97,
|
|
1093
|
-
194,
|
|
1094
|
-
153,
|
|
1095
|
-
47,
|
|
1096
|
-
94,
|
|
1097
|
-
188,
|
|
1098
|
-
101,
|
|
1099
|
-
202,
|
|
1100
|
-
137,
|
|
1101
|
-
15,
|
|
1102
|
-
30,
|
|
1103
|
-
60,
|
|
1104
|
-
120,
|
|
1105
|
-
240,
|
|
1106
|
-
253,
|
|
1107
|
-
231,
|
|
1108
|
-
211,
|
|
1109
|
-
187,
|
|
1110
|
-
107,
|
|
1111
|
-
214,
|
|
1112
|
-
177,
|
|
1113
|
-
127,
|
|
1114
|
-
254,
|
|
1115
|
-
225,
|
|
1116
|
-
223,
|
|
1117
|
-
163,
|
|
1118
|
-
91,
|
|
1119
|
-
182,
|
|
1120
|
-
113,
|
|
1121
|
-
226,
|
|
1122
|
-
217,
|
|
1123
|
-
175,
|
|
1124
|
-
67,
|
|
1125
|
-
134,
|
|
1126
|
-
17,
|
|
1127
|
-
34,
|
|
1128
|
-
68,
|
|
1129
|
-
136,
|
|
1130
|
-
13,
|
|
1131
|
-
26,
|
|
1132
|
-
52,
|
|
1133
|
-
104,
|
|
1134
|
-
208,
|
|
1135
|
-
189,
|
|
1136
|
-
103,
|
|
1137
|
-
206,
|
|
1138
|
-
129,
|
|
1139
|
-
31,
|
|
1140
|
-
62,
|
|
1141
|
-
124,
|
|
1142
|
-
248,
|
|
1143
|
-
237,
|
|
1144
|
-
199,
|
|
1145
|
-
147,
|
|
1146
|
-
59,
|
|
1147
|
-
118,
|
|
1148
|
-
236,
|
|
1149
|
-
197,
|
|
1150
|
-
151,
|
|
1151
|
-
51,
|
|
1152
|
-
102,
|
|
1153
|
-
204,
|
|
1154
|
-
133,
|
|
1155
|
-
23,
|
|
1156
|
-
46,
|
|
1157
|
-
92,
|
|
1158
|
-
184,
|
|
1159
|
-
109,
|
|
1160
|
-
218,
|
|
1161
|
-
169,
|
|
1162
|
-
79,
|
|
1163
|
-
158,
|
|
1164
|
-
33,
|
|
1165
|
-
66,
|
|
1166
|
-
132,
|
|
1167
|
-
21,
|
|
1168
|
-
42,
|
|
1169
|
-
84,
|
|
1170
|
-
168,
|
|
1171
|
-
77,
|
|
1172
|
-
154,
|
|
1173
|
-
41,
|
|
1174
|
-
82,
|
|
1175
|
-
164,
|
|
1176
|
-
85,
|
|
1177
|
-
170,
|
|
1178
|
-
73,
|
|
1179
|
-
146,
|
|
1180
|
-
57,
|
|
1181
|
-
114,
|
|
1182
|
-
228,
|
|
1183
|
-
213,
|
|
1184
|
-
183,
|
|
1185
|
-
115,
|
|
1186
|
-
230,
|
|
1187
|
-
209,
|
|
1188
|
-
191,
|
|
1189
|
-
99,
|
|
1190
|
-
198,
|
|
1191
|
-
145,
|
|
1192
|
-
63,
|
|
1193
|
-
126,
|
|
1194
|
-
252,
|
|
1195
|
-
229,
|
|
1196
|
-
215,
|
|
1197
|
-
179,
|
|
1198
|
-
123,
|
|
1199
|
-
246,
|
|
1200
|
-
241,
|
|
1201
|
-
255,
|
|
1202
|
-
227,
|
|
1203
|
-
219,
|
|
1204
|
-
171,
|
|
1205
|
-
75,
|
|
1206
|
-
150,
|
|
1207
|
-
49,
|
|
1208
|
-
98,
|
|
1209
|
-
196,
|
|
1210
|
-
149,
|
|
1211
|
-
55,
|
|
1212
|
-
110,
|
|
1213
|
-
220,
|
|
1214
|
-
165,
|
|
1215
|
-
87,
|
|
1216
|
-
174,
|
|
1217
|
-
65,
|
|
1218
|
-
130,
|
|
1219
|
-
25,
|
|
1220
|
-
50,
|
|
1221
|
-
100,
|
|
1222
|
-
200,
|
|
1223
|
-
141,
|
|
1224
|
-
7,
|
|
1225
|
-
14,
|
|
1226
|
-
28,
|
|
1227
|
-
56,
|
|
1228
|
-
112,
|
|
1229
|
-
224,
|
|
1230
|
-
221,
|
|
1231
|
-
167,
|
|
1232
|
-
83,
|
|
1233
|
-
166,
|
|
1234
|
-
81,
|
|
1235
|
-
162,
|
|
1236
|
-
89,
|
|
1237
|
-
178,
|
|
1238
|
-
121,
|
|
1239
|
-
242,
|
|
1240
|
-
249,
|
|
1241
|
-
239,
|
|
1242
|
-
195,
|
|
1243
|
-
155,
|
|
1244
|
-
43,
|
|
1245
|
-
86,
|
|
1246
|
-
172,
|
|
1247
|
-
69,
|
|
1248
|
-
138,
|
|
1249
|
-
9,
|
|
1250
|
-
18,
|
|
1251
|
-
36,
|
|
1252
|
-
72,
|
|
1253
|
-
144,
|
|
1254
|
-
61,
|
|
1255
|
-
122,
|
|
1256
|
-
244,
|
|
1257
|
-
245,
|
|
1258
|
-
247,
|
|
1259
|
-
243,
|
|
1260
|
-
251,
|
|
1261
|
-
235,
|
|
1262
|
-
203,
|
|
1263
|
-
139,
|
|
1264
|
-
11,
|
|
1265
|
-
22,
|
|
1266
|
-
44,
|
|
1267
|
-
88,
|
|
1268
|
-
176,
|
|
1269
|
-
125,
|
|
1270
|
-
250,
|
|
1271
|
-
233,
|
|
1272
|
-
207,
|
|
1273
|
-
131,
|
|
1274
|
-
27,
|
|
1275
|
-
54,
|
|
1276
|
-
108,
|
|
1277
|
-
216,
|
|
1278
|
-
173,
|
|
1279
|
-
71,
|
|
1280
|
-
142,
|
|
1281
|
-
0
|
|
1282
|
-
],
|
|
1283
|
-
/**
|
|
1284
|
-
* The Galois field log table.
|
|
1285
|
-
*
|
|
1286
|
-
* @public
|
|
1287
|
-
* @static
|
|
1288
|
-
* @type {number[]}
|
|
1289
|
-
* @memberof Galois
|
|
1290
|
-
*/
|
|
1291
|
-
LOG: [
|
|
1292
|
-
255,
|
|
1293
|
-
0,
|
|
1294
|
-
1,
|
|
1295
|
-
25,
|
|
1296
|
-
2,
|
|
1297
|
-
50,
|
|
1298
|
-
26,
|
|
1299
|
-
198,
|
|
1300
|
-
3,
|
|
1301
|
-
223,
|
|
1302
|
-
51,
|
|
1303
|
-
238,
|
|
1304
|
-
27,
|
|
1305
|
-
104,
|
|
1306
|
-
199,
|
|
1307
|
-
75,
|
|
1308
|
-
4,
|
|
1309
|
-
100,
|
|
1310
|
-
224,
|
|
1311
|
-
14,
|
|
1312
|
-
52,
|
|
1313
|
-
141,
|
|
1314
|
-
239,
|
|
1315
|
-
129,
|
|
1316
|
-
28,
|
|
1317
|
-
193,
|
|
1318
|
-
105,
|
|
1319
|
-
248,
|
|
1320
|
-
200,
|
|
1321
|
-
8,
|
|
1322
|
-
76,
|
|
1323
|
-
113,
|
|
1324
|
-
5,
|
|
1325
|
-
138,
|
|
1326
|
-
101,
|
|
1327
|
-
47,
|
|
1328
|
-
225,
|
|
1329
|
-
36,
|
|
1330
|
-
15,
|
|
1331
|
-
33,
|
|
1332
|
-
53,
|
|
1333
|
-
147,
|
|
1334
|
-
142,
|
|
1335
|
-
218,
|
|
1336
|
-
240,
|
|
1337
|
-
18,
|
|
1338
|
-
130,
|
|
1339
|
-
69,
|
|
1340
|
-
29,
|
|
1341
|
-
181,
|
|
1342
|
-
194,
|
|
1343
|
-
125,
|
|
1344
|
-
106,
|
|
1345
|
-
39,
|
|
1346
|
-
249,
|
|
1347
|
-
185,
|
|
1348
|
-
201,
|
|
1349
|
-
154,
|
|
1350
|
-
9,
|
|
1351
|
-
120,
|
|
1352
|
-
77,
|
|
1353
|
-
228,
|
|
1354
|
-
114,
|
|
1355
|
-
166,
|
|
1356
|
-
6,
|
|
1357
|
-
191,
|
|
1358
|
-
139,
|
|
1359
|
-
98,
|
|
1360
|
-
102,
|
|
1361
|
-
221,
|
|
1362
|
-
48,
|
|
1363
|
-
253,
|
|
1364
|
-
226,
|
|
1365
|
-
152,
|
|
1366
|
-
37,
|
|
1367
|
-
179,
|
|
1368
|
-
16,
|
|
1369
|
-
145,
|
|
1370
|
-
34,
|
|
1371
|
-
136,
|
|
1372
|
-
54,
|
|
1373
|
-
208,
|
|
1374
|
-
148,
|
|
1375
|
-
206,
|
|
1376
|
-
143,
|
|
1377
|
-
150,
|
|
1378
|
-
219,
|
|
1379
|
-
189,
|
|
1380
|
-
241,
|
|
1381
|
-
210,
|
|
1382
|
-
19,
|
|
1383
|
-
92,
|
|
1384
|
-
131,
|
|
1385
|
-
56,
|
|
1386
|
-
70,
|
|
1387
|
-
64,
|
|
1388
|
-
30,
|
|
1389
|
-
66,
|
|
1390
|
-
182,
|
|
1391
|
-
163,
|
|
1392
|
-
195,
|
|
1393
|
-
72,
|
|
1394
|
-
126,
|
|
1395
|
-
110,
|
|
1396
|
-
107,
|
|
1397
|
-
58,
|
|
1398
|
-
40,
|
|
1399
|
-
84,
|
|
1400
|
-
250,
|
|
1401
|
-
133,
|
|
1402
|
-
186,
|
|
1403
|
-
61,
|
|
1404
|
-
202,
|
|
1405
|
-
94,
|
|
1406
|
-
155,
|
|
1407
|
-
159,
|
|
1408
|
-
10,
|
|
1409
|
-
21,
|
|
1410
|
-
121,
|
|
1411
|
-
43,
|
|
1412
|
-
78,
|
|
1413
|
-
212,
|
|
1414
|
-
229,
|
|
1415
|
-
172,
|
|
1416
|
-
115,
|
|
1417
|
-
243,
|
|
1418
|
-
167,
|
|
1419
|
-
87,
|
|
1420
|
-
7,
|
|
1421
|
-
112,
|
|
1422
|
-
192,
|
|
1423
|
-
247,
|
|
1424
|
-
140,
|
|
1425
|
-
128,
|
|
1426
|
-
99,
|
|
1427
|
-
13,
|
|
1428
|
-
103,
|
|
1429
|
-
74,
|
|
1430
|
-
222,
|
|
1431
|
-
237,
|
|
1432
|
-
49,
|
|
1433
|
-
197,
|
|
1434
|
-
254,
|
|
1435
|
-
24,
|
|
1436
|
-
227,
|
|
1437
|
-
165,
|
|
1438
|
-
153,
|
|
1439
|
-
119,
|
|
1440
|
-
38,
|
|
1441
|
-
184,
|
|
1442
|
-
180,
|
|
1443
|
-
124,
|
|
1444
|
-
17,
|
|
1445
|
-
68,
|
|
1446
|
-
146,
|
|
1447
|
-
217,
|
|
1448
|
-
35,
|
|
1449
|
-
32,
|
|
1450
|
-
137,
|
|
1451
|
-
46,
|
|
1452
|
-
55,
|
|
1453
|
-
63,
|
|
1454
|
-
209,
|
|
1455
|
-
91,
|
|
1456
|
-
149,
|
|
1457
|
-
188,
|
|
1458
|
-
207,
|
|
1459
|
-
205,
|
|
1460
|
-
144,
|
|
1461
|
-
135,
|
|
1462
|
-
151,
|
|
1463
|
-
178,
|
|
1464
|
-
220,
|
|
1465
|
-
252,
|
|
1466
|
-
190,
|
|
1467
|
-
97,
|
|
1468
|
-
242,
|
|
1469
|
-
86,
|
|
1470
|
-
211,
|
|
1471
|
-
171,
|
|
1472
|
-
20,
|
|
1473
|
-
42,
|
|
1474
|
-
93,
|
|
1475
|
-
158,
|
|
1476
|
-
132,
|
|
1477
|
-
60,
|
|
1478
|
-
57,
|
|
1479
|
-
83,
|
|
1480
|
-
71,
|
|
1481
|
-
109,
|
|
1482
|
-
65,
|
|
1483
|
-
162,
|
|
1484
|
-
31,
|
|
1485
|
-
45,
|
|
1486
|
-
67,
|
|
1487
|
-
216,
|
|
1488
|
-
183,
|
|
1489
|
-
123,
|
|
1490
|
-
164,
|
|
1491
|
-
118,
|
|
1492
|
-
196,
|
|
1493
|
-
23,
|
|
1494
|
-
73,
|
|
1495
|
-
236,
|
|
1496
|
-
127,
|
|
1497
|
-
12,
|
|
1498
|
-
111,
|
|
1499
|
-
246,
|
|
1500
|
-
108,
|
|
1501
|
-
161,
|
|
1502
|
-
59,
|
|
1503
|
-
82,
|
|
1504
|
-
41,
|
|
1505
|
-
157,
|
|
1506
|
-
85,
|
|
1507
|
-
170,
|
|
1508
|
-
251,
|
|
1509
|
-
96,
|
|
1510
|
-
134,
|
|
1511
|
-
177,
|
|
1512
|
-
187,
|
|
1513
|
-
204,
|
|
1514
|
-
62,
|
|
1515
|
-
90,
|
|
1516
|
-
203,
|
|
1517
|
-
89,
|
|
1518
|
-
95,
|
|
1519
|
-
176,
|
|
1520
|
-
156,
|
|
1521
|
-
169,
|
|
1522
|
-
160,
|
|
1523
|
-
81,
|
|
1524
|
-
11,
|
|
1525
|
-
245,
|
|
1526
|
-
22,
|
|
1527
|
-
235,
|
|
1528
|
-
122,
|
|
1529
|
-
117,
|
|
1530
|
-
44,
|
|
1531
|
-
215,
|
|
1532
|
-
79,
|
|
1533
|
-
174,
|
|
1534
|
-
213,
|
|
1535
|
-
233,
|
|
1536
|
-
230,
|
|
1537
|
-
231,
|
|
1538
|
-
173,
|
|
1539
|
-
232,
|
|
1540
|
-
116,
|
|
1541
|
-
214,
|
|
1542
|
-
244,
|
|
1543
|
-
234,
|
|
1544
|
-
168,
|
|
1545
|
-
80,
|
|
1546
|
-
88,
|
|
1547
|
-
175
|
|
1548
|
-
]
|
|
1549
|
-
});
|
|
1550
|
-
var Galois_1 = Galois;
|
|
1551
|
-
var Version = lite.extend(null, {
|
|
1552
|
-
/**
|
|
1553
|
-
* The version pattern block.
|
|
1554
|
-
*
|
|
1555
|
-
* @public
|
|
1556
|
-
* @static
|
|
1557
|
-
* @type {number[]}
|
|
1558
|
-
* @memberof Version
|
|
1559
|
-
*/
|
|
1560
|
-
BLOCK: [
|
|
1561
|
-
3220,
|
|
1562
|
-
1468,
|
|
1563
|
-
2713,
|
|
1564
|
-
1235,
|
|
1565
|
-
3062,
|
|
1566
|
-
1890,
|
|
1567
|
-
2119,
|
|
1568
|
-
1549,
|
|
1569
|
-
2344,
|
|
1570
|
-
2936,
|
|
1571
|
-
1117,
|
|
1572
|
-
2583,
|
|
1573
|
-
1330,
|
|
1574
|
-
2470,
|
|
1575
|
-
1667,
|
|
1576
|
-
2249,
|
|
1577
|
-
2028,
|
|
1578
|
-
3780,
|
|
1579
|
-
481,
|
|
1580
|
-
4011,
|
|
1581
|
-
142,
|
|
1582
|
-
3098,
|
|
1583
|
-
831,
|
|
1584
|
-
3445,
|
|
1585
|
-
592,
|
|
1586
|
-
2517,
|
|
1587
|
-
1776,
|
|
1588
|
-
2234,
|
|
1589
|
-
1951,
|
|
1590
|
-
2827,
|
|
1591
|
-
1070,
|
|
1592
|
-
2660,
|
|
1593
|
-
1345,
|
|
1594
|
-
3177
|
|
1595
|
-
]
|
|
1596
|
-
});
|
|
1597
|
-
var Version_1 = Version;
|
|
1598
|
-
var Frame = lite.extend(function(options) {
|
|
1599
|
-
var dataBlock, eccBlock, index2, neccBlock1, neccBlock2;
|
|
1600
|
-
var valueLength = options.value.length;
|
|
1601
|
-
this._badness = [];
|
|
1602
|
-
this._level = ErrorCorrection_1.LEVELS[options.level];
|
|
1603
|
-
this._polynomial = [];
|
|
1604
|
-
this._value = options.value;
|
|
1605
|
-
this._version = 0;
|
|
1606
|
-
this._stringBuffer = [];
|
|
1607
|
-
while (this._version < 40) {
|
|
1608
|
-
this._version++;
|
|
1609
|
-
index2 = (this._level - 1) * 4 + (this._version - 1) * 16;
|
|
1610
|
-
neccBlock1 = ErrorCorrection_1.BLOCKS[index2++];
|
|
1611
|
-
neccBlock2 = ErrorCorrection_1.BLOCKS[index2++];
|
|
1612
|
-
dataBlock = ErrorCorrection_1.BLOCKS[index2++];
|
|
1613
|
-
eccBlock = ErrorCorrection_1.BLOCKS[index2];
|
|
1614
|
-
index2 = dataBlock * (neccBlock1 + neccBlock2) + neccBlock2 - 3 + (this._version <= 9);
|
|
1615
|
-
if (valueLength <= index2) {
|
|
1616
|
-
break;
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
this._dataBlock = dataBlock;
|
|
1620
|
-
this._eccBlock = eccBlock;
|
|
1621
|
-
this._neccBlock1 = neccBlock1;
|
|
1622
|
-
this._neccBlock2 = neccBlock2;
|
|
1623
|
-
var width = this.width = 17 + 4 * this._version;
|
|
1624
|
-
this.buffer = Frame._createArray(width * width);
|
|
1625
|
-
this._ecc = Frame._createArray(dataBlock + (dataBlock + eccBlock) * (neccBlock1 + neccBlock2) + neccBlock2);
|
|
1626
|
-
this._mask = Frame._createArray((width * (width + 1) + 1) / 2);
|
|
1627
|
-
this._insertFinders();
|
|
1628
|
-
this._insertAlignments();
|
|
1629
|
-
this.buffer[8 + width * (width - 8)] = 1;
|
|
1630
|
-
this._insertTimingGap();
|
|
1631
|
-
this._reverseMask();
|
|
1632
|
-
this._insertTimingRowAndColumn();
|
|
1633
|
-
this._insertVersion();
|
|
1634
|
-
this._syncMask();
|
|
1635
|
-
this._convertBitStream(valueLength);
|
|
1636
|
-
this._calculatePolynomial();
|
|
1637
|
-
this._appendEccToData();
|
|
1638
|
-
this._interleaveBlocks();
|
|
1639
|
-
this._pack();
|
|
1640
|
-
this._finish();
|
|
1641
|
-
}, {
|
|
1642
|
-
_addAlignment: function(x, y) {
|
|
1643
|
-
var i;
|
|
1644
|
-
var buffer = this.buffer;
|
|
1645
|
-
var width = this.width;
|
|
1646
|
-
buffer[x + width * y] = 1;
|
|
1647
|
-
for (i = -2; i < 2; i++) {
|
|
1648
|
-
buffer[x + i + width * (y - 2)] = 1;
|
|
1649
|
-
buffer[x - 2 + width * (y + i + 1)] = 1;
|
|
1650
|
-
buffer[x + 2 + width * (y + i)] = 1;
|
|
1651
|
-
buffer[x + i + 1 + width * (y + 2)] = 1;
|
|
1652
|
-
}
|
|
1653
|
-
for (i = 0; i < 2; i++) {
|
|
1654
|
-
this._setMask(x - 1, y + i);
|
|
1655
|
-
this._setMask(x + 1, y - i);
|
|
1656
|
-
this._setMask(x - i, y - 1);
|
|
1657
|
-
this._setMask(x + i, y + 1);
|
|
1658
|
-
}
|
|
1659
|
-
},
|
|
1660
|
-
_appendData: function(data, dataLength, ecc, eccLength) {
|
|
1661
|
-
var bit, i, j;
|
|
1662
|
-
var polynomial = this._polynomial;
|
|
1663
|
-
var stringBuffer = this._stringBuffer;
|
|
1664
|
-
for (i = 0; i < eccLength; i++) {
|
|
1665
|
-
stringBuffer[ecc + i] = 0;
|
|
1666
|
-
}
|
|
1667
|
-
for (i = 0; i < dataLength; i++) {
|
|
1668
|
-
bit = Galois_1.LOG[stringBuffer[data + i] ^ stringBuffer[ecc]];
|
|
1669
|
-
if (bit !== 255) {
|
|
1670
|
-
for (j = 1; j < eccLength; j++) {
|
|
1671
|
-
stringBuffer[ecc + j - 1] = stringBuffer[ecc + j] ^ Galois_1.EXPONENT[Frame._modN(bit + polynomial[eccLength - j])];
|
|
1672
|
-
}
|
|
1673
|
-
} else {
|
|
1674
|
-
for (j = ecc; j < ecc + eccLength; j++) {
|
|
1675
|
-
stringBuffer[j] = stringBuffer[j + 1];
|
|
1676
|
-
}
|
|
1677
|
-
}
|
|
1678
|
-
stringBuffer[ecc + eccLength - 1] = bit === 255 ? 0 : Galois_1.EXPONENT[Frame._modN(bit + polynomial[0])];
|
|
1679
|
-
}
|
|
1680
|
-
},
|
|
1681
|
-
_appendEccToData: function() {
|
|
1682
|
-
var i;
|
|
1683
|
-
var data = 0;
|
|
1684
|
-
var dataBlock = this._dataBlock;
|
|
1685
|
-
var ecc = this._calculateMaxLength();
|
|
1686
|
-
var eccBlock = this._eccBlock;
|
|
1687
|
-
for (i = 0; i < this._neccBlock1; i++) {
|
|
1688
|
-
this._appendData(data, dataBlock, ecc, eccBlock);
|
|
1689
|
-
data += dataBlock;
|
|
1690
|
-
ecc += eccBlock;
|
|
1691
|
-
}
|
|
1692
|
-
for (i = 0; i < this._neccBlock2; i++) {
|
|
1693
|
-
this._appendData(data, dataBlock + 1, ecc, eccBlock);
|
|
1694
|
-
data += dataBlock + 1;
|
|
1695
|
-
ecc += eccBlock;
|
|
1696
|
-
}
|
|
1697
|
-
},
|
|
1698
|
-
_applyMask: function(mask) {
|
|
1699
|
-
var r3x, r3y, x, y;
|
|
1700
|
-
var buffer = this.buffer;
|
|
1701
|
-
var width = this.width;
|
|
1702
|
-
switch (mask) {
|
|
1703
|
-
case 0:
|
|
1704
|
-
for (y = 0; y < width; y++) {
|
|
1705
|
-
for (x = 0; x < width; x++) {
|
|
1706
|
-
if (!(x + y & 1) && !this._isMasked(x, y)) {
|
|
1707
|
-
buffer[x + y * width] ^= 1;
|
|
1708
|
-
}
|
|
1709
|
-
}
|
|
1710
|
-
}
|
|
1711
|
-
break;
|
|
1712
|
-
case 1:
|
|
1713
|
-
for (y = 0; y < width; y++) {
|
|
1714
|
-
for (x = 0; x < width; x++) {
|
|
1715
|
-
if (!(y & 1) && !this._isMasked(x, y)) {
|
|
1716
|
-
buffer[x + y * width] ^= 1;
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
break;
|
|
1721
|
-
case 2:
|
|
1722
|
-
for (y = 0; y < width; y++) {
|
|
1723
|
-
for (r3x = 0, x = 0; x < width; x++, r3x++) {
|
|
1724
|
-
if (r3x === 3) {
|
|
1725
|
-
r3x = 0;
|
|
1726
|
-
}
|
|
1727
|
-
if (!r3x && !this._isMasked(x, y)) {
|
|
1728
|
-
buffer[x + y * width] ^= 1;
|
|
1729
|
-
}
|
|
1730
|
-
}
|
|
1731
|
-
}
|
|
1732
|
-
break;
|
|
1733
|
-
case 3:
|
|
1734
|
-
for (r3y = 0, y = 0; y < width; y++, r3y++) {
|
|
1735
|
-
if (r3y === 3) {
|
|
1736
|
-
r3y = 0;
|
|
1737
|
-
}
|
|
1738
|
-
for (r3x = r3y, x = 0; x < width; x++, r3x++) {
|
|
1739
|
-
if (r3x === 3) {
|
|
1740
|
-
r3x = 0;
|
|
1741
|
-
}
|
|
1742
|
-
if (!r3x && !this._isMasked(x, y)) {
|
|
1743
|
-
buffer[x + y * width] ^= 1;
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
}
|
|
1747
|
-
break;
|
|
1748
|
-
case 4:
|
|
1749
|
-
for (y = 0; y < width; y++) {
|
|
1750
|
-
for (r3x = 0, r3y = y >> 1 & 1, x = 0; x < width; x++, r3x++) {
|
|
1751
|
-
if (r3x === 3) {
|
|
1752
|
-
r3x = 0;
|
|
1753
|
-
r3y = !r3y;
|
|
1754
|
-
}
|
|
1755
|
-
if (!r3y && !this._isMasked(x, y)) {
|
|
1756
|
-
buffer[x + y * width] ^= 1;
|
|
1757
|
-
}
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
|
-
break;
|
|
1761
|
-
case 5:
|
|
1762
|
-
for (r3y = 0, y = 0; y < width; y++, r3y++) {
|
|
1763
|
-
if (r3y === 3) {
|
|
1764
|
-
r3y = 0;
|
|
1765
|
-
}
|
|
1766
|
-
for (r3x = 0, x = 0; x < width; x++, r3x++) {
|
|
1767
|
-
if (r3x === 3) {
|
|
1768
|
-
r3x = 0;
|
|
1769
|
-
}
|
|
1770
|
-
if (!((x & y & 1) + !(!r3x | !r3y)) && !this._isMasked(x, y)) {
|
|
1771
|
-
buffer[x + y * width] ^= 1;
|
|
1772
|
-
}
|
|
1773
|
-
}
|
|
1774
|
-
}
|
|
1775
|
-
break;
|
|
1776
|
-
case 6:
|
|
1777
|
-
for (r3y = 0, y = 0; y < width; y++, r3y++) {
|
|
1778
|
-
if (r3y === 3) {
|
|
1779
|
-
r3y = 0;
|
|
1780
|
-
}
|
|
1781
|
-
for (r3x = 0, x = 0; x < width; x++, r3x++) {
|
|
1782
|
-
if (r3x === 3) {
|
|
1783
|
-
r3x = 0;
|
|
1784
|
-
}
|
|
1785
|
-
if (!((x & y & 1) + (r3x && r3x === r3y) & 1) && !this._isMasked(x, y)) {
|
|
1786
|
-
buffer[x + y * width] ^= 1;
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1790
|
-
break;
|
|
1791
|
-
case 7:
|
|
1792
|
-
for (r3y = 0, y = 0; y < width; y++, r3y++) {
|
|
1793
|
-
if (r3y === 3) {
|
|
1794
|
-
r3y = 0;
|
|
1795
|
-
}
|
|
1796
|
-
for (r3x = 0, x = 0; x < width; x++, r3x++) {
|
|
1797
|
-
if (r3x === 3) {
|
|
1798
|
-
r3x = 0;
|
|
1799
|
-
}
|
|
1800
|
-
if (!((r3x && r3x === r3y) + (x + y & 1) & 1) && !this._isMasked(x, y)) {
|
|
1801
|
-
buffer[x + y * width] ^= 1;
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
break;
|
|
1806
|
-
}
|
|
1807
|
-
},
|
|
1808
|
-
_calculateMaxLength: function() {
|
|
1809
|
-
return this._dataBlock * (this._neccBlock1 + this._neccBlock2) + this._neccBlock2;
|
|
1810
|
-
},
|
|
1811
|
-
_calculatePolynomial: function() {
|
|
1812
|
-
var i, j;
|
|
1813
|
-
var eccBlock = this._eccBlock;
|
|
1814
|
-
var polynomial = this._polynomial;
|
|
1815
|
-
polynomial[0] = 1;
|
|
1816
|
-
for (i = 0; i < eccBlock; i++) {
|
|
1817
|
-
polynomial[i + 1] = 1;
|
|
1818
|
-
for (j = i; j > 0; j--) {
|
|
1819
|
-
polynomial[j] = polynomial[j] ? polynomial[j - 1] ^ Galois_1.EXPONENT[Frame._modN(Galois_1.LOG[polynomial[j]] + i)] : polynomial[j - 1];
|
|
1820
|
-
}
|
|
1821
|
-
polynomial[0] = Galois_1.EXPONENT[Frame._modN(Galois_1.LOG[polynomial[0]] + i)];
|
|
1822
|
-
}
|
|
1823
|
-
for (i = 0; i <= eccBlock; i++) {
|
|
1824
|
-
polynomial[i] = Galois_1.LOG[polynomial[i]];
|
|
1825
|
-
}
|
|
1826
|
-
},
|
|
1827
|
-
_checkBadness: function() {
|
|
1828
|
-
var b, b1, h, x, y;
|
|
1829
|
-
var bad = 0;
|
|
1830
|
-
var badness = this._badness;
|
|
1831
|
-
var buffer = this.buffer;
|
|
1832
|
-
var width = this.width;
|
|
1833
|
-
for (y = 0; y < width - 1; y++) {
|
|
1834
|
-
for (x = 0; x < width - 1; x++) {
|
|
1835
|
-
if (buffer[x + width * y] && buffer[x + 1 + width * y] && buffer[x + width * (y + 1)] && buffer[x + 1 + width * (y + 1)] || // All background colour.
|
|
1836
|
-
!(buffer[x + width * y] || buffer[x + 1 + width * y] || buffer[x + width * (y + 1)] || buffer[x + 1 + width * (y + 1)])) {
|
|
1837
|
-
bad += Frame.N2;
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
var bw = 0;
|
|
1842
|
-
for (y = 0; y < width; y++) {
|
|
1843
|
-
h = 0;
|
|
1844
|
-
badness[0] = 0;
|
|
1845
|
-
for (b = 0, x = 0; x < width; x++) {
|
|
1846
|
-
b1 = buffer[x + width * y];
|
|
1847
|
-
if (b === b1) {
|
|
1848
|
-
badness[h]++;
|
|
1849
|
-
} else {
|
|
1850
|
-
badness[++h] = 1;
|
|
1851
|
-
}
|
|
1852
|
-
b = b1;
|
|
1853
|
-
bw += b ? 1 : -1;
|
|
1854
|
-
}
|
|
1855
|
-
bad += this._getBadness(h);
|
|
1856
|
-
}
|
|
1857
|
-
if (bw < 0) {
|
|
1858
|
-
bw = -bw;
|
|
1859
|
-
}
|
|
1860
|
-
var count = 0;
|
|
1861
|
-
var big = bw;
|
|
1862
|
-
big += big << 2;
|
|
1863
|
-
big <<= 1;
|
|
1864
|
-
while (big > width * width) {
|
|
1865
|
-
big -= width * width;
|
|
1866
|
-
count++;
|
|
1867
|
-
}
|
|
1868
|
-
bad += count * Frame.N4;
|
|
1869
|
-
for (x = 0; x < width; x++) {
|
|
1870
|
-
h = 0;
|
|
1871
|
-
badness[0] = 0;
|
|
1872
|
-
for (b = 0, y = 0; y < width; y++) {
|
|
1873
|
-
b1 = buffer[x + width * y];
|
|
1874
|
-
if (b === b1) {
|
|
1875
|
-
badness[h]++;
|
|
1876
|
-
} else {
|
|
1877
|
-
badness[++h] = 1;
|
|
1878
|
-
}
|
|
1879
|
-
b = b1;
|
|
1880
|
-
}
|
|
1881
|
-
bad += this._getBadness(h);
|
|
1882
|
-
}
|
|
1883
|
-
return bad;
|
|
1884
|
-
},
|
|
1885
|
-
_convertBitStream: function(length) {
|
|
1886
|
-
var bit, i;
|
|
1887
|
-
var ecc = this._ecc;
|
|
1888
|
-
var version = this._version;
|
|
1889
|
-
for (i = 0; i < length; i++) {
|
|
1890
|
-
ecc[i] = this._value.charCodeAt(i);
|
|
1891
|
-
}
|
|
1892
|
-
var stringBuffer = this._stringBuffer = ecc.slice();
|
|
1893
|
-
var maxLength = this._calculateMaxLength();
|
|
1894
|
-
if (length >= maxLength - 2) {
|
|
1895
|
-
length = maxLength - 2;
|
|
1896
|
-
if (version > 9) {
|
|
1897
|
-
length--;
|
|
1898
|
-
}
|
|
1899
|
-
}
|
|
1900
|
-
var index2 = length;
|
|
1901
|
-
if (version > 9) {
|
|
1902
|
-
stringBuffer[index2 + 2] = 0;
|
|
1903
|
-
stringBuffer[index2 + 3] = 0;
|
|
1904
|
-
while (index2--) {
|
|
1905
|
-
bit = stringBuffer[index2];
|
|
1906
|
-
stringBuffer[index2 + 3] |= 255 & bit << 4;
|
|
1907
|
-
stringBuffer[index2 + 2] = bit >> 4;
|
|
1908
|
-
}
|
|
1909
|
-
stringBuffer[2] |= 255 & length << 4;
|
|
1910
|
-
stringBuffer[1] = length >> 4;
|
|
1911
|
-
stringBuffer[0] = 64 | length >> 12;
|
|
1912
|
-
} else {
|
|
1913
|
-
stringBuffer[index2 + 1] = 0;
|
|
1914
|
-
stringBuffer[index2 + 2] = 0;
|
|
1915
|
-
while (index2--) {
|
|
1916
|
-
bit = stringBuffer[index2];
|
|
1917
|
-
stringBuffer[index2 + 2] |= 255 & bit << 4;
|
|
1918
|
-
stringBuffer[index2 + 1] = bit >> 4;
|
|
1919
|
-
}
|
|
1920
|
-
stringBuffer[1] |= 255 & length << 4;
|
|
1921
|
-
stringBuffer[0] = 64 | length >> 4;
|
|
1922
|
-
}
|
|
1923
|
-
index2 = length + 3 - (version < 10);
|
|
1924
|
-
while (index2 < maxLength) {
|
|
1925
|
-
stringBuffer[index2++] = 236;
|
|
1926
|
-
stringBuffer[index2++] = 17;
|
|
1927
|
-
}
|
|
1928
|
-
},
|
|
1929
|
-
_getBadness: function(length) {
|
|
1930
|
-
var i;
|
|
1931
|
-
var badRuns = 0;
|
|
1932
|
-
var badness = this._badness;
|
|
1933
|
-
for (i = 0; i <= length; i++) {
|
|
1934
|
-
if (badness[i] >= 5) {
|
|
1935
|
-
badRuns += Frame.N1 + badness[i] - 5;
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
|
-
for (i = 3; i < length - 1; i += 2) {
|
|
1939
|
-
if (badness[i - 2] === badness[i + 2] && badness[i + 2] === badness[i - 1] && badness[i - 1] === badness[i + 1] && badness[i - 1] * 3 === badness[i] && // Background around the foreground pattern? Not part of the specs.
|
|
1940
|
-
(badness[i - 3] === 0 || i + 3 > length || badness[i - 3] * 3 >= badness[i] * 4 || badness[i + 3] * 3 >= badness[i] * 4)) {
|
|
1941
|
-
badRuns += Frame.N3;
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
return badRuns;
|
|
1945
|
-
},
|
|
1946
|
-
_finish: function() {
|
|
1947
|
-
this._stringBuffer = this.buffer.slice();
|
|
1948
|
-
var currentMask, i;
|
|
1949
|
-
var bit = 0;
|
|
1950
|
-
var mask = 3e4;
|
|
1951
|
-
for (i = 0; i < 8; i++) {
|
|
1952
|
-
this._applyMask(i);
|
|
1953
|
-
currentMask = this._checkBadness();
|
|
1954
|
-
if (currentMask < mask) {
|
|
1955
|
-
mask = currentMask;
|
|
1956
|
-
bit = i;
|
|
1957
|
-
}
|
|
1958
|
-
if (bit === 7) {
|
|
1959
|
-
break;
|
|
1960
|
-
}
|
|
1961
|
-
this.buffer = this._stringBuffer.slice();
|
|
1962
|
-
}
|
|
1963
|
-
if (bit !== i) {
|
|
1964
|
-
this._applyMask(bit);
|
|
1965
|
-
}
|
|
1966
|
-
mask = ErrorCorrection_1.FINAL_FORMAT[bit + (this._level - 1 << 3)];
|
|
1967
|
-
var buffer = this.buffer;
|
|
1968
|
-
var width = this.width;
|
|
1969
|
-
for (i = 0; i < 8; i++, mask >>= 1) {
|
|
1970
|
-
if (mask & 1) {
|
|
1971
|
-
buffer[width - 1 - i + width * 8] = 1;
|
|
1972
|
-
if (i < 6) {
|
|
1973
|
-
buffer[8 + width * i] = 1;
|
|
1974
|
-
} else {
|
|
1975
|
-
buffer[8 + width * (i + 1)] = 1;
|
|
1976
|
-
}
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
for (i = 0; i < 7; i++, mask >>= 1) {
|
|
1980
|
-
if (mask & 1) {
|
|
1981
|
-
buffer[8 + width * (width - 7 + i)] = 1;
|
|
1982
|
-
if (i) {
|
|
1983
|
-
buffer[6 - i + width * 8] = 1;
|
|
1984
|
-
} else {
|
|
1985
|
-
buffer[7 + width * 8] = 1;
|
|
1986
|
-
}
|
|
1987
|
-
}
|
|
1988
|
-
}
|
|
1989
|
-
},
|
|
1990
|
-
_interleaveBlocks: function() {
|
|
1991
|
-
var i, j;
|
|
1992
|
-
var dataBlock = this._dataBlock;
|
|
1993
|
-
var ecc = this._ecc;
|
|
1994
|
-
var eccBlock = this._eccBlock;
|
|
1995
|
-
var k = 0;
|
|
1996
|
-
var maxLength = this._calculateMaxLength();
|
|
1997
|
-
var neccBlock1 = this._neccBlock1;
|
|
1998
|
-
var neccBlock2 = this._neccBlock2;
|
|
1999
|
-
var stringBuffer = this._stringBuffer;
|
|
2000
|
-
for (i = 0; i < dataBlock; i++) {
|
|
2001
|
-
for (j = 0; j < neccBlock1; j++) {
|
|
2002
|
-
ecc[k++] = stringBuffer[i + j * dataBlock];
|
|
2003
|
-
}
|
|
2004
|
-
for (j = 0; j < neccBlock2; j++) {
|
|
2005
|
-
ecc[k++] = stringBuffer[neccBlock1 * dataBlock + i + j * (dataBlock + 1)];
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
2008
|
-
for (j = 0; j < neccBlock2; j++) {
|
|
2009
|
-
ecc[k++] = stringBuffer[neccBlock1 * dataBlock + i + j * (dataBlock + 1)];
|
|
2010
|
-
}
|
|
2011
|
-
for (i = 0; i < eccBlock; i++) {
|
|
2012
|
-
for (j = 0; j < neccBlock1 + neccBlock2; j++) {
|
|
2013
|
-
ecc[k++] = stringBuffer[maxLength + i + j * eccBlock];
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
this._stringBuffer = ecc;
|
|
2017
|
-
},
|
|
2018
|
-
_insertAlignments: function() {
|
|
2019
|
-
var i, x, y;
|
|
2020
|
-
var version = this._version;
|
|
2021
|
-
var width = this.width;
|
|
2022
|
-
if (version > 1) {
|
|
2023
|
-
i = Alignment_1.BLOCK[version];
|
|
2024
|
-
y = width - 7;
|
|
2025
|
-
for (; ; ) {
|
|
2026
|
-
x = width - 7;
|
|
2027
|
-
while (x > i - 3) {
|
|
2028
|
-
this._addAlignment(x, y);
|
|
2029
|
-
if (x < i) {
|
|
2030
|
-
break;
|
|
2031
|
-
}
|
|
2032
|
-
x -= i;
|
|
2033
|
-
}
|
|
2034
|
-
if (y <= i + 9) {
|
|
2035
|
-
break;
|
|
2036
|
-
}
|
|
2037
|
-
y -= i;
|
|
2038
|
-
this._addAlignment(6, y);
|
|
2039
|
-
this._addAlignment(y, 6);
|
|
2040
|
-
}
|
|
2041
|
-
}
|
|
2042
|
-
},
|
|
2043
|
-
_insertFinders: function() {
|
|
2044
|
-
var i, j, x, y;
|
|
2045
|
-
var buffer = this.buffer;
|
|
2046
|
-
var width = this.width;
|
|
2047
|
-
for (i = 0; i < 3; i++) {
|
|
2048
|
-
j = 0;
|
|
2049
|
-
y = 0;
|
|
2050
|
-
if (i === 1) {
|
|
2051
|
-
j = width - 7;
|
|
2052
|
-
}
|
|
2053
|
-
if (i === 2) {
|
|
2054
|
-
y = width - 7;
|
|
2055
|
-
}
|
|
2056
|
-
buffer[y + 3 + width * (j + 3)] = 1;
|
|
2057
|
-
for (x = 0; x < 6; x++) {
|
|
2058
|
-
buffer[y + x + width * j] = 1;
|
|
2059
|
-
buffer[y + width * (j + x + 1)] = 1;
|
|
2060
|
-
buffer[y + 6 + width * (j + x)] = 1;
|
|
2061
|
-
buffer[y + x + 1 + width * (j + 6)] = 1;
|
|
2062
|
-
}
|
|
2063
|
-
for (x = 1; x < 5; x++) {
|
|
2064
|
-
this._setMask(y + x, j + 1);
|
|
2065
|
-
this._setMask(y + 1, j + x + 1);
|
|
2066
|
-
this._setMask(y + 5, j + x);
|
|
2067
|
-
this._setMask(y + x + 1, j + 5);
|
|
2068
|
-
}
|
|
2069
|
-
for (x = 2; x < 4; x++) {
|
|
2070
|
-
buffer[y + x + width * (j + 2)] = 1;
|
|
2071
|
-
buffer[y + 2 + width * (j + x + 1)] = 1;
|
|
2072
|
-
buffer[y + 4 + width * (j + x)] = 1;
|
|
2073
|
-
buffer[y + x + 1 + width * (j + 4)] = 1;
|
|
2074
|
-
}
|
|
2075
|
-
}
|
|
2076
|
-
},
|
|
2077
|
-
_insertTimingGap: function() {
|
|
2078
|
-
var x, y;
|
|
2079
|
-
var width = this.width;
|
|
2080
|
-
for (y = 0; y < 7; y++) {
|
|
2081
|
-
this._setMask(7, y);
|
|
2082
|
-
this._setMask(width - 8, y);
|
|
2083
|
-
this._setMask(7, y + width - 7);
|
|
2084
|
-
}
|
|
2085
|
-
for (x = 0; x < 8; x++) {
|
|
2086
|
-
this._setMask(x, 7);
|
|
2087
|
-
this._setMask(x + width - 8, 7);
|
|
2088
|
-
this._setMask(x, width - 8);
|
|
2089
|
-
}
|
|
2090
|
-
},
|
|
2091
|
-
_insertTimingRowAndColumn: function() {
|
|
2092
|
-
var x;
|
|
2093
|
-
var buffer = this.buffer;
|
|
2094
|
-
var width = this.width;
|
|
2095
|
-
for (x = 0; x < width - 14; x++) {
|
|
2096
|
-
if (x & 1) {
|
|
2097
|
-
this._setMask(8 + x, 6);
|
|
2098
|
-
this._setMask(6, 8 + x);
|
|
2099
|
-
} else {
|
|
2100
|
-
buffer[8 + x + width * 6] = 1;
|
|
2101
|
-
buffer[6 + width * (8 + x)] = 1;
|
|
2102
|
-
}
|
|
2103
|
-
}
|
|
2104
|
-
},
|
|
2105
|
-
_insertVersion: function() {
|
|
2106
|
-
var i, j, x, y;
|
|
2107
|
-
var buffer = this.buffer;
|
|
2108
|
-
var version = this._version;
|
|
2109
|
-
var width = this.width;
|
|
2110
|
-
if (version > 6) {
|
|
2111
|
-
i = Version_1.BLOCK[version - 7];
|
|
2112
|
-
j = 17;
|
|
2113
|
-
for (x = 0; x < 6; x++) {
|
|
2114
|
-
for (y = 0; y < 3; y++, j--) {
|
|
2115
|
-
if (1 & (j > 11 ? version >> j - 12 : i >> j)) {
|
|
2116
|
-
buffer[5 - x + width * (2 - y + width - 11)] = 1;
|
|
2117
|
-
buffer[2 - y + width - 11 + width * (5 - x)] = 1;
|
|
2118
|
-
} else {
|
|
2119
|
-
this._setMask(5 - x, 2 - y + width - 11);
|
|
2120
|
-
this._setMask(2 - y + width - 11, 5 - x);
|
|
2121
|
-
}
|
|
2122
|
-
}
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
},
|
|
2126
|
-
_isMasked: function(x, y) {
|
|
2127
|
-
var bit = Frame._getMaskBit(x, y);
|
|
2128
|
-
return this._mask[bit] === 1;
|
|
2129
|
-
},
|
|
2130
|
-
_pack: function() {
|
|
2131
|
-
var bit, i, j;
|
|
2132
|
-
var k = 1;
|
|
2133
|
-
var v = 1;
|
|
2134
|
-
var width = this.width;
|
|
2135
|
-
var x = width - 1;
|
|
2136
|
-
var y = width - 1;
|
|
2137
|
-
var length = (this._dataBlock + this._eccBlock) * (this._neccBlock1 + this._neccBlock2) + this._neccBlock2;
|
|
2138
|
-
for (i = 0; i < length; i++) {
|
|
2139
|
-
bit = this._stringBuffer[i];
|
|
2140
|
-
for (j = 0; j < 8; j++, bit <<= 1) {
|
|
2141
|
-
if (128 & bit) {
|
|
2142
|
-
this.buffer[x + width * y] = 1;
|
|
2143
|
-
}
|
|
2144
|
-
do {
|
|
2145
|
-
if (v) {
|
|
2146
|
-
x--;
|
|
2147
|
-
} else {
|
|
2148
|
-
x++;
|
|
2149
|
-
if (k) {
|
|
2150
|
-
if (y !== 0) {
|
|
2151
|
-
y--;
|
|
2152
|
-
} else {
|
|
2153
|
-
x -= 2;
|
|
2154
|
-
k = !k;
|
|
2155
|
-
if (x === 6) {
|
|
2156
|
-
x--;
|
|
2157
|
-
y = 9;
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
} else if (y !== width - 1) {
|
|
2161
|
-
y++;
|
|
2162
|
-
} else {
|
|
2163
|
-
x -= 2;
|
|
2164
|
-
k = !k;
|
|
2165
|
-
if (x === 6) {
|
|
2166
|
-
x--;
|
|
2167
|
-
y -= 8;
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2170
|
-
}
|
|
2171
|
-
v = !v;
|
|
2172
|
-
} while (this._isMasked(x, y));
|
|
2173
|
-
}
|
|
2174
|
-
}
|
|
2175
|
-
},
|
|
2176
|
-
_reverseMask: function() {
|
|
2177
|
-
var x, y;
|
|
2178
|
-
var width = this.width;
|
|
2179
|
-
for (x = 0; x < 9; x++) {
|
|
2180
|
-
this._setMask(x, 8);
|
|
2181
|
-
}
|
|
2182
|
-
for (x = 0; x < 8; x++) {
|
|
2183
|
-
this._setMask(x + width - 8, 8);
|
|
2184
|
-
this._setMask(8, x);
|
|
2185
|
-
}
|
|
2186
|
-
for (y = 0; y < 7; y++) {
|
|
2187
|
-
this._setMask(8, y + width - 7);
|
|
2188
|
-
}
|
|
2189
|
-
},
|
|
2190
|
-
_setMask: function(x, y) {
|
|
2191
|
-
var bit = Frame._getMaskBit(x, y);
|
|
2192
|
-
this._mask[bit] = 1;
|
|
2193
|
-
},
|
|
2194
|
-
_syncMask: function() {
|
|
2195
|
-
var x, y;
|
|
2196
|
-
var width = this.width;
|
|
2197
|
-
for (y = 0; y < width; y++) {
|
|
2198
|
-
for (x = 0; x <= y; x++) {
|
|
2199
|
-
if (this.buffer[x + width * y]) {
|
|
2200
|
-
this._setMask(x, y);
|
|
2201
|
-
}
|
|
2202
|
-
}
|
|
2203
|
-
}
|
|
2204
|
-
}
|
|
2205
|
-
}, {
|
|
2206
|
-
_createArray: function(length) {
|
|
2207
|
-
var i;
|
|
2208
|
-
var array = [];
|
|
2209
|
-
for (i = 0; i < length; i++) {
|
|
2210
|
-
array[i] = 0;
|
|
2211
|
-
}
|
|
2212
|
-
return array;
|
|
2213
|
-
},
|
|
2214
|
-
_getMaskBit: function(x, y) {
|
|
2215
|
-
var bit;
|
|
2216
|
-
if (x > y) {
|
|
2217
|
-
bit = x;
|
|
2218
|
-
x = y;
|
|
2219
|
-
y = bit;
|
|
2220
|
-
}
|
|
2221
|
-
bit = y;
|
|
2222
|
-
bit += y * y;
|
|
2223
|
-
bit >>= 1;
|
|
2224
|
-
bit += x;
|
|
2225
|
-
return bit;
|
|
2226
|
-
},
|
|
2227
|
-
_modN: function(x) {
|
|
2228
|
-
while (x >= 255) {
|
|
2229
|
-
x -= 255;
|
|
2230
|
-
x = (x >> 8) + (x & 255);
|
|
2231
|
-
}
|
|
2232
|
-
return x;
|
|
2233
|
-
},
|
|
2234
|
-
// *Badness* coefficients.
|
|
2235
|
-
N1: 3,
|
|
2236
|
-
N2: 3,
|
|
2237
|
-
N3: 40,
|
|
2238
|
-
N4: 10
|
|
2239
|
-
});
|
|
2240
|
-
var Frame_1 = Frame;
|
|
2241
|
-
var ImageRenderer = Renderer_1.extend({
|
|
2242
|
-
/**
|
|
2243
|
-
* @override
|
|
2244
|
-
*/
|
|
2245
|
-
draw: function() {
|
|
2246
|
-
this.element.src = this.qrious.toDataURL();
|
|
2247
|
-
},
|
|
2248
|
-
/**
|
|
2249
|
-
* @override
|
|
2250
|
-
*/
|
|
2251
|
-
reset: function() {
|
|
2252
|
-
this.element.src = "";
|
|
2253
|
-
},
|
|
2254
|
-
/**
|
|
2255
|
-
* @override
|
|
2256
|
-
*/
|
|
2257
|
-
resize: function() {
|
|
2258
|
-
var element = this.element;
|
|
2259
|
-
element.width = element.height = this.qrious.size;
|
|
2260
|
-
}
|
|
2261
|
-
});
|
|
2262
|
-
var ImageRenderer_1 = ImageRenderer;
|
|
2263
|
-
var Option = lite.extend(function(name, modifiable, defaultValue, valueTransformer) {
|
|
2264
|
-
this.name = name;
|
|
2265
|
-
this.modifiable = Boolean(modifiable);
|
|
2266
|
-
this.defaultValue = defaultValue;
|
|
2267
|
-
this._valueTransformer = valueTransformer;
|
|
2268
|
-
}, {
|
|
2269
|
-
/**
|
|
2270
|
-
* Transforms the specified <code>value</code> so that it can be applied for this {@link Option}.
|
|
2271
|
-
*
|
|
2272
|
-
* If a value transformer has been specified for this {@link Option}, it will be called upon to transform
|
|
2273
|
-
* <code>value</code>. Otherwise, <code>value</code> will be returned directly.
|
|
2274
|
-
*
|
|
2275
|
-
* @param {*} value - the value to be transformed
|
|
2276
|
-
* @return {*} The transformed value or <code>value</code> if no value transformer is specified.
|
|
2277
|
-
* @public
|
|
2278
|
-
* @memberof Option#
|
|
2279
|
-
*/
|
|
2280
|
-
transform: function(value) {
|
|
2281
|
-
var transformer = this._valueTransformer;
|
|
2282
|
-
if (typeof transformer === "function") {
|
|
2283
|
-
return transformer(value, this);
|
|
2284
|
-
}
|
|
2285
|
-
return value;
|
|
2286
|
-
}
|
|
2287
|
-
});
|
|
2288
|
-
var Option_1 = Option;
|
|
2289
|
-
var Utilities = lite.extend(null, {
|
|
2290
|
-
/**
|
|
2291
|
-
* Returns the absolute value of a given number.
|
|
2292
|
-
*
|
|
2293
|
-
* This method is simply a convenient shorthand for <code>Math.abs</code> while ensuring that nulls are returned as
|
|
2294
|
-
* <code>null</code> instead of zero.
|
|
2295
|
-
*
|
|
2296
|
-
* @param {number} value - the number whose absolute value is to be returned
|
|
2297
|
-
* @return {number} The absolute value of <code>value</code> or <code>null</code> if <code>value</code> is
|
|
2298
|
-
* <code>null</code>.
|
|
2299
|
-
* @public
|
|
2300
|
-
* @static
|
|
2301
|
-
* @memberof Utilities
|
|
2302
|
-
*/
|
|
2303
|
-
abs: function(value) {
|
|
2304
|
-
return value != null ? Math.abs(value) : null;
|
|
2305
|
-
},
|
|
2306
|
-
/**
|
|
2307
|
-
* Returns whether the specified <code>object</code> has a property with the specified <code>name</code> as an own
|
|
2308
|
-
* (not inherited) property.
|
|
2309
|
-
*
|
|
2310
|
-
* @param {Object} object - the object on which the property is to be checked
|
|
2311
|
-
* @param {string} name - the name of the property to be checked
|
|
2312
|
-
* @return {boolean} <code>true</code> if <code>object</code> has an own property with <code>name</code>.
|
|
2313
|
-
* @public
|
|
2314
|
-
* @static
|
|
2315
|
-
* @memberof Utilities
|
|
2316
|
-
*/
|
|
2317
|
-
hasOwn: function(object, name) {
|
|
2318
|
-
return Object.prototype.hasOwnProperty.call(object, name);
|
|
2319
|
-
},
|
|
2320
|
-
/**
|
|
2321
|
-
* A non-operation method that does absolutely nothing.
|
|
2322
|
-
*
|
|
2323
|
-
* @return {void}
|
|
2324
|
-
* @public
|
|
2325
|
-
* @static
|
|
2326
|
-
* @memberof Utilities
|
|
2327
|
-
*/
|
|
2328
|
-
noop: function() {
|
|
2329
|
-
},
|
|
2330
|
-
/**
|
|
2331
|
-
* Transforms the specified <code>string</code> to upper case while remaining null-safe.
|
|
2332
|
-
*
|
|
2333
|
-
* @param {string} string - the string to be transformed to upper case
|
|
2334
|
-
* @return {string} <code>string</code> transformed to upper case if <code>string</code> is not <code>null</code>.
|
|
2335
|
-
* @public
|
|
2336
|
-
* @static
|
|
2337
|
-
* @memberof Utilities
|
|
2338
|
-
*/
|
|
2339
|
-
toUpperCase: function(string) {
|
|
2340
|
-
return string != null ? string.toUpperCase() : null;
|
|
2341
|
-
}
|
|
2342
|
-
});
|
|
2343
|
-
var Utilities_1 = Utilities;
|
|
2344
|
-
var OptionManager = lite.extend(function(options) {
|
|
2345
|
-
this.options = {};
|
|
2346
|
-
options.forEach(function(option) {
|
|
2347
|
-
this.options[option.name] = option;
|
|
2348
|
-
}, this);
|
|
2349
|
-
}, {
|
|
2350
|
-
/**
|
|
2351
|
-
* Returns whether an option with the specified <code>name</code> is available.
|
|
2352
|
-
*
|
|
2353
|
-
* @param {string} name - the name of the {@link Option} whose existence is to be checked
|
|
2354
|
-
* @return {boolean} <code>true</code> if an {@link Option} exists with <code>name</code>; otherwise
|
|
2355
|
-
* <code>false</code>.
|
|
2356
|
-
* @public
|
|
2357
|
-
* @memberof OptionManager#
|
|
2358
|
-
*/
|
|
2359
|
-
exists: function(name) {
|
|
2360
|
-
return this.options[name] != null;
|
|
2361
|
-
},
|
|
2362
|
-
/**
|
|
2363
|
-
* Returns the value of the option with the specified <code>name</code> on the <code>target</code> object provided.
|
|
2364
|
-
*
|
|
2365
|
-
* @param {string} name - the name of the {@link Option} whose value on <code>target</code> is to be returned
|
|
2366
|
-
* @param {Object} target - the object from which the value of the named {@link Option} is to be returned
|
|
2367
|
-
* @return {*} The value of the {@link Option} with <code>name</code> on <code>target</code>.
|
|
2368
|
-
* @public
|
|
2369
|
-
* @memberof OptionManager#
|
|
2370
|
-
*/
|
|
2371
|
-
get: function(name, target) {
|
|
2372
|
-
return OptionManager._get(this.options[name], target);
|
|
2373
|
-
},
|
|
2374
|
-
/**
|
|
2375
|
-
* Returns a copy of all of the available options on the <code>target</code> object provided.
|
|
2376
|
-
*
|
|
2377
|
-
* @param {Object} target - the object from which the option name/value pairs are to be returned
|
|
2378
|
-
* @return {Object.<string, *>} A hash containing the name/value pairs of all options on <code>target</code>.
|
|
2379
|
-
* @public
|
|
2380
|
-
* @memberof OptionManager#
|
|
2381
|
-
*/
|
|
2382
|
-
getAll: function(target) {
|
|
2383
|
-
var name;
|
|
2384
|
-
var options = this.options;
|
|
2385
|
-
var result = {};
|
|
2386
|
-
for (name in options) {
|
|
2387
|
-
if (Utilities_1.hasOwn(options, name)) {
|
|
2388
|
-
result[name] = OptionManager._get(options[name], target);
|
|
2389
|
-
}
|
|
2390
|
-
}
|
|
2391
|
-
return result;
|
|
2392
|
-
},
|
|
2393
|
-
/**
|
|
2394
|
-
* Initializes the available options for the <code>target</code> object provided and then applies the initial values
|
|
2395
|
-
* within the speciifed <code>options</code>.
|
|
2396
|
-
*
|
|
2397
|
-
* This method will throw an error if any of the names within <code>options</code> does not match an available option.
|
|
2398
|
-
*
|
|
2399
|
-
* This involves setting the default values and defining properties for all of the available options on
|
|
2400
|
-
* <code>target</code> before finally calling {@link OptionMananger#setAll} with <code>options</code> and
|
|
2401
|
-
* <code>target</code>. Any options that are configured to be modifiable will have a setter included in their defined
|
|
2402
|
-
* property that will allow its corresponding value to be modified.
|
|
2403
|
-
*
|
|
2404
|
-
* If a change handler is specified, it will be called whenever the value changes on <code>target</code> for a
|
|
2405
|
-
* modifiable option, but only when done so via the defined property's setter.
|
|
2406
|
-
*
|
|
2407
|
-
* @param {Object.<string, *>} options - the name/value pairs of the initial options to be set
|
|
2408
|
-
* @param {Object} target - the object on which the options are to be initialized
|
|
2409
|
-
* @param {Function} [changeHandler] - the function to be called whenever the value of an modifiable option changes on
|
|
2410
|
-
* <code>target</code>
|
|
2411
|
-
* @return {void}
|
|
2412
|
-
* @throws {Error} If <code>options</code> contains an invalid option name.
|
|
2413
|
-
* @public
|
|
2414
|
-
* @memberof OptionManager#
|
|
2415
|
-
*/
|
|
2416
|
-
init: function(options, target, changeHandler) {
|
|
2417
|
-
if (typeof changeHandler !== "function") {
|
|
2418
|
-
changeHandler = Utilities_1.noop;
|
|
2419
|
-
}
|
|
2420
|
-
var name, option;
|
|
2421
|
-
for (name in this.options) {
|
|
2422
|
-
if (Utilities_1.hasOwn(this.options, name)) {
|
|
2423
|
-
option = this.options[name];
|
|
2424
|
-
OptionManager._set(option, option.defaultValue, target);
|
|
2425
|
-
OptionManager._createAccessor(option, target, changeHandler);
|
|
2426
|
-
}
|
|
2427
|
-
}
|
|
2428
|
-
this._setAll(options, target, true);
|
|
2429
|
-
},
|
|
2430
|
-
/**
|
|
2431
|
-
* Sets the value of the option with the specified <code>name</code> on the <code>target</code> object provided to
|
|
2432
|
-
* <code>value</code>.
|
|
2433
|
-
*
|
|
2434
|
-
* This method will throw an error if <code>name</code> does not match an available option or matches an option that
|
|
2435
|
-
* cannot be modified.
|
|
2436
|
-
*
|
|
2437
|
-
* If <code>value</code> is <code>null</code> and the {@link Option} has a default value configured, then that default
|
|
2438
|
-
* value will be used instead. If the {@link Option} also has a value transformer configured, it will be used to
|
|
2439
|
-
* transform whichever value was determined to be used.
|
|
2440
|
-
*
|
|
2441
|
-
* This method returns whether the value of the underlying field on <code>target</code> was changed as a result.
|
|
2442
|
-
*
|
|
2443
|
-
* @param {string} name - the name of the {@link Option} whose value is to be set
|
|
2444
|
-
* @param {*} value - the value to be set for the named {@link Option} on <code>target</code>
|
|
2445
|
-
* @param {Object} target - the object on which <code>value</code> is to be set for the named {@link Option}
|
|
2446
|
-
* @return {boolean} <code>true</code> if the underlying field on <code>target</code> was changed; otherwise
|
|
2447
|
-
* <code>false</code>.
|
|
2448
|
-
* @throws {Error} If <code>name</code> is invalid or is for an option that cannot be modified.
|
|
2449
|
-
* @public
|
|
2450
|
-
* @memberof OptionManager#
|
|
2451
|
-
*/
|
|
2452
|
-
set: function(name, value, target) {
|
|
2453
|
-
return this._set(name, value, target);
|
|
2454
|
-
},
|
|
2455
|
-
/**
|
|
2456
|
-
* Sets all of the specified <code>options</code> on the <code>target</code> object provided to their corresponding
|
|
2457
|
-
* values.
|
|
2458
|
-
*
|
|
2459
|
-
* This method will throw an error if any of the names within <code>options</code> does not match an available option
|
|
2460
|
-
* or matches an option that cannot be modified.
|
|
2461
|
-
*
|
|
2462
|
-
* If any value within <code>options</code> is <code>null</code> and the corresponding {@link Option} has a default
|
|
2463
|
-
* value configured, then that default value will be used instead. If an {@link Option} also has a value transformer
|
|
2464
|
-
* configured, it will be used to transform whichever value was determined to be used.
|
|
2465
|
-
*
|
|
2466
|
-
* This method returns whether the value for any of the underlying fields on <code>target</code> were changed as a
|
|
2467
|
-
* result.
|
|
2468
|
-
*
|
|
2469
|
-
* @param {Object.<string, *>} options - the name/value pairs of options to be set
|
|
2470
|
-
* @param {Object} target - the object on which the options are to be set
|
|
2471
|
-
* @return {boolean} <code>true</code> if any of the underlying fields on <code>target</code> were changed; otherwise
|
|
2472
|
-
* <code>false</code>.
|
|
2473
|
-
* @throws {Error} If <code>options</code> contains an invalid option name or an option that cannot be modiifed.
|
|
2474
|
-
* @public
|
|
2475
|
-
* @memberof OptionManager#
|
|
2476
|
-
*/
|
|
2477
|
-
setAll: function(options, target) {
|
|
2478
|
-
return this._setAll(options, target);
|
|
2479
|
-
},
|
|
2480
|
-
_set: function(name, value, target, allowUnmodifiable) {
|
|
2481
|
-
var option = this.options[name];
|
|
2482
|
-
if (!option) {
|
|
2483
|
-
throw new Error("Invalid option: " + name);
|
|
2484
|
-
}
|
|
2485
|
-
if (!option.modifiable && !allowUnmodifiable) {
|
|
2486
|
-
throw new Error("Option cannot be modified: " + name);
|
|
2487
|
-
}
|
|
2488
|
-
return OptionManager._set(option, value, target);
|
|
2489
|
-
},
|
|
2490
|
-
_setAll: function(options, target, allowUnmodifiable) {
|
|
2491
|
-
if (!options) {
|
|
2492
|
-
return false;
|
|
2493
|
-
}
|
|
2494
|
-
var name;
|
|
2495
|
-
var changed = false;
|
|
2496
|
-
for (name in options) {
|
|
2497
|
-
if (Utilities_1.hasOwn(options, name) && this._set(name, options[name], target, allowUnmodifiable)) {
|
|
2498
|
-
changed = true;
|
|
2499
|
-
}
|
|
2500
|
-
}
|
|
2501
|
-
return changed;
|
|
2502
|
-
}
|
|
2503
|
-
}, {
|
|
2504
|
-
_createAccessor: function(option, target, changeHandler) {
|
|
2505
|
-
var descriptor = {
|
|
2506
|
-
get: function() {
|
|
2507
|
-
return OptionManager._get(option, target);
|
|
2508
|
-
}
|
|
2509
|
-
};
|
|
2510
|
-
if (option.modifiable) {
|
|
2511
|
-
descriptor.set = function(value) {
|
|
2512
|
-
if (OptionManager._set(option, value, target)) {
|
|
2513
|
-
changeHandler(value, option);
|
|
2514
|
-
}
|
|
2515
|
-
};
|
|
2516
|
-
}
|
|
2517
|
-
Object.defineProperty(target, option.name, descriptor);
|
|
2518
|
-
},
|
|
2519
|
-
_get: function(option, target) {
|
|
2520
|
-
return target["_" + option.name];
|
|
2521
|
-
},
|
|
2522
|
-
_set: function(option, value, target) {
|
|
2523
|
-
var fieldName = "_" + option.name;
|
|
2524
|
-
var oldValue = target[fieldName];
|
|
2525
|
-
var newValue = option.transform(value != null ? value : option.defaultValue);
|
|
2526
|
-
target[fieldName] = newValue;
|
|
2527
|
-
return newValue !== oldValue;
|
|
2528
|
-
}
|
|
2529
|
-
});
|
|
2530
|
-
var OptionManager_1 = OptionManager;
|
|
2531
|
-
var ServiceManager = lite.extend(function() {
|
|
2532
|
-
this._services = {};
|
|
2533
|
-
}, {
|
|
2534
|
-
/**
|
|
2535
|
-
* Returns the {@link Service} being managed with the specified <code>name</code>.
|
|
2536
|
-
*
|
|
2537
|
-
* @param {string} name - the name of the {@link Service} to be returned
|
|
2538
|
-
* @return {Service} The {@link Service} is being managed with <code>name</code>.
|
|
2539
|
-
* @throws {Error} If no {@link Service} is being managed with <code>name</code>.
|
|
2540
|
-
* @public
|
|
2541
|
-
* @memberof ServiceManager#
|
|
2542
|
-
*/
|
|
2543
|
-
getService: function(name) {
|
|
2544
|
-
var service = this._services[name];
|
|
2545
|
-
if (!service) {
|
|
2546
|
-
throw new Error("Service is not being managed with name: " + name);
|
|
2547
|
-
}
|
|
2548
|
-
return service;
|
|
2549
|
-
},
|
|
2550
|
-
/**
|
|
2551
|
-
* Sets the {@link Service} implementation to be managed for the specified <code>name</code> to the
|
|
2552
|
-
* <code>service</code> provided.
|
|
2553
|
-
*
|
|
2554
|
-
* @param {string} name - the name of the {@link Service} to be managed with <code>name</code>
|
|
2555
|
-
* @param {Service} service - the {@link Service} implementation to be managed
|
|
2556
|
-
* @return {void}
|
|
2557
|
-
* @throws {Error} If a {@link Service} is already being managed with the same <code>name</code>.
|
|
2558
|
-
* @public
|
|
2559
|
-
* @memberof ServiceManager#
|
|
2560
|
-
*/
|
|
2561
|
-
setService: function(name, service) {
|
|
2562
|
-
if (this._services[name]) {
|
|
2563
|
-
throw new Error("Service is already managed with name: " + name);
|
|
2564
|
-
}
|
|
2565
|
-
if (service) {
|
|
2566
|
-
this._services[name] = service;
|
|
2567
|
-
}
|
|
2568
|
-
}
|
|
2569
|
-
});
|
|
2570
|
-
var ServiceManager_1 = ServiceManager;
|
|
2571
|
-
var optionManager = new OptionManager_1([
|
|
2572
|
-
new Option_1("background", true, "white"),
|
|
2573
|
-
new Option_1("backgroundAlpha", true, 1, Utilities_1.abs),
|
|
2574
|
-
new Option_1("element"),
|
|
2575
|
-
new Option_1("foreground", true, "black"),
|
|
2576
|
-
new Option_1("foregroundAlpha", true, 1, Utilities_1.abs),
|
|
2577
|
-
new Option_1("level", true, "L", Utilities_1.toUpperCase),
|
|
2578
|
-
new Option_1("mime", true, "image/png"),
|
|
2579
|
-
new Option_1("padding", true, null, Utilities_1.abs),
|
|
2580
|
-
new Option_1("size", true, 100, Utilities_1.abs),
|
|
2581
|
-
new Option_1("value", true, "")
|
|
2582
|
-
]);
|
|
2583
|
-
var serviceManager = new ServiceManager_1();
|
|
2584
|
-
var QRious2 = lite.extend(function(options) {
|
|
2585
|
-
optionManager.init(options, this, this.update.bind(this));
|
|
2586
|
-
var element = optionManager.get("element", this);
|
|
2587
|
-
var elementService = serviceManager.getService("element");
|
|
2588
|
-
var canvas = element && elementService.isCanvas(element) ? element : elementService.createCanvas();
|
|
2589
|
-
var image = element && elementService.isImage(element) ? element : elementService.createImage();
|
|
2590
|
-
this._canvasRenderer = new CanvasRenderer_1(this, canvas, true);
|
|
2591
|
-
this._imageRenderer = new ImageRenderer_1(this, image, image === element);
|
|
2592
|
-
this.update();
|
|
2593
|
-
}, {
|
|
2594
|
-
/**
|
|
2595
|
-
* Returns all of the options configured for this {@link QRious}.
|
|
2596
|
-
*
|
|
2597
|
-
* Any changes made to the returned object will not be reflected in the options themselves or their corresponding
|
|
2598
|
-
* underlying fields.
|
|
2599
|
-
*
|
|
2600
|
-
* @return {Object.<string, *>} A copy of the applied options.
|
|
2601
|
-
* @public
|
|
2602
|
-
* @memberof QRious#
|
|
2603
|
-
*/
|
|
2604
|
-
get: function() {
|
|
2605
|
-
return optionManager.getAll(this);
|
|
2606
|
-
},
|
|
2607
|
-
/**
|
|
2608
|
-
* Sets all of the specified <code>options</code> and automatically updates this {@link QRious} if any of the
|
|
2609
|
-
* underlying fields are changed as a result.
|
|
2610
|
-
*
|
|
2611
|
-
* This is the preferred method for updating multiple options at one time to avoid unnecessary updates between
|
|
2612
|
-
* changes.
|
|
2613
|
-
*
|
|
2614
|
-
* @param {QRious~Options} options - the options to be set
|
|
2615
|
-
* @return {void}
|
|
2616
|
-
* @throws {Error} If any <code>options</code> are invalid or cannot be modified.
|
|
2617
|
-
* @public
|
|
2618
|
-
* @memberof QRious#
|
|
2619
|
-
*/
|
|
2620
|
-
set: function(options) {
|
|
2621
|
-
if (optionManager.setAll(options, this)) {
|
|
2622
|
-
this.update();
|
|
2623
|
-
}
|
|
2624
|
-
},
|
|
2625
|
-
/**
|
|
2626
|
-
* Returns the image data URI for the generated QR code using the <code>mime</code> provided.
|
|
2627
|
-
*
|
|
2628
|
-
* @param {string} [mime] - the MIME type for the image
|
|
2629
|
-
* @return {string} The image data URI for the QR code.
|
|
2630
|
-
* @public
|
|
2631
|
-
* @memberof QRious#
|
|
2632
|
-
*/
|
|
2633
|
-
toDataURL: function(mime) {
|
|
2634
|
-
return this.canvas.toDataURL(mime || this.mime);
|
|
2635
|
-
},
|
|
2636
|
-
/**
|
|
2637
|
-
* Updates this {@link QRious} by generating a new {@link Frame} and re-rendering the QR code.
|
|
2638
|
-
*
|
|
2639
|
-
* @return {void}
|
|
2640
|
-
* @protected
|
|
2641
|
-
* @memberof QRious#
|
|
2642
|
-
*/
|
|
2643
|
-
update: function() {
|
|
2644
|
-
var frame = new Frame_1({
|
|
2645
|
-
level: this.level,
|
|
2646
|
-
value: this.value
|
|
2647
|
-
});
|
|
2648
|
-
this._canvasRenderer.render(frame);
|
|
2649
|
-
this._imageRenderer.render(frame);
|
|
2650
|
-
}
|
|
2651
|
-
}, {
|
|
2652
|
-
/**
|
|
2653
|
-
* Configures the <code>service</code> provided to be used by all {@link QRious} instances.
|
|
2654
|
-
*
|
|
2655
|
-
* @param {Service} service - the {@link Service} to be configured
|
|
2656
|
-
* @return {void}
|
|
2657
|
-
* @throws {Error} If a {@link Service} has already been configured with the same name.
|
|
2658
|
-
* @public
|
|
2659
|
-
* @static
|
|
2660
|
-
* @memberof QRious
|
|
2661
|
-
*/
|
|
2662
|
-
use: function(service) {
|
|
2663
|
-
serviceManager.setService(service.getName(), service);
|
|
2664
|
-
}
|
|
2665
|
-
});
|
|
2666
|
-
Object.defineProperties(QRious2.prototype, {
|
|
2667
|
-
canvas: {
|
|
2668
|
-
/**
|
|
2669
|
-
* Returns the <code>canvas</code> element being used to render the QR code for this {@link QRious}.
|
|
2670
|
-
*
|
|
2671
|
-
* @return {*} The <code>canvas</code> element.
|
|
2672
|
-
* @public
|
|
2673
|
-
* @memberof QRious#
|
|
2674
|
-
* @alias canvas
|
|
2675
|
-
*/
|
|
2676
|
-
get: function() {
|
|
2677
|
-
return this._canvasRenderer.getElement();
|
|
2678
|
-
}
|
|
2679
|
-
},
|
|
2680
|
-
image: {
|
|
2681
|
-
/**
|
|
2682
|
-
* Returns the <code>img</code> element being used to render the QR code for this {@link QRious}.
|
|
2683
|
-
*
|
|
2684
|
-
* @return {*} The <code>img</code> element.
|
|
2685
|
-
* @public
|
|
2686
|
-
* @memberof QRious#
|
|
2687
|
-
* @alias image
|
|
2688
|
-
*/
|
|
2689
|
-
get: function() {
|
|
2690
|
-
return this._imageRenderer.getElement();
|
|
2691
|
-
}
|
|
2692
|
-
}
|
|
2693
|
-
});
|
|
2694
|
-
var QRious_1$2 = QRious2;
|
|
2695
|
-
var index = QRious_1$2;
|
|
2696
|
-
var Service = lite.extend({
|
|
2697
|
-
/**
|
|
2698
|
-
* Returns the name of this {@link Service}.
|
|
2699
|
-
*
|
|
2700
|
-
* @return {string} The service name.
|
|
2701
|
-
* @public
|
|
2702
|
-
* @abstract
|
|
2703
|
-
* @memberof Service#
|
|
2704
|
-
*/
|
|
2705
|
-
getName: function() {
|
|
2706
|
-
}
|
|
2707
|
-
});
|
|
2708
|
-
var Service_1 = Service;
|
|
2709
|
-
var ElementService = Service_1.extend({
|
|
2710
|
-
/**
|
|
2711
|
-
* Creates an instance of a canvas element.
|
|
2712
|
-
*
|
|
2713
|
-
* Implementations of {@link ElementService} <b>must</b> override this method with their own specific logic.
|
|
2714
|
-
*
|
|
2715
|
-
* @return {*} The newly created canvas element.
|
|
2716
|
-
* @public
|
|
2717
|
-
* @abstract
|
|
2718
|
-
* @memberof ElementService#
|
|
2719
|
-
*/
|
|
2720
|
-
createCanvas: function() {
|
|
2721
|
-
},
|
|
2722
|
-
/**
|
|
2723
|
-
* Creates an instance of a image element.
|
|
2724
|
-
*
|
|
2725
|
-
* Implementations of {@link ElementService} <b>must</b> override this method with their own specific logic.
|
|
2726
|
-
*
|
|
2727
|
-
* @return {*} The newly created image element.
|
|
2728
|
-
* @public
|
|
2729
|
-
* @abstract
|
|
2730
|
-
* @memberof ElementService#
|
|
2731
|
-
*/
|
|
2732
|
-
createImage: function() {
|
|
2733
|
-
},
|
|
2734
|
-
/**
|
|
2735
|
-
* @override
|
|
2736
|
-
*/
|
|
2737
|
-
getName: function() {
|
|
2738
|
-
return "element";
|
|
2739
|
-
},
|
|
2740
|
-
/**
|
|
2741
|
-
* Returns whether the specified <code>element</code> is a canvas.
|
|
2742
|
-
*
|
|
2743
|
-
* Implementations of {@link ElementService} <b>must</b> override this method with their own specific logic.
|
|
2744
|
-
*
|
|
2745
|
-
* @param {*} element - the element to be checked
|
|
2746
|
-
* @return {boolean} <code>true</code> if <code>element</code> is a canvas; otherwise <code>false</code>.
|
|
2747
|
-
* @public
|
|
2748
|
-
* @abstract
|
|
2749
|
-
* @memberof ElementService#
|
|
2750
|
-
*/
|
|
2751
|
-
isCanvas: function(element) {
|
|
2752
|
-
},
|
|
2753
|
-
/**
|
|
2754
|
-
* Returns whether the specified <code>element</code> is an image.
|
|
2755
|
-
*
|
|
2756
|
-
* Implementations of {@link ElementService} <b>must</b> override this method with their own specific logic.
|
|
2757
|
-
*
|
|
2758
|
-
* @param {*} element - the element to be checked
|
|
2759
|
-
* @return {boolean} <code>true</code> if <code>element</code> is an image; otherwise <code>false</code>.
|
|
2760
|
-
* @public
|
|
2761
|
-
* @abstract
|
|
2762
|
-
* @memberof ElementService#
|
|
2763
|
-
*/
|
|
2764
|
-
isImage: function(element) {
|
|
2765
|
-
}
|
|
2766
|
-
});
|
|
2767
|
-
var ElementService_1 = ElementService;
|
|
2768
|
-
var BrowserElementService = ElementService_1.extend({
|
|
2769
|
-
/**
|
|
2770
|
-
* @override
|
|
2771
|
-
*/
|
|
2772
|
-
createCanvas: function() {
|
|
2773
|
-
return document.createElement("canvas");
|
|
2774
|
-
},
|
|
2775
|
-
/**
|
|
2776
|
-
* @override
|
|
2777
|
-
*/
|
|
2778
|
-
createImage: function() {
|
|
2779
|
-
return document.createElement("img");
|
|
2780
|
-
},
|
|
2781
|
-
/**
|
|
2782
|
-
* @override
|
|
2783
|
-
*/
|
|
2784
|
-
isCanvas: function(element) {
|
|
2785
|
-
return element instanceof HTMLCanvasElement;
|
|
2786
|
-
},
|
|
2787
|
-
/**
|
|
2788
|
-
* @override
|
|
2789
|
-
*/
|
|
2790
|
-
isImage: function(element) {
|
|
2791
|
-
return element instanceof HTMLImageElement;
|
|
2792
|
-
}
|
|
2793
|
-
});
|
|
2794
|
-
var BrowserElementService_1 = BrowserElementService;
|
|
2795
|
-
index.use(new BrowserElementService_1());
|
|
2796
|
-
var QRious_1 = index;
|
|
2797
|
-
return QRious_1;
|
|
2798
|
-
}));
|
|
2799
|
-
})(qrious$1);
|
|
2800
|
-
return qrious$1.exports;
|
|
2801
|
-
}
|
|
2802
|
-
var qriousExports = requireQrious();
|
|
2803
|
-
const QRious = /* @__PURE__ */ getDefaultExportFromCjs(qriousExports);
|
|
2804
|
-
const QR_ATTRIBUTE_ALIASES = {
|
|
2805
|
-
value: ["value"],
|
|
2806
|
-
background: ["background"],
|
|
2807
|
-
backgroundAlpha: ["background-alpha", "backgroundalpha", "backgroundAlpha"],
|
|
2808
|
-
foreground: ["foreground"],
|
|
2809
|
-
foregroundAlpha: ["foreground-alpha", "foregroundalpha", "foregroundAlpha"],
|
|
2810
|
-
level: ["level"],
|
|
2811
|
-
padding: ["padding"],
|
|
2812
|
-
size: ["size"]
|
|
2813
|
-
};
|
|
2814
|
-
const NUMERIC_OPTIONS = /* @__PURE__ */ new Set(["backgroundAlpha", "foregroundAlpha", "padding", "size"]);
|
|
2815
|
-
class QrCode extends WJElement {
|
|
2816
|
-
/**
|
|
2817
|
-
* Creates an instance of QrCode.
|
|
2818
|
-
*/
|
|
8
|
+
var i, n = { exports: {} };
|
|
9
|
+
var s = (i || (i = 1, n.exports = (function() {
|
|
10
|
+
var t2 = function() {
|
|
11
|
+
}, e2 = Object.prototype.hasOwnProperty, i2 = Array.prototype.slice;
|
|
12
|
+
function n2(e3, i3) {
|
|
13
|
+
var n3;
|
|
14
|
+
return "function" == typeof Object.create ? n3 = Object.create(e3) : (t2.prototype = e3, n3 = new t2(), t2.prototype = null), i3 && r2(true, n3, i3), n3;
|
|
15
|
+
}
|
|
16
|
+
function s2(t3, e3, i3, s3) {
|
|
17
|
+
var a3 = this;
|
|
18
|
+
return "string" != typeof t3 && (s3 = i3, i3 = e3, e3 = t3, t3 = null), "function" != typeof e3 && (s3 = i3, i3 = e3, e3 = function() {
|
|
19
|
+
return a3.apply(this, arguments);
|
|
20
|
+
}), r2(false, e3, a3, s3), e3.prototype = n2(a3.prototype, i3), e3.prototype.constructor = e3, e3.class_ = t3 || a3.class_, e3.super_ = a3, e3;
|
|
21
|
+
}
|
|
22
|
+
function r2(t3, n3, s3) {
|
|
23
|
+
for (var r3, a3, o3 = 0, u3 = (s3 = i2.call(arguments, 2)).length; o3 < u3; o3++) for (r3 in a3 = s3[o3]) t3 && !e2.call(a3, r3) || (n3[r3] = a3[r3]);
|
|
24
|
+
}
|
|
25
|
+
var a2 = s2;
|
|
26
|
+
function o2() {
|
|
27
|
+
}
|
|
28
|
+
o2.class_ = "Nevis", o2.super_ = Object, o2.extend = a2;
|
|
29
|
+
var u2 = o2, l = u2.extend(function(t3, e3, i3) {
|
|
30
|
+
this.qrious = t3, this.element = e3, this.element.qrious = t3, this.enabled = Boolean(i3);
|
|
31
|
+
}, { draw: function(t3) {
|
|
32
|
+
}, getElement: function() {
|
|
33
|
+
return this.enabled || (this.enabled = true, this.render()), this.element;
|
|
34
|
+
}, getModuleSize: function(t3) {
|
|
35
|
+
var e3 = this.qrious, i3 = e3.padding || 0, n3 = Math.floor((e3.size - 2 * i3) / t3.width);
|
|
36
|
+
return Math.max(1, n3);
|
|
37
|
+
}, getOffset: function(t3) {
|
|
38
|
+
var e3 = this.qrious, i3 = e3.padding;
|
|
39
|
+
if (null != i3) return i3;
|
|
40
|
+
var n3 = this.getModuleSize(t3), s3 = Math.floor((e3.size - n3 * t3.width) / 2);
|
|
41
|
+
return Math.max(0, s3);
|
|
42
|
+
}, render: function(t3) {
|
|
43
|
+
this.enabled && (this.resize(), this.reset(), this.draw(t3));
|
|
44
|
+
}, reset: function() {
|
|
45
|
+
}, resize: function() {
|
|
46
|
+
} }), c = l, h = c.extend({ draw: function(t3) {
|
|
47
|
+
var e3, i3, n3 = this.qrious, s3 = this.getModuleSize(t3), r3 = this.getOffset(t3), a3 = this.element.getContext("2d");
|
|
48
|
+
for (a3.fillStyle = n3.foreground, a3.globalAlpha = n3.foregroundAlpha, e3 = 0; e3 < t3.width; e3++) for (i3 = 0; i3 < t3.width; i3++) t3.buffer[i3 * t3.width + e3] && a3.fillRect(s3 * e3 + r3, s3 * i3 + r3, s3, s3);
|
|
49
|
+
}, reset: function() {
|
|
50
|
+
var t3 = this.qrious, e3 = this.element.getContext("2d"), i3 = t3.size;
|
|
51
|
+
e3.lineWidth = 1, e3.clearRect(0, 0, i3, i3), e3.fillStyle = t3.background, e3.globalAlpha = t3.backgroundAlpha, e3.fillRect(0, 0, i3, i3);
|
|
52
|
+
}, resize: function() {
|
|
53
|
+
var t3 = this.element;
|
|
54
|
+
t3.width = t3.height = this.qrious.size;
|
|
55
|
+
} }), f = h, d = u2.extend(null, { BLOCK: [0, 11, 15, 19, 23, 27, 31, 16, 18, 20, 22, 24, 26, 28, 20, 22, 24, 24, 26, 28, 28, 22, 24, 24, 26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28] }), _ = u2.extend(null, { BLOCKS: [1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17, 1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28, 1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22, 1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16, 1, 0, 108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22, 2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28, 2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26, 2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26, 2, 0, 116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24, 2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28, 4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24, 2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28, 4, 0, 107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22, 3, 1, 115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24, 5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24, 5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3, 13, 15, 30, 1, 5, 107, 28, 10, 1, 46, 28, 1, 15, 22, 28, 2, 17, 14, 28, 5, 1, 120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2, 19, 14, 28, 3, 4, 113, 28, 3, 11, 44, 26, 17, 4, 21, 26, 9, 16, 13, 26, 3, 5, 107, 28, 3, 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28, 4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30, 2, 7, 111, 28, 17, 0, 46, 28, 7, 16, 24, 30, 34, 0, 13, 24, 4, 5, 121, 30, 4, 14, 47, 28, 11, 14, 24, 30, 16, 14, 15, 30, 6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2, 16, 30, 8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30, 10, 2, 114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30, 8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28, 15, 30, 3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30, 7, 7, 116, 30, 21, 7, 45, 28, 1, 37, 23, 30, 19, 26, 15, 30, 5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23, 25, 15, 30, 13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30, 17, 0, 115, 30, 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30, 17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24, 30, 11, 46, 15, 30, 13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30, 12, 7, 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30, 6, 14, 121, 30, 6, 34, 47, 28, 46, 10, 24, 30, 2, 64, 15, 30, 17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30, 4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30, 20, 4, 117, 30, 40, 7, 47, 28, 43, 22, 24, 30, 10, 67, 15, 30, 19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61, 15, 30], FINAL_FORMAT: [30660, 29427, 32170, 30877, 26159, 25368, 27713, 26998, 21522, 20773, 24188, 23371, 17913, 16590, 20375, 19104, 13663, 12392, 16177, 14854, 9396, 8579, 11994, 11245, 5769, 5054, 7399, 6608, 1890, 597, 3340, 2107], LEVELS: { L: 1, M: 2, Q: 3, H: 4 } }), g = u2.extend(null, { EXPONENT: [1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 116, 232, 205, 135, 19, 38, 76, 152, 45, 90, 180, 117, 234, 201, 143, 3, 6, 12, 24, 48, 96, 192, 157, 39, 78, 156, 37, 74, 148, 53, 106, 212, 181, 119, 238, 193, 159, 35, 70, 140, 5, 10, 20, 40, 80, 160, 93, 186, 105, 210, 185, 111, 222, 161, 95, 190, 97, 194, 153, 47, 94, 188, 101, 202, 137, 15, 30, 60, 120, 240, 253, 231, 211, 187, 107, 214, 177, 127, 254, 225, 223, 163, 91, 182, 113, 226, 217, 175, 67, 134, 17, 34, 68, 136, 13, 26, 52, 104, 208, 189, 103, 206, 129, 31, 62, 124, 248, 237, 199, 147, 59, 118, 236, 197, 151, 51, 102, 204, 133, 23, 46, 92, 184, 109, 218, 169, 79, 158, 33, 66, 132, 21, 42, 84, 168, 77, 154, 41, 82, 164, 85, 170, 73, 146, 57, 114, 228, 213, 183, 115, 230, 209, 191, 99, 198, 145, 63, 126, 252, 229, 215, 179, 123, 246, 241, 255, 227, 219, 171, 75, 150, 49, 98, 196, 149, 55, 110, 220, 165, 87, 174, 65, 130, 25, 50, 100, 200, 141, 7, 14, 28, 56, 112, 224, 221, 167, 83, 166, 81, 162, 89, 178, 121, 242, 249, 239, 195, 155, 43, 86, 172, 69, 138, 9, 18, 36, 72, 144, 61, 122, 244, 245, 247, 243, 251, 235, 203, 139, 11, 22, 44, 88, 176, 125, 250, 233, 207, 131, 27, 54, 108, 216, 173, 71, 142, 0], LOG: [255, 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, 4, 100, 224, 14, 52, 141, 239, 129, 28, 193, 105, 248, 200, 8, 76, 113, 5, 138, 101, 47, 225, 36, 15, 33, 53, 147, 142, 218, 240, 18, 130, 69, 29, 181, 194, 125, 106, 39, 249, 185, 201, 154, 9, 120, 77, 228, 114, 166, 6, 191, 139, 98, 102, 221, 48, 253, 226, 152, 37, 179, 16, 145, 34, 136, 54, 208, 148, 206, 143, 150, 219, 189, 241, 210, 19, 92, 131, 56, 70, 64, 30, 66, 182, 163, 195, 72, 126, 110, 107, 58, 40, 84, 250, 133, 186, 61, 202, 94, 155, 159, 10, 21, 121, 43, 78, 212, 229, 172, 115, 243, 167, 87, 7, 112, 192, 247, 140, 128, 99, 13, 103, 74, 222, 237, 49, 197, 254, 24, 227, 165, 153, 119, 38, 184, 180, 124, 17, 68, 146, 217, 35, 32, 137, 46, 55, 63, 209, 91, 149, 188, 207, 205, 144, 135, 151, 178, 220, 252, 190, 97, 242, 86, 211, 171, 20, 42, 93, 158, 132, 60, 57, 83, 71, 109, 65, 162, 31, 45, 67, 216, 183, 123, 164, 118, 196, 23, 73, 236, 127, 12, 111, 246, 108, 161, 59, 82, 41, 157, 85, 170, 251, 96, 134, 177, 187, 204, 62, 90, 203, 89, 95, 176, 156, 169, 160, 81, 11, 245, 22, 235, 122, 117, 44, 215, 79, 174, 213, 233, 230, 231, 173, 232, 116, 214, 244, 234, 168, 80, 88, 175] }), p = u2.extend(null, { BLOCK: [3220, 1468, 2713, 1235, 3062, 1890, 2119, 1549, 2344, 2936, 1117, 2583, 1330, 2470, 1667, 2249, 2028, 3780, 481, 4011, 142, 3098, 831, 3445, 592, 2517, 1776, 2234, 1951, 2827, 1070, 2660, 1345, 3177] }), v = u2.extend(function(t3) {
|
|
56
|
+
var e3, i3, n3, s3, r3, a3 = t3.value.length;
|
|
57
|
+
for (this._badness = [], this._level = _.LEVELS[t3.level], this._polynomial = [], this._value = t3.value, this._version = 0, this._stringBuffer = []; this._version < 40 && (this._version++, n3 = 4 * (this._level - 1) + 16 * (this._version - 1), s3 = _.BLOCKS[n3++], r3 = _.BLOCKS[n3++], e3 = _.BLOCKS[n3++], i3 = _.BLOCKS[n3], !(a3 <= (n3 = e3 * (s3 + r3) + r3 - 3 + (this._version <= 9)))); ) ;
|
|
58
|
+
this._dataBlock = e3, this._eccBlock = i3, this._neccBlock1 = s3, this._neccBlock2 = r3;
|
|
59
|
+
var o3 = this.width = 17 + 4 * this._version;
|
|
60
|
+
this.buffer = v._createArray(o3 * o3), this._ecc = v._createArray(e3 + (e3 + i3) * (s3 + r3) + r3), this._mask = v._createArray((o3 * (o3 + 1) + 1) / 2), this._insertFinders(), this._insertAlignments(), this.buffer[8 + o3 * (o3 - 8)] = 1, this._insertTimingGap(), this._reverseMask(), this._insertTimingRowAndColumn(), this._insertVersion(), this._syncMask(), this._convertBitStream(a3), this._calculatePolynomial(), this._appendEccToData(), this._interleaveBlocks(), this._pack(), this._finish();
|
|
61
|
+
}, { _addAlignment: function(t3, e3) {
|
|
62
|
+
var i3, n3 = this.buffer, s3 = this.width;
|
|
63
|
+
for (n3[t3 + s3 * e3] = 1, i3 = -2; i3 < 2; i3++) n3[t3 + i3 + s3 * (e3 - 2)] = 1, n3[t3 - 2 + s3 * (e3 + i3 + 1)] = 1, n3[t3 + 2 + s3 * (e3 + i3)] = 1, n3[t3 + i3 + 1 + s3 * (e3 + 2)] = 1;
|
|
64
|
+
for (i3 = 0; i3 < 2; i3++) this._setMask(t3 - 1, e3 + i3), this._setMask(t3 + 1, e3 - i3), this._setMask(t3 - i3, e3 - 1), this._setMask(t3 + i3, e3 + 1);
|
|
65
|
+
}, _appendData: function(t3, e3, i3, n3) {
|
|
66
|
+
var s3, r3, a3, o3 = this._polynomial, u3 = this._stringBuffer;
|
|
67
|
+
for (r3 = 0; r3 < n3; r3++) u3[i3 + r3] = 0;
|
|
68
|
+
for (r3 = 0; r3 < e3; r3++) {
|
|
69
|
+
if (255 !== (s3 = g.LOG[u3[t3 + r3] ^ u3[i3]])) for (a3 = 1; a3 < n3; a3++) u3[i3 + a3 - 1] = u3[i3 + a3] ^ g.EXPONENT[v._modN(s3 + o3[n3 - a3])];
|
|
70
|
+
else for (a3 = i3; a3 < i3 + n3; a3++) u3[a3] = u3[a3 + 1];
|
|
71
|
+
u3[i3 + n3 - 1] = 255 === s3 ? 0 : g.EXPONENT[v._modN(s3 + o3[0])];
|
|
72
|
+
}
|
|
73
|
+
}, _appendEccToData: function() {
|
|
74
|
+
var t3, e3 = 0, i3 = this._dataBlock, n3 = this._calculateMaxLength(), s3 = this._eccBlock;
|
|
75
|
+
for (t3 = 0; t3 < this._neccBlock1; t3++) this._appendData(e3, i3, n3, s3), e3 += i3, n3 += s3;
|
|
76
|
+
for (t3 = 0; t3 < this._neccBlock2; t3++) this._appendData(e3, i3 + 1, n3, s3), e3 += i3 + 1, n3 += s3;
|
|
77
|
+
}, _applyMask: function(t3) {
|
|
78
|
+
var e3, i3, n3, s3, r3 = this.buffer, a3 = this.width;
|
|
79
|
+
switch (t3) {
|
|
80
|
+
case 0:
|
|
81
|
+
for (s3 = 0; s3 < a3; s3++) for (n3 = 0; n3 < a3; n3++) n3 + s3 & 1 || this._isMasked(n3, s3) || (r3[n3 + s3 * a3] ^= 1);
|
|
82
|
+
break;
|
|
83
|
+
case 1:
|
|
84
|
+
for (s3 = 0; s3 < a3; s3++) for (n3 = 0; n3 < a3; n3++) 1 & s3 || this._isMasked(n3, s3) || (r3[n3 + s3 * a3] ^= 1);
|
|
85
|
+
break;
|
|
86
|
+
case 2:
|
|
87
|
+
for (s3 = 0; s3 < a3; s3++) for (e3 = 0, n3 = 0; n3 < a3; n3++, e3++) 3 === e3 && (e3 = 0), e3 || this._isMasked(n3, s3) || (r3[n3 + s3 * a3] ^= 1);
|
|
88
|
+
break;
|
|
89
|
+
case 3:
|
|
90
|
+
for (i3 = 0, s3 = 0; s3 < a3; s3++, i3++) for (3 === i3 && (i3 = 0), e3 = i3, n3 = 0; n3 < a3; n3++, e3++) 3 === e3 && (e3 = 0), e3 || this._isMasked(n3, s3) || (r3[n3 + s3 * a3] ^= 1);
|
|
91
|
+
break;
|
|
92
|
+
case 4:
|
|
93
|
+
for (s3 = 0; s3 < a3; s3++) for (e3 = 0, i3 = s3 >> 1 & 1, n3 = 0; n3 < a3; n3++, e3++) 3 === e3 && (e3 = 0, i3 = !i3), i3 || this._isMasked(n3, s3) || (r3[n3 + s3 * a3] ^= 1);
|
|
94
|
+
break;
|
|
95
|
+
case 5:
|
|
96
|
+
for (i3 = 0, s3 = 0; s3 < a3; s3++, i3++) for (3 === i3 && (i3 = 0), e3 = 0, n3 = 0; n3 < a3; n3++, e3++) 3 === e3 && (e3 = 0), (n3 & s3 & 1) + !(!e3 | !i3) || this._isMasked(n3, s3) || (r3[n3 + s3 * a3] ^= 1);
|
|
97
|
+
break;
|
|
98
|
+
case 6:
|
|
99
|
+
for (i3 = 0, s3 = 0; s3 < a3; s3++, i3++) for (3 === i3 && (i3 = 0), e3 = 0, n3 = 0; n3 < a3; n3++, e3++) 3 === e3 && (e3 = 0), (n3 & s3 & 1) + (e3 && e3 === i3) & 1 || this._isMasked(n3, s3) || (r3[n3 + s3 * a3] ^= 1);
|
|
100
|
+
break;
|
|
101
|
+
case 7:
|
|
102
|
+
for (i3 = 0, s3 = 0; s3 < a3; s3++, i3++) for (3 === i3 && (i3 = 0), e3 = 0, n3 = 0; n3 < a3; n3++, e3++) 3 === e3 && (e3 = 0), (e3 && e3 === i3) + (n3 + s3 & 1) & 1 || this._isMasked(n3, s3) || (r3[n3 + s3 * a3] ^= 1);
|
|
103
|
+
}
|
|
104
|
+
}, _calculateMaxLength: function() {
|
|
105
|
+
return this._dataBlock * (this._neccBlock1 + this._neccBlock2) + this._neccBlock2;
|
|
106
|
+
}, _calculatePolynomial: function() {
|
|
107
|
+
var t3, e3, i3 = this._eccBlock, n3 = this._polynomial;
|
|
108
|
+
for (n3[0] = 1, t3 = 0; t3 < i3; t3++) {
|
|
109
|
+
for (n3[t3 + 1] = 1, e3 = t3; e3 > 0; e3--) n3[e3] = n3[e3] ? n3[e3 - 1] ^ g.EXPONENT[v._modN(g.LOG[n3[e3]] + t3)] : n3[e3 - 1];
|
|
110
|
+
n3[0] = g.EXPONENT[v._modN(g.LOG[n3[0]] + t3)];
|
|
111
|
+
}
|
|
112
|
+
for (t3 = 0; t3 <= i3; t3++) n3[t3] = g.LOG[n3[t3]];
|
|
113
|
+
}, _checkBadness: function() {
|
|
114
|
+
var t3, e3, i3, n3, s3, r3 = 0, a3 = this._badness, o3 = this.buffer, u3 = this.width;
|
|
115
|
+
for (s3 = 0; s3 < u3 - 1; s3++) for (n3 = 0; n3 < u3 - 1; n3++) (o3[n3 + u3 * s3] && o3[n3 + 1 + u3 * s3] && o3[n3 + u3 * (s3 + 1)] && o3[n3 + 1 + u3 * (s3 + 1)] || !(o3[n3 + u3 * s3] || o3[n3 + 1 + u3 * s3] || o3[n3 + u3 * (s3 + 1)] || o3[n3 + 1 + u3 * (s3 + 1)])) && (r3 += v.N2);
|
|
116
|
+
var l2 = 0;
|
|
117
|
+
for (s3 = 0; s3 < u3; s3++) {
|
|
118
|
+
for (i3 = 0, a3[0] = 0, t3 = 0, n3 = 0; n3 < u3; n3++) t3 === (e3 = o3[n3 + u3 * s3]) ? a3[i3]++ : a3[++i3] = 1, l2 += (t3 = e3) ? 1 : -1;
|
|
119
|
+
r3 += this._getBadness(i3);
|
|
120
|
+
}
|
|
121
|
+
l2 < 0 && (l2 = -l2);
|
|
122
|
+
var c2 = 0, h2 = l2;
|
|
123
|
+
for (h2 += h2 << 2, h2 <<= 1; h2 > u3 * u3; ) h2 -= u3 * u3, c2++;
|
|
124
|
+
for (r3 += c2 * v.N4, n3 = 0; n3 < u3; n3++) {
|
|
125
|
+
for (i3 = 0, a3[0] = 0, t3 = 0, s3 = 0; s3 < u3; s3++) t3 === (e3 = o3[n3 + u3 * s3]) ? a3[i3]++ : a3[++i3] = 1, t3 = e3;
|
|
126
|
+
r3 += this._getBadness(i3);
|
|
127
|
+
}
|
|
128
|
+
return r3;
|
|
129
|
+
}, _convertBitStream: function(t3) {
|
|
130
|
+
var e3, i3, n3 = this._ecc, s3 = this._version;
|
|
131
|
+
for (i3 = 0; i3 < t3; i3++) n3[i3] = this._value.charCodeAt(i3);
|
|
132
|
+
var r3 = this._stringBuffer = n3.slice(), a3 = this._calculateMaxLength();
|
|
133
|
+
t3 >= a3 - 2 && (t3 = a3 - 2, s3 > 9 && t3--);
|
|
134
|
+
var o3 = t3;
|
|
135
|
+
if (s3 > 9) {
|
|
136
|
+
for (r3[o3 + 2] = 0, r3[o3 + 3] = 0; o3--; ) e3 = r3[o3], r3[o3 + 3] |= 255 & e3 << 4, r3[o3 + 2] = e3 >> 4;
|
|
137
|
+
r3[2] |= 255 & t3 << 4, r3[1] = t3 >> 4, r3[0] = 64 | t3 >> 12;
|
|
138
|
+
} else {
|
|
139
|
+
for (r3[o3 + 1] = 0, r3[o3 + 2] = 0; o3--; ) e3 = r3[o3], r3[o3 + 2] |= 255 & e3 << 4, r3[o3 + 1] = e3 >> 4;
|
|
140
|
+
r3[1] |= 255 & t3 << 4, r3[0] = 64 | t3 >> 4;
|
|
141
|
+
}
|
|
142
|
+
for (o3 = t3 + 3 - (s3 < 10); o3 < a3; ) r3[o3++] = 236, r3[o3++] = 17;
|
|
143
|
+
}, _getBadness: function(t3) {
|
|
144
|
+
var e3, i3 = 0, n3 = this._badness;
|
|
145
|
+
for (e3 = 0; e3 <= t3; e3++) n3[e3] >= 5 && (i3 += v.N1 + n3[e3] - 5);
|
|
146
|
+
for (e3 = 3; e3 < t3 - 1; e3 += 2) n3[e3 - 2] === n3[e3 + 2] && n3[e3 + 2] === n3[e3 - 1] && n3[e3 - 1] === n3[e3 + 1] && 3 * n3[e3 - 1] === n3[e3] && (0 === n3[e3 - 3] || e3 + 3 > t3 || 3 * n3[e3 - 3] >= 4 * n3[e3] || 3 * n3[e3 + 3] >= 4 * n3[e3]) && (i3 += v.N3);
|
|
147
|
+
return i3;
|
|
148
|
+
}, _finish: function() {
|
|
149
|
+
var t3, e3;
|
|
150
|
+
this._stringBuffer = this.buffer.slice();
|
|
151
|
+
var i3 = 0, n3 = 3e4;
|
|
152
|
+
for (e3 = 0; e3 < 8 && (this._applyMask(e3), (t3 = this._checkBadness()) < n3 && (n3 = t3, i3 = e3), 7 !== i3); e3++) this.buffer = this._stringBuffer.slice();
|
|
153
|
+
i3 !== e3 && this._applyMask(i3), n3 = _.FINAL_FORMAT[i3 + (this._level - 1 << 3)];
|
|
154
|
+
var s3 = this.buffer, r3 = this.width;
|
|
155
|
+
for (e3 = 0; e3 < 8; e3++, n3 >>= 1) 1 & n3 && (s3[r3 - 1 - e3 + 8 * r3] = 1, e3 < 6 ? s3[8 + r3 * e3] = 1 : s3[8 + r3 * (e3 + 1)] = 1);
|
|
156
|
+
for (e3 = 0; e3 < 7; e3++, n3 >>= 1) 1 & n3 && (s3[8 + r3 * (r3 - 7 + e3)] = 1, e3 ? s3[6 - e3 + 8 * r3] = 1 : s3[7 + 8 * r3] = 1);
|
|
157
|
+
}, _interleaveBlocks: function() {
|
|
158
|
+
var t3, e3, i3 = this._dataBlock, n3 = this._ecc, s3 = this._eccBlock, r3 = 0, a3 = this._calculateMaxLength(), o3 = this._neccBlock1, u3 = this._neccBlock2, l2 = this._stringBuffer;
|
|
159
|
+
for (t3 = 0; t3 < i3; t3++) {
|
|
160
|
+
for (e3 = 0; e3 < o3; e3++) n3[r3++] = l2[t3 + e3 * i3];
|
|
161
|
+
for (e3 = 0; e3 < u3; e3++) n3[r3++] = l2[o3 * i3 + t3 + e3 * (i3 + 1)];
|
|
162
|
+
}
|
|
163
|
+
for (e3 = 0; e3 < u3; e3++) n3[r3++] = l2[o3 * i3 + t3 + e3 * (i3 + 1)];
|
|
164
|
+
for (t3 = 0; t3 < s3; t3++) for (e3 = 0; e3 < o3 + u3; e3++) n3[r3++] = l2[a3 + t3 + e3 * s3];
|
|
165
|
+
this._stringBuffer = n3;
|
|
166
|
+
}, _insertAlignments: function() {
|
|
167
|
+
var t3, e3, i3, n3 = this._version, s3 = this.width;
|
|
168
|
+
if (n3 > 1) for (t3 = d.BLOCK[n3], i3 = s3 - 7; ; ) {
|
|
169
|
+
for (e3 = s3 - 7; e3 > t3 - 3 && (this._addAlignment(e3, i3), !(e3 < t3)); ) e3 -= t3;
|
|
170
|
+
if (i3 <= t3 + 9) break;
|
|
171
|
+
i3 -= t3, this._addAlignment(6, i3), this._addAlignment(i3, 6);
|
|
172
|
+
}
|
|
173
|
+
}, _insertFinders: function() {
|
|
174
|
+
var t3, e3, i3, n3, s3 = this.buffer, r3 = this.width;
|
|
175
|
+
for (t3 = 0; t3 < 3; t3++) {
|
|
176
|
+
for (e3 = 0, n3 = 0, 1 === t3 && (e3 = r3 - 7), 2 === t3 && (n3 = r3 - 7), s3[n3 + 3 + r3 * (e3 + 3)] = 1, i3 = 0; i3 < 6; i3++) s3[n3 + i3 + r3 * e3] = 1, s3[n3 + r3 * (e3 + i3 + 1)] = 1, s3[n3 + 6 + r3 * (e3 + i3)] = 1, s3[n3 + i3 + 1 + r3 * (e3 + 6)] = 1;
|
|
177
|
+
for (i3 = 1; i3 < 5; i3++) this._setMask(n3 + i3, e3 + 1), this._setMask(n3 + 1, e3 + i3 + 1), this._setMask(n3 + 5, e3 + i3), this._setMask(n3 + i3 + 1, e3 + 5);
|
|
178
|
+
for (i3 = 2; i3 < 4; i3++) s3[n3 + i3 + r3 * (e3 + 2)] = 1, s3[n3 + 2 + r3 * (e3 + i3 + 1)] = 1, s3[n3 + 4 + r3 * (e3 + i3)] = 1, s3[n3 + i3 + 1 + r3 * (e3 + 4)] = 1;
|
|
179
|
+
}
|
|
180
|
+
}, _insertTimingGap: function() {
|
|
181
|
+
var t3, e3, i3 = this.width;
|
|
182
|
+
for (e3 = 0; e3 < 7; e3++) this._setMask(7, e3), this._setMask(i3 - 8, e3), this._setMask(7, e3 + i3 - 7);
|
|
183
|
+
for (t3 = 0; t3 < 8; t3++) this._setMask(t3, 7), this._setMask(t3 + i3 - 8, 7), this._setMask(t3, i3 - 8);
|
|
184
|
+
}, _insertTimingRowAndColumn: function() {
|
|
185
|
+
var t3, e3 = this.buffer, i3 = this.width;
|
|
186
|
+
for (t3 = 0; t3 < i3 - 14; t3++) 1 & t3 ? (this._setMask(8 + t3, 6), this._setMask(6, 8 + t3)) : (e3[8 + t3 + 6 * i3] = 1, e3[6 + i3 * (8 + t3)] = 1);
|
|
187
|
+
}, _insertVersion: function() {
|
|
188
|
+
var t3, e3, i3, n3, s3 = this.buffer, r3 = this._version, a3 = this.width;
|
|
189
|
+
if (r3 > 6) for (t3 = p.BLOCK[r3 - 7], e3 = 17, i3 = 0; i3 < 6; i3++) for (n3 = 0; n3 < 3; n3++, e3--) 1 & (e3 > 11 ? r3 >> e3 - 12 : t3 >> e3) ? (s3[5 - i3 + a3 * (2 - n3 + a3 - 11)] = 1, s3[2 - n3 + a3 - 11 + a3 * (5 - i3)] = 1) : (this._setMask(5 - i3, 2 - n3 + a3 - 11), this._setMask(2 - n3 + a3 - 11, 5 - i3));
|
|
190
|
+
}, _isMasked: function(t3, e3) {
|
|
191
|
+
var i3 = v._getMaskBit(t3, e3);
|
|
192
|
+
return 1 === this._mask[i3];
|
|
193
|
+
}, _pack: function() {
|
|
194
|
+
var t3, e3, i3, n3 = 1, s3 = 1, r3 = this.width, a3 = r3 - 1, o3 = r3 - 1, u3 = (this._dataBlock + this._eccBlock) * (this._neccBlock1 + this._neccBlock2) + this._neccBlock2;
|
|
195
|
+
for (e3 = 0; e3 < u3; e3++) for (t3 = this._stringBuffer[e3], i3 = 0; i3 < 8; i3++, t3 <<= 1) {
|
|
196
|
+
128 & t3 && (this.buffer[a3 + r3 * o3] = 1);
|
|
197
|
+
do {
|
|
198
|
+
s3 ? a3-- : (a3++, n3 ? 0 !== o3 ? o3-- : (n3 = !n3, 6 == (a3 -= 2) && (a3--, o3 = 9)) : o3 !== r3 - 1 ? o3++ : (n3 = !n3, 6 == (a3 -= 2) && (a3--, o3 -= 8))), s3 = !s3;
|
|
199
|
+
} while (this._isMasked(a3, o3));
|
|
200
|
+
}
|
|
201
|
+
}, _reverseMask: function() {
|
|
202
|
+
var t3, e3, i3 = this.width;
|
|
203
|
+
for (t3 = 0; t3 < 9; t3++) this._setMask(t3, 8);
|
|
204
|
+
for (t3 = 0; t3 < 8; t3++) this._setMask(t3 + i3 - 8, 8), this._setMask(8, t3);
|
|
205
|
+
for (e3 = 0; e3 < 7; e3++) this._setMask(8, e3 + i3 - 7);
|
|
206
|
+
}, _setMask: function(t3, e3) {
|
|
207
|
+
var i3 = v._getMaskBit(t3, e3);
|
|
208
|
+
this._mask[i3] = 1;
|
|
209
|
+
}, _syncMask: function() {
|
|
210
|
+
var t3, e3, i3 = this.width;
|
|
211
|
+
for (e3 = 0; e3 < i3; e3++) for (t3 = 0; t3 <= e3; t3++) this.buffer[t3 + i3 * e3] && this._setMask(t3, e3);
|
|
212
|
+
} }, { _createArray: function(t3) {
|
|
213
|
+
var e3, i3 = [];
|
|
214
|
+
for (e3 = 0; e3 < t3; e3++) i3[e3] = 0;
|
|
215
|
+
return i3;
|
|
216
|
+
}, _getMaskBit: function(t3, e3) {
|
|
217
|
+
var i3;
|
|
218
|
+
return t3 > e3 && (i3 = t3, t3 = e3, e3 = i3), i3 = e3, i3 += e3 * e3, i3 >>= 1, i3 += t3;
|
|
219
|
+
}, _modN: function(t3) {
|
|
220
|
+
for (; t3 >= 255; ) t3 = ((t3 -= 255) >> 8) + (255 & t3);
|
|
221
|
+
return t3;
|
|
222
|
+
}, N1: 3, N2: 3, N3: 40, N4: 10 }), m = v, b = c.extend({ draw: function() {
|
|
223
|
+
this.element.src = this.qrious.toDataURL();
|
|
224
|
+
}, reset: function() {
|
|
225
|
+
this.element.src = "";
|
|
226
|
+
}, resize: function() {
|
|
227
|
+
var t3 = this.element;
|
|
228
|
+
t3.width = t3.height = this.qrious.size;
|
|
229
|
+
} }), k = u2.extend(function(t3, e3, i3, n3) {
|
|
230
|
+
this.name = t3, this.modifiable = Boolean(e3), this.defaultValue = i3, this._valueTransformer = n3;
|
|
231
|
+
}, { transform: function(t3) {
|
|
232
|
+
var e3 = this._valueTransformer;
|
|
233
|
+
return "function" == typeof e3 ? e3(t3, this) : t3;
|
|
234
|
+
} }), A = u2.extend(null, { abs: function(t3) {
|
|
235
|
+
return null != t3 ? Math.abs(t3) : null;
|
|
236
|
+
}, hasOwn: function(t3, e3) {
|
|
237
|
+
return Object.prototype.hasOwnProperty.call(t3, e3);
|
|
238
|
+
}, noop: function() {
|
|
239
|
+
}, toUpperCase: function(t3) {
|
|
240
|
+
return null != t3 ? t3.toUpperCase() : null;
|
|
241
|
+
} }), w = u2.extend(function(t3) {
|
|
242
|
+
this.options = {}, t3.forEach(function(t4) {
|
|
243
|
+
this.options[t4.name] = t4;
|
|
244
|
+
}, this);
|
|
245
|
+
}, { exists: function(t3) {
|
|
246
|
+
return null != this.options[t3];
|
|
247
|
+
}, get: function(t3, e3) {
|
|
248
|
+
return w._get(this.options[t3], e3);
|
|
249
|
+
}, getAll: function(t3) {
|
|
250
|
+
var e3, i3 = this.options, n3 = {};
|
|
251
|
+
for (e3 in i3) A.hasOwn(i3, e3) && (n3[e3] = w._get(i3[e3], t3));
|
|
252
|
+
return n3;
|
|
253
|
+
}, init: function(t3, e3, i3) {
|
|
254
|
+
var n3, s3;
|
|
255
|
+
for (n3 in "function" != typeof i3 && (i3 = A.noop), this.options) A.hasOwn(this.options, n3) && (s3 = this.options[n3], w._set(s3, s3.defaultValue, e3), w._createAccessor(s3, e3, i3));
|
|
256
|
+
this._setAll(t3, e3, true);
|
|
257
|
+
}, set: function(t3, e3, i3) {
|
|
258
|
+
return this._set(t3, e3, i3);
|
|
259
|
+
}, setAll: function(t3, e3) {
|
|
260
|
+
return this._setAll(t3, e3);
|
|
261
|
+
}, _set: function(t3, e3, i3, n3) {
|
|
262
|
+
var s3 = this.options[t3];
|
|
263
|
+
if (!s3) throw new Error("Invalid option: " + t3);
|
|
264
|
+
if (!s3.modifiable && !n3) throw new Error("Option cannot be modified: " + t3);
|
|
265
|
+
return w._set(s3, e3, i3);
|
|
266
|
+
}, _setAll: function(t3, e3, i3) {
|
|
267
|
+
if (!t3) return false;
|
|
268
|
+
var n3, s3 = false;
|
|
269
|
+
for (n3 in t3) A.hasOwn(t3, n3) && this._set(n3, t3[n3], e3, i3) && (s3 = true);
|
|
270
|
+
return s3;
|
|
271
|
+
} }, { _createAccessor: function(t3, e3, i3) {
|
|
272
|
+
var n3 = { get: function() {
|
|
273
|
+
return w._get(t3, e3);
|
|
274
|
+
} };
|
|
275
|
+
t3.modifiable && (n3.set = function(n4) {
|
|
276
|
+
w._set(t3, n4, e3) && i3(n4, t3);
|
|
277
|
+
}), Object.defineProperty(e3, t3.name, n3);
|
|
278
|
+
}, _get: function(t3, e3) {
|
|
279
|
+
return e3["_" + t3.name];
|
|
280
|
+
}, _set: function(t3, e3, i3) {
|
|
281
|
+
var n3 = "_" + t3.name, s3 = i3[n3], r3 = t3.transform(null != e3 ? e3 : t3.defaultValue);
|
|
282
|
+
return i3[n3] = r3, r3 !== s3;
|
|
283
|
+
} }), M = w, B = u2.extend(function() {
|
|
284
|
+
this._services = {};
|
|
285
|
+
}, { getService: function(t3) {
|
|
286
|
+
var e3 = this._services[t3];
|
|
287
|
+
if (!e3) throw new Error("Service is not being managed with name: " + t3);
|
|
288
|
+
return e3;
|
|
289
|
+
}, setService: function(t3, e3) {
|
|
290
|
+
if (this._services[t3]) throw new Error("Service is already managed with name: " + t3);
|
|
291
|
+
e3 && (this._services[t3] = e3);
|
|
292
|
+
} }), y = new M([new k("background", true, "white"), new k("backgroundAlpha", true, 1, A.abs), new k("element"), new k("foreground", true, "black"), new k("foregroundAlpha", true, 1, A.abs), new k("level", true, "L", A.toUpperCase), new k("mime", true, "image/png"), new k("padding", true, null, A.abs), new k("size", true, 100, A.abs), new k("value", true, "")]), O = new B(), N = u2.extend(function(t3) {
|
|
293
|
+
y.init(t3, this, this.update.bind(this));
|
|
294
|
+
var e3 = y.get("element", this), i3 = O.getService("element"), n3 = e3 && i3.isCanvas(e3) ? e3 : i3.createCanvas(), s3 = e3 && i3.isImage(e3) ? e3 : i3.createImage();
|
|
295
|
+
this._canvasRenderer = new f(this, n3, true), this._imageRenderer = new b(this, s3, s3 === e3), this.update();
|
|
296
|
+
}, { get: function() {
|
|
297
|
+
return y.getAll(this);
|
|
298
|
+
}, set: function(t3) {
|
|
299
|
+
y.setAll(t3, this) && this.update();
|
|
300
|
+
}, toDataURL: function(t3) {
|
|
301
|
+
return this.canvas.toDataURL(t3 || this.mime);
|
|
302
|
+
}, update: function() {
|
|
303
|
+
var t3 = new m({ level: this.level, value: this.value });
|
|
304
|
+
this._canvasRenderer.render(t3), this._imageRenderer.render(t3);
|
|
305
|
+
} }, { use: function(t3) {
|
|
306
|
+
O.setService(t3.getName(), t3);
|
|
307
|
+
} });
|
|
308
|
+
Object.defineProperties(N.prototype, { canvas: { get: function() {
|
|
309
|
+
return this._canvasRenderer.getElement();
|
|
310
|
+
} }, image: { get: function() {
|
|
311
|
+
return this._imageRenderer.getElement();
|
|
312
|
+
} } });
|
|
313
|
+
var E = N, L = E, x = u2.extend({ getName: function() {
|
|
314
|
+
} }).extend({ createCanvas: function() {
|
|
315
|
+
}, createImage: function() {
|
|
316
|
+
}, getName: function() {
|
|
317
|
+
return "element";
|
|
318
|
+
}, isCanvas: function(t3) {
|
|
319
|
+
}, isImage: function(t3) {
|
|
320
|
+
} }).extend({ createCanvas: function() {
|
|
321
|
+
return document.createElement("canvas");
|
|
322
|
+
}, createImage: function() {
|
|
323
|
+
return document.createElement("img");
|
|
324
|
+
}, isCanvas: function(t3) {
|
|
325
|
+
return t3 instanceof HTMLCanvasElement;
|
|
326
|
+
}, isImage: function(t3) {
|
|
327
|
+
return t3 instanceof HTMLImageElement;
|
|
328
|
+
} });
|
|
329
|
+
return L.use(new x()), L;
|
|
330
|
+
})()), n.exports);
|
|
331
|
+
const r = e(s), a = { value: ["value"], background: ["background"], backgroundAlpha: ["background-alpha", "backgroundalpha", "backgroundAlpha"], foreground: ["foreground"], foregroundAlpha: ["foreground-alpha", "foregroundalpha", "foregroundAlpha"], level: ["level"], padding: ["padding"], size: ["size"] }, o = /* @__PURE__ */ new Set(["backgroundAlpha", "foregroundAlpha", "padding", "size"]);
|
|
332
|
+
class u extends t {
|
|
2819
333
|
constructor() {
|
|
2820
334
|
super();
|
|
2821
|
-
/**
|
|
2822
|
-
* The class name for the component.
|
|
2823
|
-
* @type {string}
|
|
2824
|
-
*/
|
|
2825
335
|
__publicField(this, "className", "QrCode");
|
|
2826
336
|
}
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
* @type {string}
|
|
2830
|
-
*/
|
|
2831
|
-
set value(value) {
|
|
2832
|
-
this.setAliasedAttribute("value", value);
|
|
337
|
+
set value(t2) {
|
|
338
|
+
this.setAliasedAttribute("value", t2);
|
|
2833
339
|
}
|
|
2834
340
|
get value() {
|
|
2835
|
-
return this.getAttributeFromAliases(
|
|
341
|
+
return this.getAttributeFromAliases(a.value) || "empty value";
|
|
2836
342
|
}
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
* @type {string|null}
|
|
2840
|
-
*/
|
|
2841
|
-
set background(value) {
|
|
2842
|
-
this.setAliasedAttribute("background", value);
|
|
343
|
+
set background(t2) {
|
|
344
|
+
this.setAliasedAttribute("background", t2);
|
|
2843
345
|
}
|
|
2844
346
|
get background() {
|
|
2845
|
-
return this.getAttributeFromAliases(
|
|
347
|
+
return this.getAttributeFromAliases(a.background);
|
|
2846
348
|
}
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
* Supports aliases: background-alpha, backgroundalpha, backgroundAlpha.
|
|
2850
|
-
* @type {number|null}
|
|
2851
|
-
*/
|
|
2852
|
-
set backgroundAlpha(value) {
|
|
2853
|
-
this.setAliasedAttribute("backgroundAlpha", value);
|
|
349
|
+
set backgroundAlpha(t2) {
|
|
350
|
+
this.setAliasedAttribute("backgroundAlpha", t2);
|
|
2854
351
|
}
|
|
2855
352
|
get backgroundAlpha() {
|
|
2856
|
-
const
|
|
2857
|
-
if (
|
|
2858
|
-
const
|
|
2859
|
-
return Number.isFinite(
|
|
353
|
+
const t2 = this.getAttributeFromAliases(a.backgroundAlpha);
|
|
354
|
+
if (null === t2) return null;
|
|
355
|
+
const e2 = Number(t2);
|
|
356
|
+
return Number.isFinite(e2) ? e2 : null;
|
|
2860
357
|
}
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
* @type {string|null}
|
|
2864
|
-
*/
|
|
2865
|
-
set foreground(value) {
|
|
2866
|
-
this.setAliasedAttribute("foreground", value);
|
|
358
|
+
set foreground(t2) {
|
|
359
|
+
this.setAliasedAttribute("foreground", t2);
|
|
2867
360
|
}
|
|
2868
361
|
get foreground() {
|
|
2869
|
-
return this.getAttributeFromAliases(
|
|
362
|
+
return this.getAttributeFromAliases(a.foreground);
|
|
2870
363
|
}
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
* Supports aliases: foreground-alpha, foregroundalpha, foregroundAlpha.
|
|
2874
|
-
* @type {number|null}
|
|
2875
|
-
*/
|
|
2876
|
-
set foregroundAlpha(value) {
|
|
2877
|
-
this.setAliasedAttribute("foregroundAlpha", value);
|
|
364
|
+
set foregroundAlpha(t2) {
|
|
365
|
+
this.setAliasedAttribute("foregroundAlpha", t2);
|
|
2878
366
|
}
|
|
2879
367
|
get foregroundAlpha() {
|
|
2880
|
-
const
|
|
2881
|
-
if (
|
|
2882
|
-
const
|
|
2883
|
-
return Number.isFinite(
|
|
368
|
+
const t2 = this.getAttributeFromAliases(a.foregroundAlpha);
|
|
369
|
+
if (null === t2) return null;
|
|
370
|
+
const e2 = Number(t2);
|
|
371
|
+
return Number.isFinite(e2) ? e2 : null;
|
|
2884
372
|
}
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
* @type {string|null}
|
|
2888
|
-
*/
|
|
2889
|
-
set level(value) {
|
|
2890
|
-
if (value === null || value === void 0 || value === "") {
|
|
2891
|
-
this.removeAttribute("level");
|
|
2892
|
-
return;
|
|
2893
|
-
}
|
|
2894
|
-
this.setAttribute("level", String(value).trim().toUpperCase());
|
|
373
|
+
set level(t2) {
|
|
374
|
+
null != t2 && "" !== t2 ? this.setAttribute("level", String(t2).trim().toUpperCase()) : this.removeAttribute("level");
|
|
2895
375
|
}
|
|
2896
376
|
get level() {
|
|
2897
|
-
const
|
|
2898
|
-
return
|
|
377
|
+
const t2 = this.getAttributeFromAliases(a.level);
|
|
378
|
+
return t2 ? String(t2).trim().toUpperCase() : null;
|
|
2899
379
|
}
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
* @type {number|null}
|
|
2903
|
-
*/
|
|
2904
|
-
set padding(value) {
|
|
2905
|
-
this.setAliasedAttribute("padding", value);
|
|
380
|
+
set padding(t2) {
|
|
381
|
+
this.setAliasedAttribute("padding", t2);
|
|
2906
382
|
}
|
|
2907
383
|
get padding() {
|
|
2908
|
-
const
|
|
2909
|
-
if (
|
|
2910
|
-
const
|
|
2911
|
-
return Number.isFinite(
|
|
384
|
+
const t2 = this.getAttributeFromAliases(a.padding);
|
|
385
|
+
if (null === t2) return null;
|
|
386
|
+
const e2 = Number(t2);
|
|
387
|
+
return Number.isFinite(e2) ? e2 : null;
|
|
2912
388
|
}
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
* @type {number|null}
|
|
2916
|
-
*/
|
|
2917
|
-
set size(value) {
|
|
2918
|
-
this.setAliasedAttribute("size", value);
|
|
389
|
+
set size(t2) {
|
|
390
|
+
this.setAliasedAttribute("size", t2);
|
|
2919
391
|
}
|
|
2920
392
|
get size() {
|
|
2921
|
-
const
|
|
2922
|
-
if (
|
|
2923
|
-
const
|
|
2924
|
-
return Number.isFinite(
|
|
393
|
+
const t2 = this.getAttributeFromAliases(a.size);
|
|
394
|
+
if (null === t2) return null;
|
|
395
|
+
const e2 = Number(t2);
|
|
396
|
+
return Number.isFinite(e2) ? e2 : null;
|
|
2925
397
|
}
|
|
2926
|
-
/**
|
|
2927
|
-
* Returns the CSS stylesheet for the component.
|
|
2928
|
-
* @returns {CSSStyleSheet} The CSS stylesheet.
|
|
2929
|
-
*/
|
|
2930
398
|
static get cssStyleSheet() {
|
|
2931
|
-
return
|
|
399
|
+
return ".container{display:flex;flex-direction:column;align-items:center;justify-content:center;position:relative;gap:.5rem;padding:.5rem}";
|
|
2932
400
|
}
|
|
2933
|
-
/**
|
|
2934
|
-
* Sets up the attributes for the component.
|
|
2935
|
-
*/
|
|
2936
401
|
setupAttributes() {
|
|
2937
402
|
this.isShadowRoot = "open";
|
|
2938
403
|
}
|
|
2939
|
-
/**
|
|
2940
|
-
* Returns the list of observed attributes.
|
|
2941
|
-
* @returns {string[]} The list of observed attributes.
|
|
2942
|
-
*/
|
|
2943
404
|
static get observedAttributes() {
|
|
2944
|
-
return Object.values(
|
|
405
|
+
return Object.values(a).flat();
|
|
2945
406
|
}
|
|
2946
|
-
/**
|
|
2947
|
-
* Draws the QR code component.
|
|
2948
|
-
* @returns {DocumentFragment} The document fragment containing the QR code component.
|
|
2949
|
-
*/
|
|
2950
407
|
draw() {
|
|
2951
|
-
let
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
let
|
|
2958
|
-
|
|
2959
|
-
let slotBottom = document.createElement("slot");
|
|
2960
|
-
slotBottom.setAttribute("name", "bottom");
|
|
2961
|
-
wrapper.appendChild(slotTop);
|
|
2962
|
-
wrapper.appendChild(qrCode);
|
|
2963
|
-
wrapper.appendChild(slotBottom);
|
|
2964
|
-
fragment.appendChild(wrapper);
|
|
2965
|
-
return fragment;
|
|
408
|
+
let t2 = document.createDocumentFragment(), e2 = document.createElement("div");
|
|
409
|
+
e2.classList.add("container");
|
|
410
|
+
let i2 = document.createElement("canvas");
|
|
411
|
+
i2.classList.add("qr"), i2.setAttribute("part", "native");
|
|
412
|
+
let n2 = document.createElement("slot");
|
|
413
|
+
n2.setAttribute("name", "top");
|
|
414
|
+
let s2 = document.createElement("slot");
|
|
415
|
+
return s2.setAttribute("name", "bottom"), e2.appendChild(n2), e2.appendChild(i2), e2.appendChild(s2), t2.appendChild(e2), t2;
|
|
2966
416
|
}
|
|
2967
|
-
/**
|
|
2968
|
-
* Called after the component is drawn to generate the QR code.
|
|
2969
|
-
*/
|
|
2970
417
|
afterDraw() {
|
|
2971
|
-
const
|
|
2972
|
-
if (!
|
|
2973
|
-
const
|
|
2974
|
-
Object.entries(
|
|
2975
|
-
const
|
|
2976
|
-
if (
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
qrOptions.level = level;
|
|
418
|
+
const t2 = this.shadowRoot.querySelector("canvas");
|
|
419
|
+
if (!t2) return;
|
|
420
|
+
const e2 = {};
|
|
421
|
+
Object.entries(a).forEach(([t3, i2]) => {
|
|
422
|
+
const n2 = this.getAttributeFromAliases(i2);
|
|
423
|
+
if (null !== n2) {
|
|
424
|
+
if ("level" === t3) {
|
|
425
|
+
const t4 = String(n2).trim().toUpperCase();
|
|
426
|
+
return void (["L", "M", "Q", "H"].includes(t4) && (e2.level = t4));
|
|
2981
427
|
}
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
const numericValue = Number(value);
|
|
2986
|
-
if (Number.isFinite(numericValue)) {
|
|
2987
|
-
qrOptions[optionName] = numericValue;
|
|
428
|
+
if (o.has(t3)) {
|
|
429
|
+
const i3 = Number(n2);
|
|
430
|
+
return void (Number.isFinite(i3) && (e2[t3] = i3));
|
|
2988
431
|
}
|
|
2989
|
-
|
|
432
|
+
e2[t3] = n2;
|
|
2990
433
|
}
|
|
2991
|
-
|
|
2992
|
-
});
|
|
2993
|
-
if (!Object.prototype.hasOwnProperty.call(qrOptions, "value")) {
|
|
2994
|
-
qrOptions.value = "empty value";
|
|
2995
|
-
}
|
|
2996
|
-
this.qr = new QRious({
|
|
2997
|
-
element: canvas,
|
|
2998
|
-
...qrOptions
|
|
2999
|
-
});
|
|
434
|
+
}), Object.prototype.hasOwnProperty.call(e2, "value") || (e2.value = "empty value"), this.qr = new r({ element: t2, ...e2 });
|
|
3000
435
|
}
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
*/
|
|
3006
|
-
getAttributeFromAliases(aliases = []) {
|
|
3007
|
-
for (const alias of aliases) {
|
|
3008
|
-
const value = this.getAttribute(alias);
|
|
3009
|
-
if (value !== null) return value;
|
|
436
|
+
getAttributeFromAliases(t2 = []) {
|
|
437
|
+
for (const e2 of t2) {
|
|
438
|
+
const t3 = this.getAttribute(e2);
|
|
439
|
+
if (null !== t3) return t3;
|
|
3010
440
|
}
|
|
3011
441
|
return null;
|
|
3012
442
|
}
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
* @param {string|number|null|undefined} value
|
|
3017
|
-
*/
|
|
3018
|
-
setAliasedAttribute(optionName, value) {
|
|
3019
|
-
const aliases = QR_ATTRIBUTE_ALIASES[optionName] || [];
|
|
3020
|
-
const [primaryAlias, ...secondaryAliases] = aliases;
|
|
3021
|
-
secondaryAliases.forEach((alias) => this.removeAttribute(alias));
|
|
3022
|
-
if (!primaryAlias) return;
|
|
3023
|
-
if (value === null || value === void 0 || value === "") {
|
|
3024
|
-
this.removeAttribute(primaryAlias);
|
|
3025
|
-
return;
|
|
3026
|
-
}
|
|
3027
|
-
this.setAttribute(primaryAlias, String(value));
|
|
443
|
+
setAliasedAttribute(t2, e2) {
|
|
444
|
+
const i2 = a[t2] || [], [n2, ...s2] = i2;
|
|
445
|
+
s2.forEach((t3) => this.removeAttribute(t3)), n2 && (null != e2 && "" !== e2 ? this.setAttribute(n2, String(e2)) : this.removeAttribute(n2));
|
|
3028
446
|
}
|
|
3029
447
|
}
|
|
3030
|
-
|
|
448
|
+
u.define("wje-qr-code", u);
|
|
3031
449
|
export {
|
|
3032
|
-
|
|
450
|
+
u as default
|
|
3033
451
|
};
|
|
3034
452
|
//# sourceMappingURL=wje-qr-code.js.map
|