persagy-vant 0.0.53 → 0.0.55
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/es/action-sheet/ActionSheet.d.ts +3 -0
- package/es/action-sheet/ActionSheet.mjs +5 -1
- package/es/action-sheet/index.css +1 -1
- package/es/action-sheet/index.d.ts +2 -0
- package/es/action-sheet/var.less +1 -1
- package/es/calendar/Calendar.mjs +1 -0
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/locale/lang/en-US.d.ts +9 -0
- package/es/locale/lang/en-US.mjs +9 -0
- package/es/locale/lang/zh-CN.d.ts +9 -0
- package/es/locale/lang/zh-CN.mjs +9 -0
- package/es/locale/lang/zh-TW.d.ts +9 -0
- package/es/locale/lang/zh-TW.mjs +9 -0
- package/es/qr-scanner/QrScanner.d.ts +18 -1
- package/es/qr-scanner/QrScanner.mjs +141 -18
- package/es/qr-scanner/decoder.d.ts +3 -3
- package/es/qr-scanner/decoder.mjs +99 -27
- package/es/qr-scanner/function-call.d.ts +13 -1
- package/es/qr-scanner/function-call.mjs +5 -0
- package/es/qr-scanner/index.d.ts +1 -1
- package/es/qr-scanner/startup.d.ts +3 -0
- package/es/qr-scanner/startup.mjs +33 -0
- package/es/qr-scanner/types.d.ts +16 -1
- package/lib/action-sheet/ActionSheet.d.ts +3 -0
- package/lib/action-sheet/ActionSheet.js +4 -0
- package/lib/action-sheet/index.css +1 -1
- package/lib/action-sheet/index.d.ts +2 -0
- package/lib/action-sheet/var.less +1 -1
- package/lib/calendar/Calendar.js +1 -0
- package/lib/{decoder-8f5b00db.js → decoder-51de19c7.js} +112 -34
- package/lib/{decoder-a36ba9ae.mjs → decoder-6b11aad7.mjs} +112 -34
- package/lib/index-491e7ee3.js +22972 -0
- package/lib/index-4a9f05ad.mjs +22973 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/locale/lang/en-US.d.ts +9 -0
- package/lib/locale/lang/en-US.js +9 -0
- package/lib/locale/lang/zh-CN.d.ts +9 -0
- package/lib/locale/lang/zh-CN.js +9 -0
- package/lib/locale/lang/zh-TW.d.ts +9 -0
- package/lib/locale/lang/zh-TW.js +9 -0
- package/lib/qr-scanner/QrScanner.d.ts +18 -1
- package/lib/qr-scanner/QrScanner.js +141 -18
- package/lib/qr-scanner/decoder.d.ts +3 -3
- package/lib/qr-scanner/decoder.js +94 -26
- package/lib/qr-scanner/function-call.d.ts +13 -1
- package/lib/qr-scanner/function-call.js +5 -0
- package/lib/qr-scanner/index.d.ts +1 -1
- package/lib/qr-scanner/startup.d.ts +3 -0
- package/lib/qr-scanner/startup.js +52 -0
- package/lib/qr-scanner/types.d.ts +16 -1
- package/lib/vant.cjs.js +131 -22802
- package/lib/vant.es.js +131 -22802
- package/lib/vant.js +377 -137
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +1 -1
package/lib/vant.js
CHANGED
|
@@ -662,6 +662,15 @@
|
|
|
662
662
|
takePhoto: "拍照",
|
|
663
663
|
recordVideo: "拍视频",
|
|
664
664
|
chooseFromAlbum: "从相册选择"
|
|
665
|
+
},
|
|
666
|
+
vanQrScanner: {
|
|
667
|
+
startupCamera: "正在请求相机权限并打开摄像头...",
|
|
668
|
+
startupPreview: "正在启动相机画面...",
|
|
669
|
+
startupDecoder: "正在准备扫码识别...",
|
|
670
|
+
timeoutCamera: "摄像头启动超时,请检查系统和浏览器相机授权,也可以从相册识别",
|
|
671
|
+
timeoutPreview: "相机画面启动超时,请重试或从相册识别",
|
|
672
|
+
timeoutDecoder: "扫码识别准备超时,请检查网络或扫码资源部署后重试",
|
|
673
|
+
previewFailed: "相机画面启动失败,请重试或从相册识别"
|
|
665
674
|
}
|
|
666
675
|
};
|
|
667
676
|
const lang = vue.ref("zh-CN");
|
|
@@ -3042,6 +3051,7 @@
|
|
|
3042
3051
|
cancelText: String,
|
|
3043
3052
|
description: String,
|
|
3044
3053
|
contentAdaptive: Boolean,
|
|
3054
|
+
maxHeight: numericProp,
|
|
3045
3055
|
closeOnPopstate: truthProp,
|
|
3046
3056
|
closeOnClickAction: Boolean,
|
|
3047
3057
|
safeAreaInsetBottom: truthProp
|
|
@@ -3153,6 +3163,9 @@
|
|
|
3153
3163
|
"class": bem$1J({
|
|
3154
3164
|
"content-adaptive": props2.contentAdaptive
|
|
3155
3165
|
}),
|
|
3166
|
+
"style": props2.maxHeight !== void 0 ? {
|
|
3167
|
+
"--van-action-sheet-max-height": addUnit(props2.maxHeight)
|
|
3168
|
+
} : void 0,
|
|
3156
3169
|
"position": "bottom",
|
|
3157
3170
|
"onUpdate:show": updateShow
|
|
3158
3171
|
}, pick(props2, popupInheritKeys$2)), {
|
|
@@ -3432,7 +3445,7 @@
|
|
|
3432
3445
|
}, [renderOptions()])]);
|
|
3433
3446
|
}
|
|
3434
3447
|
});
|
|
3435
|
-
const [name$1L, bem$1H, t$
|
|
3448
|
+
const [name$1L, bem$1H, t$m] = createNamespace("picker");
|
|
3436
3449
|
const pickerSharedProps = {
|
|
3437
3450
|
title: String,
|
|
3438
3451
|
loading: Boolean,
|
|
@@ -3638,7 +3651,7 @@
|
|
|
3638
3651
|
}
|
|
3639
3652
|
};
|
|
3640
3653
|
const renderCancel = () => {
|
|
3641
|
-
const text = props2.cancelButtonText || t$
|
|
3654
|
+
const text = props2.cancelButtonText || t$m("cancel");
|
|
3642
3655
|
return vue.createVNode("button", {
|
|
3643
3656
|
"type": "button",
|
|
3644
3657
|
"class": [bem$1H("cancel"), HAPTICS_FEEDBACK],
|
|
@@ -3646,7 +3659,7 @@
|
|
|
3646
3659
|
}, [slots.cancel ? slots.cancel() : text]);
|
|
3647
3660
|
};
|
|
3648
3661
|
const renderConfirm = () => {
|
|
3649
|
-
const text = props2.confirmButtonText || t$
|
|
3662
|
+
const text = props2.confirmButtonText || t$m("confirm");
|
|
3650
3663
|
return vue.createVNode("button", {
|
|
3651
3664
|
"type": "button",
|
|
3652
3665
|
"class": [bem$1H("confirm"), HAPTICS_FEEDBACK],
|
|
@@ -6144,7 +6157,7 @@
|
|
|
6144
6157
|
});
|
|
6145
6158
|
const Switch = withInstall(stdin_default$1J);
|
|
6146
6159
|
const [name$1z, bem$1v] = createNamespace("address-edit-detail");
|
|
6147
|
-
const t$
|
|
6160
|
+
const t$l = createNamespace("address-edit")[2];
|
|
6148
6161
|
var stdin_default$1I = vue.defineComponent({
|
|
6149
6162
|
name: name$1z,
|
|
6150
6163
|
props: {
|
|
@@ -6207,11 +6220,11 @@
|
|
|
6207
6220
|
"rows": props2.rows,
|
|
6208
6221
|
"type": "textarea",
|
|
6209
6222
|
"rules": props2.rules,
|
|
6210
|
-
"label": t$
|
|
6223
|
+
"label": t$l("addressDetail"),
|
|
6211
6224
|
"border": !showSearchResult(),
|
|
6212
6225
|
"maxlength": props2.maxlength,
|
|
6213
6226
|
"modelValue": props2.value,
|
|
6214
|
-
"placeholder": t$
|
|
6227
|
+
"placeholder": t$l("addressDetail"),
|
|
6215
6228
|
"onBlur": onBlur,
|
|
6216
6229
|
"onFocus": onFocus,
|
|
6217
6230
|
"onUpdate:modelValue": onInput
|
|
@@ -6220,7 +6233,7 @@
|
|
|
6220
6233
|
};
|
|
6221
6234
|
}
|
|
6222
6235
|
});
|
|
6223
|
-
const [name$1y, bem$1u, t$
|
|
6236
|
+
const [name$1y, bem$1u, t$k] = createNamespace("address-edit");
|
|
6224
6237
|
const DEFAULT_DATA = {
|
|
6225
6238
|
name: "",
|
|
6226
6239
|
tel: "",
|
|
@@ -6334,16 +6347,16 @@
|
|
|
6334
6347
|
}
|
|
6335
6348
|
});
|
|
6336
6349
|
return {
|
|
6337
|
-
name: [makeRule("name", t$
|
|
6338
|
-
tel: [makeRule("tel", t$
|
|
6350
|
+
name: [makeRule("name", t$k("nameEmpty"))],
|
|
6351
|
+
tel: [makeRule("tel", t$k("telInvalid")), {
|
|
6339
6352
|
validator: telValidator,
|
|
6340
|
-
message: t$
|
|
6353
|
+
message: t$k("telInvalid")
|
|
6341
6354
|
}],
|
|
6342
|
-
areaCode: [makeRule("areaCode", t$
|
|
6343
|
-
addressDetail: [makeRule("addressDetail", t$
|
|
6344
|
-
postalCode: [makeRule("addressDetail", t$
|
|
6355
|
+
areaCode: [makeRule("areaCode", t$k("areaEmpty"))],
|
|
6356
|
+
addressDetail: [makeRule("addressDetail", t$k("addressEmpty"))],
|
|
6357
|
+
postalCode: [makeRule("addressDetail", t$k("postalEmpty")), {
|
|
6345
6358
|
validator: postalValidator,
|
|
6346
|
-
message: t$
|
|
6359
|
+
message: t$k("postalEmpty")
|
|
6347
6360
|
}]
|
|
6348
6361
|
};
|
|
6349
6362
|
});
|
|
@@ -6355,7 +6368,7 @@
|
|
|
6355
6368
|
const onAreaConfirm = (values) => {
|
|
6356
6369
|
values = values.filter(Boolean);
|
|
6357
6370
|
if (values.some((value) => !value.code)) {
|
|
6358
|
-
Toast(t$
|
|
6371
|
+
Toast(t$k("areaEmpty"));
|
|
6359
6372
|
} else {
|
|
6360
6373
|
showAreaPopup.value = false;
|
|
6361
6374
|
assignAreaValues();
|
|
@@ -6393,7 +6406,7 @@
|
|
|
6393
6406
|
};
|
|
6394
6407
|
return vue.withDirectives(vue.createVNode(Cell, {
|
|
6395
6408
|
"center": true,
|
|
6396
|
-
"title": t$
|
|
6409
|
+
"title": t$k("defaultAddress"),
|
|
6397
6410
|
"class": bem$1u("default")
|
|
6398
6411
|
}, slots2), [[vue.vShow, !hideBottomFields.value]]);
|
|
6399
6412
|
}
|
|
@@ -6427,27 +6440,27 @@
|
|
|
6427
6440
|
"modelValue": data.name,
|
|
6428
6441
|
"onUpdate:modelValue": ($event) => data.name = $event,
|
|
6429
6442
|
"clearable": true,
|
|
6430
|
-
"label": t$
|
|
6443
|
+
"label": t$k("name"),
|
|
6431
6444
|
"rules": rules.value.name,
|
|
6432
|
-
"placeholder": t$
|
|
6445
|
+
"placeholder": t$k("name"),
|
|
6433
6446
|
"onFocus": () => onFocus("name")
|
|
6434
6447
|
}, null), vue.createVNode(Field, {
|
|
6435
6448
|
"modelValue": data.tel,
|
|
6436
6449
|
"onUpdate:modelValue": ($event) => data.tel = $event,
|
|
6437
6450
|
"clearable": true,
|
|
6438
6451
|
"type": "tel",
|
|
6439
|
-
"label": t$
|
|
6452
|
+
"label": t$k("tel"),
|
|
6440
6453
|
"rules": rules.value.tel,
|
|
6441
6454
|
"maxlength": props2.telMaxlength,
|
|
6442
|
-
"placeholder": t$
|
|
6455
|
+
"placeholder": t$k("tel"),
|
|
6443
6456
|
"onFocus": () => onFocus("tel")
|
|
6444
6457
|
}, null), vue.withDirectives(vue.createVNode(Field, {
|
|
6445
6458
|
"readonly": true,
|
|
6446
|
-
"label": t$
|
|
6459
|
+
"label": t$k("area"),
|
|
6447
6460
|
"is-link": !disableArea,
|
|
6448
6461
|
"modelValue": areaText.value,
|
|
6449
6462
|
"rules": rules.value.areaCode,
|
|
6450
|
-
"placeholder": props2.areaPlaceholder || t$
|
|
6463
|
+
"placeholder": props2.areaPlaceholder || t$k("area"),
|
|
6451
6464
|
"onFocus": () => onFocus("areaCode"),
|
|
6452
6465
|
"onClick": () => {
|
|
6453
6466
|
emit("click-area");
|
|
@@ -6471,9 +6484,9 @@
|
|
|
6471
6484
|
"onUpdate:modelValue": ($event) => data.postalCode = $event,
|
|
6472
6485
|
"type": "tel",
|
|
6473
6486
|
"rules": rules.value.postalCode,
|
|
6474
|
-
"label": t$
|
|
6487
|
+
"label": t$k("postal"),
|
|
6475
6488
|
"maxlength": "6",
|
|
6476
|
-
"placeholder": t$
|
|
6489
|
+
"placeholder": t$k("postal"),
|
|
6477
6490
|
"onFocus": () => onFocus("postalCode")
|
|
6478
6491
|
}, null), [[vue.vShow, !hideBottomFields.value]]), (_a = slots.default) == null ? void 0 : _a.call(slots)]), renderSetDefaultCell(), vue.withDirectives(vue.createVNode("div", {
|
|
6479
6492
|
"class": bem$1u("buttons")
|
|
@@ -6481,7 +6494,7 @@
|
|
|
6481
6494
|
"block": true,
|
|
6482
6495
|
"round": true,
|
|
6483
6496
|
"type": "primary",
|
|
6484
|
-
"text": props2.saveButtonText || t$
|
|
6497
|
+
"text": props2.saveButtonText || t$k("save"),
|
|
6485
6498
|
"class": bem$1u("button"),
|
|
6486
6499
|
"loading": props2.isSaving,
|
|
6487
6500
|
"nativeType": "submit"
|
|
@@ -6490,7 +6503,7 @@
|
|
|
6490
6503
|
"round": true,
|
|
6491
6504
|
"class": bem$1u("button"),
|
|
6492
6505
|
"loading": props2.isDeleting,
|
|
6493
|
-
"text": props2.deleteButtonText || t$
|
|
6506
|
+
"text": props2.deleteButtonText || t$k("delete"),
|
|
6494
6507
|
"onClick": onDelete
|
|
6495
6508
|
}, null)]), [[vue.vShow, !hideBottomFields.value]]), vue.createVNode(Popup, {
|
|
6496
6509
|
"show": showAreaPopup.value,
|
|
@@ -6605,7 +6618,7 @@
|
|
|
6605
6618
|
};
|
|
6606
6619
|
}
|
|
6607
6620
|
});
|
|
6608
|
-
const [name$1w, bem$1s, t$
|
|
6621
|
+
const [name$1w, bem$1s, t$j] = createNamespace("address-list");
|
|
6609
6622
|
const addressListProps = {
|
|
6610
6623
|
list: makeArrayProp(),
|
|
6611
6624
|
modelValue: numericProp,
|
|
@@ -6657,7 +6670,7 @@
|
|
|
6657
6670
|
"round": true,
|
|
6658
6671
|
"block": true,
|
|
6659
6672
|
"type": "primary",
|
|
6660
|
-
"text": props2.addButtonText || t$
|
|
6673
|
+
"text": props2.addButtonText || t$j("add"),
|
|
6661
6674
|
"class": bem$1s("add"),
|
|
6662
6675
|
"onClick": () => emit("add")
|
|
6663
6676
|
}, null)]);
|
|
@@ -7091,8 +7104,8 @@
|
|
|
7091
7104
|
}
|
|
7092
7105
|
});
|
|
7093
7106
|
const BottomActionBar = withInstall(stdin_default$1z);
|
|
7094
|
-
const [name$1p, bem$1l, t$
|
|
7095
|
-
const formatMonthTitle = (date) => t$
|
|
7107
|
+
const [name$1p, bem$1l, t$i] = createNamespace("calendar");
|
|
7108
|
+
const formatMonthTitle = (date) => t$i("monthTitle", date.getFullYear(), date.getMonth() + 1);
|
|
7096
7109
|
function compareMonth(date1, date2) {
|
|
7097
7110
|
const year1 = date1.getFullYear();
|
|
7098
7111
|
const year2 = date2.getFullYear();
|
|
@@ -7435,10 +7448,10 @@
|
|
|
7435
7448
|
const getBottomInfo = (dayType) => {
|
|
7436
7449
|
if (props2.type === "range") {
|
|
7437
7450
|
if (dayType === "start" || dayType === "end") {
|
|
7438
|
-
return t$
|
|
7451
|
+
return t$i(dayType);
|
|
7439
7452
|
}
|
|
7440
7453
|
if (dayType === "start-end") {
|
|
7441
|
-
return `${t$
|
|
7454
|
+
return `${t$i("start")}/${t$i("end")}`;
|
|
7442
7455
|
}
|
|
7443
7456
|
}
|
|
7444
7457
|
};
|
|
@@ -7535,7 +7548,7 @@
|
|
|
7535
7548
|
}) {
|
|
7536
7549
|
const renderTitle = () => {
|
|
7537
7550
|
if (props2.showTitle) {
|
|
7538
|
-
const text = props2.title || t$
|
|
7551
|
+
const text = props2.title || t$i("title");
|
|
7539
7552
|
const title = slots.title ? slots.title() : text;
|
|
7540
7553
|
return vue.createVNode("div", {
|
|
7541
7554
|
"class": bem$1l("header-title")
|
|
@@ -7556,7 +7569,7 @@
|
|
|
7556
7569
|
const {
|
|
7557
7570
|
firstDayOfWeek
|
|
7558
7571
|
} = props2;
|
|
7559
|
-
const weekdays = t$
|
|
7572
|
+
const weekdays = t$i("weekdays");
|
|
7560
7573
|
const renderWeekDays2 = [...weekdays.slice(firstDayOfWeek, 7), ...weekdays.slice(0, firstDayOfWeek)];
|
|
7561
7574
|
return vue.createVNode("div", {
|
|
7562
7575
|
"class": bem$1l("weekdays")
|
|
@@ -7777,7 +7790,7 @@
|
|
|
7777
7790
|
} = props2;
|
|
7778
7791
|
if (maxRange && calcDateNum(date) > maxRange) {
|
|
7779
7792
|
if (showRangePrompt) {
|
|
7780
|
-
Toast(rangePrompt || t$
|
|
7793
|
+
Toast(rangePrompt || t$i("rangePrompt", maxRange));
|
|
7781
7794
|
}
|
|
7782
7795
|
emit("over-range");
|
|
7783
7796
|
return false;
|
|
@@ -7863,7 +7876,7 @@
|
|
|
7863
7876
|
const [unselectedDate] = dates.splice(selectedIndex, 1);
|
|
7864
7877
|
emit("unselect", cloneDate(unselectedDate));
|
|
7865
7878
|
} else if (props2.maxRange && dates.length >= props2.maxRange) {
|
|
7866
|
-
Toast(props2.rangePrompt || t$
|
|
7879
|
+
Toast(props2.rangePrompt || t$i("rangePrompt", props2.maxRange));
|
|
7867
7880
|
} else {
|
|
7868
7881
|
select([...dates, date]);
|
|
7869
7882
|
}
|
|
@@ -7904,7 +7917,7 @@
|
|
|
7904
7917
|
}, {
|
|
7905
7918
|
default: () => [slot ? slot({
|
|
7906
7919
|
disabled
|
|
7907
|
-
}) : text || t$
|
|
7920
|
+
}) : text || t$i("confirm")]
|
|
7908
7921
|
});
|
|
7909
7922
|
}
|
|
7910
7923
|
};
|
|
@@ -7947,6 +7960,7 @@
|
|
|
7947
7960
|
"round": props2.round,
|
|
7948
7961
|
"position": props2.position,
|
|
7949
7962
|
"closeable": props2.showTitle || props2.showSubtitle,
|
|
7963
|
+
"closeIconPosition": "top-left",
|
|
7950
7964
|
"teleport": props2.teleport,
|
|
7951
7965
|
"closeOnPopstate": props2.closeOnPopstate,
|
|
7952
7966
|
"safeAreaInsetTop": props2.safeAreaInsetTop,
|
|
@@ -8915,7 +8929,7 @@
|
|
|
8915
8929
|
return a;
|
|
8916
8930
|
};
|
|
8917
8931
|
var __spreadProps = (a, b2) => __defProps(a, __getOwnPropDescs(b2));
|
|
8918
|
-
const [name$1f, bem$1e, t$
|
|
8932
|
+
const [name$1f, bem$1e, t$h] = createNamespace("tabs");
|
|
8919
8933
|
const tabsProps = {
|
|
8920
8934
|
type: makeStringProp("line"),
|
|
8921
8935
|
color: String,
|
|
@@ -9221,7 +9235,7 @@
|
|
|
9221
9235
|
"name": "ellipsis"
|
|
9222
9236
|
}, null)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots), props2.more && vue.createVNode(ActionSheet, {
|
|
9223
9237
|
"show": props2.showMore,
|
|
9224
|
-
"title": props2.moreTitle || t$
|
|
9238
|
+
"title": props2.moreTitle || t$h("moreTitle"),
|
|
9225
9239
|
"actions": moreActions.value,
|
|
9226
9240
|
"class": bem$1e("more-panel"),
|
|
9227
9241
|
"closeOnClickAction": true,
|
|
@@ -9497,7 +9511,7 @@
|
|
|
9497
9511
|
});
|
|
9498
9512
|
const Tab = withInstall(stdin_default$1m);
|
|
9499
9513
|
const Tabs = withInstall(stdin_default$1o);
|
|
9500
|
-
const [name$1c, bem$1b, t$
|
|
9514
|
+
const [name$1c, bem$1b, t$g] = createNamespace("cascader");
|
|
9501
9515
|
const cascaderProps = {
|
|
9502
9516
|
title: String,
|
|
9503
9517
|
options: makeArrayProp(),
|
|
@@ -9664,7 +9678,7 @@
|
|
|
9664
9678
|
options,
|
|
9665
9679
|
selected
|
|
9666
9680
|
} = tab;
|
|
9667
|
-
const placeholder = props2.placeholder || t$
|
|
9681
|
+
const placeholder = props2.placeholder || t$g("select");
|
|
9668
9682
|
const title = selected ? selected[textKey] : placeholder;
|
|
9669
9683
|
return vue.createVNode(Tab, {
|
|
9670
9684
|
"title": title,
|
|
@@ -9806,7 +9820,7 @@
|
|
|
9806
9820
|
}
|
|
9807
9821
|
});
|
|
9808
9822
|
const Empty = withInstall(stdin_default$1j);
|
|
9809
|
-
const [name$19, bem$18, t$
|
|
9823
|
+
const [name$19, bem$18, t$f] = createNamespace("list");
|
|
9810
9824
|
const listProps = {
|
|
9811
9825
|
error: Boolean,
|
|
9812
9826
|
offset: makeNumericProp(300),
|
|
@@ -9893,7 +9907,7 @@
|
|
|
9893
9907
|
}, [slots.loading ? slots.loading() : vue.createVNode(Loading, {
|
|
9894
9908
|
"class": bem$18("loading-icon")
|
|
9895
9909
|
}, {
|
|
9896
|
-
default: () => [props2.loadingText || t$
|
|
9910
|
+
default: () => [props2.loadingText || t$f("loading")]
|
|
9897
9911
|
})]);
|
|
9898
9912
|
}
|
|
9899
9913
|
};
|
|
@@ -9937,7 +9951,7 @@
|
|
|
9937
9951
|
}
|
|
9938
9952
|
});
|
|
9939
9953
|
const List = withInstall(stdin_default$1i);
|
|
9940
|
-
const [name$18, bem$17, t$
|
|
9954
|
+
const [name$18, bem$17, t$e] = createNamespace("search");
|
|
9941
9955
|
const searchProps = extend$1({}, fieldSharedProps, {
|
|
9942
9956
|
label: String,
|
|
9943
9957
|
shape: makeStringProp("round"),
|
|
@@ -9984,7 +9998,7 @@
|
|
|
9984
9998
|
};
|
|
9985
9999
|
const renderAction = () => {
|
|
9986
10000
|
if (props2.showAction) {
|
|
9987
|
-
const text = props2.actionText || t$
|
|
10001
|
+
const text = props2.actionText || t$e("cancel");
|
|
9988
10002
|
return vue.createVNode("div", {
|
|
9989
10003
|
"class": bem$17("action"),
|
|
9990
10004
|
"role": "button",
|
|
@@ -10776,7 +10790,7 @@
|
|
|
10776
10790
|
});
|
|
10777
10791
|
const CollapseItem = withInstall(stdin_default$1b);
|
|
10778
10792
|
const ConfigProvider = withInstall(stdin_default$26);
|
|
10779
|
-
const [name$11, bem$10, t$
|
|
10793
|
+
const [name$11, bem$10, t$d] = createNamespace("contact-card");
|
|
10780
10794
|
const contactCardProps = {
|
|
10781
10795
|
tel: String,
|
|
10782
10796
|
name: String,
|
|
@@ -10798,9 +10812,9 @@
|
|
|
10798
10812
|
};
|
|
10799
10813
|
const renderContent = () => {
|
|
10800
10814
|
if (props2.type === "add") {
|
|
10801
|
-
return props2.addText || t$
|
|
10815
|
+
return props2.addText || t$d("addContact");
|
|
10802
10816
|
}
|
|
10803
|
-
return [vue.createVNode("div", null, [`${t$
|
|
10817
|
+
return [vue.createVNode("div", null, [`${t$d("name")}:${props2.name}`]), vue.createVNode("div", null, [`${t$d("tel")}:${props2.tel}`])];
|
|
10804
10818
|
};
|
|
10805
10819
|
return () => vue.createVNode(Cell, {
|
|
10806
10820
|
"center": true,
|
|
@@ -10816,7 +10830,7 @@
|
|
|
10816
10830
|
}
|
|
10817
10831
|
});
|
|
10818
10832
|
const ContactCard = withInstall(stdin_default$1a);
|
|
10819
|
-
const [name$10, bem$$, t$
|
|
10833
|
+
const [name$10, bem$$, t$c] = createNamespace("contact-edit");
|
|
10820
10834
|
const DEFAULT_CONTACT = {
|
|
10821
10835
|
tel: "",
|
|
10822
10836
|
name: ""
|
|
@@ -10856,14 +10870,14 @@
|
|
|
10856
10870
|
"block": true,
|
|
10857
10871
|
"round": true,
|
|
10858
10872
|
"type": "primary",
|
|
10859
|
-
"text": t$
|
|
10873
|
+
"text": t$c("save"),
|
|
10860
10874
|
"class": bem$$("button"),
|
|
10861
10875
|
"loading": props2.isSaving,
|
|
10862
10876
|
"nativeType": "submit"
|
|
10863
10877
|
}, null), props2.isEdit && vue.createVNode(Button, {
|
|
10864
10878
|
"block": true,
|
|
10865
10879
|
"round": true,
|
|
10866
|
-
"text": t$
|
|
10880
|
+
"text": t$c("delete"),
|
|
10867
10881
|
"class": bem$$("button"),
|
|
10868
10882
|
"loading": props2.isDeleting,
|
|
10869
10883
|
"onClick": onDelete
|
|
@@ -10896,30 +10910,30 @@
|
|
|
10896
10910
|
"modelValue": contact.name,
|
|
10897
10911
|
"onUpdate:modelValue": ($event) => contact.name = $event,
|
|
10898
10912
|
"clearable": true,
|
|
10899
|
-
"label": t$
|
|
10913
|
+
"label": t$c("name"),
|
|
10900
10914
|
"rules": [{
|
|
10901
10915
|
required: true,
|
|
10902
|
-
message: t$
|
|
10916
|
+
message: t$c("nameEmpty")
|
|
10903
10917
|
}],
|
|
10904
10918
|
"maxlength": "30",
|
|
10905
|
-
"placeholder": t$
|
|
10919
|
+
"placeholder": t$c("name")
|
|
10906
10920
|
}, null), vue.createVNode(Field, {
|
|
10907
10921
|
"modelValue": contact.tel,
|
|
10908
10922
|
"onUpdate:modelValue": ($event) => contact.tel = $event,
|
|
10909
10923
|
"clearable": true,
|
|
10910
10924
|
"type": "tel",
|
|
10911
|
-
"label": t$
|
|
10925
|
+
"label": t$c("tel"),
|
|
10912
10926
|
"rules": [{
|
|
10913
10927
|
validator: props2.telValidator,
|
|
10914
|
-
message: t$
|
|
10928
|
+
message: t$c("telInvalid")
|
|
10915
10929
|
}],
|
|
10916
|
-
"placeholder": t$
|
|
10930
|
+
"placeholder": t$c("tel")
|
|
10917
10931
|
}, null)]), renderSetDefault(), renderButtons()]
|
|
10918
10932
|
});
|
|
10919
10933
|
}
|
|
10920
10934
|
});
|
|
10921
10935
|
const ContactEdit = withInstall(stdin_default$19);
|
|
10922
|
-
const [name$$, bem$_, t$
|
|
10936
|
+
const [name$$, bem$_, t$b] = createNamespace("contact-list");
|
|
10923
10937
|
const contactListProps = {
|
|
10924
10938
|
list: Array,
|
|
10925
10939
|
addText: String,
|
|
@@ -10991,7 +11005,7 @@
|
|
|
10991
11005
|
"block": true,
|
|
10992
11006
|
"type": "primary",
|
|
10993
11007
|
"class": bem$_("add"),
|
|
10994
|
-
"text": props2.addText || t$
|
|
11008
|
+
"text": props2.addText || t$b("addContact"),
|
|
10995
11009
|
"onClick": () => emit("add")
|
|
10996
11010
|
}, null)])]);
|
|
10997
11011
|
}
|
|
@@ -11152,7 +11166,7 @@
|
|
|
11152
11166
|
}
|
|
11153
11167
|
const formatDiscount = (discount) => (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);
|
|
11154
11168
|
const formatAmount = (amount) => (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);
|
|
11155
|
-
const [name$Y, bem$X, t$
|
|
11169
|
+
const [name$Y, bem$X, t$a] = createNamespace("coupon");
|
|
11156
11170
|
var stdin_default$15 = vue.defineComponent({
|
|
11157
11171
|
name: name$Y,
|
|
11158
11172
|
props: {
|
|
@@ -11182,13 +11196,13 @@
|
|
|
11182
11196
|
return [vue.createVNode("span", null, [currency]), ` ${denominations}`];
|
|
11183
11197
|
}
|
|
11184
11198
|
if (coupon.discount) {
|
|
11185
|
-
return t$
|
|
11199
|
+
return t$a("discount", formatDiscount(coupon.discount));
|
|
11186
11200
|
}
|
|
11187
11201
|
return "";
|
|
11188
11202
|
});
|
|
11189
11203
|
const conditionMessage = vue.computed(() => {
|
|
11190
11204
|
const condition = formatAmount(props2.coupon.originCondition || 0);
|
|
11191
|
-
return condition === "0" ? t$
|
|
11205
|
+
return condition === "0" ? t$a("unlimited") : t$a("condition", condition);
|
|
11192
11206
|
});
|
|
11193
11207
|
return () => {
|
|
11194
11208
|
const {
|
|
@@ -11225,7 +11239,7 @@
|
|
|
11225
11239
|
}
|
|
11226
11240
|
});
|
|
11227
11241
|
const Coupon = withInstall(stdin_default$15);
|
|
11228
|
-
const [name$X, bem$W, t$
|
|
11242
|
+
const [name$X, bem$W, t$9] = createNamespace("coupon-cell");
|
|
11229
11243
|
const couponCellProps = {
|
|
11230
11244
|
title: String,
|
|
11231
11245
|
border: truthProp,
|
|
@@ -11251,7 +11265,7 @@
|
|
|
11251
11265
|
}
|
|
11252
11266
|
return `-${currency} ${(value / 100).toFixed(2)}`;
|
|
11253
11267
|
}
|
|
11254
|
-
return coupons.length === 0 ? t$
|
|
11268
|
+
return coupons.length === 0 ? t$9("noCoupon") : t$9("count", coupons.length);
|
|
11255
11269
|
}
|
|
11256
11270
|
var stdin_default$14 = vue.defineComponent({
|
|
11257
11271
|
name: name$X,
|
|
@@ -11262,7 +11276,7 @@
|
|
|
11262
11276
|
return vue.createVNode(Cell, {
|
|
11263
11277
|
"class": bem$W(),
|
|
11264
11278
|
"value": formatValue(props2),
|
|
11265
|
-
"title": props2.title || t$
|
|
11279
|
+
"title": props2.title || t$9("title"),
|
|
11266
11280
|
"border": props2.border,
|
|
11267
11281
|
"isLink": props2.editable,
|
|
11268
11282
|
"valueClass": bem$W("value", {
|
|
@@ -11273,7 +11287,7 @@
|
|
|
11273
11287
|
}
|
|
11274
11288
|
});
|
|
11275
11289
|
const CouponCell = withInstall(stdin_default$14);
|
|
11276
|
-
const [name$W, bem$V, t$
|
|
11290
|
+
const [name$W, bem$V, t$8] = createNamespace("coupon-list");
|
|
11277
11291
|
const couponListProps = {
|
|
11278
11292
|
code: makeStringProp(""),
|
|
11279
11293
|
coupons: makeArrayProp(),
|
|
@@ -11332,7 +11346,7 @@
|
|
|
11332
11346
|
}, {
|
|
11333
11347
|
default: () => [vue.createVNode("p", {
|
|
11334
11348
|
"class": bem$V("empty-tip")
|
|
11335
|
-
}, [t$
|
|
11349
|
+
}, [t$8("noCoupon")])]
|
|
11336
11350
|
});
|
|
11337
11351
|
const renderExchangeBar = () => {
|
|
11338
11352
|
if (props2.showExchangeBar) {
|
|
@@ -11345,13 +11359,13 @@
|
|
|
11345
11359
|
"clearable": true,
|
|
11346
11360
|
"border": false,
|
|
11347
11361
|
"class": bem$V("field"),
|
|
11348
|
-
"placeholder": props2.inputPlaceholder || t$
|
|
11362
|
+
"placeholder": props2.inputPlaceholder || t$8("placeholder"),
|
|
11349
11363
|
"maxlength": "20"
|
|
11350
11364
|
}, null), vue.createVNode(Button, {
|
|
11351
11365
|
"plain": true,
|
|
11352
11366
|
"type": "primary",
|
|
11353
11367
|
"class": bem$V("exchange"),
|
|
11354
|
-
"text": props2.exchangeButtonText || t$
|
|
11368
|
+
"text": props2.exchangeButtonText || t$8("exchange"),
|
|
11355
11369
|
"loading": props2.exchangeButtonLoading,
|
|
11356
11370
|
"disabled": buttonDisabled.value,
|
|
11357
11371
|
"onClick": onExchange
|
|
@@ -11363,7 +11377,7 @@
|
|
|
11363
11377
|
coupons
|
|
11364
11378
|
} = props2;
|
|
11365
11379
|
const count = props2.showCount ? ` (${coupons.length})` : "";
|
|
11366
|
-
const title = (props2.enabledTitle || t$
|
|
11380
|
+
const title = (props2.enabledTitle || t$8("enable")) + count;
|
|
11367
11381
|
return vue.createVNode(Tab, {
|
|
11368
11382
|
"title": title
|
|
11369
11383
|
}, {
|
|
@@ -11392,7 +11406,7 @@
|
|
|
11392
11406
|
disabledCoupons
|
|
11393
11407
|
} = props2;
|
|
11394
11408
|
const count = props2.showCount ? ` (${disabledCoupons.length})` : "";
|
|
11395
|
-
const title = (props2.disabledTitle || t$
|
|
11409
|
+
const title = (props2.disabledTitle || t$8("disabled")) + count;
|
|
11396
11410
|
return vue.createVNode(Tab, {
|
|
11397
11411
|
"title": title
|
|
11398
11412
|
}, {
|
|
@@ -11440,7 +11454,7 @@
|
|
|
11440
11454
|
"block": true,
|
|
11441
11455
|
"type": "primary",
|
|
11442
11456
|
"class": bem$V("close"),
|
|
11443
|
-
"text": props2.closeButtonText || t$
|
|
11457
|
+
"text": props2.closeButtonText || t$8("close"),
|
|
11444
11458
|
"onClick": () => emit("change", -1)
|
|
11445
11459
|
}, null), [[vue.vShow, props2.showCloseButton]])])]);
|
|
11446
11460
|
}
|
|
@@ -12001,7 +12015,7 @@
|
|
|
12001
12015
|
}
|
|
12002
12016
|
});
|
|
12003
12017
|
const DatetimePicker = withInstall(stdin_default$$);
|
|
12004
|
-
const [name$R, bem$S, t$
|
|
12018
|
+
const [name$R, bem$S, t$7] = createNamespace("dialog");
|
|
12005
12019
|
const dialogProps = extend$1({}, popupSharedProps, {
|
|
12006
12020
|
title: String,
|
|
12007
12021
|
theme: String,
|
|
@@ -12165,7 +12179,7 @@
|
|
|
12165
12179
|
})]
|
|
12166
12180
|
}, [props2.showCancelButton && vue.createVNode(Button, {
|
|
12167
12181
|
"size": "large",
|
|
12168
|
-
"text": props2.cancelButtonText || t$
|
|
12182
|
+
"text": props2.cancelButtonText || t$7("cancel"),
|
|
12169
12183
|
"class": bem$S("cancel"),
|
|
12170
12184
|
"style": {
|
|
12171
12185
|
color: props2.cancelButtonColor
|
|
@@ -12175,7 +12189,7 @@
|
|
|
12175
12189
|
"onClick": onCancel
|
|
12176
12190
|
}, null), props2.showConfirmButton && vue.createVNode(Button, {
|
|
12177
12191
|
"size": "large",
|
|
12178
|
-
"text": props2.confirmButtonText || t$
|
|
12192
|
+
"text": props2.confirmButtonText || t$7("confirm"),
|
|
12179
12193
|
"class": [bem$S("confirm"), {
|
|
12180
12194
|
[BORDER_LEFT]: props2.showCancelButton && !props2.showThirdButton
|
|
12181
12195
|
}],
|
|
@@ -12201,7 +12215,7 @@
|
|
|
12201
12215
|
}, {
|
|
12202
12216
|
default: () => [props2.showCancelButton && vue.createVNode(ActionBarButton, {
|
|
12203
12217
|
"type": "warning",
|
|
12204
|
-
"text": props2.cancelButtonText || t$
|
|
12218
|
+
"text": props2.cancelButtonText || t$7("cancel"),
|
|
12205
12219
|
"class": bem$S("cancel"),
|
|
12206
12220
|
"color": props2.cancelButtonColor,
|
|
12207
12221
|
"loading": loading.cancel,
|
|
@@ -12209,7 +12223,7 @@
|
|
|
12209
12223
|
"onClick": onCancel
|
|
12210
12224
|
}, null), props2.showConfirmButton && vue.createVNode(ActionBarButton, {
|
|
12211
12225
|
"type": "primary",
|
|
12212
|
-
"text": props2.confirmButtonText || t$
|
|
12226
|
+
"text": props2.confirmButtonText || t$7("confirm"),
|
|
12213
12227
|
"class": bem$S("confirm"),
|
|
12214
12228
|
"color": props2.confirmButtonColor,
|
|
12215
12229
|
"loading": loading.confirm,
|
|
@@ -18077,7 +18091,7 @@
|
|
|
18077
18091
|
}
|
|
18078
18092
|
});
|
|
18079
18093
|
const ObjectSelect = withInstall(stdin_default$u);
|
|
18080
|
-
const [name$o, bem$o, t$
|
|
18094
|
+
const [name$o, bem$o, t$6] = createNamespace("pagination");
|
|
18081
18095
|
const makePage = (number, text, active) => ({
|
|
18082
18096
|
number,
|
|
18083
18097
|
text,
|
|
@@ -18176,7 +18190,7 @@
|
|
|
18176
18190
|
"type": "button",
|
|
18177
18191
|
"disabled": disabled,
|
|
18178
18192
|
"onClick": () => updateModelValue(modelValue - 1, true)
|
|
18179
|
-
}, [slot ? slot() : props2.prevText || t$
|
|
18193
|
+
}, [slot ? slot() : props2.prevText || t$6("prev")])]);
|
|
18180
18194
|
};
|
|
18181
18195
|
const renderNextButton = () => {
|
|
18182
18196
|
const {
|
|
@@ -18195,7 +18209,7 @@
|
|
|
18195
18209
|
"type": "button",
|
|
18196
18210
|
"disabled": disabled,
|
|
18197
18211
|
"onClick": () => updateModelValue(modelValue + 1, true)
|
|
18198
|
-
}, [slot ? slot() : props2.nextText || t$
|
|
18212
|
+
}, [slot ? slot() : props2.nextText || t$6("next")])]);
|
|
18199
18213
|
};
|
|
18200
18214
|
const renderPages = () => pages.value.map((page) => vue.createVNode("li", {
|
|
18201
18215
|
"class": [bem$o("item", {
|
|
@@ -18365,7 +18379,7 @@
|
|
|
18365
18379
|
}
|
|
18366
18380
|
});
|
|
18367
18381
|
const Progress = withInstall(stdin_default$r);
|
|
18368
|
-
const [name$l, bem$l, t$
|
|
18382
|
+
const [name$l, bem$l, t$5] = createNamespace("pull-refresh");
|
|
18369
18383
|
const DEFAULT_HEAD_HEIGHT = 50;
|
|
18370
18384
|
const TEXT_STATUS = ["pulling", "loosing", "success"];
|
|
18371
18385
|
const pullRefreshProps = {
|
|
@@ -18441,7 +18455,7 @@
|
|
|
18441
18455
|
if (status === "normal") {
|
|
18442
18456
|
return "";
|
|
18443
18457
|
}
|
|
18444
|
-
return props2[`${status}Text`] || t$
|
|
18458
|
+
return props2[`${status}Text`] || t$5(status);
|
|
18445
18459
|
};
|
|
18446
18460
|
const renderStatus = () => {
|
|
18447
18461
|
const {
|
|
@@ -18550,6 +18564,34 @@
|
|
|
18550
18564
|
}
|
|
18551
18565
|
});
|
|
18552
18566
|
const PullRefresh = withInstall(stdin_default$q);
|
|
18567
|
+
const DEFAULT_STARTUP_TIMEOUT = 15e3;
|
|
18568
|
+
function abortError() {
|
|
18569
|
+
const error = new Error("Scanner startup cancelled");
|
|
18570
|
+
error.name = "AbortError";
|
|
18571
|
+
return error;
|
|
18572
|
+
}
|
|
18573
|
+
function waitForAbort(task, signal) {
|
|
18574
|
+
return new Promise((resolve, reject) => {
|
|
18575
|
+
const onAbort = () => {
|
|
18576
|
+
signal == null ? void 0 : signal.removeEventListener("abort", onAbort);
|
|
18577
|
+
reject(abortError());
|
|
18578
|
+
};
|
|
18579
|
+
if (signal == null ? void 0 : signal.aborted)
|
|
18580
|
+
onAbort();
|
|
18581
|
+
else
|
|
18582
|
+
signal == null ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
|
|
18583
|
+
task.then(
|
|
18584
|
+
(value) => {
|
|
18585
|
+
signal == null ? void 0 : signal.removeEventListener("abort", onAbort);
|
|
18586
|
+
resolve(value);
|
|
18587
|
+
},
|
|
18588
|
+
(error) => {
|
|
18589
|
+
signal == null ? void 0 : signal.removeEventListener("abort", onAbort);
|
|
18590
|
+
reject(error);
|
|
18591
|
+
}
|
|
18592
|
+
);
|
|
18593
|
+
});
|
|
18594
|
+
}
|
|
18553
18595
|
var __async$3 = (__this, __arguments, generator) => {
|
|
18554
18596
|
return new Promise((resolve, reject) => {
|
|
18555
18597
|
var fulfilled = (value) => {
|
|
@@ -18570,12 +18612,14 @@
|
|
|
18570
18612
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
18571
18613
|
});
|
|
18572
18614
|
};
|
|
18573
|
-
const [name$k, bem$k] = createNamespace("qr-scanner");
|
|
18615
|
+
const [name$k, bem$k, t$4] = createNamespace("qr-scanner");
|
|
18574
18616
|
const qrScannerProps = {
|
|
18575
18617
|
show: Boolean,
|
|
18576
18618
|
title: makeStringProp("扫描设备二维码"),
|
|
18577
18619
|
tip: makeStringProp("将设备二维码置于取景框内,即可自动识别"),
|
|
18578
18620
|
processingText: makeStringProp("正在处理扫码结果..."),
|
|
18621
|
+
startupTimeout: makeNumericProp(DEFAULT_STARTUP_TIMEOUT),
|
|
18622
|
+
startupTexts: Object,
|
|
18579
18623
|
formats: extend$1(makeArrayProp(), {
|
|
18580
18624
|
default: () => ["QRCode"]
|
|
18581
18625
|
}),
|
|
@@ -18601,7 +18645,7 @@
|
|
|
18601
18645
|
var stdin_default$p = vue.defineComponent({
|
|
18602
18646
|
name: name$k,
|
|
18603
18647
|
props: qrScannerProps,
|
|
18604
|
-
emits: ["update:show", "scan", "error", "cancel", "close", "closed", "ready"],
|
|
18648
|
+
emits: ["update:show", "scan", "error", "cancel", "close", "closed", "ready", "stageChange"],
|
|
18605
18649
|
setup(props2, {
|
|
18606
18650
|
emit
|
|
18607
18651
|
}) {
|
|
@@ -18610,6 +18654,7 @@
|
|
|
18610
18654
|
const frame = vue.ref();
|
|
18611
18655
|
const fileInput = vue.ref();
|
|
18612
18656
|
const phase = vue.ref("idle");
|
|
18657
|
+
const startupStage = vue.ref("camera");
|
|
18613
18658
|
const message = vue.ref("");
|
|
18614
18659
|
const hasTorch = vue.ref(false);
|
|
18615
18660
|
const torchOn = vue.ref(false);
|
|
@@ -18620,13 +18665,25 @@
|
|
|
18620
18665
|
let stream;
|
|
18621
18666
|
let canvas;
|
|
18622
18667
|
let timer2;
|
|
18668
|
+
let startupTimer;
|
|
18669
|
+
let startupStartedAt = 0;
|
|
18670
|
+
let startupDeadline = 0;
|
|
18623
18671
|
let generation = 0;
|
|
18624
18672
|
let abortController;
|
|
18625
18673
|
let resumeWhenVisible = false;
|
|
18674
|
+
let pickingAlbum = false;
|
|
18626
18675
|
const recentResults = /* @__PURE__ */ new Map();
|
|
18627
18676
|
const isCurrent = (id) => id === generation && props2.show && !props2.paused;
|
|
18677
|
+
const startupText = (key) => t$4(key) || stdin_default$2a.vanQrScanner[key];
|
|
18678
|
+
const clearStartupTimer = () => {
|
|
18679
|
+
if (startupTimer !== void 0)
|
|
18680
|
+
clearTimeout(startupTimer);
|
|
18681
|
+
startupTimer = void 0;
|
|
18682
|
+
startupDeadline = 0;
|
|
18683
|
+
};
|
|
18628
18684
|
const release = () => {
|
|
18629
18685
|
generation += 1;
|
|
18686
|
+
clearStartupTimer();
|
|
18630
18687
|
if (timer2)
|
|
18631
18688
|
clearTimeout(timer2);
|
|
18632
18689
|
timer2 = void 0;
|
|
@@ -18645,6 +18702,7 @@
|
|
|
18645
18702
|
phase.value = "paused";
|
|
18646
18703
|
};
|
|
18647
18704
|
const close = (cancelled = false) => {
|
|
18705
|
+
pickingAlbum = false;
|
|
18648
18706
|
release();
|
|
18649
18707
|
phase.value = "idle";
|
|
18650
18708
|
if (cancelled)
|
|
@@ -18652,14 +18710,46 @@
|
|
|
18652
18710
|
emit("update:show", false);
|
|
18653
18711
|
};
|
|
18654
18712
|
const reportError = (code, text, cause) => {
|
|
18713
|
+
const startupInfo = phase.value === "starting" && abortController && !props2.nativeScan ? {
|
|
18714
|
+
stage: startupStage.value,
|
|
18715
|
+
elapsedMs: Math.max(0, Date.now() - startupStartedAt)
|
|
18716
|
+
} : {};
|
|
18655
18717
|
release();
|
|
18656
18718
|
phase.value = "error";
|
|
18657
18719
|
message.value = text;
|
|
18658
|
-
emit("error", {
|
|
18720
|
+
emit("error", extend$1({
|
|
18659
18721
|
code,
|
|
18660
18722
|
message: text,
|
|
18661
18723
|
cause
|
|
18724
|
+
}, startupInfo));
|
|
18725
|
+
};
|
|
18726
|
+
const reportStartupTimeout = () => {
|
|
18727
|
+
const timeoutMessages = {
|
|
18728
|
+
camera: startupText("timeoutCamera"),
|
|
18729
|
+
preview: startupText("timeoutPreview"),
|
|
18730
|
+
decoder: startupText("timeoutDecoder"),
|
|
18731
|
+
ready: ""
|
|
18732
|
+
};
|
|
18733
|
+
reportError("STARTUP_TIMEOUT", timeoutMessages[startupStage.value]);
|
|
18734
|
+
};
|
|
18735
|
+
const canContinueStartup = (id) => {
|
|
18736
|
+
if (!isCurrent(id))
|
|
18737
|
+
return false;
|
|
18738
|
+
if (startupDeadline && Date.now() >= startupDeadline) {
|
|
18739
|
+
reportStartupTimeout();
|
|
18740
|
+
return false;
|
|
18741
|
+
}
|
|
18742
|
+
return true;
|
|
18743
|
+
};
|
|
18744
|
+
const setStartupStage = (stage, id) => {
|
|
18745
|
+
if (!canContinueStartup(id))
|
|
18746
|
+
return false;
|
|
18747
|
+
startupStage.value = stage;
|
|
18748
|
+
emit("stageChange", {
|
|
18749
|
+
stage,
|
|
18750
|
+
elapsedMs: Math.max(0, Date.now() - startupStartedAt)
|
|
18662
18751
|
});
|
|
18752
|
+
return isCurrent(id);
|
|
18663
18753
|
};
|
|
18664
18754
|
const cameraError = (error) => {
|
|
18665
18755
|
const errorName = error == null ? void 0 : error.name;
|
|
@@ -18747,7 +18837,7 @@
|
|
|
18747
18837
|
height: target.height / scale
|
|
18748
18838
|
});
|
|
18749
18839
|
if (image) {
|
|
18750
|
-
const result = yield decoder2.decode(image, props2.formats, props2.wasmUrl);
|
|
18840
|
+
const result = yield decoder2.decode(image, props2.formats, props2.wasmUrl, abortController == null ? void 0 : abortController.signal);
|
|
18751
18841
|
if (!isCurrent(id))
|
|
18752
18842
|
return;
|
|
18753
18843
|
if (result)
|
|
@@ -18773,6 +18863,7 @@
|
|
|
18773
18863
|
return;
|
|
18774
18864
|
}
|
|
18775
18865
|
const id = generation;
|
|
18866
|
+
pickingAlbum = false;
|
|
18776
18867
|
phase.value = "starting";
|
|
18777
18868
|
message.value = "";
|
|
18778
18869
|
if (props2.nativeScan) {
|
|
@@ -18808,8 +18899,25 @@
|
|
|
18808
18899
|
reportError("CAMERA_UNSUPPORTED", "当前环境不支持实时扫码,请从相册识别或在系统浏览器打开");
|
|
18809
18900
|
return;
|
|
18810
18901
|
}
|
|
18902
|
+
abortController = new AbortController();
|
|
18903
|
+
const {
|
|
18904
|
+
signal
|
|
18905
|
+
} = abortController;
|
|
18906
|
+
startupStartedAt = Date.now();
|
|
18907
|
+
const configuredTimeout = Number(props2.startupTimeout);
|
|
18908
|
+
const timeout = Number.isFinite(configuredTimeout) ? Math.max(0, configuredTimeout) : DEFAULT_STARTUP_TIMEOUT;
|
|
18909
|
+
if (timeout > 0) {
|
|
18910
|
+
startupDeadline = startupStartedAt + timeout;
|
|
18911
|
+
startupTimer = setTimeout(() => {
|
|
18912
|
+
if (!isCurrent(id) || phase.value !== "starting")
|
|
18913
|
+
return;
|
|
18914
|
+
reportStartupTimeout();
|
|
18915
|
+
}, timeout);
|
|
18916
|
+
}
|
|
18917
|
+
if (!setStartupStage("camera", id))
|
|
18918
|
+
return;
|
|
18811
18919
|
try {
|
|
18812
|
-
const acquiredStream = yield navigator.mediaDevices.getUserMedia({
|
|
18920
|
+
const acquiredStream = yield waitForAbort(navigator.mediaDevices.getUserMedia({
|
|
18813
18921
|
audio: false,
|
|
18814
18922
|
video: extend$1(deviceId ? {
|
|
18815
18923
|
deviceId: {
|
|
@@ -18827,28 +18935,44 @@
|
|
|
18827
18935
|
ideal: 720
|
|
18828
18936
|
}
|
|
18829
18937
|
})
|
|
18830
|
-
})
|
|
18938
|
+
}).then((acquired) => {
|
|
18939
|
+
if (!isCurrent(id))
|
|
18940
|
+
acquired.getTracks().forEach((track2) => track2.stop());
|
|
18941
|
+
return acquired;
|
|
18942
|
+
}), signal);
|
|
18831
18943
|
if (!isCurrent(id)) {
|
|
18832
18944
|
acquiredStream.getTracks().forEach((track2) => track2.stop());
|
|
18833
18945
|
return;
|
|
18834
18946
|
}
|
|
18835
18947
|
stream = acquiredStream;
|
|
18948
|
+
} catch (error) {
|
|
18949
|
+
if (isCurrent(id))
|
|
18950
|
+
cameraError(error);
|
|
18951
|
+
return;
|
|
18952
|
+
}
|
|
18953
|
+
if (!setStartupStage("preview", id))
|
|
18954
|
+
return;
|
|
18955
|
+
try {
|
|
18836
18956
|
yield vue.nextTick();
|
|
18837
|
-
if (!
|
|
18957
|
+
if (!canContinueStartup(id))
|
|
18838
18958
|
return;
|
|
18839
18959
|
if (!video.value)
|
|
18840
18960
|
throw new Error("扫码预览尚未就绪");
|
|
18841
18961
|
video.value.srcObject = stream;
|
|
18842
|
-
yield video.value.play();
|
|
18962
|
+
yield waitForAbort(video.value.play(), signal);
|
|
18843
18963
|
} catch (error) {
|
|
18844
18964
|
if (isCurrent(id))
|
|
18845
|
-
|
|
18965
|
+
reportError("PREVIEW_FAILED", startupText("previewFailed"), error);
|
|
18846
18966
|
return;
|
|
18847
18967
|
}
|
|
18968
|
+
if (!setStartupStage("decoder", id))
|
|
18969
|
+
return;
|
|
18848
18970
|
let decoder$1;
|
|
18849
18971
|
try {
|
|
18850
|
-
decoder$1 = yield Promise.resolve().then(() => decoder);
|
|
18851
|
-
|
|
18972
|
+
decoder$1 = yield waitForAbort(Promise.resolve().then(() => decoder), signal);
|
|
18973
|
+
if (!canContinueStartup(id))
|
|
18974
|
+
return;
|
|
18975
|
+
yield waitForAbort(decoder$1.prepareDecoder(props2.wasmUrl, signal), signal);
|
|
18852
18976
|
} catch (error) {
|
|
18853
18977
|
if (isCurrent(id))
|
|
18854
18978
|
reportError("DECODER_LOAD_FAILED", "扫码资源加载失败,请检查网络或资源部署后重试", error);
|
|
@@ -18856,6 +18980,8 @@
|
|
|
18856
18980
|
}
|
|
18857
18981
|
if (!isCurrent(id))
|
|
18858
18982
|
return;
|
|
18983
|
+
if (!canContinueStartup(id))
|
|
18984
|
+
return;
|
|
18859
18985
|
const track = stream == null ? void 0 : stream.getVideoTracks()[0];
|
|
18860
18986
|
try {
|
|
18861
18987
|
const capability = (_b = track == null ? void 0 : track.getCapabilities) == null ? void 0 : _b.call(track).torch;
|
|
@@ -18877,6 +19003,9 @@
|
|
|
18877
19003
|
}).catch(() => {
|
|
18878
19004
|
});
|
|
18879
19005
|
phase.value = "scanning";
|
|
19006
|
+
clearStartupTimer();
|
|
19007
|
+
if (!setStartupStage("ready", id))
|
|
19008
|
+
return;
|
|
18880
19009
|
emit("ready", {
|
|
18881
19010
|
torch: hasTorch.value
|
|
18882
19011
|
});
|
|
@@ -18886,25 +19015,32 @@
|
|
|
18886
19015
|
const scanImage = (file) => __async$3(this, null, function* () {
|
|
18887
19016
|
if (!props2.show || props2.paused)
|
|
18888
19017
|
return;
|
|
19018
|
+
pickingAlbum = false;
|
|
19019
|
+
release();
|
|
19020
|
+
phase.value = "processing";
|
|
19021
|
+
message.value = "";
|
|
18889
19022
|
if (file.size > Number(props2.maxImageSize)) {
|
|
18890
19023
|
reportError("IMAGE_TOO_LARGE", "图片过大,请选择较小的图片");
|
|
18891
19024
|
return;
|
|
18892
19025
|
}
|
|
18893
|
-
release();
|
|
18894
19026
|
const id = generation;
|
|
18895
|
-
|
|
18896
|
-
|
|
19027
|
+
abortController = new AbortController();
|
|
19028
|
+
const {
|
|
19029
|
+
signal
|
|
19030
|
+
} = abortController;
|
|
18897
19031
|
let imageCanvas;
|
|
18898
19032
|
try {
|
|
18899
|
-
const decoder$1 = yield Promise.resolve().then(() => decoder);
|
|
18900
|
-
|
|
19033
|
+
const decoder$1 = yield waitForAbort(Promise.resolve().then(() => decoder), signal);
|
|
19034
|
+
if (!isCurrent(id))
|
|
19035
|
+
return;
|
|
19036
|
+
const image = yield waitForAbort(decoder$1.loadImage(file, signal), signal);
|
|
18901
19037
|
if (!isCurrent(id))
|
|
18902
19038
|
return;
|
|
18903
19039
|
imageCanvas = document.createElement("canvas");
|
|
18904
19040
|
const data = decoder$1.captureImage(image, imageCanvas, 1920);
|
|
18905
19041
|
if (!data)
|
|
18906
19042
|
throw new Error("无法读取图片");
|
|
18907
|
-
const result = yield decoder$1.decode(data, props2.formats, props2.wasmUrl);
|
|
19043
|
+
const result = yield waitForAbort(decoder$1.decode(data, props2.formats, props2.wasmUrl, signal), signal);
|
|
18908
19044
|
if (!isCurrent(id))
|
|
18909
19045
|
return;
|
|
18910
19046
|
if (!result) {
|
|
@@ -18973,6 +19109,15 @@
|
|
|
18973
19109
|
start2();
|
|
18974
19110
|
}
|
|
18975
19111
|
};
|
|
19112
|
+
const onAlbumCancel = () => {
|
|
19113
|
+
if (pickingAlbum && phase.value === "paused")
|
|
19114
|
+
start2();
|
|
19115
|
+
pickingAlbum = false;
|
|
19116
|
+
};
|
|
19117
|
+
vue.watch(fileInput, (input, previous) => {
|
|
19118
|
+
previous == null ? void 0 : previous.removeEventListener("cancel", onAlbumCancel);
|
|
19119
|
+
input == null ? void 0 : input.addEventListener("cancel", onAlbumCancel);
|
|
19120
|
+
});
|
|
18976
19121
|
vue.watch(() => props2.show, (show) => __async$3(this, null, function* () {
|
|
18977
19122
|
release();
|
|
18978
19123
|
recentResults.clear();
|
|
@@ -18999,9 +19144,15 @@
|
|
|
18999
19144
|
if (props2.show)
|
|
19000
19145
|
start2();
|
|
19001
19146
|
});
|
|
19147
|
+
vue.watch(() => props2.wasmUrl, () => {
|
|
19148
|
+
if (props2.show && !props2.nativeScan && (phase.value === "starting" || phase.value === "scanning"))
|
|
19149
|
+
start2();
|
|
19150
|
+
});
|
|
19002
19151
|
vue.onMounted(() => document.addEventListener("visibilitychange", onVisibilityChange));
|
|
19003
19152
|
vue.onBeforeUnmount(() => {
|
|
19153
|
+
var _a;
|
|
19004
19154
|
release();
|
|
19155
|
+
(_a = fileInput.value) == null ? void 0 : _a.removeEventListener("cancel", onAlbumCancel);
|
|
19005
19156
|
if (canvas) {
|
|
19006
19157
|
canvas.width = 0;
|
|
19007
19158
|
canvas.height = 0;
|
|
@@ -19086,7 +19237,15 @@
|
|
|
19086
19237
|
"color": "white",
|
|
19087
19238
|
"vertical": true
|
|
19088
19239
|
}, {
|
|
19089
|
-
default: () =>
|
|
19240
|
+
default: () => {
|
|
19241
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19242
|
+
return [phase.value === "starting" ? props2.nativeScan ? "正在打开扫码..." : {
|
|
19243
|
+
camera: (_b = (_a = props2.startupTexts) == null ? void 0 : _a.camera) != null ? _b : startupText("startupCamera"),
|
|
19244
|
+
preview: (_d = (_c = props2.startupTexts) == null ? void 0 : _c.preview) != null ? _d : startupText("startupPreview"),
|
|
19245
|
+
decoder: (_f = (_e = props2.startupTexts) == null ? void 0 : _e.decoder) != null ? _f : startupText("startupDecoder"),
|
|
19246
|
+
ready: ""
|
|
19247
|
+
}[startupStage.value] : props2.processingText];
|
|
19248
|
+
}
|
|
19090
19249
|
}), needsRetry && vue.createVNode(vue.Fragment, null, [vue.createVNode("p", {
|
|
19091
19250
|
"class": bem$k("message")
|
|
19092
19251
|
}, [message.value || "扫描已暂停"]), vue.createVNode(Button, {
|
|
@@ -19119,6 +19278,7 @@
|
|
|
19119
19278
|
var _a;
|
|
19120
19279
|
stop();
|
|
19121
19280
|
resumeWhenVisible = false;
|
|
19281
|
+
pickingAlbum = true;
|
|
19122
19282
|
(_a = fileInput.value) == null ? void 0 : _a.click();
|
|
19123
19283
|
}
|
|
19124
19284
|
}, [vue.createVNode(Icon, {
|
|
@@ -19148,6 +19308,9 @@
|
|
|
19148
19308
|
input.value = "";
|
|
19149
19309
|
if (file)
|
|
19150
19310
|
scanImage(file);
|
|
19311
|
+
else if (pickingAlbum && phase.value === "paused")
|
|
19312
|
+
start2();
|
|
19313
|
+
pickingAlbum = false;
|
|
19151
19314
|
}
|
|
19152
19315
|
}, null)]
|
|
19153
19316
|
});
|
|
@@ -19159,6 +19322,8 @@
|
|
|
19159
19322
|
title: "扫描设备二维码",
|
|
19160
19323
|
tip: "将设备二维码置于取景框内,即可自动识别",
|
|
19161
19324
|
processingText: "正在处理扫码结果...",
|
|
19325
|
+
startupTimeout: DEFAULT_STARTUP_TIMEOUT,
|
|
19326
|
+
startupTexts: void 0,
|
|
19162
19327
|
formats: ["QRCode"],
|
|
19163
19328
|
facingMode: "environment",
|
|
19164
19329
|
showAlbum: true,
|
|
@@ -19177,6 +19342,8 @@
|
|
|
19177
19342
|
closeOnPopstate: true,
|
|
19178
19343
|
onScan: void 0,
|
|
19179
19344
|
onError: void 0,
|
|
19345
|
+
onStageChange: void 0,
|
|
19346
|
+
onReady: void 0,
|
|
19180
19347
|
onCancel: void 0,
|
|
19181
19348
|
onClose: void 0
|
|
19182
19349
|
};
|
|
@@ -22192,7 +22359,7 @@
|
|
|
22192
22359
|
t2.removeEventListener(i, s, n);
|
|
22193
22360
|
}), this.eventListeners = []);
|
|
22194
22361
|
}
|
|
22195
|
-
function ready
|
|
22362
|
+
function ready() {
|
|
22196
22363
|
return new Promise((e2) => this.ready ? setTimeout(e2, 0) : on$1.call(this, this.elements.container, "ready", e2)).then(() => {
|
|
22197
22364
|
});
|
|
22198
22365
|
}
|
|
@@ -23072,7 +23239,7 @@
|
|
|
23072
23239
|
}, togglePoster(e2) {
|
|
23073
23240
|
toggleClass(this.elements.container, this.config.classNames.posterEnabled, e2);
|
|
23074
23241
|
}, setPoster(e2, t2 = true) {
|
|
23075
|
-
return t2 && this.poster ? Promise.reject(new Error("Poster already set")) : (this.media.setAttribute("data-poster", e2), this.elements.poster.removeAttribute("hidden"), ready
|
|
23242
|
+
return t2 && this.poster ? Promise.reject(new Error("Poster already set")) : (this.media.setAttribute("data-poster", e2), this.elements.poster.removeAttribute("hidden"), ready.call(this).then(() => loadImage$1(e2)).catch((t3) => {
|
|
23076
23243
|
throw e2 === this.poster && ui.togglePoster.call(this, false), t3;
|
|
23077
23244
|
}).then(() => {
|
|
23078
23245
|
if (e2 !== this.poster)
|
|
@@ -26134,7 +26301,7 @@
|
|
|
26134
26301
|
});
|
|
26135
26302
|
}
|
|
26136
26303
|
};
|
|
26137
|
-
const version = "0.0.
|
|
26304
|
+
const version = "0.0.55";
|
|
26138
26305
|
function install(app) {
|
|
26139
26306
|
const components = [
|
|
26140
26307
|
ActionBar,
|
|
@@ -26811,6 +26978,9 @@
|
|
|
26811
26978
|
}
|
|
26812
26979
|
(c == null ? n(a, s) : c) || K.set(e2, [s]);
|
|
26813
26980
|
}
|
|
26981
|
+
function Y(e2) {
|
|
26982
|
+
K.delete(e2);
|
|
26983
|
+
}
|
|
26814
26984
|
async function X(e2, t2) {
|
|
26815
26985
|
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : I, r = {
|
|
26816
26986
|
...I,
|
|
@@ -26907,12 +27077,12 @@
|
|
|
26907
27077
|
var e3;
|
|
26908
27078
|
if (!(y2 != null && (e3 = y2.buffer) != null && e3.resizable)) {
|
|
26909
27079
|
var t3 = te();
|
|
26910
|
-
y2 = new Int8Array(t3), Ht = new Int16Array(t3), i.HEAPU8 = I2 = new Uint8Array(t3),
|
|
27080
|
+
y2 = new Int8Array(t3), Ht = new Int16Array(t3), i.HEAPU8 = I2 = new Uint8Array(t3), Y2 = new Uint16Array(t3), Ut = new Int32Array(t3), E2 = new Uint32Array(t3), Lt = new Float32Array(t3), Rt = new Float64Array(t3);
|
|
26911
27081
|
}
|
|
26912
27082
|
}
|
|
26913
27083
|
function re() {
|
|
26914
27084
|
var e3 = i.preRun;
|
|
26915
|
-
e3 && (typeof e3 == "function" && (e3 = [e3]),
|
|
27085
|
+
e3 && (typeof e3 == "function" && (e3 = [e3]), ge2.push(...e3)), b2(ge2);
|
|
26916
27086
|
}
|
|
26917
27087
|
function ie() {
|
|
26918
27088
|
Rr.ra();
|
|
@@ -26986,7 +27156,7 @@
|
|
|
26986
27156
|
var y2, b2 = (e3) => {
|
|
26987
27157
|
for (; e3.length > 0; )
|
|
26988
27158
|
e3.shift()(i);
|
|
26989
|
-
}, x2 = [],
|
|
27159
|
+
}, x2 = [], ge2 = [], _e = true, S = (e3) => Yn(e3), C2 = () => Zn(), ve = [], w2 = (e3) => {
|
|
26990
27160
|
var t3 = ve[e3];
|
|
26991
27161
|
return t3 || (ve[e3] = t3 = rr.get(e3)), t3;
|
|
26992
27162
|
}, ye = (e3, t3) => w2(e3)(t3), T = [], be = 0, E2;
|
|
@@ -27627,12 +27797,12 @@
|
|
|
27627
27797
|
var r3 = [n3[0], null].concat(n3.slice(1));
|
|
27628
27798
|
return _t(e3, Ot(e3, r3, null, i2, a2, o2), t3 - 1), [];
|
|
27629
27799
|
});
|
|
27630
|
-
}, Ht,
|
|
27800
|
+
}, Ht, Y2, Ut, Wt = (e3, t3, n2) => {
|
|
27631
27801
|
switch (t3) {
|
|
27632
27802
|
case 1:
|
|
27633
27803
|
return n2 ? (e4) => y2[e4] : (e4) => I2[e4];
|
|
27634
27804
|
case 2:
|
|
27635
|
-
return n2 ? (e4) => Ht[e4 >> 1] : (e4) =>
|
|
27805
|
+
return n2 ? (e4) => Ht[e4 >> 1] : (e4) => Y2[e4 >> 1];
|
|
27636
27806
|
case 4:
|
|
27637
27807
|
return n2 ? (e4) => Ut[e4 >> 2] : (e4) => E2[e4 >> 2];
|
|
27638
27808
|
default:
|
|
@@ -27789,11 +27959,11 @@
|
|
|
27789
27959
|
}
|
|
27790
27960
|
});
|
|
27791
27961
|
}, on2 = globalThis.TextDecoder ? new TextDecoder("utf-16le") : void 0, sn = (e3, t3, n2) => {
|
|
27792
|
-
var r2 = e3 >> 1, i2 = tn(
|
|
27962
|
+
var r2 = e3 >> 1, i2 = tn(Y2, r2, t3 / 2, n2);
|
|
27793
27963
|
if (i2 - r2 > 16 && on2)
|
|
27794
|
-
return on2.decode(
|
|
27964
|
+
return on2.decode(Y2.subarray(r2, i2));
|
|
27795
27965
|
for (var a2 = "", o2 = r2; o2 < i2; ++o2) {
|
|
27796
|
-
var s2 =
|
|
27966
|
+
var s2 = Y2[o2];
|
|
27797
27967
|
a2 += String.fromCharCode(s2);
|
|
27798
27968
|
}
|
|
27799
27969
|
return a2;
|
|
@@ -28375,6 +28545,9 @@
|
|
|
28375
28545
|
function x(e2) {
|
|
28376
28546
|
return J(b, e2);
|
|
28377
28547
|
}
|
|
28548
|
+
function ge() {
|
|
28549
|
+
return Y(b);
|
|
28550
|
+
}
|
|
28378
28551
|
async function C(e2, t2) {
|
|
28379
28552
|
return X(b, e2, t2);
|
|
28380
28553
|
}
|
|
@@ -28398,47 +28571,114 @@
|
|
|
28398
28571
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
28399
28572
|
});
|
|
28400
28573
|
};
|
|
28401
|
-
let
|
|
28402
|
-
|
|
28403
|
-
|
|
28404
|
-
|
|
28574
|
+
let preparation;
|
|
28575
|
+
function invalidate(entry) {
|
|
28576
|
+
if (preparation === entry) {
|
|
28577
|
+
preparation = void 0;
|
|
28578
|
+
ge();
|
|
28579
|
+
}
|
|
28580
|
+
}
|
|
28581
|
+
function createPreparation(wasmUrl) {
|
|
28582
|
+
const controller = new AbortController();
|
|
28583
|
+
const entry = {
|
|
28584
|
+
wasmUrl,
|
|
28585
|
+
pending: true,
|
|
28586
|
+
controller,
|
|
28587
|
+
consumers: /* @__PURE__ */ new Set(),
|
|
28588
|
+
promise: void 0
|
|
28589
|
+
};
|
|
28590
|
+
const initialize = () => __async(this, null, function* () {
|
|
28405
28591
|
const url = wasmUrl || (yield Promise.resolve().then(() => zxing_reader$1)).default;
|
|
28406
|
-
if (
|
|
28407
|
-
|
|
28408
|
-
|
|
28409
|
-
|
|
28410
|
-
|
|
28411
|
-
|
|
28412
|
-
|
|
28413
|
-
|
|
28414
|
-
|
|
28415
|
-
|
|
28416
|
-
|
|
28592
|
+
if (controller.signal.aborted || preparation !== entry)
|
|
28593
|
+
throw abortError();
|
|
28594
|
+
yield x({
|
|
28595
|
+
overrides: { locateFile: () => url },
|
|
28596
|
+
fireImmediately: true
|
|
28597
|
+
});
|
|
28598
|
+
});
|
|
28599
|
+
entry.promise = waitForAbort(
|
|
28600
|
+
Promise.resolve().then(initialize),
|
|
28601
|
+
controller.signal
|
|
28602
|
+
).then(
|
|
28603
|
+
() => {
|
|
28604
|
+
entry.pending = false;
|
|
28605
|
+
},
|
|
28606
|
+
(error) => {
|
|
28607
|
+
entry.pending = false;
|
|
28608
|
+
invalidate(entry);
|
|
28609
|
+
throw error;
|
|
28610
|
+
}
|
|
28611
|
+
);
|
|
28612
|
+
return entry;
|
|
28613
|
+
}
|
|
28614
|
+
function prepareDecoder(wasmUrl, signal) {
|
|
28615
|
+
return __async(this, null, function* () {
|
|
28616
|
+
if (signal == null ? void 0 : signal.aborted)
|
|
28617
|
+
throw abortError();
|
|
28618
|
+
if (!preparation || preparation.wasmUrl !== wasmUrl) {
|
|
28619
|
+
preparation = createPreparation(wasmUrl);
|
|
28620
|
+
}
|
|
28621
|
+
const entry = preparation;
|
|
28622
|
+
const consumer = Symbol("decoder-consumer");
|
|
28623
|
+
entry.consumers.add(consumer);
|
|
28624
|
+
const releaseConsumer = () => {
|
|
28625
|
+
entry.consumers.delete(consumer);
|
|
28626
|
+
if (entry.pending && !entry.consumers.size) {
|
|
28627
|
+
invalidate(entry);
|
|
28628
|
+
entry.controller.abort();
|
|
28629
|
+
}
|
|
28630
|
+
};
|
|
28631
|
+
signal == null ? void 0 : signal.addEventListener("abort", releaseConsumer, { once: true });
|
|
28632
|
+
try {
|
|
28633
|
+
yield waitForAbort(entry.promise, signal);
|
|
28634
|
+
} finally {
|
|
28635
|
+
signal == null ? void 0 : signal.removeEventListener("abort", releaseConsumer);
|
|
28636
|
+
releaseConsumer();
|
|
28417
28637
|
}
|
|
28418
|
-
yield ready;
|
|
28419
28638
|
});
|
|
28420
28639
|
}
|
|
28421
|
-
function decode(image, formats, wasmUrl) {
|
|
28640
|
+
function decode(image, formats, wasmUrl, signal) {
|
|
28422
28641
|
return __async(this, null, function* () {
|
|
28423
|
-
yield prepareDecoder(wasmUrl);
|
|
28424
|
-
|
|
28425
|
-
|
|
28426
|
-
|
|
28427
|
-
|
|
28428
|
-
|
|
28642
|
+
yield prepareDecoder(wasmUrl, signal);
|
|
28643
|
+
if (signal == null ? void 0 : signal.aborted)
|
|
28644
|
+
throw abortError();
|
|
28645
|
+
const results = yield waitForAbort(
|
|
28646
|
+
C(image, {
|
|
28647
|
+
formats: formats.length ? formats : ["QRCode"],
|
|
28648
|
+
tryHarder: true,
|
|
28649
|
+
maxNumberOfSymbols: 1
|
|
28650
|
+
}),
|
|
28651
|
+
signal
|
|
28652
|
+
);
|
|
28429
28653
|
return results.find((result) => result.isValid && result.text.length > 0);
|
|
28430
28654
|
});
|
|
28431
28655
|
}
|
|
28432
|
-
function loadImage(file) {
|
|
28656
|
+
function loadImage(file, signal) {
|
|
28433
28657
|
return new Promise((resolve, reject) => {
|
|
28658
|
+
if (signal == null ? void 0 : signal.aborted) {
|
|
28659
|
+
reject(abortError());
|
|
28660
|
+
return;
|
|
28661
|
+
}
|
|
28434
28662
|
const url = URL.createObjectURL(file);
|
|
28435
28663
|
const image = new Image();
|
|
28436
|
-
|
|
28664
|
+
const cleanup = () => {
|
|
28437
28665
|
URL.revokeObjectURL(url);
|
|
28666
|
+
signal == null ? void 0 : signal.removeEventListener("abort", onAbort);
|
|
28667
|
+
image.onload = null;
|
|
28668
|
+
image.onerror = null;
|
|
28669
|
+
};
|
|
28670
|
+
const onAbort = () => {
|
|
28671
|
+
cleanup();
|
|
28672
|
+
image.src = "";
|
|
28673
|
+
reject(abortError());
|
|
28674
|
+
};
|
|
28675
|
+
signal == null ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
|
|
28676
|
+
image.onload = () => {
|
|
28677
|
+
cleanup();
|
|
28438
28678
|
resolve(image);
|
|
28439
28679
|
};
|
|
28440
28680
|
image.onerror = () => {
|
|
28441
|
-
|
|
28681
|
+
cleanup();
|
|
28442
28682
|
reject(new Error("无法读取图片,请选择 JPG、PNG 等浏览器支持的图片"));
|
|
28443
28683
|
};
|
|
28444
28684
|
image.src = url;
|