@scandit/web-datacapture-core 7.5.1 → 7.6.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/build/electron/common.cjs +1 -1
- package/build/electron/constants.cjs +1 -1
- package/build/electron/main.cjs +1 -1
- package/build/electron/preload.cjs +1 -1
- package/build/js/AimerViewfinder.js +1 -1
- package/build/js/Brush.js +1 -1
- package/build/js/{Camera-bxDEtlUu.d.ts → Camera-Bpnu6h9d.d.ts} +46 -38
- package/build/js/Camera.d.ts +1 -1
- package/build/js/Camera.js +1 -1
- package/build/js/CameraAccess.d.ts +1 -1
- package/build/js/CameraAccess.js +1 -1
- package/build/js/CameraRelated.d.ts +1 -1
- package/build/js/CameraRelated.js +1 -1
- package/build/js/Common.d.ts +1 -0
- package/build/js/Common.js +1 -1
- package/build/js/DataCaptureContext.d.ts +2 -2
- package/build/js/DataCaptureContext.js +1 -1
- package/build/js/DataCaptureContextRelated.d.ts +1 -1
- package/build/js/DataCaptureVersion.js +1 -1
- package/build/js/DataCaptureView.d.ts +1 -1
- package/build/js/DataCaptureView.js +1 -1
- package/build/js/DefaultViewClassnames.d.ts +0 -2
- package/build/js/DefaultViewClassnames.js +1 -1
- package/build/js/Defaults.d.ts +1 -1
- package/build/js/Defaults.js +1 -1
- package/build/js/Feedback.js +1 -1
- package/build/js/FrameData.d.ts +1 -1
- package/build/js/ImageFrameSource.d.ts +1 -1
- package/build/js/LaserlineViewfinder.js +1 -1
- package/build/js/LocationSelection.js +1 -1
- package/build/js/NotificationPresenter/NotificationBuilder.js +1 -1
- package/build/js/NotificationPresenter/index.d.ts +1 -1
- package/build/js/NotificationPresenter/index.js +1 -1
- package/build/js/NotificationPresenter/private/ConcreteNotificationPresenter.d.ts +1 -1
- package/build/js/NotificationPresenter/private/presets.d.ts +1 -1
- package/build/js/RectangularViewfinder.js +1 -1
- package/build/js/ScanditIcon.js +1 -1
- package/build/js/ScanditIconBuilder.js +1 -1
- package/build/js/SingleImageUploader.d.ts +1 -1
- package/build/js/SingleImageUploader.js +1 -1
- package/build/js/SingleImageUploaderSettings.js +1 -1
- package/build/js/Sound.js +1 -1
- package/build/js/Vibration.js +1 -1
- package/build/js/ViewControls.js +1 -1
- package/build/js/browserHelper.js +1 -1
- package/build/js/chunks/{chunk-O4TEQJ6H.js → chunk-26DQPDMK.js} +1 -1
- package/build/js/chunks/{chunk-BHIFOHFI.js → chunk-27Z5CYJL.js} +1 -1
- package/build/js/chunks/{chunk-3BBG6EVS.js → chunk-2HL2IEE2.js} +1 -1
- package/build/js/chunks/{chunk-WKTLU3L4.js → chunk-33ZLQAZS.js} +2 -2
- package/build/js/chunks/{chunk-KCNXUTBL.js → chunk-34HLD6AY.js} +1 -1
- package/build/js/chunks/{chunk-7WQXUZB4.js → chunk-4TDWWHP2.js} +1 -1
- package/build/js/chunks/chunk-4XTOUXDD.js +1 -0
- package/build/js/chunks/{chunk-DAFXSVRW.js → chunk-5S5BT5PK.js} +1 -1
- package/build/js/chunks/{chunk-LEE5JACK.js → chunk-6NVWG2LP.js} +1 -1
- package/build/js/chunks/{chunk-OPX62GWU.js → chunk-7ELPJFJV.js} +1 -1
- package/build/js/chunks/{chunk-JVZYXEYO.js → chunk-7TQID6JJ.js} +1 -1
- package/build/js/chunks/{chunk-MDC2G4SQ.js → chunk-AJE43LJ5.js} +1 -1
- package/build/js/chunks/{chunk-DCZONWJ2.js → chunk-AKDTQZ73.js} +1 -1
- package/build/js/chunks/{chunk-2AJGK77F.js → chunk-AUWF33RB.js} +1 -1
- package/build/js/chunks/chunk-DFFYK2ZZ.js +1 -0
- package/build/js/chunks/chunk-EKOWJS3E.js +1 -0
- package/build/js/chunks/{chunk-QEWYPYNF.js → chunk-ESVB4WW6.js} +1 -1
- package/build/js/chunks/{chunk-T5EUB6UG.js → chunk-FS52JIW4.js} +1 -1
- package/build/js/chunks/chunk-GC2ECHKL.js +2 -0
- package/build/js/chunks/{chunk-TTGWNLNK.js → chunk-GYQMVT7L.js} +1 -1
- package/build/js/chunks/chunk-GYSREBEJ.js +1 -0
- package/build/js/chunks/{chunk-TSOWSKE3.js → chunk-H75G3H4R.js} +1 -1
- package/build/js/chunks/chunk-HJXLUUA6.js +18 -0
- package/build/js/chunks/chunk-JBX2RBUT.js +1 -0
- package/build/js/chunks/{chunk-FSWALUUO.js → chunk-K7MUTJWB.js} +1 -1
- package/build/js/chunks/{chunk-GPKU5XMS.js → chunk-KXSW5F3G.js} +1 -1
- package/build/js/chunks/chunk-L3BBOGIY.js +4 -0
- package/build/js/chunks/{chunk-ZXA6VEK2.js → chunk-LISC6VSM.js} +1 -1
- package/build/js/chunks/chunk-MQ6H2ORR.js +1 -0
- package/build/js/chunks/{chunk-NFB6DO6C.js → chunk-N2GWO3EX.js} +1 -1
- package/build/js/chunks/chunk-NKCR7VPO.js +1 -0
- package/build/js/chunks/chunk-OARD7KIC.js +11 -0
- package/build/js/chunks/{chunk-UOEN3RFJ.js → chunk-OQ4XCKFQ.js} +1 -1
- package/build/js/chunks/{chunk-EUZWZFRQ.js → chunk-PUP3NNKU.js} +1 -1
- package/build/js/chunks/{chunk-SP777KFV.js → chunk-Q5DQ3FTE.js} +1 -1
- package/build/js/chunks/chunk-QR3AOFAD.js +5 -0
- package/build/js/chunks/{chunk-HHMOVH27.js → chunk-R3XUWVHG.js} +2 -2
- package/build/js/chunks/chunk-SFJIWITJ.js +1 -0
- package/build/js/chunks/{chunk-DDYEOOSY.js → chunk-SJJGHQ52.js} +1 -1
- package/build/js/chunks/{chunk-IVDD7PCI.js → chunk-TB4UKDDI.js} +1 -1
- package/build/js/chunks/chunk-TPQTY3KB.js +1 -0
- package/build/js/chunks/chunk-TR3NGINC.js +1 -0
- package/build/js/chunks/{chunk-RX2673AX.js → chunk-U7Z5PR2O.js} +1 -1
- package/build/js/chunks/{chunk-6VWIJ62O.js → chunk-UCD6YLP3.js} +1 -1
- package/build/js/chunks/chunk-UUD3OXOZ.js +1 -0
- package/build/js/chunks/{chunk-6YZS76QW.js → chunk-VBRTZG3W.js} +1 -1
- package/build/js/chunks/chunk-VQ7LLVHQ.js +1 -0
- package/build/js/chunks/{chunk-QM37NXPY.js → chunk-VW3DMTE7.js} +1 -1
- package/build/js/index.d.ts +5 -4
- package/build/js/index.js +3 -3
- package/build/js/private/AnchorPositions.js +1 -1
- package/build/js/private/CameraAccess.d.ts +1 -1
- package/build/js/private/CameraAccess.js +1 -1
- package/build/js/private/CameraManager.d.ts +1 -1
- package/build/js/private/CameraManager.js +1 -1
- package/build/js/private/CanvasDrawerWithMetrics.d.ts +1 -1
- package/build/js/private/CoreModuleLicenseTextProvider.d.ts +1 -1
- package/build/js/private/CoreModuleLicenseTextProvider.js +1 -1
- package/build/js/private/CustomLocationsView.js +1 -1
- package/build/js/private/DataCaptureContextRelated.d.ts +1 -1
- package/build/js/private/FrameReaders/FrameReader.d.ts +1 -1
- package/build/js/private/FrameReaders/FrameReaderAbstract.d.ts +1 -1
- package/build/js/private/FrameReaders/GrayScaleFrameReader.d.ts +1 -1
- package/build/js/private/FrameReaders/index.d.ts +1 -1
- package/build/js/private/GestureRecognizer/GestureRecognizer.js +1 -1
- package/build/js/private/GestureRecognizer/index.js +1 -1
- package/build/js/private/HtmlElementState.js +1 -1
- package/build/js/private/NormalizedConfigureOptions.d.ts +6 -5
- package/build/js/private/SingleImageUploaderView.d.ts +1 -1
- package/build/js/private/SingleImageUploaderView.js +1 -1
- package/build/js/private/ViewClassNames.d.ts +0 -2
- package/build/js/private/ViewClassNames.js +1 -1
- package/build/js/private/ViewControls+related.js +1 -1
- package/build/js/private/ViewControls_related.d.ts +1 -1
- package/build/js/private/ViewStyles.js +1 -1
- package/build/js/private/ViewsRegistry.d.ts +1 -1
- package/build/js/private/hybridDesktopPlatformHelpers.js +1 -1
- package/build/js/private/ui/atoms/Card.d.ts +2 -0
- package/build/js/private/ui/atoms/Card.js +1 -1
- package/build/js/private/ui/atoms/CardList.js +1 -1
- package/build/js/private/ui/atoms/ProgressBar.js +1 -1
- package/build/js/private/ui/atoms/Toast.d.ts +3 -2
- package/build/js/private/ui/atoms/Toast.js +1 -1
- package/build/js/private/ui/colors.js +1 -1
- package/build/js/private/ui/molecules/HintPresenter.d.ts +1 -1
- package/build/js/private/ui/molecules/HintPresenter.js +1 -1
- package/build/js/private/ui/molecules/LoadingOverlay.js +1 -1
- package/build/js/private/utils/finalizationRegistryPolyfill.d.ts +0 -5
- package/build/js/private/utils/index.js +1 -1
- package/build/js/private/utils/polyfillLoader.d.ts +25 -0
- package/build/js/private/utils/polyfillLoader.js +1 -0
- package/build/js/private/utils/replaceImagesInViewUtils.d.ts +1 -1
- package/build/js/private/utils/structuredClonePolyfill.d.ts +15 -0
- package/build/js/private/utils/structuredClonePolyfill.js +1 -0
- package/build/js/private/utils/warnMultithreadingUnavailable.js +1 -1
- package/build/js/sdk.d.ts +22 -7
- package/build/js/sdk.js +1 -1
- package/build/js/worker/WorkerMain.d.ts +1 -1
- package/build/js/worker/WorkerMain.js +1 -1
- package/build/js/worker/coreCapture.inlineWorker.d.ts +1 -1
- package/build/js/worker/coreCapture.inlineWorker.js +1 -1
- package/build/js/worker/dataCaptureEngine.d.ts +1 -1
- package/build/js/worker/dataCaptureEngine.js +1 -1
- package/build/js/worker/dataCaptureLoader.d.ts +1 -1
- package/build/js/worker/dataCaptureWorkerRelated.d.ts +1 -1
- package/build/js/worker/index.d.ts +1 -1
- package/build/js/worker/index.js +1 -1
- package/package.json +1 -1
- package/build/js/chunks/chunk-55IMEHJS.js +0 -1
- package/build/js/chunks/chunk-5FUZURCZ.js +0 -1
- package/build/js/chunks/chunk-7452WLDM.js +0 -1
- package/build/js/chunks/chunk-77BBIAZE.js +0 -1
- package/build/js/chunks/chunk-CXX2ZE7M.js +0 -1
- package/build/js/chunks/chunk-DUPLHZRJ.js +0 -1
- package/build/js/chunks/chunk-F2YB7OLE.js +0 -5
- package/build/js/chunks/chunk-GSFBVAUZ.js +0 -1
- package/build/js/chunks/chunk-JKL2W65E.js +0 -1
- package/build/js/chunks/chunk-KC74WR2Q.js +0 -4
- package/build/js/chunks/chunk-MUJ7NKAY.js +0 -1
- package/build/js/chunks/chunk-NMROJLGQ.js +0 -1
- package/build/js/chunks/chunk-NMX4VHW2.js +0 -1
- package/build/js/chunks/chunk-QMWVSPM5.js +0 -21
- package/build/js/chunks/chunk-TVQ54DA3.js +0 -11
- package/build/js/chunks/chunk-Y6SLVHK3.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as LoadingOverlay}from'../../../chunks/chunk-
|
|
1
|
+
export{a as LoadingOverlay}from'../../../chunks/chunk-R3XUWVHG.js';
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
/// <reference types="emscripten" />
|
|
2
|
-
/**
|
|
3
|
-
* Polyfill for FinalizationRegistry to support environments where it's not available
|
|
4
|
-
* (e.g., some worker contexts). This provides a no-op implementation that maintains
|
|
5
|
-
* the same API but doesn't perform actual cleanup.
|
|
6
|
-
*/
|
|
7
2
|
/**
|
|
8
3
|
* Provides FinalizationRegistry polyfill when not available
|
|
9
4
|
* @param target The target object (globalThis, self, or global) where FinalizationRegistry should be added
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as
|
|
1
|
+
export{a as wait}from'../../chunks/chunk-UZWBB65W.js';export{a as waitTransitionEndForElement}from'../../chunks/chunk-2HTI5D6Y.js';export{b as safeAwaitAnimation,a as safeCancelAnimation}from'../../chunks/chunk-SM5S3DDC.js';export{a as throttle}from'../../chunks/chunk-T3AOBMAS.js';export{a as Timeout}from'../../chunks/chunk-Q7JWDX4U.js';export{a as defineCustomElements}from'../../chunks/chunk-3A4KLILV.js';export{a as html}from'../../chunks/chunk-MU6SADSF.js';export{a as ScanditHTMLElement}from'../../chunks/chunk-EV4OEANA.js';export{a as clamp}from'../../chunks/chunk-L2STPTEN.js';export{a as unknownErrorToString}from'../../chunks/chunk-AIRWHLJH.js';export{a as isObject}from'../../chunks/chunk-FGO2SSRS.js';export{a as isWorkerScope}from'../../chunks/chunk-QCRFVRSS.js';export{a as Deferred}from'../../chunks/chunk-O7TZTIHO.js';export{a as css}from'../../chunks/chunk-LSZZVJ6B.js';export{a as fromEntries}from'../../chunks/chunk-RG272MAJ.js';export{a as debounce}from'../../chunks/chunk-R6E4CT22.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="emscripten" />
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (C) 2024 Scandit AG. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Polyfill loader utility
|
|
6
|
+
* This module handles the dynamic loading of various polyfills needed for browser compatibility.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Options for polyfill loading
|
|
10
|
+
*/
|
|
11
|
+
interface PolyfillOptions {
|
|
12
|
+
/** Whether to force loading the animation polyfill */
|
|
13
|
+
forceAnimationPolyfill?: boolean;
|
|
14
|
+
/** Whether to force loading the structuredClone polyfill */
|
|
15
|
+
forceStructuredClonePolyfill?: boolean;
|
|
16
|
+
/** Whether to force loading all polyfills */
|
|
17
|
+
forceAllPolyfills?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Loads all necessary polyfills for browser compatibility
|
|
21
|
+
* @param options Polyfill loading options
|
|
22
|
+
*/
|
|
23
|
+
declare function loadPolyfills(options?: PolyfillOptions): Promise<void>;
|
|
24
|
+
|
|
25
|
+
export { type PolyfillOptions, loadPolyfills };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as loadPolyfills}from'../../chunks/chunk-GC2ECHKL.js';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Size } from '../../Common.js';
|
|
3
3
|
import { Optional } from '../../tsHelper.js';
|
|
4
4
|
import '../../ScanditIcon.js';
|
|
5
|
-
import '../../Camera-
|
|
5
|
+
import '../../Camera-Bpnu6h9d.js';
|
|
6
6
|
import '../Serializable.js';
|
|
7
7
|
import './ScanditHTMLElement.js';
|
|
8
8
|
import '../FrameReaders/WatermarkStack.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="emscripten" />
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (C) 2024 Scandit AG. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* structuredClone polyfill for older browsers
|
|
6
|
+
* This polyfill provides a fallback implementation when structuredClone is not available.
|
|
7
|
+
* Based on the polyfill from https://github.com/ungap/structured-clone
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Registers the structuredClone polyfill if it's not already available
|
|
11
|
+
* @returns true if the polyfill was applied, false if structuredClone already exists
|
|
12
|
+
*/
|
|
13
|
+
declare function structuredClonePolyfill(): boolean;
|
|
14
|
+
|
|
15
|
+
export { structuredClonePolyfill };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e))return e.map(t=>n(t));if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){let t=new Map;for(let[l,u]of e)t.set(n(l),n(u));return t}if(e instanceof Set){let t=new Set;for(let l of e)t.add(n(l));return t}let r={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=n(e[t]));return r}function a(){return typeof globalThis.structuredClone=="function"?false:(Object.defineProperty(globalThis,"structuredClone",{value:r=>n(r),writable:true,configurable:true}),true)}export{a as structuredClonePolyfill};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a as a$1}from'../../chunks/chunk-
|
|
1
|
+
import {a as a$1}from'../../chunks/chunk-UCD6YLP3.js';import {a as a$2}from'../../chunks/chunk-XR65N6EG.js';async function a(){let[{missingFeatures:t},i]=await Promise.all([a$1.checkBrowserCompatibility(),a$1.checkMultithreadingSupport()]);i||(a$2.warn("Multithreading is not supported."),t.includes("crossOriginIsolated")&&a$2.warn("Headers for Multithreading are absent or misconfigured: please check how to configure them properly: https://docs.scandit.com/sdks/web/matrixscan/get-started#enable-browser-multithreading"),t.includes("sharedArrayBuffer")&&a$2.warn("SharedArrayBuffer not supported. Check the requirements here: https://docs.scandit.com/system-requirements#web-sdk"));}
|
|
2
2
|
export{a as warnMultithreadingUnavailable};
|
package/build/js/sdk.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="emscripten" />
|
|
2
2
|
import { LoadingStatus } from './LoadingStatus.js';
|
|
3
3
|
import './ScanditIcon.js';
|
|
4
|
-
import { D as DataCaptureLoader } from './Camera-
|
|
4
|
+
import { D as DataCaptureLoader } from './Camera-Bpnu6h9d.js';
|
|
5
5
|
import './Common.js';
|
|
6
6
|
import './private/Serializable.js';
|
|
7
7
|
import './private/utils/ScanditHTMLElement.js';
|
|
@@ -22,16 +22,31 @@ import './private/HtmlElementState.js';
|
|
|
22
22
|
import './worker/OverrideState.js';
|
|
23
23
|
import './logger.js';
|
|
24
24
|
|
|
25
|
+
type ConfigurePhase = "done" | "started" | "unconfigured";
|
|
25
26
|
interface SDKGlobals {
|
|
26
|
-
configurePhase:
|
|
27
|
-
configurePromise: Promise<void
|
|
28
|
-
userLicenseKey: string;
|
|
29
|
-
mainDataCaptureLoader: DataCaptureLoader;
|
|
27
|
+
configurePhase: ConfigurePhase;
|
|
28
|
+
configurePromise: Promise<void> | null;
|
|
29
|
+
userLicenseKey: string | null;
|
|
30
|
+
mainDataCaptureLoader: DataCaptureLoader | undefined;
|
|
30
31
|
dataCaptureLoaders: Map<string, DataCaptureLoader>;
|
|
31
32
|
loadingStatus: LoadingStatus;
|
|
32
33
|
libraryLocation: string | undefined;
|
|
33
34
|
}
|
|
34
35
|
type PartialSDKGlobals = Partial<SDKGlobals>;
|
|
35
|
-
declare
|
|
36
|
+
declare class SDK extends EventTarget implements SDKGlobals {
|
|
37
|
+
userLicenseKey: string | null;
|
|
38
|
+
mainDataCaptureLoader: DataCaptureLoader | undefined;
|
|
39
|
+
dataCaptureLoaders: Map<string, DataCaptureLoader>;
|
|
40
|
+
loadingStatus: LoadingStatus;
|
|
41
|
+
libraryLocation: string | undefined;
|
|
42
|
+
private _configurePhase;
|
|
43
|
+
private _configurePromise;
|
|
44
|
+
constructor();
|
|
45
|
+
set configurePhase(value: ConfigurePhase);
|
|
46
|
+
get configurePhase(): ConfigurePhase;
|
|
47
|
+
set configurePromise(value: Promise<void> | null);
|
|
48
|
+
get configurePromise(): Promise<void> | null;
|
|
49
|
+
}
|
|
50
|
+
declare const sdk: SDK;
|
|
36
51
|
|
|
37
|
-
export { type PartialSDKGlobals, sdk };
|
|
52
|
+
export { type ConfigurePhase, type PartialSDKGlobals, type SDKGlobals, sdk };
|
package/build/js/sdk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as sdk}from'./chunks/chunk-
|
|
1
|
+
export{a as sdk}from'./chunks/chunk-NKCR7VPO.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="emscripten" />
|
|
2
|
-
import {
|
|
2
|
+
import { X as DataCaptureEngine, Y as Module, _ as AnyDataCaptureActionMessage, $ as AugmentedWorker, a0 as ModuleHandler, a1 as DataCaptureCallbackMessage, a2 as DataCaptureActionMessageKey, a3 as EngineWorkerResponse } from '../Camera-Bpnu6h9d.js';
|
|
3
3
|
import '../private/Serializable.js';
|
|
4
4
|
import '../Common.js';
|
|
5
5
|
import '../private/FrameReaders/WatermarkStack.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as WorkerMain}from'../chunks/chunk-
|
|
1
|
+
export{a as WorkerMain}from'../chunks/chunk-ESVB4WW6.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="emscripten" />
|
|
2
|
-
import {
|
|
2
|
+
import { X as DataCaptureEngine, Y as Module } from '../Camera-Bpnu6h9d.js';
|
|
3
3
|
import { WorkerMain } from './WorkerMain.js';
|
|
4
4
|
import '../private/Serializable.js';
|
|
5
5
|
import '../Common.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as InlineWorker,a as workerInstance}from'../chunks/chunk-
|
|
1
|
+
export{b as InlineWorker,a as workerInstance}from'../chunks/chunk-SFJIWITJ.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="emscripten" />
|
|
2
|
-
export { bf as CreateContextParameters,
|
|
2
|
+
export { bf as CreateContextParameters, X as DataCaptureEngine, be as LoadLibraryParameters, bi as ProcessFrameParameters, bj as ReportCameraPropertiesParameters, bh as SetFrameSourceParameters, bg as UpdateContextParameters, bk as WorkerFunctions } from '../Camera-Bpnu6h9d.js';
|
|
3
3
|
import './OverrideState.js';
|
|
4
4
|
import '../LoadingStatus.js';
|
|
5
5
|
import '../Common.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DataCaptureEngine}from'../chunks/chunk-
|
|
1
|
+
export{a as DataCaptureEngine}from'../chunks/chunk-KXSW5F3G.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="emscripten" />
|
|
2
2
|
import './OverrideState.js';
|
|
3
|
-
export { D as DataCaptureLoader, S as DataCaptureLoaderOptions } from '../Camera-
|
|
3
|
+
export { D as DataCaptureLoader, S as DataCaptureLoaderOptions } from '../Camera-Bpnu6h9d.js';
|
|
4
4
|
import '../logger.js';
|
|
5
5
|
import '../LoadingStatus.js';
|
|
6
6
|
import '../ScanditIcon.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="emscripten" />
|
|
2
2
|
import '../Common.js';
|
|
3
|
-
export { as as AddNativeOverlayAction, _ as AnyDataCaptureActionMessage, $ as AugmentedWorker, aW as CaptureModeDeserializerInstance, ab as CreateContextDataCaptureAction, a2 as DataCaptureActionMessageKey, a1 as DataCaptureCallbackMessage, au as DataCaptureCallbackMessageKeys, aO as DataCaptureContext, aV as DataCaptureContextDeserializer, aU as DataCaptureContextDeserializerResult, aP as DataCaptureImageBufferFrameSource, aS as DataCaptureView, aM as DataCaptureWorker, af as DeleteFrameDataDataCaptureAction, aB as DidTapTrackedBarcode, aj as DisposeDataCaptureAction, aN as EmscriptenClassHandle, a3 as EngineWorkerResponse, an as ExtractCentaurusLicenseDataCaptureAction, a4 as ExtractCentaurusLicenseResponse, ak as FlushAnalyticsDataCaptureAction, Z as GenericHint, aQ as GestureListener, aR as GestureRecognizer, ar as GetOpenSourceSoftwareLicenseInfoAction, a8 as GetOpenSourceSoftwareLicenseInfoResponse, a7 as GetViewfinderInfo, aq as GetViewfinderInfoAction, b8 as GuidanceHint, b6 as GuidanceHintAnchor, b7 as GuidanceHintStyle, aI as HideGuidanceMessage, az as HideHintWorkerMessage, aG as HideToastMessage, b4 as HintAnchor, b2 as HintCornerStyle, a_ as HintFont, b1 as HintHeight, b3 as HintIcon, bc as HintPresenterV2, ap as HintPresenterV2updateAction, b5 as HintStyle, a$ as HintTextAlignment, b0 as HintWidth, ah as IsFeatureSupportedAction, ay as IsFeatureSupportedMessage, a6 as IsFeatureSupportedResponse, aT as JSONParseable, bb as LicensedFeature, aa as LoadLibraryDataCaptureAction,
|
|
3
|
+
export { as as AddNativeOverlayAction, _ as AnyDataCaptureActionMessage, $ as AugmentedWorker, aW as CaptureModeDeserializerInstance, ab as CreateContextDataCaptureAction, a2 as DataCaptureActionMessageKey, a1 as DataCaptureCallbackMessage, au as DataCaptureCallbackMessageKeys, aO as DataCaptureContext, aV as DataCaptureContextDeserializer, aU as DataCaptureContextDeserializerResult, aP as DataCaptureImageBufferFrameSource, aS as DataCaptureView, aM as DataCaptureWorker, af as DeleteFrameDataDataCaptureAction, aB as DidTapTrackedBarcode, aj as DisposeDataCaptureAction, aN as EmscriptenClassHandle, a3 as EngineWorkerResponse, an as ExtractCentaurusLicenseDataCaptureAction, a4 as ExtractCentaurusLicenseResponse, ak as FlushAnalyticsDataCaptureAction, Z as GenericHint, aQ as GestureListener, aR as GestureRecognizer, ar as GetOpenSourceSoftwareLicenseInfoAction, a8 as GetOpenSourceSoftwareLicenseInfoResponse, a7 as GetViewfinderInfo, aq as GetViewfinderInfoAction, b8 as GuidanceHint, b6 as GuidanceHintAnchor, b7 as GuidanceHintStyle, aI as HideGuidanceMessage, az as HideHintWorkerMessage, aG as HideToastMessage, b4 as HintAnchor, b2 as HintCornerStyle, a_ as HintFont, b1 as HintHeight, b3 as HintIcon, bc as HintPresenterV2, ap as HintPresenterV2updateAction, b5 as HintStyle, a$ as HintTextAlignment, b0 as HintWidth, ah as IsFeatureSupportedAction, ay as IsFeatureSupportedMessage, a6 as IsFeatureSupportedResponse, aT as JSONParseable, bb as LicensedFeature, aa as LoadLibraryDataCaptureAction, Y as Module, a0 as ModuleHandler, aX as ModuleMirrorAxis, aD as OnFrameProcessingFinishedMessage, aC as OnFrameProcessingStartedMessage, aE as OnFrameSkippedMessage, ao as OnTapAction, aL as PayloadForCommand, W as PerformanceMetrics, aA as PerformanceMetricsReportMessage, bd as PlatformHintPresenter, ad as ProcessFrameDataCaptureAction, at as RemoveNativeOverlayAction, al as ReportCameraPropertiesDataCaptureAction, ae as RequestFrameDataDataCaptureAction, a5 as RequestFrameDataResponse, ac as SetFrameSourceDataCaptureAction, am as SetLogLevelDataCaptureAction, aH as ShowGuidanceMessage, aw as ShowHintWorkerMessage, aF as ShowToastMessage, aJ as StartUpdateTimerMessage, aK as StopUpdateTimerMessage, av as SuccessFeedbackWorkerMessage, ba as ToastHint, b9 as ToastHintStyle, ai as UpdateContextDataCaptureAction, ax as UpdateHintWorkerMessage, aY as Vector, ag as VisibilityChangeAction, aZ as WasmFrameData, a9 as WorkerResponse } from '../Camera-Bpnu6h9d.js';
|
|
4
4
|
import '../LoadingStatus.js';
|
|
5
5
|
import '../logger.js';
|
|
6
6
|
import '../private/Serializable.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="emscripten" />
|
|
2
2
|
export { WorkerMain } from './WorkerMain.js';
|
|
3
|
-
export { as as AddNativeOverlayAction, _ as AnyDataCaptureActionMessage, $ as AugmentedWorker, aW as CaptureModeDeserializerInstance, ab as CreateContextDataCaptureAction, bf as CreateContextParameters, a2 as DataCaptureActionMessageKey, a1 as DataCaptureCallbackMessage, au as DataCaptureCallbackMessageKeys, aO as DataCaptureContext, aV as DataCaptureContextDeserializer, aU as DataCaptureContextDeserializerResult,
|
|
3
|
+
export { as as AddNativeOverlayAction, _ as AnyDataCaptureActionMessage, $ as AugmentedWorker, aW as CaptureModeDeserializerInstance, ab as CreateContextDataCaptureAction, bf as CreateContextParameters, a2 as DataCaptureActionMessageKey, a1 as DataCaptureCallbackMessage, au as DataCaptureCallbackMessageKeys, aO as DataCaptureContext, aV as DataCaptureContextDeserializer, aU as DataCaptureContextDeserializerResult, X as DataCaptureEngine, aP as DataCaptureImageBufferFrameSource, D as DataCaptureLoader, S as DataCaptureLoaderOptions, aS as DataCaptureView, aM as DataCaptureWorker, af as DeleteFrameDataDataCaptureAction, aB as DidTapTrackedBarcode, aj as DisposeDataCaptureAction, aN as EmscriptenClassHandle, a3 as EngineWorkerResponse, an as ExtractCentaurusLicenseDataCaptureAction, a4 as ExtractCentaurusLicenseResponse, ak as FlushAnalyticsDataCaptureAction, Z as GenericHint, aQ as GestureListener, aR as GestureRecognizer, ar as GetOpenSourceSoftwareLicenseInfoAction, a8 as GetOpenSourceSoftwareLicenseInfoResponse, a7 as GetViewfinderInfo, aq as GetViewfinderInfoAction, b8 as GuidanceHint, b6 as GuidanceHintAnchor, b7 as GuidanceHintStyle, aI as HideGuidanceMessage, az as HideHintWorkerMessage, aG as HideToastMessage, b4 as HintAnchor, b2 as HintCornerStyle, a_ as HintFont, b1 as HintHeight, b3 as HintIcon, bc as HintPresenterV2, ap as HintPresenterV2updateAction, b5 as HintStyle, a$ as HintTextAlignment, b0 as HintWidth, ah as IsFeatureSupportedAction, ay as IsFeatureSupportedMessage, a6 as IsFeatureSupportedResponse, aT as JSONParseable, bb as LicensedFeature, aa as LoadLibraryDataCaptureAction, be as LoadLibraryParameters, Y as Module, a0 as ModuleHandler, aX as ModuleMirrorAxis, aD as OnFrameProcessingFinishedMessage, aC as OnFrameProcessingStartedMessage, aE as OnFrameSkippedMessage, ao as OnTapAction, aL as PayloadForCommand, W as PerformanceMetrics, aA as PerformanceMetricsReportMessage, bd as PlatformHintPresenter, ad as ProcessFrameDataCaptureAction, bi as ProcessFrameParameters, at as RemoveNativeOverlayAction, al as ReportCameraPropertiesDataCaptureAction, bj as ReportCameraPropertiesParameters, ae as RequestFrameDataDataCaptureAction, a5 as RequestFrameDataResponse, ac as SetFrameSourceDataCaptureAction, bh as SetFrameSourceParameters, am as SetLogLevelDataCaptureAction, aH as ShowGuidanceMessage, aw as ShowHintWorkerMessage, aF as ShowToastMessage, aJ as StartUpdateTimerMessage, aK as StopUpdateTimerMessage, av as SuccessFeedbackWorkerMessage, ba as ToastHint, b9 as ToastHintStyle, ai as UpdateContextDataCaptureAction, bg as UpdateContextParameters, ax as UpdateHintWorkerMessage, aY as Vector, ag as VisibilityChangeAction, aZ as WasmFrameData, bk as WorkerFunctions, a9 as WorkerResponse } from '../Camera-Bpnu6h9d.js';
|
|
4
4
|
import '../private/Serializable.js';
|
|
5
5
|
import '../Common.js';
|
|
6
6
|
import '../private/FrameReaders/WatermarkStack.js';
|
package/build/js/worker/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DataCaptureLoader}from'../chunks/chunk-VGSPU525.js';export{a as WorkerMain}from'../chunks/chunk-
|
|
1
|
+
export{a as DataCaptureLoader}from'../chunks/chunk-VGSPU525.js';export{a as WorkerMain}from'../chunks/chunk-ESVB4WW6.js';export{a as DataCaptureEngine}from'../chunks/chunk-KXSW5F3G.js';export{h as GuidanceHintAnchor,i as GuidanceHintStyle,g as HintAnchor,e as HintCornerStyle,a as HintFont,d as HintHeight,f as HintIcon,b as HintTextAlignment,c as HintWidth,k as LicensedFeature,j as ToastHintStyle}from'../chunks/chunk-L7TY4UEP.js';
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e;(o=>{function i(){let r="7.5.1";return r}o.sdkVersion=i;})(e||(e={}));export{e as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {b,a as a$1}from'./chunk-77BBIAZE.js';var a=class m extends b{constructor(r,n,i,e,t,h,p,s,c){super(r,n,i,e),this._centerLeft=t,this._topCenter=h,this._centerRight=p,this._bottomCenter=s,this._center=c;}get centerRight(){return this._centerRight}get center(){return this._center}get centerLeft(){return this._centerLeft}get topCenter(){return this._topCenter}get bottomCenter(){return this._bottomCenter}static fromJSON(r){let{topLeft:n,topRight:i,bottomRight:e,bottomLeft:t,centerLeft:h,topCenter:p,centerRight:s,bottomCenter:c,center:P}=r,b=a$1.fromJSON(n),O=a$1.fromJSON(i),l=a$1.fromJSON(e),y=a$1.fromJSON(t),S=a$1.fromJSON(h),x=a$1.fromJSON(p),J=a$1.fromJSON(s),N=a$1.fromJSON(c),g=a$1.fromJSON(P);return new m(b,O,l,y,S,x,J,N,g)}toJSONObject(){return {...super.toJSONObject(),center:this._center.toJSONObject(),bottomCenter:this._bottomCenter.toJSONObject(),topCenter:this._topCenter.toJSONObject(),centerLeft:this._centerLeft.toJSONObject(),centerRight:this._centerRight.toJSONObject()}}orderVerticesByPosition(){let r=[[this.topLeft,this.topRight],[this.topRight,this.bottomRight],[this.bottomRight,this.bottomLeft],[this.bottomLeft,this.topLeft]],n=r.reduce((s,c)=>{let P=new a$1((s[0].x+s[1].x)/2,(s[0].y+s[1].y)/2),b=new a$1((c[0].x+c[1].x)/2,(c[0].y+c[1].y)/2);return P.y<b.y?s:c},r[0]),i=n[0].x<=n[1].x?n[0]:n[1],e=n[0].x>n[1].x?n[0]:n[1],t=[this.topLeft,this.topRight,this.bottomLeft,this.bottomRight].filter(s=>!s.equals(i)&&!s.equals(e)),h=new m(i,e,t[0],t[1],new a$1((i.x+t[1].x)/2,(i.y+t[1].y)/2),new a$1((i.x+e.x)/2,(i.y+e.y)/2),new a$1((e.x+t[0].x)/2,(e.y+t[0].y)/2),new a$1((t[1].x+t[0].x)/2,(t[1].y+t[0].y)/2),this.center),p=new m(i,e,t[1],t[0],new a$1((i.x+t[0].x)/2,(i.y+t[0].y)/2),new a$1((i.x+e.x)/2,(i.y+e.y)/2),new a$1((e.x+t[1].x)/2,(e.y+t[1].y)/2),new a$1((t[0].x+t[1].x)/2,(t[0].y+t[1].y)/2),this.center);return this.getArea(h)>=this.getArea(p)?h:p}getArea(r){let n=[r.topLeft,r.topRight,r.bottomRight,r.bottomLeft,r.topLeft],i=0;for(let e=0;e<n.length-1;e++)i+=n[e].x*n[e+1].y-n[e+1].x*n[e].y;return Math.abs(i)/2}};export{a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-QEWYPYNF.js';var t=new a(globalThis,{get:()=>globalThis.Module,set:e=>{globalThis.Module=e;}});function l(e){}export{t as a,l as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var u=class e{constructor(t,i){this._x=t,this._y=i;}get x(){return this._x}get y(){return this._y}static mirrorX(t,i){let r=t.x-i.width;return r*=-1,new e(r,t.y)}static fromJSON(t){return new e(t.x,t.y)}toJSONObject(){return {x:this.x,y:this.y}}equals(t){return this.x===t.x&&this.y===t.y}},m=class e{constructor(t,i,r,o){this._topLeft=t,this._topRight=i,this._bottomRight=r,this._bottomLeft=o;}get topLeft(){return this._topLeft}get topRight(){return this._topRight}get bottomRight(){return this._bottomRight}get bottomLeft(){return this._bottomLeft}static fromJSON(t){return new e(u.fromJSON(t.topLeft),u.fromJSON(t.topRight),u.fromJSON(t.bottomRight),u.fromJSON(t.bottomLeft))}toJSONObject(){return {topLeft:this.topLeft.toJSONObject(),topRight:this.topRight.toJSONObject(),bottomLeft:this.bottomLeft.toJSONObject(),bottomRight:this.bottomRight.toJSONObject()}}},W=(i=>(i.Pixel="pixel",i.Fraction="fraction",i))(W||{}),n=class e{constructor(t,i){this._value=t,this._unit=i;}get value(){return this._value}get unit(){return this._unit}static fromJSON(t){return new e(t.value,t.unit)}toJSONObject(){return {unit:this.unit,value:this.value}}},S=class e{constructor(t,i){this._x=t,this._y=i;}static get zero(){return new e(new n(0,"pixel"),new n(0,"pixel"))}get x(){return this._x}get y(){return this._y}static fromJSON(t){return new e(n.fromJSON(t.x),n.fromJSON(t.y))}toJSONObject(){return {x:this.x.toJSONObject(),y:this.y.toJSONObject()}}},g=class{constructor(t,i){this._origin=t,this._size=i;}get origin(){return this._origin}get size(){return this._size}toJSONObject(){return {origin:this.origin.toJSONObject(),size:this.size.toJSONObject()}}},N=class{constructor(t,i){this._origin=t,this._size=i;}get origin(){return this._origin}get size(){return this._size}toJSONObject(){return {origin:this._origin.toJSONObject(),size:this._size.toJSONObject()}}},l=class e{constructor(t,i){this._width=t,this._height=i;}get width(){return this._width}get height(){return this._height}static fromJSON(t){return new e(n.fromJSON(t.width),n.fromJSON(t.height))}isSameAs(t){return JSON.stringify(this.toJSONObject())===JSON.stringify(t.toJSONObject())}toJSONObject(){return {width:this.width.toJSONObject(),height:this.height.toJSONObject()}}},d=class e{constructor(t,i){this._width=t,this._height=i;}get width(){return this._width}get height(){return this._height}static fromJSON(t){return new e(t.width,t.height)}toJSONObject(){return {height:this.height,width:this.width}}},p=class{constructor(t,i){this._size=t,this._aspect=i;}get size(){return this._size}get aspect(){return this._aspect}},f=(o=>(o.WidthAndHeight="widthAndHeight",o.WidthAndAspectRatio="widthAndAspectRatio",o.HeightAndAspectRatio="heightAndAspectRatio",o.ShorterDimensionAndAspectRatio="shorterDimensionAndAspectRatio",o))(f||{}),O=class e{constructor(){this._shorterDimensionAndAspectRatio=null;}get widthAndHeight(){return this._widthAndHeight}get widthAndAspectRatio(){return this._widthAndAspectRatio}get heightAndAspectRatio(){return this._heightAndAspectRatio}get shorterDimensionAndAspectRatio(){return this._shorterDimensionAndAspectRatio}get sizingMode(){return this.widthAndAspectRatio?"widthAndAspectRatio":this.heightAndAspectRatio?"heightAndAspectRatio":this.shorterDimensionAndAspectRatio?"shorterDimensionAndAspectRatio":"widthAndHeight"}static sizeWithWidthAndHeight(t){let i=new e;return i._widthAndHeight=t,i}static sizeWithWidthAndAspectRatio(t,i){let r=new e;return r._widthAndAspectRatio=new p(t,i),r}static sizeWithHeightAndAspectRatio(t,i){let r=new e;return r._heightAndAspectRatio=new p(t,i),r}static sizeWithShorterDimensionAndAspectRatio(t,i){let r=new e;return r._shorterDimensionAndAspectRatio=new p(t,i),r}static fromJSON(t){if(t.width&&t.height)return e.sizeWithWidthAndHeight(new l(n.fromJSON(t.width),n.fromJSON(t.height)));if(t.width&&typeof t.aspect=="number")return e.sizeWithWidthAndAspectRatio(n.fromJSON(t.width),t.aspect);if(t.height&&typeof t.aspect=="number")return e.sizeWithHeightAndAspectRatio(n.fromJSON(t.height),t.aspect);if(t.shorterDimension&&typeof t.aspect=="number")return e.sizeWithShorterDimensionAndAspectRatio(n.fromJSON(t.shorterDimension),t.aspect);throw new Error(`SizeWithUnitAndAspectJSON is malformed: ${JSON.stringify(t)}`)}toJSONObject(){var t,i,r,o,s,c,h,b;switch(this.sizingMode){case "widthAndAspectRatio":return {width:(t=this.widthAndAspectRatio)==null?void 0:t.size.toJSONObject(),aspect:(i=this.widthAndAspectRatio)==null?void 0:i.aspect};case "heightAndAspectRatio":return {height:(r=this.heightAndAspectRatio)==null?void 0:r.size.toJSONObject(),aspect:(o=this.heightAndAspectRatio)==null?void 0:o.aspect};case "shorterDimensionAndAspectRatio":return {shorterDimension:(s=this.shorterDimensionAndAspectRatio)==null?void 0:s.size.toJSONObject(),aspect:(c=this.shorterDimensionAndAspectRatio)==null?void 0:c.aspect};default:return {width:(h=this.widthAndHeight)==null?void 0:h.width.toJSONObject(),height:(b=this.widthAndHeight)==null?void 0:b.height.toJSONObject()}}}},J=class e{constructor(t,i,r,o){this._left=t,this._top=i,this._right=r,this._bottom=o;}static get zero(){return new e(new n(0,"pixel"),new n(0,"pixel"),new n(0,"pixel"),new n(0,"pixel"))}get left(){return this._left}get right(){return this._right}get top(){return this._top}get bottom(){return this._bottom}static fromJSON(t){return new e(n.fromJSON(t.left),n.fromJSON(t.top),n.fromJSON(t.right),n.fromJSON(t.bottom))}toJSONObject(){return {left:this.left.toJSONObject(),right:this.right.toJSONObject(),top:this.top.toJSONObject(),bottom:this.bottom.toJSONObject()}}},A=class e{constructor(t){this.hexadecimalString=t;}get redComponent(){return this.hexadecimalString.slice(0,2)}get greenComponent(){return this.hexadecimalString.slice(2,4)}get blueComponent(){return this.hexadecimalString.slice(4,6)}get alphaComponent(){return this.hexadecimalString.slice(6,8)}get red(){return e.hexToNumber(this.redComponent)}get green(){return e.hexToNumber(this.greenComponent)}get blue(){return e.hexToNumber(this.blueComponent)}get alpha(){return e.hexToNumber(this.alphaComponent)}static fromHex(t){return new e(e.normalizeHex(t))}static fromRGBA(t,i,r,o=1){let s=[t,i,r,e.normalizeAlpha(o)].reduce((c,h)=>c+e.numberToHex(h),"");return new e(s)}static areEquals(t,i){return t==null||i==null?false:t.hexadecimalString===i.hexadecimalString}static hexToNumber(t){return Number.parseInt(t,16)}static fromJSON(t){return e.fromHex(t)}static numberToHex(t){let r=Math.round(t).toString(16);return r.length===1&&(r=`0${r}`),r.toUpperCase()}static normalizeHex(t){let i=t;return i.startsWith("#")&&(i=i.slice(1)),i.length<6&&(i=[...i].map(r=>r+r).join("")),i.length===6&&(i+="FF"),i.toUpperCase()}static normalizeAlpha(t){return t>0&&t<=1?255*t:t}withAlpha(t){let i=this.hexadecimalString.slice(0,6)+e.numberToHex(e.normalizeAlpha(t));return e.fromHex(i)}toJSON(){return this.hexadecimalString}},U=(s=>(s.Unknown="unknown",s.Portrait="portrait",s.PortraitUpsideDown="portraitUpsideDown",s.LandscapeRight="landscapeRight",s.LandscapeLeft="landscapeLeft",s))(U||{}),z=(h=>(h.None="none",h.Horizontal="horizontal",h.LeftToRight="leftToRight",h.RightToLeft="rightToLeft",h.Vertical="vertical",h.TopToBottom="topToBottom",h.BottomToTop="bottomToTop",h))(z||{}),x=(a=>(a.TopLeft="topLeft",a.TopCenter="topCenter",a.TopRight="topRight",a.CenterLeft="centerLeft",a.Center="center",a.CenterRight="centerRight",a.BottomLeft="bottomLeft",a.BottomCenter="bottomCenter",a.BottomRight="bottomRight",a))(x||{});export{u as a,m as b,W as c,n as d,S as e,g as f,N as g,l as h,d as i,p as j,f as k,O as l,J as m,A as n,U as o,z as p,x as q};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$5}from'./chunk-7B2VPGLP.js';import {b as b$1}from'./chunk-ULRY4SXF.js';import {b}from'./chunk-FTD535WI.js';import {a}from'./chunk-R6E4CT22.js';import {a as a$6}from'./chunk-JKL2W65E.js';import {d}from'./chunk-UOEN3RFJ.js';import {a as a$3}from'./chunk-QCZSSQAQ.js';import {a as a$1}from'./chunk-6VWIJ62O.js';import {a as a$2}from'./chunk-XR65N6EG.js';import {f,a as a$4,i}from'./chunk-77BBIAZE.js';var k=(r=>(r.CONTINUOUS="continuous",r.MANUAL="manual",r.NONE="none",r.SINGLE_SHOT="single-shot",r))(k||{}),F=(s=>(s[s.ULTRA_HD=0]="ULTRA_HD",s[s.FULL_HD=1]="FULL_HD",s[s.HD=2]="HD",s[s.SD=3]="SD",s[s.NONE=4]="NONE",s))(F||{}),P=(t=>(t.CAMERA_PROPERTIES="cameraProperties",t.CAMERA_ACCESS_ERROR="cameraAccessError",t))(P||{}),o=class o{constructor(){this.constraint=4;this.checkCameraVideoStreamAccessIfVisibleListener=this.checkCameraVideoStreamAccessIfVisible.bind(this);this.handleWebGLContextLostListener=this.handleWebGLContextLost.bind(this);this.listeners=new Map;this.mirrorImageOverrides=new Map;this.postStreamInitializationListener=this.postStreamInitialization.bind(this);this.triggerManualFocusListener=this.triggerManualFocus.bind(this);this.triggerZoomMoveListener=this.triggerZoomMove.bind(this);this.triggerZoomStartListener=this.triggerZoomStart.bind(this);this.videoResizeListener=a(this.handleVideoResize.bind(this),500);this.videoTrackEndedListener=this.videoTrackEndedRecovery.bind(this);this.videoTrackMuteListener=this.videoTrackMuteRecovery.bind(this);this._synchronousFrameHandling=false;this._glFrameReaders={GRAYSCALE:null,RGBA:null};this._frameReaderType="RGBA";this.isVideoStreamPaused=false;this.cameraPosition="worldFacing",this.gui={isCameraRecoveryVisible:()=>false,setCameraRecoveryVisible:()=>{}},this.isWebGLSupported=!a$1.checkBrowserCompatibility().missingFeatures.includes("webGL"),this.videoElement=document.createElement("video"),this.canvas=document.createElement("canvas"),this.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLostListener);}get mediaStream(){return this._mediaStream}set mediaStream(e){this._mediaStream=e,e&&(this.mediaTrackCapabilitiesPromise=new Promise(t=>{this.mediaTrackCapabilitiesPromiseResolver=t;}));}get synchronousFrameHandling(){return this._synchronousFrameHandling}get canvas2dContext(){return this._canvas2dContext||(this._canvas2dContext=this.canvas.getContext("2d",{willReadFrequently:true}),this._canvas2dContext==null&&a$2.log(a$2.Level.Warn,"Unable to get 2d canvas context"),this.handleVideoResize()),this._canvas2dContext}get canvasWebGLContext(){var e;if(!this._canvas2dContext&&!this._canvasWebGLContext){if(!this.isWebGLSupported){a$2.log(a$2.Level.Warn,"WebGL context not supported, falling back to 2d canvas context. This may impact the scanning performance.");return}let t=(e=this.canvas.getContext("webgl",{alpha:false,antialias:false}))!=null?e:this.canvas.getContext("experimental-webgl",{alpha:false,antialias:false});t!=null&&(this._canvasWebGLContext=t,this.handleVideoResize());}return this._canvasWebGLContext}static instance(){return o._instance==null&&(o._instance=new o),o._instance}recycle(e){var t;(t=this.getFrameReader())==null||t.recycle(e);}getCurrentFrame(){var e;return (e=this._glFrameReaders.RGBA)==null?void 0:e.readFromSource(this.videoElement)}requestVideoFrame(e,t=this.videoElement){return "requestVideoFrameCallback"in HTMLVideoElement.prototype?t.requestVideoFrameCallback(e):requestAnimationFrame(e)}cancelVideoFrame(e,t=this.videoElement){if("cancelVideoFrameCallback"in HTMLVideoElement.prototype){t.cancelVideoFrameCallback(e);return}cancelAnimationFrame(e);}addListener(e,t){var r;let i=(r=this.listeners.get(e))!=null?r:[];i.includes(t)||this.listeners.set(e,[...i,t]);}async applyCameraSettings(e){if(this.selectedCameraSettings=e,this.activeCamera==null)throw new a$3(o.noCameraErrorParameters);return this.initializeCameraWithSettings(this.activeCamera,e)}captureImage(){var e;if(((e=this.mediaStream)==null?void 0:e.active)!=null){if(this.canvasWebGLContext!=null)return this.captureImageForWebGLContext();if(this.canvas2dContext!=null)return this.captureImageFor2dContext()}return null}async initializeCameraWithSettings(e,t){if(this.cameraInitializationPromise&&await this.cameraInitializationPromise,e==null)throw new a$3(o.noCameraErrorParameters);return this.setSelectedCamera(e),this.selectedCameraSettings=t,this.activeCameraSettings=t,this.cameraInitializationPromise=this.initializeCameraAndCheckUpdatedSettings(e),this.cameraInitializationPromise}isMirrorImageEnabled(){if(this.selectedCamera&&this.activeCamera){let e=this.mirrorImageOverrides.get(this.activeCamera);return e!=null?e:this.activeCamera.position==="userFacing"}return false}isPinchToZoomEnabled(){return this.pinchToZoomEnabled}isTapToFocusEnabled(){return this.tapToFocusEnabled}async isTorchAvailable(){var e;return this.mediaStream?(await this.waitForCapabilities(),((e=this.mediaTrackCapabilities)==null?void 0:e.torch)===true):false}async playVideo(){return new Promise(e=>{this._canvas2dContext&&this._canvas2dContext.clearRect(0,0,this.canvas.width,this.canvas.height);let t=this.videoElement.play();t==null?e():t.then(e).catch(()=>{e();});})}async reinitializeCamera(){if(this.activeCamera==null)a$2.log(a$2.Level.Debug,"Camera reinitialization delayed");else {a$2.log(a$2.Level.Debug,"Reinitialize camera:",this.activeCamera);try{let e=this.activeCamera;await this.stopStream(),await this.initializeCameraWithSettings(e,this.activeCameraSettings);}catch(e){throw a$2.log(a$2.Level.Warn,"Couldn't access camera:",this.activeCamera,e),this.emit("cameraAccessError",e),e}}}removeListener(e,t){var s;let r=((s=this.listeners.get(e))!=null?s:[]).filter(n=>n!==t);this.listeners.set(e,r);}async setCameraPosition(e){var i;this.setInitialCameraPosition(e);let t=d.getMainCameraForPosition(await d.getCameras(),e);if(t&&t.deviceId!==((i=this.selectedCamera)==null?void 0:i.deviceId))return this.initializeCameraWithSettings(t,this.selectedCameraSettings)}async setExposure(e){var r,s,n,c,d,l,v,p;let t=(s=(r=this.mediaStream)==null?void 0:r.getVideoTracks())!=null?s:[];if(t.length===0||typeof t[0].applyConstraints!="function")return;await this.waitForCapabilities();let i=e.time!=null&&e.time>0?"manual":"continuous";if(((c=(n=this.mediaTrackCapabilities)==null?void 0:n.exposureMode)==null?void 0:c.includes(i))===true){if(await t[0].applyConstraints({advanced:[{exposureMode:i}]}),e.time!=null&&e.time>0&&this.mediaTrackCapabilities.exposureTime){let u=Math.max((d=this.mediaTrackCapabilities.exposureTime.min)!=null?d:.01,Math.min(e.time,(l=this.mediaTrackCapabilities.exposureTime.max)!=null?l:1e5));await t[0].applyConstraints({advanced:[{exposureTime:u}]});}else if(e.compensation!=null&&i==="continuous"&&this.mediaTrackCapabilities.exposureCompensation){let u=Math.max((v=this.mediaTrackCapabilities.exposureCompensation.min)!=null?v:-10,Math.min(e.compensation,(p=this.mediaTrackCapabilities.exposureCompensation.max)!=null?p:10));await t[0].applyConstraints({advanced:[{exposureCompensation:u}]});}}}async setFocus(e){var i,r,s,n,c;if(!this.mediaStream)return;let t=this.mediaStream.getVideoTracks();if(t.length>0&&typeof t[0].applyConstraints=="function"){await this.waitForCapabilities();let d=e>=0?"manual":"continuous";if(((r=(i=this.mediaTrackCapabilities)==null?void 0:i.focusMode)==null?void 0:r.includes(d))===true&&(await t[0].applyConstraints({advanced:[{focusMode:d}]}),d==="manual"&&this.mediaTrackCapabilities.focusDistance)){let l=Math.max(0,Math.min(e,1))*(((s=this.mediaTrackCapabilities.focusDistance.max)!=null?s:1e3)-((n=this.mediaTrackCapabilities.focusDistance.min)!=null?n:.01))+((c=this.mediaTrackCapabilities.focusDistance.min)!=null?c:.01);await t[0].applyConstraints({advanced:[{focusDistance:l}]});}}}async setFrameRate(e){var t,i,r;if(this.mediaStream&&(await this.waitForCapabilities(),(t=this.mediaTrackCapabilities)!=null&&t.frameRate)){let s=this.mediaStream.getVideoTracks();if(s.length>0&&typeof s[0].applyConstraints=="function"){let n=Math.min((i=this.mediaTrackCapabilities.frameRate.max)!=null?i:240,(r=e.max)!=null?r:240);await s[0].applyConstraints({advanced:[{frameRate:n}]});}}}setInitialCameraPosition(e){this.cameraPosition=e;}setInteractionOptions(e,t,i){this.torchToggleEnabled=e,this.tapToFocusEnabled=t,this.pinchToZoomEnabled=i;}setMirrorImageEnabled(e,t){this.selectedCamera&&(e?(this.videoElement.classList.add(o.MIRRORED_CLASS_NAME),this.canvas.classList.add(o.MIRRORED_CLASS_NAME)):(this.videoElement.classList.remove(o.MIRRORED_CLASS_NAME),this.canvas.classList.remove(o.MIRRORED_CLASS_NAME)),t&&this.mirrorImageOverrides.set(this.selectedCamera,e));}setPinchToZoomEnabled(e){this.pinchToZoomEnabled=e,this.mediaStream&&(this.pinchToZoomEnabled?this.enablePinchToZoomListeners():this.disablePinchToZoomListeners());}setSelectedCamera(e){this.selectedCamera=e;}setSelectedCameraSettings(e){this.selectedCameraSettings=e;}setTapToFocusEnabled(e){this.tapToFocusEnabled=e,this.mediaStream&&(this.tapToFocusEnabled?this.enableTapToFocusListeners():this.disableTapToFocusListeners());}async setTorchEnabled(e){var t;if(this.mediaStream&&((t=this.mediaTrackCapabilities)==null?void 0:t.torch)===true){this.torchEnabled=e;let i=this.mediaStream.getVideoTracks();i.length>0&&typeof i[0].applyConstraints=="function"&&await i[0].applyConstraints({advanced:[{torch:e}]});}}async setZoom(e){var t,i,r;if(this.mediaStream&&(await this.waitForCapabilities(),(t=this.mediaTrackCapabilities)!=null&&t.zoom)){let s=this.mediaStream.getVideoTracks();if(s.length>0&&typeof s[0].applyConstraints=="function"){let n=Math.max((i=this.mediaTrackCapabilities.zoom.min)!=null?i:1,Math.min(e,(r=this.mediaTrackCapabilities.zoom.max)!=null?r:16));await s[0].applyConstraints({advanced:[{zoom:n}]});}}}async setupCameras(){if(this.cameraSetupPromise)return this.cameraSetupPromise;let e=this.isVideoStreamPaused;return this.cameraSetupPromise=this.setupCamerasAndStream(),this.cameraSetupPromise.then(()=>{e||(this.isVideoStreamPaused=false);})}pauseStream(){if(this.mediaStream){for(let e of this.mediaStream.getVideoTracks())e.enabled=false;this.isVideoStreamPaused=true,a$2.log(a$2.Level.Debug,"Paused camera video stream",this.mediaStream);}}resumeStream(){if(this.mediaStream){for(let e of this.mediaStream.getVideoTracks())e.enabled=true;this.isVideoStreamPaused=false,a$2.log(a$2.Level.Debug,"Resumed camera video stream",this.mediaStream);}}async stopStream(e=false){this.activeCamera&&(this.activeCamera.currentResolution=void 0),this.activeCamera=void 0,this.torchEnabled=false,this.isVideoStreamPaused=false,this.mediaStream&&(a$2.log(a$2.Level.Debug,`Stop camera video stream access${e?" (abort access detection)":""}:`,this.mediaStream),document.removeEventListener("visibilitychange",this.checkCameraVideoStreamAccessIfVisibleListener),window.clearTimeout(this.cameraAccessTimeout),window.clearInterval(this.videoMetadataCheckInterval),window.clearTimeout(this.getCapabilitiesTimeout),window.clearTimeout(this.manualFocusWaitTimeout),window.clearTimeout(this.manualToAutofocusResumeTimeout),window.clearInterval(this.autofocusInterval),this.videoElement.pause(),await new Promise(t=>{setTimeout(()=>{var i,r,s;for(let n of (r=(i=this.mediaStream)==null?void 0:i.getVideoTracks())!=null?r:[])n.removeEventListener("ended",this.videoTrackEndedListener),n.stop();this.videoElement.srcObject=null,this._canvas2dContext&&this._canvas2dContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.mediaStream=void 0,this.mediaTrackCapabilities=void 0,this.mediaTrackCapabilitiesPromise=void 0,this.mediaTrackCapabilitiesPromiseResolver=void 0,e||(s=this.abortedCameraInitializationResolveCallback)==null||s.call(this),t();},0);}));}stopVideoTracks(){if(this.mediaStream!=null)for(let e of this.mediaStream.getVideoTracks())e.stop();}async toggleTorch(){this.torchEnabled=!this.torchEnabled,await this.setTorchEnabled(this.torchEnabled);}updateCanvasVideoImage(){this.canvas2dContext.drawImage(this.videoElement,0,0);}async waitForCapabilities(){var e;return (e=this.mediaTrackCapabilitiesPromise)!=null?e:Promise.resolve()}setFrameReaderType(e){e!==this._frameReaderType&&(this._frameReaderType=e,a$2.log(a$2.Level.Debug,`Change frame reader type to ${this._frameReaderType} mode`));}async allowPictureInPicture(e){e?(this.videoElement.disablePictureInPicture=false,this.videoElement.removeAttribute("controlslist"),this.videoElement.removeAttribute("disablepictureinpicture")):(this.videoElement.disablePictureInPicture=true,this.videoElement.setAttribute("controlslist","nodownload"),this.videoElement.setAttribute("disablepictureinpicture","true")),await this.reinitializeCamera();}setFrameHandling(e){var t;this._synchronousFrameHandling=e,this._frameReaderOptions=this.getFrameReaderOptions(e),(t=this._glFrameReaders[this._frameReaderType])==null||t.dispose(),delete this._glFrameReaders[this._frameReaderType];}async setClipArea(e){if(this.activeCamera&&this.isVideoAndContextStateValid()){this.clipArea=e?this.frameRectFromViewRect(e):void 0,await this.initializeStreamForResolution(this.activeCamera,this.constraint,this.isVideoStreamPaused);return}this.clipArea=e;}frameRectFromViewRect(e){let t=this.videoElement.videoWidth/this.videoElement.clientWidth||1,i$1=this.videoElement.videoHeight/this.videoElement.clientHeight||1;return new f(new a$4(e.origin.x*t,e.origin.y*i$1),new i(e.size.width*t,e.size.height*i$1))}async accessAutoselectedCamera(e){let t=d.sortCamerasForCameraPosition(e,this.cameraPosition),i=t.shift();for(;i;)try{await this.initializeCameraWithSettings(i,this.selectedCameraSettings);return}catch(r){if(this.setSelectedCamera(),t.length>0){a$2.log(a$2.Level.Warn,"Couldn't access camera:",i,r),i=t.shift();continue}throw r}throw new a$3(o.noCameraErrorParameters)}getFrameReaderOptions(e){return e?{minPoolCapacity:0,maxPoolCapacity:1}:a$1.isDesktopDevice()?{maxPoolCapacity:2,minPoolCapacity:1}:{maxPoolCapacity:10,minPoolCapacity:3}}getFrameReader(){var t;if(this._glFrameReaders[this._frameReaderType])return this._glFrameReaders[this._frameReaderType];if(!this._canvasWebGLContext)return null;let e=(t=this._frameReaderOptions)!=null?t:this.getFrameReaderOptions(this._synchronousFrameHandling);switch(this._frameReaderType){case "GRAYSCALE":{this._glFrameReaders.GRAYSCALE=new a$5(this._canvasWebGLContext,e),this._glFrameReaders.RGBA=new b$1(this._canvasWebGLContext,{minPoolCapacity:1,maxPoolCapacity:2});break}case "RGBA":{this._glFrameReaders.RGBA=new b$1(this._canvasWebGLContext,e);break}default:b(this._frameReaderType);}return a$2.debug(`Created frame reader ${this._frameReaderType}`,e),this._glFrameReaders[this._frameReaderType]}async accessInitialCamera(){let e={position:this.cameraPosition,deviceId:"",label:""};try{await this.initializeCameraWithSettings(e,this.selectedCameraSettings);}catch(t){}finally{this.setSelectedCamera();}return e}recreateCanvas(){this.canvas.removeEventListener("webglcontextlost",this.handleWebGLContextLostListener),this._canvasWebGLContext=void 0,this._canvas2dContext=void 0;for(let t of Object.values(this._glFrameReaders))t==null||t.dispose();let e=document.createElement("canvas");e.addEventListener("webglcontextlost",this.handleWebGLContextLostListener),e.width=this.canvas.width,e.height=this.canvas.height,e.className=this.canvas.className,this.canvas=e;}captureImageFor2dContext(){if(!this.isVideoAndContextStateValid())return null;let{width:e,height:t}=this.canvas;return {colorType:"RGBA",data:this.canvas2dContext.getImageData(0,0,e,t).data,width:e,height:t}}areVideoAndWebGLSizeMismatching(){return this.canvasWebGLContext?this.canvasWebGLContext.drawingBufferWidth!==this.videoElement.videoWidth||this.canvasWebGLContext.drawingBufferHeight!==this.videoElement.videoHeight:true}captureImageForWebGLContext(){if(!this.isVideoAndContextStateValid()||!this.canvasWebGLContext||this.canvasWebGLContext.drawingBufferWidth<=2||this.canvasWebGLContext.drawingBufferHeight<=2||this.areVideoAndWebGLSizeMismatching()||this.getFrameReader()==null)return null;let e=this.getFrameReader().readFromSource(this.videoElement);if(e.data[3]!==255&&e.colorType==="RGBA"){if(a$2.log(a$2.Level.Warn,"Detected incorrect GPU accelerated WebGL image processing, switching to canvas mode"),this.recreateCanvas(),this.canvas2dContext==null)throw new Error("Unable to get 2d canvas context");return this.captureImage()}return e}async checkCameraAccess(e){return new Promise((t,i)=>{this.cameraAccessRejectCallback=r=>{a$2.log(a$2.Level.Debug,"Camera video stream access failure (video data load timeout):",e),this.gui.setCameraRecoveryVisible(true),i(r);},this.setCameraAccessTimeout();})}checkCameraVideoStreamAccessIfVisible(){document.visibilityState==="visible"&&(a$2.log(a$2.Level.Debug,"Page is visible again, waiting for camera video stream start..."),document.removeEventListener("visibilitychange",this.checkCameraVideoStreamAccessIfVisibleListener),this.setCameraAccessTimeout());}async checkVideoMetadata(e){return new Promise((t,i)=>{this.videoElement.onloadeddata=()=>{if(this.videoElement.onloadeddata=null,window.clearTimeout(this.cameraAccessTimeout),this.videoElement.videoWidth>2&&this.videoElement.videoHeight>2&&this.videoElement.currentTime>0){this.updateActiveCameraCurrentResolution(e),a$2.log(a$2.Level.Debug,"Camera video stream access success:",e),t();return}let r=performance.now();window.clearInterval(this.videoMetadataCheckInterval),this.videoMetadataCheckInterval=window.setInterval(async()=>{if(this.videoElement.videoWidth<=2||this.videoElement.videoHeight<=2||this.videoElement.currentTime===0){if(performance.now()-r>o.videoMetadataCheckTimeoutMs){a$2.log(a$2.Level.Warn,"Camera video stream access failure (valid video metadata timeout):",e),window.clearInterval(this.videoMetadataCheckInterval),await this.stopStream(true),i(new a$3(o.notReadableErrorParameters));return}return}window.clearInterval(this.videoMetadataCheckInterval),this.updateActiveCameraCurrentResolution(e),a$2.log(a$2.Level.Debug,"Camera video stream access success:",e),t();},o.videoMetadataCheckIntervalMs);};})}disablePinchToZoomListeners(){this.videoElement.removeEventListener("touchstart",this.triggerZoomStartListener),this.videoElement.removeEventListener("touchmove",this.triggerZoomMoveListener);}disableTapToFocusListeners(){for(let e of ["touchend","mousedown"])this.videoElement.removeEventListener(e,this.triggerManualFocusListener);}emit(e,t){var r;let i=(r=this.listeners.get(e))!=null?r:[];for(let s of i)s(t);}enablePinchToZoomListeners(){this.videoElement.addEventListener("touchstart",this.triggerZoomStartListener),this.videoElement.addEventListener("touchmove",this.triggerZoomMoveListener);}enableTapToFocusListeners(){for(let e of ["touchend","mousedown"])this.videoElement.addEventListener(e,this.triggerManualFocusListener);}getActiveCamera(e,t,i){return e.length===1?e[0]:e.find(r=>r.deviceId===i||r.label!==""&&r.label===t)}getInitialCameraResolutionConstraint(e){var i;let t;switch((i=this.activeCameraSettings)==null?void 0:i.preferredResolution){case "uhd4k":{t=0;break}case "fullHd":{t=1;break}default:{t=2;break}}return t}async handleCameraInitializationError(e,t,i){if(!["OverconstrainedError","NotReadableError"].includes(i.name)||i.name==="NotReadableError"&&t===4)throw a$2.log(a$2.Level.Debug,"Camera video stream access failure (unrecoverable error)",e,i),i.name!=="NotAllowedError"&&d.markCameraAsInaccessible(e),i;if(i.name==="OverconstrainedError"&&t===4){if(e.deviceId==="")throw a$2.log(a$2.Level.Warn,"Camera video stream access failure (no camera with such type error)",e,i),i;a$2.log(a$2.Level.Warn,"Detected non-existent deviceId error, attempt to find and reaccess updated camera",e,i);let r=e.deviceId;if(await d.getCameras(true),r===e.deviceId)throw a$2.log(a$2.Level.Warn,"Camera video stream access failure (updated camera not found after non-existent deviceId error)",e,i),d.markCameraAsInaccessible(e),i;return a$2.log(a$2.Level.Warn,"Updated camera found (recovered from non-existent deviceId error), attempt to access it",e),this.initializeCameraForResolution(e)}return this.initializeCameraForResolution(e,t+1)}handleVideoResize(){if(!(this.videoElement.videoWidth<=2||this.videoElement.videoHeight<=2)){if(this.activeCamera&&this.updateActiveCameraCurrentResolution(this.activeCamera),this.canvasWebGLContext!=null){if(this.canvas.width===this.videoElement.videoWidth&&this.canvas.height===this.videoElement.videoHeight)return;this.canvas.width=this.videoElement.videoWidth,this.canvas.height=this.videoElement.videoHeight,this.canvasWebGLContext.viewport(0,0,this.canvasWebGLContext.drawingBufferWidth,this.canvasWebGLContext.drawingBufferHeight);}else if(this.canvas2dContext!=null){if(this.canvas.width===this.videoElement.videoWidth&&this.canvas.height===this.videoElement.videoHeight)return;this.canvas.width=this.videoElement.videoWidth,this.canvas.height=this.videoElement.videoHeight;}}}handleWebGLContextLost(){a$2.log(a$2.Level.Warn,"WebGL context has been lost, restoring..."),this._canvasWebGLContext=void 0,this.canvasWebGLContext?(this.handleVideoResize(),a$2.log(a$2.Level.Warn,"WebGL context restored")):a$2.log(a$2.Level.Error,"WebGL context restore failed");}async initializeCameraAndCheckUpdatedSettings(e){var t,i,r,s,n;try{if(await this.initializeCameraForResolution(e),this.selectedCameraSettings!==this.activeCameraSettings&&(this.selectedCameraSettings==null||this.activeCameraSettings==null||Object.keys(this.selectedCameraSettings).some(u=>{var b,f;return ((b=this.selectedCameraSettings)==null?void 0:b[u])!==((f=this.activeCameraSettings)==null?void 0:f[u])}))){this.activeCameraSettings=this.selectedCameraSettings,await this.initializeCameraAndCheckUpdatedSettings(e);return}this.activeCameraSettings&&this.activeCameraSettings.zoomFactor>1&&await this.setZoom(this.activeCameraSettings.zoomFactor);let c=(t=this.activeCameraSettings)==null?void 0:t.getProperty("minFrameRate"),d=(i=this.activeCameraSettings)==null?void 0:i.getProperty("maxFrameRate");(c!=null||d!=null)&&await this.setFrameRate({min:c,max:d});let l=(r=this.activeCameraSettings)==null?void 0:r.getProperty("manualLensPosition");l!=null&&await this.setFocus(l);let v=(s=this.activeCameraSettings)==null?void 0:s.getProperty("exposureTargetBias"),p=(n=this.activeCameraSettings)==null?void 0:n.getProperty("exposureDuration");(v!=null||p!=null)&&await this.setExposure({compensation:v,time:p});}finally{this.cameraInitializationPromise=void 0;}}async initializeCameraForResolution(e,t){var i;this.gui.setCameraRecoveryVisible(false),this.constraint=t!=null?t:this.getInitialCameraResolutionConstraint(e),this.mediaStream!=null&&e.deviceId!==""&&((i=this.activeCamera)==null?void 0:i.deviceId)===e.deviceId?await(a$1.isIPhone()?this.initializeStreamForResolution(e,this.constraint):this.updateStreamForResolution(e,this.constraint)):await this.initializeStreamForResolution(e,this.constraint);}async initializeStreamForResolution(e,t,i=false){var r;await this.stopStream();try{let s=(r=this.activeCameraSettings)==null?void 0:r.getProperty("preferredAspectRatio"),n=await d.accessCameraStream(e,t,s),c=await this.clipMediaStreamIfNeeded(n);if(a$2.log(a$2.Level.Debug,"Camera accessed, waiting for camera video stream start..."),typeof c.getVideoTracks()[0].getSettings=="function"){let d=c.getVideoTracks()[0].getSettings();if(d.width!=null&&d.height!=null&&(d.width===2||d.height===2)){if(a$2.log(a$2.Level.Debug,"Camera video stream access failure (invalid video metadata):",e),t===4)throw new a$3(o.notReadableErrorParameters);return await this.stopStream(),this.initializeStreamForResolution(e,t+1)}}this.mediaStream=c,i&&this.pauseStream();for(let d of this.mediaStream.getVideoTracks())d.addEventListener("ended",this.videoTrackEndedListener),d.addEventListener("mute",this.videoTrackMuteListener),d.addEventListener("unmute",this.videoTrackMuteListener);try{await this.setupCameraStreamVideo(e,c);}catch(d){if(t===4)throw d;return this.initializeStreamForResolution(e,t+1)}}catch(s){return this.handleCameraInitializationError(e,t,s)}}isVideoAndContextStateValid(){return this.videoElement.readyState===4&&this.videoElement.videoWidth>2&&this.videoElement.videoHeight>2&&this.canvas.width>2&&this.canvas.height>2}postStreamInitialization(){window.clearTimeout(this.getCapabilitiesTimeout),this.getCapabilitiesTimeout=window.setTimeout(()=>{this.storeStreamCapabilities(),this.setupAutofocus();},o.getCapabilitiesTimeoutMs);}async recoverStreamIfNeeded(){var t,i;let e=(t=this.mediaStream)==null?void 0:t.getVideoTracks();((i=e==null?void 0:e[0])==null?void 0:i.readyState)==="ended"&&await this.reinitializeCamera();}reportCameraProperties(e,t,i=true){this.emit("cameraProperties",{deviceId:e,isFrontFacing:t==="userFacing",hasAutofocus:i});}setCameraAccessTimeout(){window.clearTimeout(this.cameraAccessTimeout),this.cameraAccessTimeout=window.setTimeout(async()=>{var e;document.visibilityState==="visible"?(await this.stopStream(true),(e=this.cameraAccessRejectCallback)==null||e.call(this,new a$3(o.notReadableErrorParameters))):(a$2.log(a$2.Level.Debug,"Page is currently not visible, delay camera video stream access detection"),document.addEventListener("visibilitychange",this.checkCameraVideoStreamAccessIfVisibleListener));},o.cameraAccessTimeoutMs);}setupAutofocus(){if(window.clearTimeout(this.manualFocusWaitTimeout),window.clearTimeout(this.manualToAutofocusResumeTimeout),this.mediaStream&&this.mediaTrackCapabilities){let e=this.mediaTrackCapabilities.focusMode;Array.isArray(e)&&!e.includes("continuous")&&e.includes("single-shot")&&(window.clearInterval(this.autofocusInterval),this.autofocusInterval=window.setInterval(this.triggerAutoFocus.bind(this),o.autofocusIntervalMs));}}async setupCameraStreamVideo(e,t){this.videoElement.addEventListener("loadedmetadata",this.postStreamInitializationListener),this.videoElement.addEventListener("resize",this.videoResizeListener),this.tapToFocusEnabled&&this.enableTapToFocusListeners(),this.pinchToZoomEnabled&&this.enablePinchToZoomListeners();let i=Promise.race([this.checkCameraAccess(e),this.checkVideoMetadata(e),new Promise(r=>{this.abortedCameraInitializationResolveCallback=r;})]);return this.videoElement.srcObject=t,this.videoElement.load(),await this.playVideo(),this.handleVideoResize(),this.reportCameraProperties(e.deviceId,e.position),i}async setupCamerasAndStream(){var e,t;try{let i;this.selectedCamera==null&&(i=await this.accessInitialCamera());let r=await d.getCameras(false,true),s=(t=(e=this.mediaStream)==null?void 0:e.getVideoTracks()[0])==null?void 0:t.getSettings().deviceId;if(this.mediaStream&&i){let n=this.getActiveCamera(r,i.label,s);if(n){if(d.adjustCameraFromMediaStream(this.mediaStream,n),a$1.isDesktopDevice()&&(d.setMainCameraForPositionOverridesOnDesktop(this.cameraPosition,n),d.setMainCameraForPositionOverridesOnDesktop(n.position,n)),r.length===1||d.getMainCameraForPosition(r,this.cameraPosition)===n){a$2.log(a$2.Level.Debug,"Initial camera access was correct (main camera), keep camera:",n),this.setSelectedCamera(n),this.updateActiveCameraCurrentResolution(n),await this.recoverStreamIfNeeded();return}a$2.log(a$2.Level.Debug,"Initial camera access was incorrect (not main camera), change camera",{...i,deviceId:s});}else a$2.log(a$2.Level.Debug,"Initial camera access was incorrect (unknown camera), change camera",{...i,deviceId:s});}if(this.selectedCamera==null){await this.accessAutoselectedCamera(r);return}await this.initializeCameraWithSettings(this.selectedCamera,this.selectedCameraSettings);}finally{this.cameraSetupPromise=void 0;}}storeStreamCapabilities(){var e;if(this.mediaStream){let t=this.mediaStream.getVideoTracks();t.length>0&&typeof t[0].getCapabilities=="function"&&(this.mediaTrackCapabilities=t[0].getCapabilities()),this.mediaTrackCapabilitiesPromiseResolver&&this.mediaTrackCapabilitiesPromiseResolver();}this.activeCamera&&this.reportCameraProperties(this.activeCamera.deviceId,this.activeCamera.position,((e=this.mediaTrackCapabilities)==null?void 0:e.focusMode)==null||this.mediaTrackCapabilities.focusMode.includes("continuous"));}async triggerAutoFocus(){await this.triggerFocusMode("single-shot");}async triggerFocusMode(e){if(this.mediaStream){let t=this.mediaStream.getVideoTracks();if(t.length>0&&typeof t[0].applyConstraints=="function")try{await t[0].applyConstraints({advanced:[{focusMode:e}]});}catch(i){}}}async triggerManualFocus(e){if(e){if(e.preventDefault(),e.type==="touchend"&&e.touches.length>0)return;if(this.pinchToZoomDistance!=null){this.pinchToZoomDistance=void 0;return}}if(window.clearTimeout(this.manualFocusWaitTimeout),window.clearTimeout(this.manualToAutofocusResumeTimeout),!this.mediaStream||!this.mediaTrackCapabilities)return;let t=this.mediaTrackCapabilities.focusMode;Array.isArray(t)&&t.includes("single-shot")&&(t.includes("continuous")&&t.includes("manual")?await this.triggerManualFocusForContinuous():t.includes("continuous")||await this.triggerManualFocusForSingleShot());}async triggerManualFocusForContinuous(){var i;if(!this.mediaStream)return;this.manualToAutofocusResumeTimeout=window.setTimeout(async()=>{await this.triggerFocusMode("continuous");},o.manualToAutofocusResumeTimeoutMs);let e=true,t=this.mediaStream.getVideoTracks();t.length>0&&typeof t[0].getConstraints=="function"&&(e=((i=t[0].getConstraints().advanced)==null?void 0:i.some(r=>r.focusMode==="manual"))===true),e?(await this.triggerFocusMode("continuous"),this.manualFocusWaitTimeout=window.setTimeout(async()=>{await this.triggerFocusMode("manual");},o.manualFocusWaitTimeoutMs)):await this.triggerFocusMode("manual");}async triggerManualFocusForSingleShot(){window.clearInterval(this.autofocusInterval),this.manualToAutofocusResumeTimeout=window.setTimeout(()=>{this.autofocusInterval=window.setInterval(this.triggerAutoFocus.bind(this),o.autofocusIntervalMs);},o.manualToAutofocusResumeTimeoutMs);try{await this.triggerFocusMode("single-shot");}catch(e){}}async triggerZoomMove(e){this.pinchToZoomDistance==null||(e==null?void 0:e.touches.length)!==2||e.preventDefault();}triggerZoomStart(e){var r,s,n,c;if((e==null?void 0:e.touches.length)!==2||(e.preventDefault(),this.pinchToZoomDistance=Math.hypot((e.touches[1].screenX-e.touches[0].screenX)/screen.width,(e.touches[1].screenY-e.touches[0].screenY)/screen.height),!this.mediaStream||!((r=this.mediaTrackCapabilities)!=null&&r.zoom)))return;let t=this.mediaStream.getVideoTracks();if(t.length===0||typeof t[0].getConstraints!="function")return;this.pinchToZoomInitialZoom=(s=this.mediaTrackCapabilities.zoom.min)!=null?s:1;let i=t[0].getConstraints();if(i.advanced){let d=(n=i.advanced.find(l=>"zoom"in l))==null?void 0:n.zoom;d!=null&&(this.pinchToZoomInitialZoom=typeof d=="number"?d:(c=d.ideal)!=null?c:1);}}updateActiveCameraCurrentResolution(e){this.videoElement.videoWidth>2&&this.videoElement.videoHeight>2&&(e.currentResolution={width:this.videoElement.videoWidth,height:this.videoElement.videoHeight}),e.deviceId!==""&&(this.activeCamera=e,this.setMirrorImageEnabled(this.isMirrorImageEnabled(),false));}async updateStreamForResolution(e,t){var i;if(this.mediaStream==null)await this.initializeCameraForResolution(e,t);else try{let r=(i=this.activeCameraSettings)==null?void 0:i.getProperty("preferredAspectRatio");a$2.log(a$2.Level.Debug,"Setting new resolution for active camera video stream..."),await this.mediaStream.getVideoTracks()[0].applyConstraints(d.getUserMediaVideoParameters(t,r)),await new Promise(n=>{this.videoElement.addEventListener("timeupdate",()=>{n();},{once:true});});let s=this.mediaStream.getVideoTracks()[0].getSettings();a$2.log(a$2.Level.Debug,"New active camera video stream resolution set",{width:s.width,height:s.height});}catch(r){if(t===4)throw r;await this.updateStreamForResolution(e,t+1);}}async videoTrackEndedRecovery(){if(document.visibilityState==="visible")try{a$2.log(a$2.Level.Debug,'Detected video track "ended" event, try to reinitialize camera'),await this.reinitializeCamera();}catch(e){}else a$2.log(a$2.Level.Debug,"Page is currently not visible, delay camera reinitialization until visible"),document.addEventListener("visibilitychange",this.checkCameraVideoStreamAccessIfVisibleListener);}videoTrackMuteRecovery(e){if(this.videoElement.onloadeddata!=null){a$2.log(a$2.Level.Debug,`Detected video track "${e.type}" event, delay camera video stream access detection`),this.setCameraAccessTimeout();return}let t=e.type==="mute";t!==this.gui.isCameraRecoveryVisible()&&(a$2.log(a$2.Level.Debug,`Detected video track "${e.type}" event, ${t?"enable":"disable"} camera recovery`),this.gui.setCameraRecoveryVisible(t));}async clipMediaStreamIfNeeded(e){if(!this.clipArea)return e;let t=this.videoElement.cloneNode();t.srcObject=e,t.load();let i=document.createElement("canvas");i.width=this.clipArea.size.width,i.height=this.clipArea.size.height;let r=i.getContext("2d",{alpha:false,willReadFrequently:false});return r?(t.addEventListener("play",this.drawClippedFrame.bind(this,this.clipArea,t,r),{once:true}),t.addEventListener("pause",this.cleanupClippedStream.bind(this,t),{once:true}),await t.play(),i.captureStream()):e}drawClippedFrame(e,t,i){i.drawImage(t,e.origin.x,e.origin.y,e.size.width,e.size.height,0,0,e.size.width,e.size.height),this.clippedFrameRequestID=this.requestVideoFrame(this.drawClippedFrame.bind(this,e,t,i),t);}cleanupClippedStream(e){this.clippedFrameRequestID&&(this.cancelVideoFrame(this.clippedFrameRequestID,e),this.clippedFrameRequestID=void 0);}};o.autofocusIntervalMs=1500,o.cameraAccessTimeoutMs=4e3,o.getCapabilitiesTimeoutMs=500,o.manualFocusWaitTimeoutMs=400,o.manualToAutofocusResumeTimeoutMs=5e3,o.noCameraErrorParameters={name:"NoCameraAvailableError",message:"No camera available"},o.notReadableErrorParameters={name:"NotReadableError",message:"Could not initialize camera correctly"},o.videoMetadataCheckIntervalMs=50,o.videoMetadataCheckTimeoutMs=4e3,o.MIRRORED_CLASS_NAME=a$6.MIRRORED_CLASS_NAME,o._instance=null;var L=o;export{k as a,F as b,P as c,L as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {c,a,b}from'./chunk-JFRSUCMO.js';import {a as a$2}from'./chunk-EQRBQJYM.js';import {a as a$1}from'./chunk-GHTCNOQN.js';import {a as a$3}from'./chunk-XR65N6EG.js';var s=class s{constructor(e){this.canUploadFile=false;this._mounted=false;this._loading=false;this._htmlRoot=void 0;this._canvas=void 0;this._onInputCheck=void 0;this._onBeforeFileRead=void 0;this._onImageLoadError=void 0;this._onFileReaderError=void 0;this._onCaptureReady=void 0;this._resizedImageSizeLimit=1440;this._inputElement=void 0;this._buttonElement=void 0;this._chooseImageText="";this._settings=e;}get canvas(){return this._canvas||(this._canvas=document.createElement("canvas")),this._canvas}get canvasContext(){return this._canvasContext||(this._canvasContext=this.canvas.getContext("2d",{willReadFrequently:true})),this._canvasContext}mount(e){var E;if(this._mounted)return;if(!document.head.querySelector(`[data-component=${s.componentName}]`)){let o=document.createElement("style");o.dataset.component=s.componentName,o.textContent=c,document.head.append(o);}let t=document.createElement("div");t.className=a.SINGLE_IMAGE_UPLOADER_CONTAINER,Object.assign(t.style,b.SINGLE_IMAGE_UPLOADER_CONTAINER_STYLE,this._settings.containerStyle),e.append(t);let{iconElement:n,iconStyle:d,informationElement:i,informationStyle:u,buttonElement:r,buttonStyle:p,onlyCameraCapture:b$1}=this._settings;Object.assign(n.style,b.SINGLE_IMAGE_UPLOADER_ICON_STYLE,d,{maxWidth:"100px",maxHeight:"100px"}),t.append(n),i.hasAttribute(s.DEFAULT_DOM_ATTRIBUTE)&&(Object.assign(i.style,b.SINGLE_IMAGE_UPLOADER_INFORMATION_STYLE,u),i.textContent=a$1.getInstance().get("core.singleImageUploader.title")),t.append(i);let a$3=document.createElement("input");a$3.type="file",a$3.accept="image/*",b$1&&(a$3.capture="environment",a$3.dataset.onlyCaptureOnMobile="environment"),a$3.addEventListener("change",o=>{this.onFileUpload(o);}),a$3.addEventListener("click",o=>{var l;(l=this._onInputCheck)==null||l.call(this,o);}),a$3.addEventListener("keydown",o=>{var l;(l=this._onInputCheck)==null||l.call(this,o);});let c$1=document.createElement("label");c$1.append(a$3),r.hasAttribute(s.DEFAULT_DOM_ATTRIBUTE)&&(Object.assign(r.style,b.SINGLE_IMAGE_UPLOADER_BUTTON_STYLE,p),r.textContent=a$1.getInstance().get("core.singleImageUploader.button")),c$1.append(r),t.append(c$1);let v=document.createRange().createContextualFragment(atob(a$2)).firstElementChild;Object.assign(v.style,{position:"absolute",bottom:"1em",right:"1em",width:"10em"}),t.append(v),this._htmlRoot=t,this._mounted=true,this._inputElement=a$3,this._buttonElement=r,this._chooseImageText=(E=r.textContent)!=null?E:"";}unmount(){var e,t;this._mounted&&((e=this._htmlRoot)==null||e.remove(),(t=document.head.querySelector(`[data-component=${s.componentName}]`))==null||t.remove(),this._mounted=false);}setButtonState(e){this._inputElement&&(this._inputElement.disabled=e==="disabled");}getButtonState(){return this._inputElement?this._inputElement.disabled?"disabled":"enabled":"disabled"}onInputCheck(e){this._onInputCheck=e;}onBeforeFileRead(e){this._onBeforeFileRead=e;}onImageLoadError(e){this._onImageLoadError=e;}onFileReaderError(e){this._onFileReaderError=e;}onCaptureReady(e){this._onCaptureReady=e;}onAfterImageProcessed(){this.setLoading(false);}setLoading(e){this._buttonElement&&(this.setButtonState(e?"disabled":"enabled"),this._buttonElement.textContent=e?"...":this._chooseImageText,this._loading=e);}getResizedImageDimensions(e,t){return e<=this._resizedImageSizeLimit&&t<=this._resizedImageSizeLimit?{width:e,height:t}:e>t?{width:this._resizedImageSizeLimit,height:Math.round(t/e*this._resizedImageSizeLimit)}:{width:Math.round(e/t*this._resizedImageSizeLimit),height:this._resizedImageSizeLimit}}onImageLoad(e){var i;let{height:t,width:n}=this.getResizedImageDimensions(e.naturalWidth,e.naturalHeight);this.canvasContext.canvas.width=n,this.canvasContext.canvas.height=t,this.canvasContext.drawImage(e,0,0,n,t);let d={data:this.canvasContext.getImageData(0,0,n,t).data,width:n,height:t};(i=this._onCaptureReady)==null||i.call(this,d);}onFileReaderLoad(e,t,n){e.value="",t.result!=null&&(n.addEventListener("load",()=>{this.onImageLoad(n);},{once:true}),n.addEventListener("error",d=>{var i;(i=this._onImageLoadError)==null||i.call(this,d),this.setLoading(false);},{once:true}),n.src=t.result);}onFileUpload(e){var u;this.setLoading(true);let t=e.currentTarget,{files:n}=t;if(n==null||n.length===0){this.setLoading(false);return}if((u=this._onBeforeFileRead)==null||u.call(this,e),!this.canUploadFile){t.value="",a$3.log(a$3.Level.Warn,"Can't upload file, no capture mode enabled."),this.setLoading(false);return}let d=new Image,i=new FileReader;i.addEventListener("load",()=>{this.onFileReaderLoad(t,i,d);}),i.addEventListener("error",r=>{var p;(p=this._onFileReaderError)==null||p.call(this,r),this.setLoading(false);}),i.readAsDataURL(n[0]);}};s.componentName="SingleImageUploaderView",s.DEFAULT_DOM_ATTRIBUTE="data-scandit-default";var I=s;export{I as a};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import {a as a$2}from'./chunk-3A4KLILV.js';import {a}from'./chunk-MU6SADSF.js';import {a as a$1}from'./chunk-EV4OEANA.js';import {a as a$3}from'./chunk-LSZZVJ6B.js';import {n}from'./chunk-77BBIAZE.js';var i=a`
|
|
2
|
-
<div role="listitem">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</div>
|
|
5
|
-
`,r=class r extends a$1{constructor(){super();let o=this.attachShadow({mode:"open"});o.innerHTML=i,o.append(r.createStyleElement().cloneNode(true));}set backgroundColor(o){this.style.setProperty("--background-color",`#${o.toJSON()}`);}get backgroundColor(){return n.fromHex(this.style.getPropertyValue("--background-color"))}set borderColor(o){this.style.setProperty("--border-color",`#${o.toJSON()}`);}get borderColor(){return n.fromHex(this.style.getPropertyValue("--border-color"))}static create(){return document.createElement(r.tag)}static register(){a$2({[r.tag]:r});}static createStyleElement(){return a$3`:host{--corner-radius:0.75rem;--background-color:#ffffffe6;--border-color:#0000;backdrop-filter:saturate(180%) blur(20px);background-color:var(--background-color);border:1px solid var(--border-color);border-radius:var(--corner-radius);box-shadow:0 2px 6px 0 #12161926;box-sizing:border-box;display:block;font-family:SF Pro Text,sans-serif;max-height:100px;min-height:5rem;min-width:200px}:host([with-border]){--border-color:#d92121}`}};r.tag="scandit-basic-card";var t=r;t.register();export{t as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {d}from'./chunk-UOEN3RFJ.js';var i;(m=>{async function n(o,t){return d.getCameras(o!=null?o:false,t!=null?t:false)}m.getCameras=n;})(i||(i={}));export{i as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var A={CONTAINER_CLASS_NAME:"scandit-container",PAINTBOARDS_CONTAINER_CLASS_NAME:"scandit-paintboards",PAINTBOARD_CLASS_NAME:"scandit-paintboard",PAINTBOARD_CLASS_NAME_STATE_ON:"scandit-paintboard--camera-on",CONTROLS_CLASS_NAME:"scandit-controls",CONTROL_WIDGET_CLASS_NAME:"scandit-control-widget",MIRRORED_CLASS_NAME:"scandit-mirrored",CAMERA_RECOVERY_CLASS_NAME:"scandit-camera-recovery",ERROR_CLASS_NAME:"scandit-error",HINT_CONTAINER_CLASS_NAME:"scandit-hint-container",HINT_CLASS_NAME:"scandit-hint",SINGLE_IMAGE_UPLOADER_CONTAINER_CLASS_NAME:"scandit-single-image-uploader-container",CANVAS_VIDEO_PREVIEW_CLASS_NAME:"scandit-canvas-video-preview",TORCH_SWITCH_CONTROL_CLASS_NAME:"torch",CAMERA_SWITCH_CONTROL_CLASS_NAME:"camera",CAMERA_FOV_SWITCH_CONTROL_CLASS_NAME:"camera-fov",SHUTTER_BUTTON_CONTROL_CLASS_NAME:"shutter",FROZEN_FRAME:"frozen-frame"};export{A as a};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import {a as a$5,b as b$1}from'./chunk-ZXA6VEK2.js';import {a as a$9}from'./chunk-BA3RP6L2.js';import {a as a$4}from'./chunk-JS3T7K2Z.js';import {a as a$1}from'./chunk-KCNXUTBL.js';import {a as a$3}from'./chunk-NMROJLGQ.js';import {a as a$2}from'./chunk-7SW2PEHB.js';import {a as a$6}from'./chunk-FGO2SSRS.js';import {d}from'./chunk-CXX2ZE7M.js';import {a}from'./chunk-6VWIJ62O.js';import {a as a$7}from'./chunk-XR65N6EG.js';import {f}from'./chunk-OPX62GWU.js';import {a as a$8}from'./chunk-WUHKODFA.js';function b(M){return M[a$9]!=null}var O,x,P,i=class i{constructor(e,t){this.framework="web";this.runtimeEnvironment={deviceOS:(O=a.getUserAgentInfo().getOS().name)!=null?O:"",browser:(x=a.getUserAgentInfo().getBrowser().name)!=null?x:"",browserVersion:(P=a.getUserAgentInfo().getBrowser().version)!=null?P:"",get deviceModelName(){let{model:e,vendor:t}=a.getUserAgentInfo().getDevice();return (t==null||t==="")&&(t="Unknown"),(e==null||e==="")&&(e="Unknown"),[t,e].join(" ")}};this.settings=new a$2;this._frameSource=null;this._view=null;this.modes=new Set;this.nativeModes=new Set;this.components=[];this.listeners=[];this.updateListeners=new Set;this.cameraPropertiesReportListener=this.reportCameraProperties.bind(this);this.cameraAccessErrorListener=this.onCameraAccessError.bind(this);this.onWorkerMessageListener=this.onWorkerMessage.bind(this);this.onVisibilityChangeListener=this.onVisibilityChange.bind(this);this._frameHandlers=[];this._useSynchronousFrameFlow=false;var a$1,n,r,p,v,C;this.licenseKey=e,this.deviceName=(a$1=t.deviceName)!=null?a$1:"",this.dataCaptureInstance=(n=t.dataCaptureInstance)!=null?n:a$3.mainDataCaptureLoader,this.delayedRegistration=(r=t.delayedRegistration)!=null?r:false,this.highEndBlurryRecognition=(C=(v=(p=t.dataCaptureInstance)==null?void 0:p.highEndBlurryRecognition)!=null?v:a$3.mainDataCaptureLoader.highEndBlurryRecognition)!=null?C:false;}get frameSource(){return this._frameSource}get workerCommand(){return this.dataCaptureInstance.workerCommand.bind(this.dataCaptureInstance)}static async create(){return i.createWithOptions({})}static async createWithOptions(e){var a;let t=new i((a=e.licenseKey)!=null?a:a$3.userLicenseKey,{deviceName:e.deviceName});return e.settings!=null&&await t.applySettings(e.settings),await t.initialize(),t}static async getOpenSourceSoftwareLicenseInfo(){let e=[];for(let a of i.moduleLicenseTextProviders){let n=await a.getLicenseText();e.push(n);}let t=e.join(`
|
|
2
|
-
|
|
3
|
-
`);return new a$4(t)}async setFrameSource(e){let t=e!==this._frameSource;if(this._frameSource!==null&&(this._frameSource.context=null),this._frameSource=e!=null?e:null,e&&(e.context=this,await this.workerCommand("setFrameSource",{mirrorAxis:this.getMirrorAxisForFrameSource(e),isCameraFrameSource:f(e)})),await this.update([{type:"frameSourceState",newValue:this.frameSource}]),t)for(let a of this.listeners)a.didChangeFrameSource&&a.didChangeFrameSource(this,this._frameSource);}addListener(e){this.listeners.includes(e)||this.listeners.push(e);}async flushAnalytics(){await this.workerCommand("flushAnalytics",{});}removeListener(e){this.listeners.includes(e)&&this.listeners.splice(this.listeners.indexOf(e),1);}async addMode(e){this.modes.add(e),await e.attachedToContext(this),this.updateCameraFrameFlow(),await this.update();}async removeMode(e){this.modes.delete(e),await e.detachedFromContext(),this.updateCameraFrameFlow(),await this.update();}async removeAllModes(){for(let e of this.modes)await this.removeMode(e);}async dispose(){d.instance().removeListener("cameraProperties",this.cameraPropertiesReportListener),d.instance().removeListener("cameraAccessError",this.cameraAccessErrorListener),this.unsubscribeToVisibilityChange(this.onVisibilityChangeListener),await this.workerCommand("dispose",{});}async applySettings(e){this.settings=e,await this.update();}toJSONObject(){var e,t;return {licenseKey:this.licenseKey,framework:this.framework,deviceName:this.deviceName,...this.runtimeEnvironment,modes:[...this.modes].filter(a=>!a.skipSerialization).map(a=>a.toJSONObject()),components:this.components.map(a=>a.toJSONObject()),frameSource:this.frameSource?this.frameSource.toJSONObject():null,settings:this.settings.toJSONObject(),view:(t=(e=this._view)==null?void 0:e.toJSONObject())!=null?t:null}}getView(){return this._view}async setView(e){return this._view=e,this.update([{type:"viewSet",newValue:e}])}async getAppName(){let e=null;if(a$5()){let t=await b$1();if((t==null?void 0:t.appName)==null||t.appName==="")throw new Error("Cannot retrieve electron appName. Did you set it up in package.json? https://www.electronjs.org/docs/latest/api/app#appgetname");e=t.appName;}return e}urlToHostname(e){try{return new URL(e!=null?e:"").hostname}catch(t){return ""}}getParentDomain(){var t;let e="";return parent!==window&&(e||(e=this.urlToHostname((t=location.ancestorOrigins)==null?void 0:t[0])),e||(e=this.urlToHostname(document.referrer)),e||(e="")),e.startsWith("[")&&e.endsWith("]")&&(e=e.slice(1,-1)),e}async initialize(e=true){await this.workerCommand("createContext",{context:this.toJSONObject(),deviceId:i.deviceID,delayedRegistration:this.delayedRegistration,highEndBlurryRecognition:this.highEndBlurryRecognition,appName:await this.getAppName(),parentDomain:this.getParentDomain()}),this.subscribeToWorkerMessages(this.onWorkerMessageListener),e&&(this.subscribeToCameraManagerEvents(),this.subscribeToVisibilityChange(this.onVisibilityChangeListener));}subscribeToVisibilityChange(e){document.addEventListener("visibilitychange",e);}unsubscribeToVisibilityChange(e){document.removeEventListener("visibilitychange",e);}async requestFrameData(e){return this.workerCommand("requestFrameData",{frameId:e})}performanceMark(e){a$6(globalThis.performance)&&typeof globalThis.performance.mark=="function"&&performance.mark(e);}async sendFrameToProcessor(e){let t=e instanceof ImageData?{data:e.data,width:e.width,height:e.height}:e,a=await this.sendFrameToHandlers(t);return t.data=a.capture.data,a.skip?a.capture:(this.performanceMark("processFrameBeforeSDC"),this.sendFrameToSDC(t))}async sendFrameToHandlers(e){for(let t of this._frameHandlers)if((await t(e)).action==="skip")return {skip:true,capture:e};return {skip:false,capture:e}}async sendFrameToSDC(e){return this.workerCommand("processFrame",e,[e.data.buffer])}registerFrameHandler(e){this._frameHandlers.includes(e)||this._frameHandlers.push(e);}unregisterFrameHandler(e){this._frameHandlers.includes(e)&&this._frameHandlers.splice(this._frameHandlers.indexOf(e),1);}onVisibilityChange(){this.workerCommand("documentVisibility",{state:document.visibilityState});}onWorkerMessage(e){if(e.type==="contextDidChangeStatus"){e.payload.isValid||a$7.error(e.payload);for(let t of this.listeners)t.didChangeStatus&&t.didChangeStatus(this,a$8.fromJSON(e.payload));}if(e.type==="didStartObservingContext")for(let t of this.listeners)t.didStartObservingContext&&t.didStartObservingContext(this);e.type==="onFrameProcessingFinished"&&this.performanceMark("processFrameAfterSDC");}subscribeToCameraManagerEvents(){d.instance().addListener("cameraProperties",this.cameraPropertiesReportListener),d.instance().addListener("cameraAccessError",this.cameraAccessErrorListener);}async reportCameraProperties(e){return this.workerCommand("reportCameraProperties",e)}onCameraAccessError(e){for(let t of this.listeners)t.didChangeStatus&&t.didChangeStatus(this,a$8.fromJSON({code:33794,isValid:true,message:e.toString()}));}async update(e=[],{updateContext:t=true}={}){var a,n;t&&await this.updateContext();for(let r of e){switch(r.type){case "frameSourceState":{await((a=this._view)==null?void 0:a.onFrameSourceChange(this.frameSource));break}case "singleImageModeUploaderSettings":{(n=this._view)==null||n.onSingleImageUploaderSettingsChange(r.newValue);break}case "addOverlay":{this.addNativeOverlay(r.newValue);break}case "removeOverlay":{this.removeNativeOverlay(r.newValue);break}}for(let p of this.updateListeners)p(r);}}async updateContext(){await this.workerCommand("updateContext",{context:this.toJSONObject(),...this.getViewInfo()}).catch(e=>{a$7.warn("Error while updating context:",e);});}getViewInfo(){return this._view!=null?{view:{width:this._view.width,height:this._view.height,visible:this._view.width>0&&this._view.height>0,orientation:this._view.orientation}}:{view:null}}getMirrorAxisForFrameSource(e){let t="None";return f(e)&&e.getMirrorImageEnabled()&&(t="Y"),t}async addComponent(e){if(!this.components.includes(e))return this.components.push(e),e._context=this,this.update()}addNativeMode(e){this.nativeModes.add(e);}removeNativeMode(e){this.nativeModes.delete(e);}addNativeOverlay(e){b(e)&&this.workerCommand("addNativeOverlay",{overlayHandle:e[a$9]});}removeNativeOverlay(e){b(e)&&this.workerCommand("removeNativeOverlay",{overlayHandle:e[a$9]});}subscribeToWorkerMessages(e){this.dataCaptureInstance.addWorkerListener(e);}unsubscribeToWorkerMessages(e){this.dataCaptureInstance.removeWorkerListener(e);}hasEnabledMode(){return [...this.modes].some(e=>e.isEnabled())}async hasEnabledNativeMode(){return (await Promise.all([...this.nativeModes].map(e=>e.isEnabled()))).some(e=>e)}updateCameraFrameFlow(){let e=[...this.modes].some(t=>t._synchronousFrameFlow===true);d.instance().setFrameHandling(e);}async isFeatureSupported(e){return (await this.workerCommand("isFeatureSupported",{feature:e})).supported}};i.deviceID=a.getDeviceId(),i.moduleLicenseTextProviders=[new a$1];var D=i;
|
|
4
|
-
export{D as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-NMX4VHW2.js';import {a as a$1}from'./chunk-LSZZVJ6B.js';function E(){let e=a$1`@keyframes scandit-rotation{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.${a.CONTAINER_CLASS_NAME}{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.${a.CONTAINER_CLASS_NAME}:before{animation:scandit-rotation 1s linear infinite;background-color:#fff;content:" ";height:1px;left:0;opacity:0;pointer-events:none;position:absolute;top:0;width:1px}`,o=a$1`.${a.PAINTBOARDS_CONTAINER_CLASS_NAME}{height:inherit;position:relative;width:100%}.${a.PAINTBOARD_CLASS_NAME}{aspect-ratio:16/9;background-color:#000;height:100%;min-height:1px;min-width:1px;position:relative;width:100%}.${a.PAINTBOARD_CLASS_NAME}.${a.PAINTBOARD_CLASS_NAME_STATE_ON}{aspect-ratio:auto}.${a.PAINTBOARD_CLASS_NAME} video{display:block;height:100%;object-fit:cover;transition:opacity .3s;width:100%}.${a.PAINTBOARD_CLASS_NAME} .${a.MIRRORED_CLASS_NAME}{transform:scaleX(-1)}.${a.PAINTBOARD_CLASS_NAME} .${a.CAMERA_RECOVERY_CLASS_NAME}{background-color:#000;cursor:pointer;z-index:5}.${a.PAINTBOARD_CLASS_NAME} .${a.CAMERA_RECOVERY_CLASS_NAME},.${a.PAINTBOARD_CLASS_NAME} .${a.ERROR_CLASS_NAME}{align-items:center;color:#fff;display:flex;height:100%;justify-content:center;left:0;position:absolute;top:0;width:100%}.${a.PAINTBOARD_CLASS_NAME} .${a.ERROR_CLASS_NAME}{background-color:#00000080;text-align:center;z-index:6}.${a.PAINTBOARD_CLASS_NAME} .${a.HINT_CONTAINER_CLASS_NAME}{bottom:5vh;display:grid;pointer-events:none;position:absolute;top:5vh;width:100%}.${a.PAINTBOARD_CLASS_NAME} .${a.HINT_CLASS_NAME}{background-color:#fff;color:#000;padding:10px;width:fit-content}.${a.CAMERA_RECOVERY_CLASS_NAME}[hidden],.${a.ERROR_CLASS_NAME}[hidden],.${a.HINT_CLASS_NAME}[hidden]{display:none}.${a.PAINTBOARD_CLASS_NAME} canvas{height:100%;left:0;object-fit:cover;pointer-events:none;position:absolute;top:0;transition:opacity .3s;width:100%}`,i=a$1`.${a.PAINTBOARD_CLASS_NAME} .${a.SINGLE_IMAGE_UPLOADER_CONTAINER_CLASS_NAME}{-webkit-tap-highlight-color:rgba(255,255,255,0);align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;width:100%}.${a.PAINTBOARD_CLASS_NAME} .${a.SINGLE_IMAGE_UPLOADER_CONTAINER_CLASS_NAME} label{align-items:center;cursor:pointer;display:flex;flex-direction:column;justify-content:center}.${a.PAINTBOARD_CLASS_NAME} .${a.SINGLE_IMAGE_UPLOADER_CONTAINER_CLASS_NAME} label input[type=file]{position:absolute;top:-9999px}.${a.PAINTBOARD_CLASS_NAME}.${a.SINGLE_IMAGE_UPLOADER_CONTAINER_CLASS_NAME} label button{pointer-events:none}`,n=a$1`.${a.PAINTBOARD_CLASS_NAME} .${a.CONTROLS_CLASS_NAME}{display:flex;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%}.${a.PAINTBOARD_CLASS_NAME} .${a.CONTROL_WIDGET_CLASS_NAME}-${a.TORCH_SWITCH_CONTROL_CLASS_NAME}{left:16px;top:24px}.${a.PAINTBOARD_CLASS_NAME} .${a.CONTROL_WIDGET_CLASS_NAME}-${a.CAMERA_SWITCH_CONTROL_CLASS_NAME}{right:16px;top:24px}.${a.PAINTBOARD_CLASS_NAME} .${a.CONTROL_WIDGET_CLASS_NAME}-${a.CAMERA_FOV_SWITCH_CONTROL_CLASS_NAME}{bottom:24px;right:24px}.${a.CONTROL_WIDGET_CLASS_NAME}{background-color:initial;background-repeat:no-repeat;border:none;cursor:pointer;height:32px;pointer-events:all;position:absolute;width:32px}.${a.CONTROL_WIDGET_CLASS_NAME}+.${a.CONTROL_WIDGET_CLASS_NAME}{margin-left:16px}`,_=a$1`.${a.FROZEN_FRAME}{height:100%;left:0;object-fit:cover;opacity:1;position:absolute;top:0;width:100%}.${a.FROZEN_FRAME}[hidden]{opacity:0;pointer-events:none;visibility:hidden}`;return [e,o,n,i,_]}export{E as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {b}from'./chunk-6H6FKGVE.js';var r={configurePhase:"unconfigured",configurePromise:void 0,userLicenseKey:void 0,mainDataCaptureLoader:void 0,dataCaptureLoaders:void 0,loadingStatus:b,libraryLocation:void 0};export{r as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-JKL2W65E.js';var S={CONTAINER_CLASS_NAME:a.CONTAINER_CLASS_NAME,PAINTBOARD_CLASS_NAME:a.PAINTBOARD_CLASS_NAME,PAINTBOARD_CLASS_NAME_STATE_ON:a.PAINTBOARD_CLASS_NAME_STATE_ON,CONTROLS_CLASS_NAME:a.CONTROLS_CLASS_NAME,CONTROL_WIDGET_CLASS_NAME:a.CONTROL_WIDGET_CLASS_NAME,MIRRORED_CLASS_NAME:a.MIRRORED_CLASS_NAME,CAMERA_RECOVERY_CLASS_NAME:a.CAMERA_RECOVERY_CLASS_NAME,ERROR_CLASS_NAME:a.ERROR_CLASS_NAME,HINT_CONTAINER_CLASS_NAME:a.HINT_CONTAINER_CLASS_NAME,HINT_CLASS_NAME:a.HINT_CLASS_NAME,PAINTBOARDS_CONTAINER_CLASS_NAME:a.PAINTBOARDS_CONTAINER_CLASS_NAME,SINGLE_IMAGE_UPLOADER_CONTAINER_CLASS_NAME:a.SINGLE_IMAGE_UPLOADER_CONTAINER_CLASS_NAME,CANVAS_VIDEO_PREVIEW_CLASS_NAME:a.CANVAS_VIDEO_PREVIEW_CLASS_NAME,TORCH_SWITCH_CONTROL_CLASS_NAME:a.TORCH_SWITCH_CONTROL_CLASS_NAME,CAMERA_SWITCH_CONTROL_CLASS_NAME:a.CAMERA_SWITCH_CONTROL_CLASS_NAME,CAMERA_FOV_SWITCH_CONTROL_CLASS_NAME:a.CAMERA_FOV_SWITCH_CONTROL_CLASS_NAME,SHUTTER_BUTTON_CONTROL_CLASS_NAME:a.SHUTTER_BUTTON_CONTROL_CLASS_NAME,FROZEN_FRAME:a.FROZEN_FRAME};export{S as a};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {b as b$4}from'./chunk-WKTLU3L4.js';import {a as a$a}from'./chunk-HHMOVH27.js';import {a as a$2}from'./chunk-N5YZEC56.js';import {b as b$1,a as a$3}from'./chunk-5S537AFM.js';import {a as a$e}from'./chunk-DUPLHZRJ.js';import {d as d$2,c,b as b$5}from'./chunk-TTGWNLNK.js';import {a as a$g}from'./chunk-MUJ7NKAY.js';import {a as a$c}from'./chunk-FSWALUUO.js';import {a as a$5}from'./chunk-5FUZURCZ.js';import {a as a$h}from'./chunk-DMOXDUF6.js';import {b as b$2}from'./chunk-457L5N2F.js';import {a as a$b}from'./chunk-JVZYXEYO.js';import {a as a$d}from'./chunk-3BBG6EVS.js';import {a as a$9}from'./chunk-KYNYQBNF.js';import {a as a$8}from'./chunk-ZKROZLQ4.js';import {a as a$6}from'./chunk-3MEGNPVU.js';import {a as a$1}from'./chunk-VJB527QZ.js';import {a as a$7}from'./chunk-NMX4VHW2.js';import {a}from'./chunk-GHTCNOQN.js';import {d as d$1}from'./chunk-CXX2ZE7M.js';import {a as a$f}from'./chunk-XR65N6EG.js';import {d}from'./chunk-QM37NXPY.js';import {a as a$4,b as b$3,i,f}from'./chunk-77BBIAZE.js';import {a as a$i}from'./chunk-WUHKODFA.js';var b="core.camera.recovery",q=class Y{constructor(){this.focusGesture=d.DataCaptureView.focusGesture;this.zoomGesture=d.DataCaptureView.zoomGesture;this._scanAreaMargins=d.DataCaptureView.scanAreaMargins;this._pointOfInterest=d.DataCaptureView.pointOfInterest;this._logoStyle=d.DataCaptureView.logoStyle;this._logoAnchor=d.DataCaptureView.logoAnchor;this._logoOffset=d.DataCaptureView.logoOffset;this._context=null;this.overlays=new Set;this.controls=[];this.controlWidgets=new WeakMap;this.frozenFrameCanvas=document.createElement("canvas");this.listeners=[];this.isVideoElementDetached=false;this.orientation="portrait";this.hiddenProperties={stopVideoTracksOnVisibilityChange:true,freezeFrameWhenStoppingFrameSource:true};this.orientationObserver=new b$1;this.onOrientationChangeListener=this.onOrientationChange.bind(this);this.onHintPresenterUpdateHandler=this.onHintPresenterUpdate.bind(this);this.onBeforeShowToastsHandler=this.onBeforeShowToasts.bind(this);this.onWorkerMessageHandler=this.onWorkerMessage.bind(this);this.htmlElementDidChangeHandler=this.htmlElementDidChange.bind(this);this.htmlElementDisconnectedHandler=this.htmlElementDisconnected.bind(this);this.notificationPresenter=null;this.visibilityListener=this.onVisibilityChange.bind(this),this.cameraRecoveryListener=this.cameraRecovery.bind(this),a.getInstance().updateIfMissing(a$1);}get scanAreaMargins(){return this._scanAreaMargins}set scanAreaMargins(e){var t;this._scanAreaMargins=e,(t=this.privateContext)==null||t.update();}get pointOfInterest(){return this._pointOfInterest}set pointOfInterest(e){var t;this._pointOfInterest=e,(t=this.privateContext)==null||t.update();}get logoStyle(){return this._logoStyle}set logoStyle(e){var t;this._logoStyle=e,(t=this.privateContext)==null||t.update();}get logoAnchor(){return this._logoAnchor}set logoAnchor(e){var t;this._logoAnchor=e,(t=this.privateContext)==null||t.update();}get logoOffset(){return this._logoOffset}set logoOffset(e){var t;this._logoOffset=e,(t=this.privateContext)==null||t.update();}get cameraRecoveryText(){return a.getInstance().get(b)}get width(){var e,t;return Math.round((t=(e=this.htmlElementState)==null?void 0:e.width)!=null?t:0)}get height(){var e,t;return Math.round((t=(e=this.htmlElementState)==null?void 0:e.height)!=null?t:0)}get canvasDrawer(){return !this._canvasDrawer&&this.canvasElement!=null&&(this._canvasDrawer=new b$2(this.canvasElement),this._canvasDrawer.startObservingCanvasResize()),this._canvasDrawer}get privateContext(){return this._context}static async forContext(e){let t=new Y;return await t.setContext(e),t}showProgressBar(){var e;(e=this.loadingOverlay)==null||e.show();}hideProgressBar(){var e;(e=this.loadingOverlay)==null||e.hide();}setProgressBarPercentage(e){this.loadingOverlay&&(this.loadingOverlay.progress=e);}setProgressBarMessage(e){this.loadingOverlay&&(this.loadingOverlay.message=e);}getContext(){return this._context}async setContext(e){var t,i,n;if(this._context=e,e){if(this.overlays.size>0&&((t=this.privateContext)==null?void 0:t.modes.size)===0)throw new Error(["Cannot assign this view to this context. This view has overlays but the context does not have any mode attached matching these overlays.","Remove the overlays first before attaching the view to the context, or add the corresponding mode to the context before attaching this view."].join(" "));await e.setView(this),(i=this.privateContext)==null||i.subscribeToWorkerMessages(this.onWorkerMessageHandler),(n=this._context)!=null&&n.frameSource&&await this.onFrameSourceChange(this._context.frameSource);}}connectToElement(e){var t,i,n;this.orientationObserver.register(),this.setupHtmlElement(e),(t=this.canvasDrawer)==null||t.startObservingCanvasResize(),this.htmlElementDidChange(),a$2.add(this),this.orientation=this.orientationObserver.orientation.value,this.orientationObserver.addEventListener(a$3,this.onOrientationChangeListener),(i=this.hintPresenter)==null||i.addEventListener("hintpresenterupdate",this.onHintPresenterUpdateHandler),(n=this.hintPresenter)==null||n.addEventListener("willshow",this.onBeforeShowToastsHandler),this.localizationSubscription=a.getInstance().subscribe(r=>{r[b]!=null&&(this.cameraRecoveryElement.textContent=r[b]);});}detachFromElement(){var e,t,i,n,r,o,l,d;(e=this.htmlElementState)==null||e.removeListeners(),this.removeStyles(),(t=this.canvasDrawer)==null||t.endObservingCanvasResize(),document.removeEventListener("visibilitychange",this.visibilityListener);for(let h of ["touchend","mousedown"])this.cameraRecoveryElement.removeEventListener(h,this.cameraRecoveryListener);(i=this.loadingOverlay)==null||i.remove(),(n=this.customLocationsView)==null||n.unmount(),this.notificationPresenter=null,this.htmlElementDidChange(),(r=this.gestureRecognizer)==null||r.removeAllListeners(),this.clearHtmlElementContent(),a$2.delete(this),this.orientationObserver.unregister(),this.orientationObserver.removeEventListener(a$3,this.onOrientationChangeListener),(o=this.hintPresenter)==null||o.removeEventListener("hintpresenterupdate",this.onHintPresenterUpdateHandler),(l=this.hintPresenter)==null||l.removeEventListener("willshow",this.onBeforeShowToastsHandler),(d=this.localizationSubscription)==null||d.cancel();}async addOverlay(e){var t;this.overlays.has(e)||(this.overlays.add(e),await((t=this.privateContext)==null?void 0:t.update([{type:"addOverlay",newValue:e}])));}async removeOverlay(e){var t;this.overlays.has(e)&&(await((t=this.privateContext)==null?void 0:t.update([{type:"removeOverlay",newValue:e}])),this.overlays.delete(e));}addListener(e){this.listeners.includes(e)||this.listeners.push(e);}removeListener(e){this.listeners.includes(e)&&this.listeners.splice(this.listeners.indexOf(e),1);}viewPointForFramePoint(e){var v,O,P,L,V,D,R,A;let t={width:(O=(v=this.htmlElementState)==null?void 0:v.width)!=null?O:0,height:(L=(P=this.htmlElementState)==null?void 0:P.height)!=null?L:0},i={width:(D=(V=this.videoElement)==null?void 0:V.videoWidth)!=null?D:0,height:(A=(R=this.videoElement)==null?void 0:R.videoHeight)!=null?A:0},n=t.width/t.height,r=i.width/i.height,o=n>r?t.width/i.width:t.height/i.height,l={x:e.x*o,y:e.y*o},d=(i.width*o-t.width)/2,h=(i.height*o-t.height)/2;return new a$4(l.x-d,l.y-h)}viewQuadrilateralForFrameQuadrilateral(e){let t=this.viewPointForFramePoint(e.topLeft),i=this.viewPointForFramePoint(e.topRight),n=this.viewPointForFramePoint(e.bottomLeft),r=this.viewPointForFramePoint(e.bottomRight);return new b$3(t,i,r,n)}addControl(e){var t;this.controls.includes(e)||(e.view=this,this.controls.push(e),this.controlsUpdated(),(t=this.privateContext)==null||t.update([{type:"addControl",newValue:e}]));}removeControl(e){var t;if(this.controls.includes(e)){e.view=null;let i=this.controls.splice(this.controls.indexOf(e),1);this.getControlWidget(i[0]).remove(true),this.controlsUpdated(),(t=this.privateContext)==null||t.update([{type:"removeControl",newValue:e}]);}}toJSONObject(){var e;return {scanAreaMargins:this.scanAreaMargins.toJSONObject(),pointOfInterest:this.pointOfInterest.toJSONObject(),logoAnchor:this.logoAnchor,logoOffset:this.logoOffset.toJSONObject(),logoHidden:(e=this.logoHidden)!=null?e:false,logoStyle:this.logoStyle,overlays:[...this.overlays].map(t=>t.toJSONObject()),controls:this.controls.map(t=>t.toJSONObject()),focusGesture:this.focusGesture?this.focusGesture.toJSONObject():null,zoomGesture:this.zoomGesture?this.zoomGesture.toJSONObject():null}}isCameraRecoveryVisible(){return !this.cameraRecoveryElement.hidden}setCameraRecoveryVisible(e){this.cameraRecoveryElement.hidden=!e;}async allowPictureInPicture(e){await d$1.instance().allowPictureInPicture(e);}viewAnchorPositionsForFrameAnchorPositions(e){let t=this.viewPointForFramePoint(e.topLeft),i=this.viewPointForFramePoint(e.topRight),n=this.viewPointForFramePoint(e.bottomLeft),r=this.viewPointForFramePoint(e.bottomRight),o=this.viewPointForFramePoint(e.centerLeft),l=this.viewPointForFramePoint(e.centerRight),d=this.viewPointForFramePoint(e.topCenter),h=this.viewPointForFramePoint(e.bottomCenter),v=this.viewPointForFramePoint(e.center);return new a$5(t,i,r,n,o,d,l,h,v)}setDidTapCustomLocationsViewListener(e){this.customLocationsView&&this.customLocationsView.listener===null&&(this.customLocationsView.listener=e);}renderCustomLocationsView(e){this.customLocationsView!=null&&(this.customLocationsView.setMirrored(d$1.instance().isMirrorImageEnabled()),Object.keys(e).includes("removedIds")?this.customLocationsView.render(e):this.customLocationsView.renderDomView(e));}getNotificationPresenter(){var e;if(!this.notificationPresenter){let t=(e=this.htmlElement)==null?void 0:e.querySelector(b$4.tag);if(!t)throw new Error("Notification presenter cannot be found. Please ensure the DataCaptureView is connected.");this.notificationPresenter=new a$6(t);}return this.notificationPresenter}removeStyles(){for(let e of document.querySelectorAll("style[scandit]"))e.remove();}onHintPresenterUpdate(e){var t;(t=this.privateContext)==null||t.workerCommand("hintPresenterV2update",{});}clearHtmlElementContent(){var e;this.htmlElement&&((e=this.canvasDrawer)==null||e.endObservingCanvasResize(),this.htmlElement.innerHTML="",this.cameraPaintboardElement=void 0,this.singleImageUploaderPaintboardElement=void 0,this.htmlElement=void 0);}setupHtmlElement(e){var o,l,d;this.createStyles(),this.htmlElement=e,b$4.register();let t=`
|
|
2
|
-
<div class="${a$7.CONTAINER_CLASS_NAME}">
|
|
3
|
-
<div class="${a$7.PAINTBOARDS_CONTAINER_CLASS_NAME}">
|
|
4
|
-
<div data-js-id="loading-overlay"></div>
|
|
5
|
-
<div class="${a$7.PAINTBOARD_CLASS_NAME}" data-js-id="camera-paintboard">
|
|
6
|
-
<video autoplay="autoplay" playsinline="true" muted="muted" poster="${a$8}" style="opacity: 0;"></video>
|
|
7
|
-
<img class="${a$7.FROZEN_FRAME}" data-js-id="frozen-frame" alt="frozen-frame" hidden />
|
|
8
|
-
<canvas></canvas>
|
|
9
|
-
<div data-js-id="${a$9.CUSTOM_VIEW_CONTAINER}"></div>
|
|
10
|
-
<div class="${a$7.HINT_CONTAINER_CLASS_NAME}">
|
|
11
|
-
<div class="${a$7.HINT_CLASS_NAME}" hidden></div>
|
|
12
|
-
</div>
|
|
13
|
-
<${b$4.tag}></${b$4.tag}>
|
|
14
|
-
<div class="${a$7.CONTROLS_CLASS_NAME}"></div>
|
|
15
|
-
<div class="${a$7.CAMERA_RECOVERY_CLASS_NAME}" hidden>${this.cameraRecoveryText}</div>
|
|
16
|
-
<div class="${a$7.ERROR_CLASS_NAME}" hidden></div>
|
|
17
|
-
</div>
|
|
18
|
-
<div class="${a$7.PAINTBOARD_CLASS_NAME}" data-js-id="singleimage-paintboard"></div>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
`;this.htmlElement.innerHTML=t,this.hintPresenter=this.htmlElement.querySelector(b$4.tag),this.notificationPresenter=this.hintPresenter?new a$6(this.hintPresenter):null,this.loadingOverlay&&this.loadingOverlay.remove(),this.loadingOverlay=a$a.create(),this.loadingOverlay.hide(),(o=this.htmlElement.querySelector('[data-js-id="loading-overlay"]'))==null||o.replaceWith(this.loadingOverlay),this.customLocationsView&&this.customLocationsView.unmount(),this.customLocationsView=new a$b,this.customLocationsView.mount(this.htmlElement.querySelector(`[data-js-id="${a$9.CUSTOM_VIEW_CONTAINER}"]`)),this.customLocationsView.mapViewAnchorPositionsForFramePoint=h=>this.viewAnchorPositionsForFrameAnchorPositions(h),this.containerElement=this.htmlElement.querySelector(`.${a$7.CONTAINER_CLASS_NAME}`),this.cameraPaintboardElement=this.containerElement.querySelector('[data-js-id="camera-paintboard"]'),this.singleImageUploaderPaintboardElement=this.containerElement.querySelector('[data-js-id="singleimage-paintboard"]');let i=this.cameraPaintboardElement.querySelector("canvas");this.canvasElement==null?this.canvasElement=i:i.replaceWith(this.canvasElement);let n=this.cameraPaintboardElement.querySelector('[data-js-id="frozen-frame"]');this.frozenFrame==null?this.frozenFrame=n:n.replaceWith(this.frozenFrame),this.controlsElement=this.cameraPaintboardElement.querySelector(`.${a$7.CONTROLS_CLASS_NAME}`),this.cameraRecoveryElement=this.cameraPaintboardElement.querySelector(`.${a$7.CAMERA_RECOVERY_CLASS_NAME}`),this.errorElement=this.cameraPaintboardElement.querySelector(`.${a$7.ERROR_CLASS_NAME}`),this.hintContainerElement=this.cameraPaintboardElement.querySelector(`.${a$7.HINT_CONTAINER_CLASS_NAME}`),this.hintElement=this.cameraPaintboardElement.querySelector(`.${a$7.HINT_CLASS_NAME}`);let r=this.cameraPaintboardElement.querySelector("video");this.videoElement?r.replaceWith(this.videoElement):(this.videoElement=r,this.videoPauseListener=this.handleVideoPause.bind(this),this.videoElement.addEventListener("pause",this.videoPauseListener)),this.lastFrameSourceState!=null&&((d=(l=this._context)==null?void 0:l.frameSource)==null||d.switchToDesiredState(this.lastFrameSourceState)),document.addEventListener("visibilitychange",this.visibilityListener);for(let h of ["touchend","mousedown"])this.cameraRecoveryElement.addEventListener(h,this.cameraRecoveryListener);this.htmlElementState&&this.htmlElementState.removeListeners(),this.htmlElementState=new a$c(this.htmlElement),this.htmlElementState.onStateChanged(this.htmlElementDidChangeHandler),this.htmlElementState.onDisconnected(this.htmlElementDisconnectedHandler),this.gestureRecognizer=new a$d(this.htmlElement),this.gestureRecognizer.addListener({onTap:async h=>{var v;(v=this.privateContext)==null||v.workerCommand("onTap",{point:h.toJSONObject()});}});}setupHtmlElementSingleImageUploader(e){var i;if(this.singleImageUploaderPaintboardElement==null)return;this.singleImageUploaderView&&this.singleImageUploaderView.unmount(),this.singleImageUploaderView=new a$e(e),this.singleImageUploaderView.mount(this.containerElement.querySelector('[data-js-id="singleimage-paintboard"]'));let t=(i=this._context)==null?void 0:i.frameSource;this.singleImageUploaderView.onInputCheck(n=>{t.getCurrentState()!=="starting"&&n.preventDefault();}),this.singleImageUploaderView.onBeforeFileRead(()=>{t._context&&this.singleImageUploaderView&&(this.singleImageUploaderView.canUploadFile=t._context.hasEnabledMode());}),this.singleImageUploaderView.onImageLoadError(()=>{t.currentState="starting",a$f.log(a$f.Level.Error,"Could not load image from selected file");}),this.singleImageUploaderView.onFileReaderError(n=>{var o,l;let r=n.target;t.currentState="starting",a$f.log(a$f.Level.Error,`Error while reading the file: ${(l=(o=r.error)==null?void 0:o.toString())!=null?l:""}`);}),this.singleImageUploaderView.onCaptureReady(async n=>{await t.processUploadedFileCapture(n);}),this.singleImageUploaderView.setButtonState(t.getCurrentState()==="starting"?"enabled":"disabled"),t.addView(this.singleImageUploaderView);}setupHtmlElementVisibility(e){this.cameraPaintboardElement!=null&&(this.cameraPaintboardElement.hidden=e!=="camera"),this.singleImageUploaderPaintboardElement!=null&&(this.singleImageUploaderPaintboardElement.hidden=e!=="singleImageUploader");}createStyles(){if(document.querySelector("style[scandit]")===null){let e=a$g();for(let[t,i]of Object.entries(e))i.setAttribute("scandit",`data-capture-sdk-${t}`),document.head.append(i);}}async onOrientationChange(e){var t,i;this.orientation=e.detail.value,await((i=this.privateContext)==null?void 0:i.update([{type:"viewChange",newValue:{...(t=this.htmlElementState)==null?void 0:t.toJSONObject(),orientation:this.orientation}}]));}htmlElementDidChange(){var i$1,n;if(!this.htmlElementState)return;let e=this.htmlElementState,t=e.toJSONObject();if(!a$c.areEquivalentJSONStates(this.lastHtmlElementState,t)){this.orientation=this.orientationObserver.orientation.value,(i$1=this.privateContext)==null||i$1.update([{type:"viewChange",newValue:{...e.toJSONObject(),orientation:this.orientation}}]),this.lastHtmlElementState=t,(n=this.canvasDrawer)==null||n.updateCanvasSizeAttributes(this.width,this.height),this.handleVideoDisplay(t.visible);for(let r of this.listeners)typeof r.didChangeSize=="function"&&r.didChangeSize(this,new i(t.size.width.value,t.size.height.value),this.orientation);}}async htmlElementDisconnected(){var e,t,i,n,r,o,l;this.isVideoElementDetached=false,(e=this.videoElement)==null||e.remove(),this.lastFrameSourceState=(i=(t=this._context)==null?void 0:t.frameSource)==null?void 0:i.getCurrentState(),await((r=(n=this._context)==null?void 0:n.frameSource)==null?void 0:r.switchToDesiredState("off")),await((l=this.privateContext)==null?void 0:l.update([{type:"viewChange",newValue:{...(o=this.htmlElementState)==null?void 0:o.toJSONObject(),orientation:this.orientation}}]));}handleVideoDisplay(e){this.videoElement==null||this.cameraPaintboardElement==null||(!e&&!this.isVideoElementDetached?(this.videoElement.width=0,this.videoElement.height=0,this.videoElement.style.opacity="0",this.videoElement.style.visibility="hidden",document.body.append(this.videoElement),this.isVideoElementDetached=true):e&&this.isVideoElementDetached&&(this.cameraPaintboardElement.insertAdjacentElement("afterbegin",this.videoElement),this.isVideoElementDetached=false,this.videoElement.style.removeProperty("visibility"),this.videoElement.removeAttribute("width"),this.videoElement.removeAttribute("height"),this.videoElement.style.removeProperty("opacity")));}isCanvasDrawerWithMetrics(e){return e instanceof a$h}onWorkerMessage(e){var t,i;switch(e.type){case "draw":{this.drawEngineCommands(e.payload);break}case "performanceMetricsReport":{let n=this._canvasDrawer;n!=null&&this.isCanvasDrawerWithMetrics(n)&&n.setPerformanceMetrics(e.payload);break}case "contextDidChangeStatus":{let n=a$i.fromJSON(e.payload);(t=this.loadingOverlay)==null||t.hide(),n.isValid?this.clearError():this.displayError(n);break}case "showHint":{this.displayHint(e.payload.text,e.payload.style);break}case "updateHint":{this.updateHint(e.payload.style);break}case "hideHint":{this.hideHint();break}default:{(i=this.hintPresenter)==null||i.handleMessage(e);break}}}async onBeforeShowToasts(){var t,i$1;let e=await((t=this._context)==null?void 0:t.workerCommand("getViewfinderInfo",{}));if((e==null?void 0:e.rect)!=null){if(e.rect.origin.x===0&&e.rect.origin.y===0&&e.rect.size.width===0&&e.rect.size.height===0)return;(i$1=this.hintPresenter)==null||i$1.setViewFinderRect(new f(new a$4(e.rect.origin.x,e.rect.origin.y),new i(e.rect.size.width,e.rect.size.height)));}}drawEngineCommands(e){var t;(t=this.canvasDrawer)==null||t.draw(e);}displayError(e){this.errorElement.textContent=`Error ${e.code}: ${e.message}`,this.errorElement.hidden=false;}clearError(){this.errorElement.textContent="",this.errorElement.hidden=true;}displayHint(e,t){this.hintElement.textContent=e,this.hintElement.hidden=false,this.updateHint(t);}hideHint(){this.hintElement.textContent="",this.hintElement.hidden=true;}updateHint(e){this.hintElement.style.background=e.backgroundColor,this.hintElement.style.color=e.textColor,this.hintElement.style.fontSize=e.font==="body"?"1.25rem":"1rem",this.hintElement.style.borderRadius=e.hintCornerStyle==="rounded"?"5px":"0px",e.hintHeight==="taller"&&(this.hintElement.style.paddingTop="1.25em",this.hintElement.style.paddingBottom="1.25em"),e.hintWidth==="wider"&&(this.hintElement.style.paddingLeft="1.25em",this.hintElement.style.paddingRight="1.25em"),this.updateAnchor(e);}updateAnchor(e){let t=`${e.verticalOffsetRatio*100}vh`;switch(e.anchor){case "topLeft":{this.hintContainerElement.style.placeContent="start left",this.hintElement.style.transform=`translateY(${t})`;break}case "topCenter":{this.hintContainerElement.style.placeContent="start center",this.hintElement.style.transform=`translateY(${t})`;break}case "topRight":{this.hintContainerElement.style.placeContent="start right",this.hintElement.style.transform=`translateY(${t})`;break}case "centerLeft":{this.hintContainerElement.style.placeContent="center start";break}case "center":{this.hintContainerElement.style.placeContent="center";break}case "centerRight":{this.hintContainerElement.style.placeContent="center end";break}case "bottomLeft":{this.hintContainerElement.style.placeContent="end left";break}case "bottomCenter":{this.hintContainerElement.style.placeContent="end center";break}case "bottomRight":{this.hintContainerElement.style.placeContent="end right";break}}}controlsUpdated(){var e;this.redrawControls(),(e=this.privateContext)==null||e.update();}redrawControls(){var t;let e=(t=this._context)==null?void 0:t.frameSource;for(let i of this.controls){let n=this.getControlWidget(i);e==null||e.desiredState==="off"||e.desiredState==="standby"||e.desiredState==="stopping"?n.remove():n.install();}}registerControlWidget(e,t){let i=new t(e,this.controlsElement);return this.controlWidgets.set(e,i),i}getControlWidget(e){let t=this.controlWidgets.get(e);if(t)return t;let{type:i}=e,n;switch(i){case "torch":{n=new b$5(e,this.controlsElement),this.controlWidgets.set(e,n);break}case "camera":{n=new c(e,this.controlsElement),this.controlWidgets.set(e,n);break}case "camera-fov":{n=new d$2(e,this.controlsElement),this.controlWidgets.set(e,n);break}}return n}async onFrameSourceChange(e){let t=e==null?void 0:e.type;if(this.setupHtmlElementVisibility(t),t==="camera"){let i=e==null?void 0:e.getCurrentState();i!=null&&await this.onCameraStateChanged(i);}else t==="singleImageUploader"&&this.setupHtmlElementSingleImageUploader(e.settings);}async onCameraStateChanged(e){var t;switch((t=this.cameraPaintboardElement)==null||t.classList.toggle(a$7.PAINTBOARD_CLASS_NAME_STATE_ON,e==="on"),e){case "stopping":{this.hiddenProperties.freezeFrameWhenStoppingFrameSource&&this.freezeFrame(),this.setVideoElementOpacity("0");return}case "starting":case "bootingUp":case "wakingUp":{if(!this.htmlElement){a$f.log(a$f.Level.Error,"cannot set frame source stream before connecting view to an HTML element");return}this.videoElement&&(d$1.instance().videoElement=this.videoElement,d$1.instance().gui.isCameraRecoveryVisible=this.isCameraRecoveryVisible.bind(this),d$1.instance().gui.setCameraRecoveryVisible=this.setCameraRecoveryVisible.bind(this),this.setVideoElementOpacity("0"));return}case "off":{this.setVideoElementOpacity("0"),this.redrawControls();return}case "on":{await d$1.instance().waitForCapabilities(),this.redrawControls(),this.unfreezeFrame(),this.setVideoElementOpacity("1");break}case "goingToSleep":{this.freezeFrame();break}}}setVideoElementOpacity(e){this.videoElement&&(this.videoElement.style.opacity=e),this.canvasElement&&(this.canvasElement.style.opacity=e);}onSingleImageUploaderSettingsChange(e){this.setupHtmlElementSingleImageUploader(e);}handleVideoPause(){d$1.instance().playVideo();}setHiddenProperty(e,t){this.hiddenProperties[e]=t;}async onVisibilityChange(){var t,i;let e=(t=this.videoElement)==null?void 0:t.srcObject;if(this.hiddenProperties.stopVideoTracksOnVisibilityChange&&(document.visibilityState==="hidden"&&d$1.instance().stopVideoTracks(),document.visibilityState==="visible"&&d$1.instance().activeCamera!=null&&e!=null))if(!e.active||(i=e.getVideoTracks()[0])!=null&&i.muted)try{a$f.debug('Detected visibility change ("visible") event with inactive video source, try to reinitialize camera'),await d$1.instance().reinitializeCamera();}catch(n){}else a$f.debug('Detected visibility change ("visible") event with active video source, replay video'),d$1.instance().playVideo();}async cameraRecovery(e){e.preventDefault(),d$1.instance().activeCamera=d$1.instance().selectedCamera,await d$1.instance().reinitializeCamera();}freezeFrame(){var i;if(!this.frozenFrame)return;let e=d$1.instance().getCurrentFrame();if(!e)return;let t=new ImageData(e.data,e.width,e.height);this.frozenFrameCanvas.width=t.width,this.frozenFrameCanvas.height=t.height,this.frozenFrame.width=t.width,this.frozenFrame.height=t.height,(i=this.frozenFrameCanvas.getContext("2d"))==null||i.putImageData(t,0,0),this.frozenFrame.src=this.frozenFrameCanvas.toDataURL("image/jpeg",.4),this.frozenFrame.classList.toggle(a$7.MIRRORED_CLASS_NAME,d$1.instance().isMirrorImageEnabled()),this.frozenFrame.hidden=false;}unfreezeFrame(){this.frozenFrame&&(this.frozenFrame.src="",this.frozenFrame.hidden=true);}};export{q as a};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {a as a$3}from'./chunk-2QT7PJFA.js';import {a as a$2}from'./chunk-QUHRBS4G.js';import {e}from'./chunk-IVDD7PCI.js';import {b as b$1}from'./chunk-SM5S3DDC.js';import {a as a$6}from'./chunk-3A4KLILV.js';import {a as a$4}from'./chunk-MU6SADSF.js';import {a as a$1}from'./chunk-EV4OEANA.js';import {a as a$5}from'./chunk-LSZZVJ6B.js';var w=(e=>(e.DidShow="didshow",e.DidHide="didhide",e.WillShow="willshow",e))(w||{}),o="--text-size",s="--text-color",n="--text-alignment",r="--text-weight",a="--line-height",l="--background-color",c="--corner-radius",h="--max-lines",x="ease-in-out",i=class i extends a$1{constructor(){super();this.toast=null;this._hintStyle=null;this._customIcon=null;this.currentAnimation=null;this.animationDuration=250;let t=this.attachShadow({mode:"open"});this._exclamationIcon=a$2.create(),this._checkIcon=a$3.create(),this._exclamationIcon.size=24,this._checkIcon.size=24,t.innerHTML=a$4`
|
|
2
|
-
<div class="toast">
|
|
3
|
-
<slot name="first-child"></slot>
|
|
4
|
-
<div class="left">
|
|
5
|
-
<slot name="icon"></slot>
|
|
6
|
-
</div>
|
|
7
|
-
<p class="middle">
|
|
8
|
-
<slot></slot>
|
|
9
|
-
</p>
|
|
10
|
-
</div>
|
|
11
|
-
`,t.append(i.createStyleElement().cloneNode(true)),this.toast=t.querySelector(".toast");}static createStyleElement(){return a$5`:host{display:inline-block;font-family:SF Pro Display,sans-serif}:host([hidden]){display:none}.toast{${o}:1rem;${s}:#000;${r}:400;${n}:${"center"};${a}:1.5rem;${l}:#fff;${c}:.25rem;${h}:2;align-items:flex-start;background-color:var(${l});border-radius:var(${c});color:var(${s});display:flex;flex-direction:row;font-size:var(${o});font-weight:var(${r});gap:.625rem;justify-content:var(${n});line-height:var(${a});padding:1rem}:host([direction=column]) .toast{align-items:center;flex-direction:column}:host([direction=row]) .toast{align-items:center;flex-direction:row}.toast .left{align-self:flex-start;display:flex}.toast.icon-${"none"} .left{display:none}.toast p.middle{display:inline-block;display:-webkit-box;margin:0;padding:0;text-align:var(${n});-webkit-line-clamp:var(${h});-webkit-box-orient:vertical;align-self:center;overflow:hidden;text-shadow:0 1px 2px #${e.withAlpha(.3).toJSON()}}p.middle{text-align:var(${n})}`}get hintStyle(){return this._hintStyle}set hintStyle(t){this._hintStyle=t,this.render();}get customIcon(){return this._customIcon}set customIcon(t){this._customIcon=t,this.render();}get showAnimation(){return new Animation(new KeyframeEffect(this,[{opacity:0},{opacity:1}],{duration:this.animationDuration,fill:"both",easing:x}))}get hideAnimation(){return new Animation(new KeyframeEffect(this,[{opacity:1},{opacity:0}],{duration:this.animationDuration,fill:"both",easing:x}))}static create(){return i.register(),document.createElement(i.tag)}static register(){a$6({[i.tag]:i});}async show(){return this.toggle(true)}async hide(){return this.toggle(false)}connectedCallback(){this.render();}async toggle(t){var e,d;if(this.currentAnimation==null){this.animationDuration=(d=(e=this.hintStyle)==null?void 0:e.isAnimatedToView)==null||d?250:0,this.currentAnimation=t?this.showAnimation:this.hideAnimation,t&&this.dispatchEvent(new CustomEvent("willshow",{bubbles:true})),this.currentAnimation.play();try{await b$1(this.currentAnimation),this.dispatchEvent(new CustomEvent(t?"didshow":"didhide",{bubbles:true,detail:{target:this}}));}catch(I){}finally{this.currentAnimation=null;}}}render(){var t;if(!(!this.toast||!this.hintStyle)){this.toast.className="toast",this.toast.style.setProperty(o,`${this.hintStyle.textSize}px`),this.toast.style.setProperty(s,`#${this.hintStyle.textColor}`),this.toast.style.setProperty(r,this.hintStyle.textWeight.toString()),this.toast.style.setProperty(n,this.hintStyle.textAlignment),this.toast.style.setProperty(a,`${this.hintStyle.lineHeight/14}`),this.toast.style.setProperty(l,`#${this.hintStyle.backgroundColor}`),this.toast.style.setProperty(c,`${this.hintStyle.cornerRadius/10}rem`),this.toast.style.setProperty(h,this.hintStyle.maxLines.toString());for(let e of this.querySelectorAll("[slot=icon]"))e.remove();this._customIcon?(this._customIcon.setAttribute("slot","icon"),this.append(this._customIcon),this.toast.classList.remove("icon-none")):(this.toast.classList.toggle("icon-none",this.hintStyle.hintIcon==="none"),this.hintStyle.hintIcon==="check"?(this._checkIcon.setAttribute("slot","icon"),this.append(this._checkIcon)):this.hintStyle.hintIcon==="exclamationMark"&&(this._exclamationIcon.setAttribute("slot","icon"),this.append(this._exclamationIcon)),this.hintStyle.iconColor&&((t=this.querySelector("[slot=icon]"))==null||t.setAttribute("fill",`#${this.hintStyle.iconColor}`)));}}};i.tag="scandit-toast-hint";var b=i;export{w as a,b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports);var l=(b,a,c,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&f(b,d,{get:()=>a[d],enumerable:!(e=h(a,d))||e.enumerable});return b};var n=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:true}):c,b));export{m as a,n as b};
|