@scandit/web-datacapture-core 7.2.0 → 7.2.1
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/js/Camera.js +1 -1
- package/build/js/CameraAccess.js +1 -1
- package/build/js/DataCaptureContext.js +1 -1
- package/build/js/DataCaptureVersion.js +1 -1
- package/build/js/DataCaptureView.js +1 -1
- package/build/js/Feedback.js +1 -1
- package/build/js/ScanditIcon.js +1 -1
- package/build/js/ScanditIconBuilder.js +1 -1
- package/build/js/Sound.js +1 -1
- package/build/js/assets/beepSound.js +1 -1
- package/build/js/chunks/{chunk-U7XZE33G.js → chunk-4KCDIWC3.js} +1 -1
- package/build/js/chunks/{chunk-3OBWS6CO.js → chunk-6HPS3VUF.js} +1 -1
- package/build/js/chunks/chunk-6LUJAFBV.js +1 -0
- package/build/js/chunks/chunk-6X73W3EO.js +2 -0
- package/build/js/chunks/{chunk-DVQH5JLR.js → chunk-72A5262S.js} +1 -1
- package/build/js/chunks/{chunk-FNFCPBQI.js → chunk-7CQVGY6N.js} +1 -1
- package/build/js/chunks/{chunk-EXY5MS5K.js → chunk-7M3GGOSL.js} +1 -1
- package/build/js/chunks/{chunk-BIGR7VVJ.js → chunk-7QNII4K3.js} +1 -1
- package/build/js/chunks/{chunk-BYMYBEMT.js → chunk-AC6MK6LU.js} +1 -1
- package/build/js/chunks/{chunk-KRIYEHHW.js → chunk-ACXLPROZ.js} +1 -1
- package/build/js/chunks/{chunk-VEXAGRW7.js → chunk-EEA7AA2K.js} +2 -2
- package/build/js/chunks/{chunk-6FPW3MIJ.js → chunk-EVI6U6CG.js} +1 -1
- package/build/js/chunks/{chunk-MST2ECFN.js → chunk-FFTRSHP6.js} +1 -1
- package/build/js/chunks/{chunk-LY6NJOQH.js → chunk-FLO5QRX5.js} +1 -1
- package/build/js/chunks/{chunk-5E7ISPKS.js → chunk-FPCLZS52.js} +1 -1
- package/build/js/chunks/chunk-J7ZH4PNS.js +1 -0
- package/build/js/chunks/chunk-LSZZVJ6B.js +1 -0
- package/build/js/chunks/chunk-MU6SADSF.js +1 -0
- package/build/js/chunks/chunk-MWPSUUFY.js +1 -0
- package/build/js/chunks/{chunk-T5FGQOCF.js → chunk-NAOIN6LV.js} +1 -1
- package/build/js/chunks/{chunk-2NHLNMAU.js → chunk-SCTIUP46.js} +1 -1
- package/build/js/chunks/{chunk-YS6R5ZYE.js → chunk-TTT735E7.js} +1 -1
- package/build/js/chunks/{chunk-CBF2PLFL.js → chunk-U2OJFO7J.js} +1 -1
- package/build/js/chunks/{chunk-FFFXM7UY.js → chunk-UUGROS73.js} +1 -1
- package/build/js/chunks/{chunk-TJJYIG7M.js → chunk-VZJ2FQ7I.js} +1 -1
- package/build/js/chunks/{chunk-VIZTTYLK.js → chunk-WPY7T7HY.js} +1 -1
- package/build/js/index.js +1 -1
- package/build/js/private/CameraAccess.js +1 -1
- package/build/js/private/CameraManager.js +1 -1
- package/build/js/private/ViewControls+related.js +1 -1
- package/build/js/private/ViewStyles.js +1 -1
- package/build/js/private/ui/atoms/ArrowDownSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/ArrowLeftSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/ArrowRightSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/ArrowUpSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/ArrowsUp.js +1 -1
- package/build/js/private/ui/atoms/CalendarExclamationMarkSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/CameraSwitchReverseSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/CameraSwitchSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/CheckSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/ChevronDownSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/ChevronLeftSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/ChevronRightSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/ChevronUpSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/CrossSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/Dot5xSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/ExclamationMarkSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/GlassSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/HandLensCheckSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/LowStockSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/OnexSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/PrinterSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/ProgressBar.js +1 -1
- package/build/js/private/ui/atoms/QuestionMarkSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/RoundedCheckSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/RoundedExclamationMarkSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/ShutterButton.js +1 -1
- package/build/js/private/ui/atoms/StarFilledSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/StarHalfFilledSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/StarOutlinedSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/SvgIcon.js +1 -1
- package/build/js/private/ui/atoms/ToPickSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/Toast.js +1 -1
- package/build/js/private/ui/atoms/TwoxSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/WrongItemSvgIcon.js +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/css.js +1 -1
- package/build/js/private/utils/html.js +1 -1
- package/build/js/private/utils/index.js +1 -1
- package/build/js/worker/WorkerMain.js +1 -1
- package/build/js/worker/dataCapture.inlineWorker.js +1 -1
- package/build/js/worker/dataCaptureEngine.js +1 -1
- package/build/js/worker/index.js +1 -1
- package/package.json +1 -1
- package/build/js/chunks/chunk-5TKCHVG2.js +0 -1
- package/build/js/chunks/chunk-GE4CBD4E.js +0 -1
- package/build/js/chunks/chunk-GSJH2EXJ.js +0 -2
- package/build/js/chunks/chunk-I22KIYBM.js +0 -1
- package/build/js/chunks/chunk-JXJQSWYG.js +0 -1
- package/build/js/chunks/chunk-U6BTTEV6.js +0 -1
- package/build/js/chunks/chunk-VXPXBTR2.js +0 -1
package/build/js/Camera.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as Camera}from'./chunks/chunk-
|
|
1
|
+
export{a as Camera}from'./chunks/chunk-FLO5QRX5.js';
|
package/build/js/CameraAccess.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as CameraAccess}from'./chunks/chunk-
|
|
1
|
+
export{a as CameraAccess}from'./chunks/chunk-6LUJAFBV.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DataCaptureContext}from'./chunks/chunk-
|
|
1
|
+
export{a as DataCaptureContext}from'./chunks/chunk-EEA7AA2K.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DataCaptureVersion}from'./chunks/chunk-
|
|
1
|
+
export{a as DataCaptureVersion}from'./chunks/chunk-MWPSUUFY.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DataCaptureView}from'./chunks/chunk-
|
|
1
|
+
export{a as DataCaptureView}from'./chunks/chunk-4KCDIWC3.js';
|
package/build/js/Feedback.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as Feedback}from'./chunks/chunk-
|
|
1
|
+
export{a as Feedback}from'./chunks/chunk-U2OJFO7J.js';
|
package/build/js/ScanditIcon.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as ScanditIcon,a as ScanditIconShape}from'./chunks/chunk-
|
|
1
|
+
export{b as ScanditIcon,a as ScanditIconShape}from'./chunks/chunk-6HPS3VUF.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{c as ScanditIconBuilder,b as ScanditIconForIconType,a as ScanditIconType}from'./chunks/chunk-
|
|
1
|
+
export{c as ScanditIconBuilder,b as ScanditIconForIconType,a as ScanditIconType}from'./chunks/chunk-VZJ2FQ7I.js';export{a as ScanditIconShape}from'./chunks/chunk-6HPS3VUF.js';
|
package/build/js/Sound.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as Sound}from'./chunks/chunk-
|
|
1
|
+
export{a as Sound}from'./chunks/chunk-6X73W3EO.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
var A="data:audio/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQRChYECGFOAZwEAAAAAAAOWEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHWTbuMU6uEElTDZ1OsggFATbuMU6uEHFO7a1OsggOA7AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmsCrXsYMPQkBNgIxMYXZmNjEuMS4xMDBXQYxMYXZmNjEuMS4xMDBEiYhAd+AAAAAAABZUrmvlrgEAAAAAAABc14EBc8WIg08ub3qWhnCcgQAitZyDdW5kiIEAhoZBX09QVVNWqoNjLqBWu4QExLQAg4EC4ZGfgQK1iEDHcAAAAAAAYmSBIGOik09wdXNIZWFkAQI4AeAuAAAAAAASVMNn+3Nzn2PAgGfImUWjh0VOQ09ERVJEh4xMYXZmNjEuMS4xMDBzc9ZjwItjxYiDTy5vepaGcGfIoUWjh0VOQ09ERVJEh5RMYXZjNjEuMy4xMDAgbGlib3B1c2fIoUWjiERVUkFUSU9ORIeTMDA6MDA6MDAuMzgyMDAwMDAwAB9DtnVBuueBAKOugQAAgCiDbjuDzUwipkvAAbsncWC64YXA60en1ZoN8Z+MzFsMrkjZdE9+kzThwKOugQAVgCikmlGjqD/BMTx8UMHQQIkyzNa4+i/GF8qWxMmwp9/b52ziROwy8+vlu6OogQApgCif9PJP2TVhRpk9OiIKqY7SgqYyraCgntSwzRFSNDAu39ER0KO0gQA9gCi+D4hgiPOvYBIzXCNWGWyjS2R2d67BIFy+lpuz8g8lJ9B/wNMBXD6sTtm6R2FKYKObgQBRgCgjswJcBYTX6v+tXBR9jGkdsn9jRx/Io4uBAGWAKAfGs+Mf06OMgQB5gCgHxrMPn6Jko4yBAI2AKAfGsw+fomSjjIEAoYAoB8azD5+iZKOMgQC1gCgHxrMPn6Jko4yBAMmAKAfGsw+fomSjjIEA3YAoB8azD5+iZKOMgQDxgCgHxrMPn6Jko4yBAQWAKAfGsw+fomSjjIEBGYAoB8azD5+iZKOMgQEtgCgHxrMPn6Jko4yBAUGAKAfGsw+fomSjjIEBVYAoB8azD5+iZKOMgQFpgCgHxrMPn6JkoJWhjIEBfQAoB8azD5+iZHWihAEgpTscU7trkbuPs4EAt4r3gQHxggHA8IED";export{A as beepSound};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b as b$3}from'./chunk-
|
|
1
|
+
import {b as b$3}from'./chunk-7M3GGOSL.js';import {a as a$6}from'./chunk-NAOIN6LV.js';import {a as a$c}from'./chunk-46WJFV3I.js';import {d as d$2,c,b as b$4}from'./chunk-WPY7T7HY.js';import {a as a$e}from'./chunk-7CQVGY6N.js';import {a as a$2}from'./chunk-N5YZEC56.js';import {a as a$a}from'./chunk-FSWALUUO.js';import {b,a as a$3}from'./chunk-5S537AFM.js';import {a as a$f}from'./chunk-DMOXDUF6.js';import {b as b$1}from'./chunk-457L5N2F.js';import {a as a$7}from'./chunk-JVZYXEYO.js';import {a as a$b}from'./chunk-3BBG6EVS.js';import {a as a$8}from'./chunk-KYNYQBNF.js';import {a as a$h}from'./chunk-ZKROZLQ4.js';import {a as a$5}from'./chunk-5FUZURCZ.js';import {a as a$1}from'./chunk-VJB527QZ.js';import {a as a$9}from'./chunk-NMX4VHW2.js';import {a}from'./chunk-7XQ3GHYH.js';import {d as d$1}from'./chunk-AC6MK6LU.js';import {a as a$d}from'./chunk-XR65N6EG.js';import {d}from'./chunk-E3TDSWVQ.js';import {a as a$4,b as b$2,i,f}from'./chunk-77BBIAZE.js';import {a as a$g}from'./chunk-WUHKODFA.js';var y="core.camera.recovery",B=class q{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=!1;this.orientation="portrait";this.hiddenProperties={stopVideoTracksOnVisibilityChange:!0,freezeFrameWhenStoppingFrameSource:!0};this.orientationObserver=new b;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.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(y)}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$1(this.canvasElement),this._canvasDrawer.startObservingCanvasResize()),this._canvasDrawer}get privateContext(){return this._context}static async forContext(e){let t=new q;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(a=>{a[y]!=null&&(this.cameraRecoveryElement.textContent=a[y]);});}detachFromElement(){var e,t,i,n,a,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.htmlElementDidChange(),(a=this.gestureRecognizer)==null||a.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,b,O,P,L,V,D,R;let t={width:(b=(v=this.htmlElementState)==null?void 0:v.width)!=null?b:0,height:(P=(O=this.htmlElementState)==null?void 0:O.height)!=null?P:0},i={width:(V=(L=this.videoElement)==null?void 0:L.videoWidth)!=null?V:0,height:(R=(D=this.videoElement)==null?void 0:D.videoHeight)!=null?R:0},n=t.width/t.height,a=i.width/i.height,o=n>a?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),a=this.viewPointForFramePoint(e.bottomRight);return new b$2(t,i,a,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(!0),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:!1,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),a=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,a,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));}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$3.register();let t=`
|
|
2
2
|
<div class="${a$9.CONTAINER_CLASS_NAME}">
|
|
3
3
|
<div class="${a$9.PAINTBOARDS_CONTAINER_CLASS_NAME}">
|
|
4
4
|
<div data-js-id="loading-overlay"></div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {e}from'./chunk-YKP6UYCY.js';import {a}from'./chunk-EV4OEANA.js';import {a as a$2}from'./chunk-3A4KLILV.js';import {a as a$1}from'./chunk-
|
|
1
|
+
import {e}from'./chunk-YKP6UYCY.js';import {a}from'./chunk-EV4OEANA.js';import {a as a$2}from'./chunk-3A4KLILV.js';import {a as a$1}from'./chunk-MU6SADSF.js';import {a as a$3}from'./chunk-LSZZVJ6B.js';import {n as n$1}from'./chunk-77BBIAZE.js';var v=(e=>(e.Circle="circle",e.Square="square",e))(v||{}),c="--width",l="--height",h="--background-color",d="--stroke-color",p="--stroke-width",n=class n extends a{constructor(){super();this.onSlotChangeListener=this.onSlotChange.bind(this);let e=this.attachShadow({mode:"open"});e.innerHTML=a$1`<div class="container shape-none"><slot /></div>`,this.containerElement=e.querySelector(".container"),this.setStylePropertyValue(c,"32px"),this.setStylePropertyValue(l,"32px"),this.setStylePropertyValue(h,"transparent"),this.setStylePropertyValue(d,"#fff"),this.setStylePropertyValue(p,"0px"),e.append(n.createStyleElement().cloneNode(!0));}get iconColor(){var o,r;let e=(o=this.shadowRoot)==null?void 0:o.querySelector("slot"),t=(r=e==null?void 0:e.assignedElements())!=null?r:[];return n$1.fromHex(t[0].fill)}set iconColor(e){this.render({propChanged:"iconcolor",value:`#${e.toJSON()}`});}get backgroundColor(){return n$1.fromHex(this.getStylePropertyValue(h))}set backgroundColor(e){this.render({propChanged:"backgroundcolor",value:`#${e.toJSON()}`});}get backgroundStrokeColor(){return n$1.fromHex(this.getStylePropertyValue(d))}set backgroundStrokeColor(e){this.render({propChanged:"backgroundstrokecolor",value:`#${e.toJSON()}`});}get backgroundStrokeWidth(){let e=this.getStylePropertyValue(p);return Number.parseInt(e,10)}set backgroundStrokeWidth(e){this.render({propChanged:"backgroundstrokewidth",value:String(e)});}get backgroundShape(){var t;let e=(t=/shape-(.*)/.exec(this.containerElement.classList.value))==null?void 0:t[1];return e!=null&&e!=="none"?e:null}set backgroundShape(e){this.render({propChanged:"backgroundshape",value:e!=null?e:"none"});}set width(e){this.render({propChanged:"width",value:String(e)}),this.updateIconSizeProperty(e,this.height);}get width(){let e=this.getStylePropertyValue(c).replace("px","");return Number.parseInt(e,10)}set height(e){this.render({propChanged:"height",value:String(e)}),this.updateIconSizeProperty(this.width,e);}get height(){let e=this.getStylePropertyValue(l).replace("px","");return Number.parseInt(e,10)}static create(){return n.register(),document.createElement(n.tag)}static register(){a$2({[n.tag]:n});}static createStyleElement(){return a$3`:host{display:inline-block;--width:32px;--height:32px;--background-color:transparent;--stroke-color:#fff;--stroke-width:0px}:host([hidden]){display:none}.container{background-color:var(--background-color);box-shadow:0 1px 2px 0 #${e.withAlpha(.3).toJSON()};height:calc(var(--height) - var(--stroke-width));outline:var(--stroke-width) solid var(--stroke-color);position:relative;width:calc(var(--width) - var(--stroke-width))}.container.shape-${"circle"}{border-radius:50%}.container.shape-${"square"}{border-radius:0}.container.shape-none{box-shadow:unset}::slotted(*){left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}`}onSlotChange(){this.updateIconSizeProperty(this.width,this.height);}connectedCallback(){var t;let e=(t=this.shadowRoot)==null?void 0:t.querySelector("slot");e==null||e.addEventListener("slotchange",this.onSlotChangeListener);}disconnectedCallback(){var t;let e=(t=this.shadowRoot)==null?void 0:t.querySelector("slot");e==null||e.removeEventListener("slotchange",this.onSlotChangeListener);}render({propChanged:e,value:t}){switch(e){case"width":{this.setStylePropertyValue(c,`${t}px`);break}case"height":{this.setStylePropertyValue(l,`${t}px`);break}case"backgroundstrokewidth":{this.setStylePropertyValue(p,`${t}px`);break}case"backgroundstrokecolor":{this.setStylePropertyValue(d,t);break}case"backgroundcolor":{this.setStylePropertyValue(h,t);break}case"iconcolor":{this.updateFillIconColor(n$1.fromHex(t));break}case"backgroundshape":{let o=t;this.containerElement.classList.toggle("shape-circle",o==="circle"),this.containerElement.classList.toggle("shape-square",o==="square"),this.containerElement.classList.toggle("shape-none",o==="none");break}}}attributeChangedCallback(e,t,o){this.render({propChanged:e,value:o});}getStylePropertyValue(e){return this.containerElement.style.getPropertyValue(e)}setStylePropertyValue(e,t){this.containerElement.style.setProperty(e,t);}updateIconSizeProperty(e,t){var s,u;let o=(s=this.shadowRoot)==null?void 0:s.querySelector("slot"),r=(u=o==null?void 0:o.assignedElements())!=null?u:[],a=Math.min(e,t);for(let C of r)C.size=a/2;}setIconSize(e){var r,a;let t=(r=this.shadowRoot)==null?void 0:r.querySelector("slot"),o=(a=t==null?void 0:t.assignedElements())!=null?a:[];for(let s of o)s.size=e;}updateFillIconColor(e){var r,a;let t=(r=this.shadowRoot)==null?void 0:r.querySelector("slot"),o=(a=t==null?void 0:t.assignedElements())!=null?a:[];for(let s of o)s.fill=`#${e.toJSON()}`;}};n.tag="scandit-barcode-icon-container",n.observedAttributes=["width","height","backgroundstrokecolor","backgroundcolor","backgroundstrokewidth","iconcolor","backgroundshape"];var y=n;export{v as a,y as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {d}from'./chunk-7QNII4K3.js';var i;(m=>{async function n(o,t){return d.getCameras(o!=null?o:!1,t!=null?t:!1)}m.getCameras=n;})(i||(i={}));export{i as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a,b as b$1}from'./chunk-2Q5FZVGV.js';var B=a(k=>{(function(){var g=function(){this.init();};g.prototype={init:function(){var e=this||r;return e._counter=1e3,e._html5AudioPool=[],e.html5PoolSize=10,e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator=typeof window<"u"&&window.navigator?window.navigator:null,e.masterGain=null,e.noAudio=!1,e.usingWebAudio=!0,e.autoSuspend=!0,e.ctx=null,e.autoUnlock=!0,e._setup(),e},volume:function(e){var t=this||r;if(e=parseFloat(e),t.ctx||A(),typeof e<"u"&&e>=0&&e<=1){if(t._volume=e,t._muted)return t;t.usingWebAudio&&t.masterGain.gain.setValueAtTime(e,r.ctx.currentTime);for(var n=0;n<t._howls.length;n++)if(!t._howls[n]._webAudio)for(var o=t._howls[n]._getSoundIds(),l=0;l<o.length;l++){var s=t._howls[n]._soundById(o[l]);s&&s._node&&(s._node.volume=s._volume*e);}return t}return t._volume},mute:function(e){var t=this||r;t.ctx||A(),t._muted=e,t.usingWebAudio&&t.masterGain.gain.setValueAtTime(e?0:t._volume,r.ctx.currentTime);for(var n=0;n<t._howls.length;n++)if(!t._howls[n]._webAudio)for(var o=t._howls[n]._getSoundIds(),l=0;l<o.length;l++){var s=t._howls[n]._soundById(o[l]);s&&s._node&&(s._node.muted=e?!0:s._muted);}return t},stop:function(){for(var e=this||r,t=0;t<e._howls.length;t++)e._howls[t].stop();return e},unload:function(){for(var e=this||r,t=e._howls.length-1;t>=0;t--)e._howls[t].unload();return e.usingWebAudio&&e.ctx&&typeof e.ctx.close<"u"&&(e.ctx.close(),e.ctx=null,A()),e},codecs:function(e){return (this||r)._codecs[e.replace(/^x-/,"")]},_setup:function(){var e=this||r;if(e.state=e.ctx&&e.ctx.state||"suspended",e._autoSuspend(),!e.usingWebAudio)if(typeof Audio<"u")try{var t=new Audio;typeof t.oncanplaythrough>"u"&&(e._canPlayEvent="canplay");}catch(n){e.noAudio=!0;}else e.noAudio=!0;try{var t=new Audio;t.muted&&(e.noAudio=!0);}catch(n){}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||r,t=null;try{t=typeof Audio<"u"?new Audio:null;}catch(y){return e}if(!t||typeof t.canPlayType!="function")return e;var n=t.canPlayType("audio/mpeg;").replace(/^no$/,""),o=e._navigator?e._navigator.userAgent:"",l=o.match(/OPR\/(\d+)/g),s=l&&parseInt(l[0].split("/")[1],10)<33,a=o.indexOf("Safari")!==-1&&o.indexOf("Chrome")===-1,f=o.match(/Version\/(.*?) /),m=a&&f&&parseInt(f[1],10)<15;return e._codecs={mp3:!!(!s&&(n||t.canPlayType("audio/mp3;").replace(/^no$/,""))),mpeg:!!n,opus:!!t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(t.canPlayType('audio/wav; codecs="1"')||t.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!t.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!t.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(t.canPlayType("audio/x-m4a;")||t.canPlayType("audio/m4a;")||t.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(t.canPlayType("audio/x-m4b;")||t.canPlayType("audio/m4b;")||t.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(t.canPlayType("audio/x-mp4;")||t.canPlayType("audio/mp4;")||t.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!(!m&&t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!!(!m&&t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!t.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(t.canPlayType("audio/x-flac;")||t.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||r;if(!(e._audioUnlocked||!e.ctx)){e._audioUnlocked=!1,e.autoUnlock=!1,!e._mobileUnloaded&&e.ctx.sampleRate!==44100&&(e._mobileUnloaded=!0,e.unload()),e._scratchBuffer=e.ctx.createBuffer(1,1,22050);var t=function(n){for(;e._html5AudioPool.length<e.html5PoolSize;)try{var o=new Audio;o._unlocked=!0,e._releaseHtml5Audio(o);}catch(y){e.noAudio=!0;break}for(var l=0;l<e._howls.length;l++)if(!e._howls[l]._webAudio)for(var s=e._howls[l]._getSoundIds(),a=0;a<s.length;a++){var f=e._howls[l]._soundById(s[a]);f&&f._node&&!f._node._unlocked&&(f._node._unlocked=!0,f._node.load());}e._autoResume();var m=e.ctx.createBufferSource();m.buffer=e._scratchBuffer,m.connect(e.ctx.destination),typeof m.start>"u"?m.noteOn(0):m.start(0),typeof e.ctx.resume=="function"&&e.ctx.resume(),m.onended=function(){m.disconnect(0),e._audioUnlocked=!0,document.removeEventListener("touchstart",t,!0),document.removeEventListener("touchend",t,!0),document.removeEventListener("click",t,!0),document.removeEventListener("keydown",t,!0);for(var y=0;y<e._howls.length;y++)e._howls[y]._emit("unlock");};};return document.addEventListener("touchstart",t,!0),document.addEventListener("touchend",t,!0),document.addEventListener("click",t,!0),document.addEventListener("keydown",t,!0),e}},_obtainHtml5Audio:function(){var e=this||r;if(e._html5AudioPool.length)return e._html5AudioPool.pop();var t=new Audio().play();return t&&typeof Promise<"u"&&(t instanceof Promise||typeof t.then=="function")&&t.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.");}),new Audio},_releaseHtml5Audio:function(e){var t=this||r;return e._unlocked&&t._html5AudioPool.push(e),t},_autoSuspend:function(){var e=this;if(!(!e.autoSuspend||!e.ctx||typeof e.ctx.suspend>"u"||!r.usingWebAudio)){for(var t=0;t<e._howls.length;t++)if(e._howls[t]._webAudio){for(var n=0;n<e._howls[t]._sounds.length;n++)if(!e._howls[t]._sounds[n]._paused)return e}return e._suspendTimer&&clearTimeout(e._suspendTimer),e._suspendTimer=setTimeout(function(){if(e.autoSuspend){e._suspendTimer=null,e.state="suspending";var o=function(){e.state="suspended",e._resumeAfterSuspend&&(delete e._resumeAfterSuspend,e._autoResume());};e.ctx.suspend().then(o,o);}},3e4),e}},_autoResume:function(){var e=this;if(!(!e.ctx||typeof e.ctx.resume>"u"||!r.usingWebAudio))return e.state==="running"&&e.ctx.state!=="interrupted"&&e._suspendTimer?(clearTimeout(e._suspendTimer),e._suspendTimer=null):e.state==="suspended"||e.state==="running"&&e.ctx.state==="interrupted"?(e.ctx.resume().then(function(){e.state="running";for(var t=0;t<e._howls.length;t++)e._howls[t]._emit("resume");}),e._suspendTimer&&(clearTimeout(e._suspendTimer),e._suspendTimer=null)):e.state==="suspending"&&(e._resumeAfterSuspend=!0),e}};var r=new g,i=function(e){var t=this;if(!e.src||e.src.length===0){console.error("An array of source files must be passed with any new Howl.");return}t.init(e);};i.prototype={init:function(e){var t=this;return r.ctx||A(),t._autoplay=e.autoplay||!1,t._format=typeof e.format!="string"?e.format:[e.format],t._html5=e.html5||!1,t._muted=e.mute||!1,t._loop=e.loop||!1,t._pool=e.pool||5,t._preload=typeof e.preload=="boolean"||e.preload==="metadata"?e.preload:!0,t._rate=e.rate||1,t._sprite=e.sprite||{},t._src=typeof e.src!="string"?e.src:[e.src],t._volume=e.volume!==void 0?e.volume:1,t._xhr={method:e.xhr&&e.xhr.method?e.xhr.method:"GET",headers:e.xhr&&e.xhr.headers?e.xhr.headers:null,withCredentials:e.xhr&&e.xhr.withCredentials?e.xhr.withCredentials:!1},t._duration=0,t._state="unloaded",t._sounds=[],t._endTimers={},t._queue=[],t._playLock=!1,t._onend=e.onend?[{fn:e.onend}]:[],t._onfade=e.onfade?[{fn:e.onfade}]:[],t._onload=e.onload?[{fn:e.onload}]:[],t._onloaderror=e.onloaderror?[{fn:e.onloaderror}]:[],t._onplayerror=e.onplayerror?[{fn:e.onplayerror}]:[],t._onpause=e.onpause?[{fn:e.onpause}]:[],t._onplay=e.onplay?[{fn:e.onplay}]:[],t._onstop=e.onstop?[{fn:e.onstop}]:[],t._onmute=e.onmute?[{fn:e.onmute}]:[],t._onvolume=e.onvolume?[{fn:e.onvolume}]:[],t._onrate=e.onrate?[{fn:e.onrate}]:[],t._onseek=e.onseek?[{fn:e.onseek}]:[],t._onunlock=e.onunlock?[{fn:e.onunlock}]:[],t._onresume=[],t._webAudio=r.usingWebAudio&&!t._html5,typeof r.ctx<"u"&&r.ctx&&r.autoUnlock&&r._unlockAudio(),r._howls.push(t),t._autoplay&&t._queue.push({event:"play",action:function(){t.play();}}),t._preload&&t._preload!=="none"&&t.load(),t},load:function(){var e=this,t=null;if(r.noAudio){e._emit("loaderror",null,"No audio support.");return}typeof e._src=="string"&&(e._src=[e._src]);for(var n=0;n<e._src.length;n++){var o,l;if(e._format&&e._format[n])o=e._format[n];else {if(l=e._src[n],typeof l!="string"){e._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}o=/^data:audio\/([^;,]+);/i.exec(l),o||(o=/\.([^.]+)$/.exec(l.split("?",1)[0])),o&&(o=o[1].toLowerCase());}if(o||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),o&&r.codecs(o)){t=e._src[n];break}}if(!t){e._emit("loaderror",null,"No codec support for selected audio sources.");return}return e._src=t,e._state="loading",window.location.protocol==="https:"&&t.slice(0,5)==="http:"&&(e._html5=!0,e._webAudio=!1),new u(e),e._webAudio&&d(e),e},play:function(e,t){var n=this,o=null;if(typeof e=="number")o=e,e=null;else {if(typeof e=="string"&&n._state==="loaded"&&!n._sprite[e])return null;if(typeof e>"u"&&(e="__default",!n._playLock)){for(var l=0,s=0;s<n._sounds.length;s++)n._sounds[s]._paused&&!n._sounds[s]._ended&&(l++,o=n._sounds[s]._id);l===1?e=null:o=null;}}var a=o?n._soundById(o):n._inactiveSound();if(!a)return null;if(o&&!e&&(e=a._sprite||"__default"),n._state!=="loaded"){a._sprite=e,a._ended=!1;var f=a._id;return n._queue.push({event:"play",action:function(){n.play(f);}}),f}if(o&&!a._paused)return t||n._loadQueue("play"),a._id;n._webAudio&&r._autoResume();var m=Math.max(0,a._seek>0?a._seek:n._sprite[e][0]/1e3),y=Math.max(0,(n._sprite[e][0]+n._sprite[e][1])/1e3-m),w=y*1e3/Math.abs(a._rate),T=n._sprite[e][0]/1e3,S=(n._sprite[e][0]+n._sprite[e][1])/1e3;a._sprite=e,a._ended=!1;var I=function(){a._paused=!1,a._seek=m,a._start=T,a._stop=S,a._loop=!!(a._loop||n._sprite[e][2]);};if(m>=S){n._ended(a);return}var v=a._node;if(n._webAudio){var P=function(){n._playLock=!1,I(),n._refreshBuffer(a);var x=a._muted||n._muted?0:a._volume;v.gain.setValueAtTime(x,r.ctx.currentTime),a._playStart=r.ctx.currentTime,typeof v.bufferSource.start>"u"?a._loop?v.bufferSource.noteGrainOn(0,m,86400):v.bufferSource.noteGrainOn(0,m,y):a._loop?v.bufferSource.start(0,m,86400):v.bufferSource.start(0,m,y),w!==1/0&&(n._endTimers[a._id]=setTimeout(n._ended.bind(n,a),w)),t||setTimeout(function(){n._emit("play",a._id),n._loadQueue();},0);};r.state==="running"&&r.ctx.state!=="interrupted"?P():(n._playLock=!0,n.once("resume",P),n._clearTimer(a._id));}else {var M=function(){v.currentTime=m,v.muted=a._muted||n._muted||r._muted||v.muted,v.volume=a._volume*r.volume(),v.playbackRate=a._rate;try{var x=v.play();if(x&&typeof Promise<"u"&&(x instanceof Promise||typeof x.then=="function")?(n._playLock=!0,I(),x.then(function(){n._playLock=!1,v._unlocked=!0,t?n._loadQueue():n._emit("play",a._id);}).catch(function(){n._playLock=!1,n._emit("playerror",a._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),a._ended=!0,a._paused=!0;})):t||(n._playLock=!1,I(),n._emit("play",a._id)),v.playbackRate=a._rate,v.paused){n._emit("playerror",a._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");return}e!=="__default"||a._loop?n._endTimers[a._id]=setTimeout(n._ended.bind(n,a),w):(n._endTimers[a._id]=function(){n._ended(a),v.removeEventListener("ended",n._endTimers[a._id],!1);},v.addEventListener("ended",n._endTimers[a._id],!1));}catch(D){n._emit("playerror",a._id,D);}};v.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(v.src=n._src,v.load());var G=window&&window.ejecta||!v.readyState&&r._navigator.isCocoonJS;if(v.readyState>=3||G)M();else {n._playLock=!0,n._state="loading";var F=function(){n._state="loaded",M(),v.removeEventListener(r._canPlayEvent,F,!1);};v.addEventListener(r._canPlayEvent,F,!1),n._clearTimer(a._id);}}return a._id},pause:function(e){var t=this;if(t._state!=="loaded"||t._playLock)return t._queue.push({event:"pause",action:function(){t.pause(e);}}),t;for(var n=t._getSoundIds(e),o=0;o<n.length;o++){t._clearTimer(n[o]);var l=t._soundById(n[o]);if(l&&!l._paused&&(l._seek=t.seek(n[o]),l._rateSeek=0,l._paused=!0,t._stopFade(n[o]),l._node))if(t._webAudio){if(!l._node.bufferSource)continue;typeof l._node.bufferSource.stop>"u"?l._node.bufferSource.noteOff(0):l._node.bufferSource.stop(0),t._cleanBuffer(l._node);}else (!isNaN(l._node.duration)||l._node.duration===1/0)&&l._node.pause();arguments[1]||t._emit("pause",l?l._id:null);}return t},stop:function(e,t){var n=this;if(n._state!=="loaded"||n._playLock)return n._queue.push({event:"stop",action:function(){n.stop(e);}}),n;for(var o=n._getSoundIds(e),l=0;l<o.length;l++){n._clearTimer(o[l]);var s=n._soundById(o[l]);s&&(s._seek=s._start||0,s._rateSeek=0,s._paused=!0,s._ended=!0,n._stopFade(o[l]),s._node&&(n._webAudio?s._node.bufferSource&&(typeof s._node.bufferSource.stop>"u"?s._node.bufferSource.noteOff(0):s._node.bufferSource.stop(0),n._cleanBuffer(s._node)):(!isNaN(s._node.duration)||s._node.duration===1/0)&&(s._node.currentTime=s._start||0,s._node.pause(),s._node.duration===1/0&&n._clearSound(s._node))),t||n._emit("stop",s._id));}return n},mute:function(e,t){var n=this;if(n._state!=="loaded"||n._playLock)return n._queue.push({event:"mute",action:function(){n.mute(e,t);}}),n;if(typeof t>"u")if(typeof e=="boolean")n._muted=e;else return n._muted;for(var o=n._getSoundIds(t),l=0;l<o.length;l++){var s=n._soundById(o[l]);s&&(s._muted=e,s._interval&&n._stopFade(s._id),n._webAudio&&s._node?s._node.gain.setValueAtTime(e?0:s._volume,r.ctx.currentTime):s._node&&(s._node.muted=r._muted?!0:e),n._emit("mute",s._id));}return n},volume:function(){var e=this,t=arguments,n,o;if(t.length===0)return e._volume;if(t.length===1||t.length===2&&typeof t[1]>"u"){var l=e._getSoundIds(),s=l.indexOf(t[0]);s>=0?o=parseInt(t[0],10):n=parseFloat(t[0]);}else t.length>=2&&(n=parseFloat(t[0]),o=parseInt(t[1],10));var a;if(typeof n<"u"&&n>=0&&n<=1){if(e._state!=="loaded"||e._playLock)return e._queue.push({event:"volume",action:function(){e.volume.apply(e,t);}}),e;typeof o>"u"&&(e._volume=n),o=e._getSoundIds(o);for(var f=0;f<o.length;f++)a=e._soundById(o[f]),a&&(a._volume=n,t[2]||e._stopFade(o[f]),e._webAudio&&a._node&&!a._muted?a._node.gain.setValueAtTime(n,r.ctx.currentTime):a._node&&!a._muted&&(a._node.volume=n*r.volume()),e._emit("volume",a._id));}else return a=o?e._soundById(o):e._sounds[0],a?a._volume:0;return e},fade:function(e,t,n,o){var l=this;if(l._state!=="loaded"||l._playLock)return l._queue.push({event:"fade",action:function(){l.fade(e,t,n,o);}}),l;e=Math.min(Math.max(0,parseFloat(e)),1),t=Math.min(Math.max(0,parseFloat(t)),1),n=parseFloat(n),l.volume(e,o);for(var s=l._getSoundIds(o),a=0;a<s.length;a++){var f=l._soundById(s[a]);if(f){if(o||l._stopFade(s[a]),l._webAudio&&!f._muted){var m=r.ctx.currentTime,y=m+n/1e3;f._volume=e,f._node.gain.setValueAtTime(e,m),f._node.gain.linearRampToValueAtTime(t,y);}l._startFadeInterval(f,e,t,n,s[a],typeof o>"u");}}return l},_startFadeInterval:function(e,t,n,o,l,s){var a=this,f=t,m=n-t,y=Math.abs(m/.01),w=Math.max(4,y>0?o/y:o),T=Date.now();e._fadeTo=n,e._interval=setInterval(function(){var S=(Date.now()-T)/o;T=Date.now(),f+=m*S,f=Math.round(f*100)/100,m<0?f=Math.max(n,f):f=Math.min(n,f),a._webAudio?e._volume=f:a.volume(f,e._id,!0),s&&(a._volume=f),(n<t&&f<=n||n>t&&f>=n)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,a.volume(n,e._id),a._emit("fade",e._id));},w);},_stopFade:function(e){var t=this,n=t._soundById(e);return n&&n._interval&&(t._webAudio&&n._node.gain.cancelScheduledValues(r.ctx.currentTime),clearInterval(n._interval),n._interval=null,t.volume(n._fadeTo,e),n._fadeTo=null,t._emit("fade",e)),t},loop:function(){var e=this,t=arguments,n,o,l;if(t.length===0)return e._loop;if(t.length===1)if(typeof t[0]=="boolean")n=t[0],e._loop=n;else return l=e._soundById(parseInt(t[0],10)),l?l._loop:!1;else t.length===2&&(n=t[0],o=parseInt(t[1],10));for(var s=e._getSoundIds(o),a=0;a<s.length;a++)l=e._soundById(s[a]),l&&(l._loop=n,e._webAudio&&l._node&&l._node.bufferSource&&(l._node.bufferSource.loop=n,n&&(l._node.bufferSource.loopStart=l._start||0,l._node.bufferSource.loopEnd=l._stop,e.playing(s[a])&&(e.pause(s[a],!0),e.play(s[a],!0)))));return e},rate:function(){var e=this,t=arguments,n,o;if(t.length===0)o=e._sounds[0]._id;else if(t.length===1){var l=e._getSoundIds(),s=l.indexOf(t[0]);s>=0?o=parseInt(t[0],10):n=parseFloat(t[0]);}else t.length===2&&(n=parseFloat(t[0]),o=parseInt(t[1],10));var a;if(typeof n=="number"){if(e._state!=="loaded"||e._playLock)return e._queue.push({event:"rate",action:function(){e.rate.apply(e,t);}}),e;typeof o>"u"&&(e._rate=n),o=e._getSoundIds(o);for(var f=0;f<o.length;f++)if(a=e._soundById(o[f]),a){e.playing(o[f])&&(a._rateSeek=e.seek(o[f]),a._playStart=e._webAudio?r.ctx.currentTime:a._playStart),a._rate=n,e._webAudio&&a._node&&a._node.bufferSource?a._node.bufferSource.playbackRate.setValueAtTime(n,r.ctx.currentTime):a._node&&(a._node.playbackRate=n);var m=e.seek(o[f]),y=(e._sprite[a._sprite][0]+e._sprite[a._sprite][1])/1e3-m,w=y*1e3/Math.abs(a._rate);(e._endTimers[o[f]]||!a._paused)&&(e._clearTimer(o[f]),e._endTimers[o[f]]=setTimeout(e._ended.bind(e,a),w)),e._emit("rate",a._id);}}else return a=e._soundById(o),a?a._rate:e._rate;return e},seek:function(){var e=this,t=arguments,n,o;if(t.length===0)e._sounds.length&&(o=e._sounds[0]._id);else if(t.length===1){var l=e._getSoundIds(),s=l.indexOf(t[0]);s>=0?o=parseInt(t[0],10):e._sounds.length&&(o=e._sounds[0]._id,n=parseFloat(t[0]));}else t.length===2&&(n=parseFloat(t[0]),o=parseInt(t[1],10));if(typeof o>"u")return 0;if(typeof n=="number"&&(e._state!=="loaded"||e._playLock))return e._queue.push({event:"seek",action:function(){e.seek.apply(e,t);}}),e;var a=e._soundById(o);if(a)if(typeof n=="number"&&n>=0){var f=e.playing(o);f&&e.pause(o,!0),a._seek=n,a._ended=!1,e._clearTimer(o),!e._webAudio&&a._node&&!isNaN(a._node.duration)&&(a._node.currentTime=n);var m=function(){f&&e.play(o,!0),e._emit("seek",o);};if(f&&!e._webAudio){var y=function(){e._playLock?setTimeout(y,0):m();};setTimeout(y,0);}else m();}else if(e._webAudio){var w=e.playing(o)?r.ctx.currentTime-a._playStart:0,T=a._rateSeek?a._rateSeek-a._seek:0;return a._seek+(T+w*Math.abs(a._rate))}else return a._node.currentTime;return e},playing:function(e){var t=this;if(typeof e=="number"){var n=t._soundById(e);return n?!n._paused:!1}for(var o=0;o<t._sounds.length;o++)if(!t._sounds[o]._paused)return !0;return !1},duration:function(e){var t=this,n=t._duration,o=t._soundById(e);return o&&(n=t._sprite[o._sprite][1]/1e3),n},state:function(){return this._state},unload:function(){for(var e=this,t=e._sounds,n=0;n<t.length;n++)t[n]._paused||e.stop(t[n]._id),e._webAudio||(e._clearSound(t[n]._node),t[n]._node.removeEventListener("error",t[n]._errorFn,!1),t[n]._node.removeEventListener(r._canPlayEvent,t[n]._loadFn,!1),t[n]._node.removeEventListener("ended",t[n]._endFn,!1),r._releaseHtml5Audio(t[n]._node)),delete t[n]._node,e._clearTimer(t[n]._id);var o=r._howls.indexOf(e);o>=0&&r._howls.splice(o,1);var l=!0;for(n=0;n<r._howls.length;n++)if(r._howls[n]._src===e._src||e._src.indexOf(r._howls[n]._src)>=0){l=!1;break}return c&&l&&delete c[e._src],r.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,t,n,o){var l=this,s=l["_on"+e];return typeof t=="function"&&s.push(o?{id:n,fn:t,once:o}:{id:n,fn:t}),l},off:function(e,t,n){var o=this,l=o["_on"+e],s=0;if(typeof t=="number"&&(n=t,t=null),t||n)for(s=0;s<l.length;s++){var a=n===l[s].id;if(t===l[s].fn&&a||!t&&a){l.splice(s,1);break}}else if(e)o["_on"+e]=[];else {var f=Object.keys(o);for(s=0;s<f.length;s++)f[s].indexOf("_on")===0&&Array.isArray(o[f[s]])&&(o[f[s]]=[]);}return o},once:function(e,t,n){var o=this;return o.on(e,t,n,1),o},_emit:function(e,t,n){for(var o=this,l=o["_on"+e],s=l.length-1;s>=0;s--)(!l[s].id||l[s].id===t||e==="load")&&(setTimeout((function(a){a.call(this,t,n);}).bind(o,l[s].fn),0),l[s].once&&o.off(e,l[s].fn,l[s].id));return o._loadQueue(e),o},_loadQueue:function(e){var t=this;if(t._queue.length>0){var n=t._queue[0];n.event===e&&(t._queue.shift(),t._loadQueue()),e||n.action();}return t},_ended:function(e){var t=this,n=e._sprite;if(!t._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime<e._stop)return setTimeout(t._ended.bind(t,e),100),t;var o=!!(e._loop||t._sprite[n][2]);if(t._emit("end",e._id),!t._webAudio&&o&&t.stop(e._id,!0).play(e._id),t._webAudio&&o){t._emit("play",e._id),e._seek=e._start||0,e._rateSeek=0,e._playStart=r.ctx.currentTime;var l=(e._stop-e._start)*1e3/Math.abs(e._rate);t._endTimers[e._id]=setTimeout(t._ended.bind(t,e),l);}return t._webAudio&&!o&&(e._paused=!0,e._ended=!0,e._seek=e._start||0,e._rateSeek=0,t._clearTimer(e._id),t._cleanBuffer(e._node),r._autoSuspend()),!t._webAudio&&!o&&t.stop(e._id,!0),t},_clearTimer:function(e){var t=this;if(t._endTimers[e]){if(typeof t._endTimers[e]!="function")clearTimeout(t._endTimers[e]);else {var n=t._soundById(e);n&&n._node&&n._node.removeEventListener("ended",t._endTimers[e],!1);}delete t._endTimers[e];}return t},_soundById:function(e){for(var t=this,n=0;n<t._sounds.length;n++)if(e===t._sounds[n]._id)return t._sounds[n];return null},_inactiveSound:function(){var e=this;e._drain();for(var t=0;t<e._sounds.length;t++)if(e._sounds[t]._ended)return e._sounds[t].reset();return new u(e)},_drain:function(){var e=this,t=e._pool,n=0,o=0;if(!(e._sounds.length<t)){for(o=0;o<e._sounds.length;o++)e._sounds[o]._ended&&n++;for(o=e._sounds.length-1;o>=0;o--){if(n<=t)return;e._sounds[o]._ended&&(e._webAudio&&e._sounds[o]._node&&e._sounds[o]._node.disconnect(0),e._sounds.splice(o,1),n--);}}},_getSoundIds:function(e){var t=this;if(typeof e>"u"){for(var n=[],o=0;o<t._sounds.length;o++)n.push(t._sounds[o]._id);return n}else return [e]},_refreshBuffer:function(e){var t=this;return e._node.bufferSource=r.ctx.createBufferSource(),e._node.bufferSource.buffer=c[t._src],e._panner?e._node.bufferSource.connect(e._panner):e._node.bufferSource.connect(e._node),e._node.bufferSource.loop=e._loop,e._loop&&(e._node.bufferSource.loopStart=e._start||0,e._node.bufferSource.loopEnd=e._stop||0),e._node.bufferSource.playbackRate.setValueAtTime(e._rate,r.ctx.currentTime),t},_cleanBuffer:function(e){var t=this,n=r._navigator&&r._navigator.vendor.indexOf("Apple")>=0;if(!e.bufferSource)return t;if(r._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),n))try{e.bufferSource.buffer=r._scratchBuffer;}catch(o){}return e.bufferSource=null,t},_clearSound:function(e){var t=/MSIE |Trident\//.test(r._navigator&&r._navigator.userAgent);t||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA");}};var u=function(e){this._parent=e,this.init();};u.prototype={init:function(){var e=this,t=e._parent;return e._muted=t._muted,e._loop=t._loop,e._volume=t._volume,e._rate=t._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++r._counter,t._sounds.push(e),e.create(),e},create:function(){var e=this,t=e._parent,n=r._muted||e._muted||e._parent._muted?0:e._volume;return t._webAudio?(e._node=typeof r.ctx.createGain>"u"?r.ctx.createGainNode():r.ctx.createGain(),e._node.gain.setValueAtTime(n,r.ctx.currentTime),e._node.paused=!0,e._node.connect(r.masterGain)):r.noAudio||(e._node=r._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(r._canPlayEvent,e._loadFn,!1),e._endFn=e._endListener.bind(e),e._node.addEventListener("ended",e._endFn,!1),e._node.src=t._src,e._node.preload=t._preload===!0?"auto":t._preload,e._node.volume=n*r.volume(),e._node.load()),e},reset:function(){var e=this,t=e._parent;return e._muted=t._muted,e._loop=t._loop,e._volume=t._volume,e._rate=t._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++r._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1);},_loadListener:function(){var e=this,t=e._parent;t._duration=Math.ceil(e._node.duration*10)/10,Object.keys(t._sprite).length===0&&(t._sprite={__default:[0,t._duration*1e3]}),t._state!=="loaded"&&(t._state="loaded",t._emit("load"),t._loadQueue()),e._node.removeEventListener(r._canPlayEvent,e._loadFn,!1);},_endListener:function(){var e=this,t=e._parent;t._duration===1/0&&(t._duration=Math.ceil(e._node.duration*10)/10,t._sprite.__default[1]===1/0&&(t._sprite.__default[1]=t._duration*1e3),t._ended(e)),e._node.removeEventListener("ended",e._endFn,!1);}};var c={},d=function(e){var t=e._src;if(c[t]){e._duration=c[t].duration,_(e);return}if(/^data:[^;]+;base64,/.test(t)){for(var n=atob(t.split(",")[1]),o=new Uint8Array(n.length),l=0;l<n.length;++l)o[l]=n.charCodeAt(l);p(o.buffer,e);}else {var s=new XMLHttpRequest;s.open(e._xhr.method,t,!0),s.withCredentials=e._xhr.withCredentials,s.responseType="arraybuffer",e._xhr.headers&&Object.keys(e._xhr.headers).forEach(function(a){s.setRequestHeader(a,e._xhr.headers[a]);}),s.onload=function(){var a=(s.status+"")[0];if(a!=="0"&&a!=="2"&&a!=="3"){e._emit("loaderror",null,"Failed loading audio file with status: "+s.status+".");return}p(s.response,e);},s.onerror=function(){e._webAudio&&(e._html5=!0,e._webAudio=!1,e._sounds=[],delete c[t],e.load());},h(s);}},h=function(e){try{e.send();}catch(t){e.onerror();}},p=function(e,t){var n=function(){t._emit("loaderror",null,"Decoding audio data failed.");},o=function(l){l&&t._sounds.length>0?(c[t._src]=l,_(t,l)):n();};typeof Promise<"u"&&r.ctx.decodeAudioData.length===1?r.ctx.decodeAudioData(e).then(o).catch(n):r.ctx.decodeAudioData(e,o,n);},_=function(e,t){t&&!e._duration&&(e._duration=t.duration),Object.keys(e._sprite).length===0&&(e._sprite={__default:[0,e._duration*1e3]}),e._state!=="loaded"&&(e._state="loaded",e._emit("load"),e._loadQueue());},A=function(){if(r.usingWebAudio){try{typeof AudioContext<"u"?r.ctx=new AudioContext:typeof webkitAudioContext<"u"?r.ctx=new webkitAudioContext:r.usingWebAudio=!1;}catch(l){r.usingWebAudio=!1;}r.ctx||(r.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(r._navigator&&r._navigator.platform),t=r._navigator&&r._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),n=t?parseInt(t[1],10):null;if(e&&n&&n<9){var o=/safari/.test(r._navigator&&r._navigator.userAgent.toLowerCase());r._navigator&&!o&&(r.usingWebAudio=!1);}r.usingWebAudio&&(r.masterGain=typeof r.ctx.createGain>"u"?r.ctx.createGainNode():r.ctx.createGain(),r.masterGain.gain.setValueAtTime(r._muted?0:r._volume,r.ctx.currentTime),r.masterGain.connect(r.ctx.destination)),r._setup();}};typeof define=="function"&&define.amd&&define([],function(){return {Howler:r,Howl:i}}),typeof k<"u"&&(k.Howler=r,k.Howl=i),typeof global<"u"?(global.HowlerGlobal=g,global.Howler=r,global.Howl=i,global.Sound=u):typeof window<"u"&&(window.HowlerGlobal=g,window.Howler=r,window.Howl=i,window.Sound=u);})();(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(r){var i=this;if(!i.ctx||!i.ctx.listener)return i;for(var u=i._howls.length-1;u>=0;u--)i._howls[u].stereo(r);return i},HowlerGlobal.prototype.pos=function(r,i,u){var c=this;if(!c.ctx||!c.ctx.listener)return c;if(i=typeof i!="number"?c._pos[1]:i,u=typeof u!="number"?c._pos[2]:u,typeof r=="number")c._pos=[r,i,u],typeof c.ctx.listener.positionX<"u"?(c.ctx.listener.positionX.setTargetAtTime(c._pos[0],Howler.ctx.currentTime,.1),c.ctx.listener.positionY.setTargetAtTime(c._pos[1],Howler.ctx.currentTime,.1),c.ctx.listener.positionZ.setTargetAtTime(c._pos[2],Howler.ctx.currentTime,.1)):c.ctx.listener.setPosition(c._pos[0],c._pos[1],c._pos[2]);else return c._pos;return c},HowlerGlobal.prototype.orientation=function(r,i,u,c,d,h){var p=this;if(!p.ctx||!p.ctx.listener)return p;var _=p._orientation;if(i=typeof i!="number"?_[1]:i,u=typeof u!="number"?_[2]:u,c=typeof c!="number"?_[3]:c,d=typeof d!="number"?_[4]:d,h=typeof h!="number"?_[5]:h,typeof r=="number")p._orientation=[r,i,u,c,d,h],typeof p.ctx.listener.forwardX<"u"?(p.ctx.listener.forwardX.setTargetAtTime(r,Howler.ctx.currentTime,.1),p.ctx.listener.forwardY.setTargetAtTime(i,Howler.ctx.currentTime,.1),p.ctx.listener.forwardZ.setTargetAtTime(u,Howler.ctx.currentTime,.1),p.ctx.listener.upX.setTargetAtTime(c,Howler.ctx.currentTime,.1),p.ctx.listener.upY.setTargetAtTime(d,Howler.ctx.currentTime,.1),p.ctx.listener.upZ.setTargetAtTime(h,Howler.ctx.currentTime,.1)):p.ctx.listener.setOrientation(r,i,u,c,d,h);else return _;return p},Howl.prototype.init=function(r){return function(i){var u=this;return u._orientation=i.orientation||[1,0,0],u._stereo=i.stereo||null,u._pos=i.pos||null,u._pannerAttr={coneInnerAngle:typeof i.coneInnerAngle<"u"?i.coneInnerAngle:360,coneOuterAngle:typeof i.coneOuterAngle<"u"?i.coneOuterAngle:360,coneOuterGain:typeof i.coneOuterGain<"u"?i.coneOuterGain:0,distanceModel:typeof i.distanceModel<"u"?i.distanceModel:"inverse",maxDistance:typeof i.maxDistance<"u"?i.maxDistance:1e4,panningModel:typeof i.panningModel<"u"?i.panningModel:"HRTF",refDistance:typeof i.refDistance<"u"?i.refDistance:1,rolloffFactor:typeof i.rolloffFactor<"u"?i.rolloffFactor:1},u._onstereo=i.onstereo?[{fn:i.onstereo}]:[],u._onpos=i.onpos?[{fn:i.onpos}]:[],u._onorientation=i.onorientation?[{fn:i.onorientation}]:[],r.call(this,i)}}(Howl.prototype.init),Howl.prototype.stereo=function(r,i){var u=this;if(!u._webAudio)return u;if(u._state!=="loaded")return u._queue.push({event:"stereo",action:function(){u.stereo(r,i);}}),u;var c=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof i>"u")if(typeof r=="number")u._stereo=r,u._pos=[r,0,0];else return u._stereo;for(var d=u._getSoundIds(i),h=0;h<d.length;h++){var p=u._soundById(d[h]);if(p)if(typeof r=="number")p._stereo=r,p._pos=[r,0,0],p._node&&(p._pannerAttr.panningModel="equalpower",(!p._panner||!p._panner.pan)&&g(p,c),c==="spatial"?typeof p._panner.positionX<"u"?(p._panner.positionX.setValueAtTime(r,Howler.ctx.currentTime),p._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),p._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):p._panner.setPosition(r,0,0):p._panner.pan.setValueAtTime(r,Howler.ctx.currentTime)),u._emit("stereo",p._id);else return p._stereo}return u},Howl.prototype.pos=function(r,i,u,c){var d=this;if(!d._webAudio)return d;if(d._state!=="loaded")return d._queue.push({event:"pos",action:function(){d.pos(r,i,u,c);}}),d;if(i=typeof i!="number"?0:i,u=typeof u!="number"?-.5:u,typeof c>"u")if(typeof r=="number")d._pos=[r,i,u];else return d._pos;for(var h=d._getSoundIds(c),p=0;p<h.length;p++){var _=d._soundById(h[p]);if(_)if(typeof r=="number")_._pos=[r,i,u],_._node&&((!_._panner||_._panner.pan)&&g(_,"spatial"),typeof _._panner.positionX<"u"?(_._panner.positionX.setValueAtTime(r,Howler.ctx.currentTime),_._panner.positionY.setValueAtTime(i,Howler.ctx.currentTime),_._panner.positionZ.setValueAtTime(u,Howler.ctx.currentTime)):_._panner.setPosition(r,i,u)),d._emit("pos",_._id);else return _._pos}return d},Howl.prototype.orientation=function(r,i,u,c){var d=this;if(!d._webAudio)return d;if(d._state!=="loaded")return d._queue.push({event:"orientation",action:function(){d.orientation(r,i,u,c);}}),d;if(i=typeof i!="number"?d._orientation[1]:i,u=typeof u!="number"?d._orientation[2]:u,typeof c>"u")if(typeof r=="number")d._orientation=[r,i,u];else return d._orientation;for(var h=d._getSoundIds(c),p=0;p<h.length;p++){var _=d._soundById(h[p]);if(_)if(typeof r=="number")_._orientation=[r,i,u],_._node&&(_._panner||(_._pos||(_._pos=d._pos||[0,0,-.5]),g(_,"spatial")),typeof _._panner.orientationX<"u"?(_._panner.orientationX.setValueAtTime(r,Howler.ctx.currentTime),_._panner.orientationY.setValueAtTime(i,Howler.ctx.currentTime),_._panner.orientationZ.setValueAtTime(u,Howler.ctx.currentTime)):_._panner.setOrientation(r,i,u)),d._emit("orientation",_._id);else return _._orientation}return d},Howl.prototype.pannerAttr=function(){var r=this,i=arguments,u,c,d;if(!r._webAudio)return r;if(i.length===0)return r._pannerAttr;if(i.length===1)if(typeof i[0]=="object")u=i[0],typeof c>"u"&&(u.pannerAttr||(u.pannerAttr={coneInnerAngle:u.coneInnerAngle,coneOuterAngle:u.coneOuterAngle,coneOuterGain:u.coneOuterGain,distanceModel:u.distanceModel,maxDistance:u.maxDistance,refDistance:u.refDistance,rolloffFactor:u.rolloffFactor,panningModel:u.panningModel}),r._pannerAttr={coneInnerAngle:typeof u.pannerAttr.coneInnerAngle<"u"?u.pannerAttr.coneInnerAngle:r._coneInnerAngle,coneOuterAngle:typeof u.pannerAttr.coneOuterAngle<"u"?u.pannerAttr.coneOuterAngle:r._coneOuterAngle,coneOuterGain:typeof u.pannerAttr.coneOuterGain<"u"?u.pannerAttr.coneOuterGain:r._coneOuterGain,distanceModel:typeof u.pannerAttr.distanceModel<"u"?u.pannerAttr.distanceModel:r._distanceModel,maxDistance:typeof u.pannerAttr.maxDistance<"u"?u.pannerAttr.maxDistance:r._maxDistance,refDistance:typeof u.pannerAttr.refDistance<"u"?u.pannerAttr.refDistance:r._refDistance,rolloffFactor:typeof u.pannerAttr.rolloffFactor<"u"?u.pannerAttr.rolloffFactor:r._rolloffFactor,panningModel:typeof u.pannerAttr.panningModel<"u"?u.pannerAttr.panningModel:r._panningModel});else return d=r._soundById(parseInt(i[0],10)),d?d._pannerAttr:r._pannerAttr;else i.length===2&&(u=i[0],c=parseInt(i[1],10));for(var h=r._getSoundIds(c),p=0;p<h.length;p++)if(d=r._soundById(h[p]),d){var _=d._pannerAttr;_={coneInnerAngle:typeof u.coneInnerAngle<"u"?u.coneInnerAngle:_.coneInnerAngle,coneOuterAngle:typeof u.coneOuterAngle<"u"?u.coneOuterAngle:_.coneOuterAngle,coneOuterGain:typeof u.coneOuterGain<"u"?u.coneOuterGain:_.coneOuterGain,distanceModel:typeof u.distanceModel<"u"?u.distanceModel:_.distanceModel,maxDistance:typeof u.maxDistance<"u"?u.maxDistance:_.maxDistance,refDistance:typeof u.refDistance<"u"?u.refDistance:_.refDistance,rolloffFactor:typeof u.rolloffFactor<"u"?u.rolloffFactor:_.rolloffFactor,panningModel:typeof u.panningModel<"u"?u.panningModel:_.panningModel};var A=d._panner;A||(d._pos||(d._pos=r._pos||[0,0,-.5]),g(d,"spatial"),A=d._panner),A.coneInnerAngle=_.coneInnerAngle,A.coneOuterAngle=_.coneOuterAngle,A.coneOuterGain=_.coneOuterGain,A.distanceModel=_.distanceModel,A.maxDistance=_.maxDistance,A.refDistance=_.refDistance,A.rolloffFactor=_.rolloffFactor,A.panningModel=_.panningModel;}return r},Sound.prototype.init=function(r){return function(){var i=this,u=i._parent;i._orientation=u._orientation,i._stereo=u._stereo,i._pos=u._pos,i._pannerAttr=u._pannerAttr,r.call(this),i._stereo?u.stereo(i._stereo):i._pos&&u.pos(i._pos[0],i._pos[1],i._pos[2],i._id);}}(Sound.prototype.init),Sound.prototype.reset=function(r){return function(){var i=this,u=i._parent;return i._orientation=u._orientation,i._stereo=u._stereo,i._pos=u._pos,i._pannerAttr=u._pannerAttr,i._stereo?u.stereo(i._stereo):i._pos?u.pos(i._pos[0],i._pos[1],i._pos[2],i._id):i._panner&&(i._panner.disconnect(0),i._panner=void 0,u._refreshBuffer(i)),r.call(this)}}(Sound.prototype.reset);var g=function(r,i){i=i||"spatial",i==="spatial"?(r._panner=Howler.ctx.createPanner(),r._panner.coneInnerAngle=r._pannerAttr.coneInnerAngle,r._panner.coneOuterAngle=r._pannerAttr.coneOuterAngle,r._panner.coneOuterGain=r._pannerAttr.coneOuterGain,r._panner.distanceModel=r._pannerAttr.distanceModel,r._panner.maxDistance=r._pannerAttr.maxDistance,r._panner.refDistance=r._pannerAttr.refDistance,r._panner.rolloffFactor=r._pannerAttr.rolloffFactor,r._panner.panningModel=r._pannerAttr.panningModel,typeof r._panner.positionX<"u"?(r._panner.positionX.setValueAtTime(r._pos[0],Howler.ctx.currentTime),r._panner.positionY.setValueAtTime(r._pos[1],Howler.ctx.currentTime),r._panner.positionZ.setValueAtTime(r._pos[2],Howler.ctx.currentTime)):r._panner.setPosition(r._pos[0],r._pos[1],r._pos[2]),typeof r._panner.orientationX<"u"?(r._panner.orientationX.setValueAtTime(r._orientation[0],Howler.ctx.currentTime),r._panner.orientationY.setValueAtTime(r._orientation[1],Howler.ctx.currentTime),r._panner.orientationZ.setValueAtTime(r._orientation[2],Howler.ctx.currentTime)):r._panner.setOrientation(r._orientation[0],r._orientation[1],r._orientation[2])):(r._panner=Howler.ctx.createStereoPanner(),r._panner.pan.setValueAtTime(r._stereo,Howler.ctx.currentTime)),r._panner.connect(r._node),r._paused||r._parent.pause(r._id,!0).play(r._id,!0);};})();});var O=b$1(B(),1),H=new Map;H.set("default",()=>import('../assets/beepSound.js'));var b=class b{constructor(r){this.resource=null;this.resource=r;}static get defaultSound(){return b._defaultSound instanceof b||(b._defaultSound=new b("default")),b._defaultSound}toJSONObject(){return this.resource!==null?{resource:this.resource}:{}}async play(){var r;if(this.audio==null&&this.resource!=null)if(H.has(this.resource)){let i=await((r=H.get(this.resource))==null?void 0:r());i!=null&&i.beepSound&&(this.audio=new O.Howl({src:i.beepSound,html5:!0}));}else this.audio=new O.Howl({src:this.resource,html5:!0});this.audio!=null&&this.audio.play();}};b._defaultSound=null;var L=b;
|
|
2
|
+
export{L as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-EV4OEANA.js';import {a as a$1}from'./chunk-3A4KLILV.js';import {a as a$2}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-EV4OEANA.js';import {a as a$1}from'./chunk-3A4KLILV.js';import {a as a$2}from'./chunk-MU6SADSF.js';var r="inline-style",e=class e extends a{get fill(){var t;return (t=this.getAttribute("fill"))!=null?t:"black"}set fill(t){this.setAttribute("fill",t);}get size(){var t;return Number((t=this.getAttribute("size"))!=null?t:"32")}set size(t){this.setAttribute("size",t.toString());}get[r](){return this.getAttribute(r)}set[r](t){t==null?this.removeAttribute(r):this.setAttribute(r,t);}static create(){return a$1({[e.tag]:e}),document.createElement(e.tag)}render(){return a$2`<div></div>`}heightForViewbox(t,i){return this.size*this.aspectRatioForViewbox(t,i)}aspectRatioForViewbox(t,i){return i/t}connectedCallback(){this.innerHTML=this.render();}attributeChangedCallback(t,i,b){b!==i&&(this.innerHTML=this.render());}};e.tag="scandit-svg-icon",e.observedAttributes=["fill","size"];var u=e;export{u as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-NMX4VHW2.js';import {a}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-NMX4VHW2.js';import {a}from'./chunk-LSZZVJ6B.js';function r(){let e=a`@keyframes scandit-rotation{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.${a$1.CONTAINER_CLASS_NAME}{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.${a$1.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`.${a$1.PAINTBOARDS_CONTAINER_CLASS_NAME}{height:inherit;position:relative;width:100%}.${a$1.PAINTBOARD_CLASS_NAME}{aspect-ratio:16/9;background-color:#000;height:100%;min-height:1px;min-width:1px;position:relative;width:100%}.${a$1.PAINTBOARD_CLASS_NAME}.${a$1.PAINTBOARD_CLASS_NAME_STATE_ON}{aspect-ratio:auto}.${a$1.PAINTBOARD_CLASS_NAME} video{display:block;height:100%;object-fit:cover;transition:opacity .3s;width:100%}.${a$1.PAINTBOARD_CLASS_NAME} .${a$1.MIRRORED_CLASS_NAME}{transform:scaleX(-1)}.${a$1.PAINTBOARD_CLASS_NAME} .${a$1.CAMERA_RECOVERY_CLASS_NAME}{background-color:#000;cursor:pointer;z-index:5}.${a$1.PAINTBOARD_CLASS_NAME} .${a$1.CAMERA_RECOVERY_CLASS_NAME},.${a$1.PAINTBOARD_CLASS_NAME} .${a$1.ERROR_CLASS_NAME}{align-items:center;color:#fff;display:flex;height:100%;justify-content:center;left:0;position:absolute;top:0;width:100%}.${a$1.PAINTBOARD_CLASS_NAME} .${a$1.ERROR_CLASS_NAME}{background-color:rgba(0,0,0,.5);text-align:center;z-index:6}.${a$1.PAINTBOARD_CLASS_NAME} .${a$1.HINT_CONTAINER_CLASS_NAME}{bottom:5vh;display:grid;pointer-events:none;position:absolute;top:5vh;width:100%}.${a$1.PAINTBOARD_CLASS_NAME} .${a$1.HINT_CLASS_NAME}{background-color:#fff;color:#000;padding:10px;width:fit-content}.${a$1.CAMERA_RECOVERY_CLASS_NAME}[hidden],.${a$1.ERROR_CLASS_NAME}[hidden],.${a$1.HINT_CLASS_NAME}[hidden]{display:none}.${a$1.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`.${a$1.PAINTBOARD_CLASS_NAME} .${a$1.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$1.PAINTBOARD_CLASS_NAME} .${a$1.SINGLE_IMAGE_UPLOADER_CONTAINER_CLASS_NAME} label{align-items:center;cursor:pointer;display:flex;flex-direction:column;justify-content:center}.${a$1.PAINTBOARD_CLASS_NAME} .${a$1.SINGLE_IMAGE_UPLOADER_CONTAINER_CLASS_NAME} label input[type=file]{position:absolute;top:-9999px}.${a$1.PAINTBOARD_CLASS_NAME}.${a$1.SINGLE_IMAGE_UPLOADER_CONTAINER_CLASS_NAME} label button{pointer-events:none}`,n=a`.${a$1.PAINTBOARD_CLASS_NAME} .${a$1.CONTROLS_CLASS_NAME}{display:flex;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%}.${a$1.PAINTBOARD_CLASS_NAME} .${a$1.CONTROL_WIDGET_CLASS_NAME}-${a$1.TORCH_SWITCH_CONTROL_CLASS_NAME}{left:16px;top:24px}.${a$1.PAINTBOARD_CLASS_NAME} .${a$1.CONTROL_WIDGET_CLASS_NAME}-${a$1.CAMERA_SWITCH_CONTROL_CLASS_NAME}{right:16px;top:24px}.${a$1.PAINTBOARD_CLASS_NAME} .${a$1.CONTROL_WIDGET_CLASS_NAME}-${a$1.CAMERA_FOV_SWITCH_CONTROL_CLASS_NAME}{bottom:24px;right:24px}.${a$1.CONTROL_WIDGET_CLASS_NAME}{background-color:transparent;background-repeat:no-repeat;border:none;cursor:pointer;height:32px;pointer-events:all;position:absolute;width:32px}.${a$1.CONTROL_WIDGET_CLASS_NAME}+.${a$1.CONTROL_WIDGET_CLASS_NAME}{margin-left:16px}`,_=a`.${a$1.FROZEN_FRAME}{height:100%;left:0;object-fit:cover;opacity:1;position:absolute;top:0;width:100%}.${a$1.FROZEN_FRAME}[hidden]{opacity:0;pointer-events:none;visibility:hidden}`;return [e,o,n,i,_]}export{r as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-
|
|
1
|
+
import {b as b$1}from'./chunk-ACXLPROZ.js';import {a as a$7}from'./chunk-FFTRSHP6.js';import {b,a as a$6}from'./chunk-5S537AFM.js';import {a as a$1}from'./chunk-EV4OEANA.js';import {a as a$5}from'./chunk-3A4KLILV.js';import {a as a$3}from'./chunk-MU6SADSF.js';import {a as a$4}from'./chunk-LSZZVJ6B.js';import {a as a$2}from'./chunk-R6E4CT22.js';var o="--view-finder-top",a="--view-finder-bottom",l="--hint-anchor-offset",w="--max-width-fraction",$="--horizontal-margin",c="--max-width-ratio-adjust",E=(d=>(d.Update="hintpresenterupdate",d))(E||{});function s(p,d=100){return typeof p=="string"?p.slice(0,d):""}var n=class n extends a$1{constructor(){super();this.onDidToastHideHandler=this.onDidToastHide.bind(this);this.orientationObserver=new b;this.onOrientationChangeHandler=a$2(this.onOrientationChange.bind(this),200);let t=this.attachShadow({mode:"open"});t.innerHTML=a$3`
|
|
2
2
|
<div id="root">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-GPJEB376.js';import {a as a$2}from'./chunk-XR65N6EG.js';import {a as a$3}from'./chunk-QCZSSQAQ.js';import {a}from'./chunk-MU4VAJIM.js';var J=(p=>(p.WorldFacing="worldFacing",p.UserFacing="userFacing",p))(J||{}),Q=(c=>(c[c.ULTRA_HD=0]="ULTRA_HD",c[c.FULL_HD=1]="FULL_HD",c[c.HD=2]="HD",c[c.SD=3]="SD",c[c.NONE=4]="NONE",c))(Q||{}),$=(v=>(v.AUTO="auto",v.FOUR_TO_THREE="fourToThree",v.SIXTEEN_TO_NINE="sixteenToNine",v))($||{}),T;(l=>{let U=new Map([["DeviceCaptureError","AbortError"],["NotSupportedError","AbortError"],["ScreenCaptureError","AbortError"],["TabCaptureError","AbortError"],["TypeError","AbortError"],["InvalidStateError","NotAllowedError"],["MediaDeviceFailedDueToShutdown","NotAllowedError"],["MediaDeviceKillSwitchOn","NotAllowedError"],["PermissionDeniedError","NotAllowedError"],["PermissionDismissedError","NotAllowedError"],["DevicesNotFoundError","NotFoundError"],["SourceUnavailableError","NotReadableError"],["TrackStartError","NotReadableError"],["ConstraintNotSatisfiedError","OverconstrainedError"]]),P=["rear","back","r\xFCck","arri\xE8re","trasera","tr\xE1s","traseira","posteriore","\u540E\u9762","\u5F8C\u9762","\u80CC\u9762","\u540E\u7F6E","\u5F8C\u7F6E","\u80CC\u7F6E","\u0437\u0430\u0434\u043D\u0435\u0439","\u0627\u0644\u062E\u0644\u0641\u064A\u0629","\uD6C4","arka","achterzijde","\u0E2B\u0E25\u0E31\u0E07","baksidan","bagside","sau","bak","tylny","takakamera","belakang","\u05D0\u05D7\u05D5\u05E8\u05D9\u05EA","\u03C0\u03AF\u03C3\u03C9","spate","h\xE1ts\xF3","zadn\xED","darrere","posterior","zadn\xE1","\u0437\u0430\u0434\u043D\u044F","stra\u017Enja","belakang","\u092C\u0948\u0915"],p=new Set(["Desk View Camera","Schreibtischansicht-Kamera","Cam\xE9ra Desk\xA0View","C\xE1mara de Vista Cenital","C\xE2mara da Vista de Secret\xE1ria","Fotocamera di Panoramica Scrivania","\u684C\u4E0A\u89C6\u89D2\u76F8\u673A","\u30C7\u30B9\u30AF\u30D3\u30E5\u30FC\u30AB\u30E1\u30E9","\u041A\u0430\u043C\u0435\u0440\u0430 \u041E\u0431\u0437\u043E\u0440\u0430 \u0441\u0442\u043E\u043B\u0430","Masa G\xF6r\xFCnt\xFCs\xFC Kameras\u0131","Bureauweergave-camera","\u0643\u0627\u0645\u064A\u0631\u0627 \u0627\u0644\u0639\u0631\u0636 \u0627\u0644\u0631\u0623\u0633\u064A","\u0E01\u0E25\u0E49\u0E2D\u0E07\u0E14\u0E39\u0E14\u0E49\u0E32\u0E19\u0E2B\u0E19\u0E49\u0E32\u0E42\u0E15\u0E4A\u0E30","Bordsvisningskamera","Kamera til Visning af skrivebord","Camera Desk View","Bordvisning-kamera","Kamera w\xA0aplikacji Widok blatu","Ty\xF6p\xF6yt\xE4n\xE4kym\xE4n kamera","Kamera Tampilan Meja","\u05DE\u05E6\u05DC\u05DE\u05EA \u05F4\u05EA\u05E6\u05D5\u05D2\u05EA \u05E9\u05D5\u05DC\u05D7\u05DF\u05F4","\u039A\u03AC\u03BC\u03B5\u03C1\u03B1 \u03C4\u03B7\u03C2 \u03A0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE\u03C2 \u03B3\u03C1\u03B1\u03C6\u03B5\u03AF\u03BF\u03C5","Camer\u0103 Vizualizare birou","\xCDr\xF3asztal n\xE9zet kamer\xE1ja","Stoln\xED kamera","C\xE0mera de l\u2019app Vista de l\u2019Escriptori"]),v=new Set(["Front Camera","Frontkamera","Appareil photo avant","C\xE1mara frontal","C\xE2mera Frontal","C\xE2mara frontal","Fotocamera (anteriore)","\u524D\u7F6E\u76F8\u673A","\u524D\u7F6E\u76F8\u6A5F","\u524D\u9762\u30AB\u30E1\u30E9","\u041A\u0430\u043C\u0435\u0440\u0430 \u043D\u0430 \u043F\u0435\u0440\u0435\u0434\u043D\u0435\u0439 \u043F\u0430\u043D\u0435\u043B\u0438","\xD6n Kamera","Camera aan voorzijde","\u0627\u0644\u0643\u0627\u0645\u064A\u0631\u0627 \u0627\u0644\u0623\u0645\u0627\u0645\u064A\u0629","\u0E01\u0E25\u0E49\u0E2D\u0E07\u0E14\u0E49\u0E32\u0E19\u0E2B\u0E19\u0E49\u0E32","Kamera p\xE5 framsidan","Forsidekamera","Camera m\u1EB7t tr\u01B0\u1EDBc","Kamera foran","Przedni aparat","Etukamera","Kamera Depan","\u05DE\u05E6\u05DC\u05DE\u05D4 \u05E7\u05D3\u05DE\u05D9\u05EA","\u039C\u03C0\u03C1\u03BF\u03C3\u03C4\u03B9\u03BD\u03AE \u03BA\u03AC\u03BC\u03B5\u03C1\u03B1","Camer\u0103 fa\u021B\u0103","El\xFCls\u0151 kamera","P\u0159edn\xED fotoapar\xE1t","C\xE0mera frontal","Predn\xE1 kamera","\u041F\u0435\u0440\u0435\u0434\u043D\u044F \u043A\u0430\u043C\u0435\u0440\u0430","Prednja kamera","Kamera Depan","\u092B\u093C\u094D\u0930\u0902\u091F \u0915\u0948\u092E\u0930\u093E"]),x=new Set(["Back Camera","R\xFCckkamera","Cam\xE9ra arri\xE8re","C\xE1mara trasera","C\xE2mera Traseira","C\xE2mara traseira","Fotocamera (posteriore)","\u540E\u7F6E\u76F8\u673A","\u5F8C\u7F6E\u76F8\u6A5F","\u80CC\u9762\u30AB\u30E1\u30E9","\u041A\u0430\u043C\u0435\u0440\u0430 \u043D\u0430 \u0437\u0430\u0434\u043D\u0435\u0439 \u043F\u0430\u043D\u0435\u043B\u0438","Arka Kamera","Camera aan achterzijde","\u0627\u0644\u0643\u0627\u0645\u064A\u0631\u0627 \u0627\u0644\u062E\u0644\u0641\u064A\u0629","\u0E01\u0E25\u0E49\u0E2D\u0E07\u0E14\u0E49\u0E32\u0E19\u0E2B\u0E25\u0E31\u0E07","Kamera p\xE5 baksidan","Bagsidekamera","Camera m\u1EB7t sau","Kamera bak","Tylny aparat","Takakamera","Kamera Belakang","\u05DE\u05E6\u05DC\u05DE\u05D4 \u05D0\u05D7\u05D5\u05E8\u05D9\u05EA","\u03A0\u03AF\u03C3\u03C9 \u03BA\u03AC\u03BC\u03B5\u03C1\u03B1","Camer\u0103 spate","H\xE1ts\xF3 kamera","Zadn\xED fotoapar\xE1t","C\xE0mera posterior","Zadn\xE1 kamera","\u0417\u0430\u0434\u043D\u044F \u043A\u0430\u043C\u0435\u0440\u0430","Stra\u017Enja kamera","Kamera Belakang","\u092C\u0948\u0915 \u0915\u0948\u092E\u0930\u093E"]),c=new Set(["Back Dual Wide Camera","R\xFCckseitige Dual-Weitwinkelkamera","Double appareil photo grand angle arri\xE8re","C\xE1mara trasera dual con gran angular","C\xE2mera Dupla Grande-Angular Traseira","C\xE2mara grande angular dupla traseira","Fotocamera doppia con grandangolo (posteriore)","\u540E\u7F6E\u53CC\u5E7F\u89D2\u955C\u5934","\u5F8C\u7F6E\u96D9\u5EE3\u89D2\u76F8\u6A5F","\u80CC\u9762\u30C7\u30E5\u30A2\u30EB\u5E83\u89D2\u30AB\u30E1\u30E9","\u0417\u0430\u0434\u043D\u044F\u044F \u0434\u0432\u043E\u0439\u043D\u0430\u044F \u0448\u0438\u0440\u043E\u043A\u043E\u0443\u0433\u043E\u043B\u044C\u043D\u0430\u044F \u043A\u0430\u043C\u0435\u0440\u0430","\xC7ift Geni\u015F Kamera Arka Y\xFCz\xFC","\u0643\u0627\u0645\u064A\u0631\u0627 \u062E\u0644\u0641\u064A\u0629 \u0645\u0632\u062F\u0648\u062C\u0629 \u0639\u0631\u064A\u0636\u0629","\u0E01\u0E25\u0E49\u0E2D\u0E07\u0E04\u0E39\u0E48\u0E14\u0E49\u0E32\u0E19\u0E2B\u0E25\u0E31\u0E07\u0E21\u0E38\u0E21\u0E01\u0E27\u0E49\u0E32\u0E07","Dubbel vidvinkelkamera p\xE5 baksidan","Camera k\xE9p r\u1ED9ng m\u1EB7t sau","Dobbelt vidvinkelkamera bak","Tylny dwuobiektywowy aparat szerokok\u0105tny","Laajakulmainen kaksoistakakamera","Kamera Lebar Belakang Ganda","\u05DE\u05E6\u05DC\u05DE\u05D4 \u05DB\u05E4\u05D5\u05DC\u05D4 \u05E8\u05D7\u05D1\u05D4 \u05D0\u05D7\u05D5\u05E8\u05D9\u05EA","\u03A0\u03AF\u03C3\u03C9 \u03B4\u03B9\u03C0\u03BB\u03AE \u03B5\u03C5\u03C1\u03B5\u03AF\u03B1 \u03BA\u03AC\u03BC\u03B5\u03C1\u03B1","Camer\u0103 dubl\u0103 cu obiectiv superangular spate","H\xE1ts\xF3, kett\u0151s, sz\xE9les l\xE1t\xF3sz\xF6g\u0171 kamera","Zadn\xED du\xE1ln\xED \u0161iroko\xFAhl\xFD fotoapar\xE1t","C\xE0mera dual posterior amb gran angular","Zadn\xE1 du\xE1lna \u0161irokouhl\xE1 kamera","\u0417\u0430\u0434\u043D\u044F \u0437\u0434\u0432\u043E\u0454\u043D\u0430 \u0448\u0438\u0440\u043E\u043A\u043E\u043A\u0443\u0442\u043D\u0430 \u043A\u0430\u043C\u0435\u0440\u0430","Stra\u017Enja dvostruka \u0161iroka kamera","Dwikamera Lebar Belakang","\u092C\u0948\u0915 \u0921\u094D\u092F\u0941\u0905\u0932 \u0935\u093E\u0907\u0921 \u0915\u0948\u092E\u0930\u093E"]),O=new Set(["Back Ultra Wide Camera","R\xFCckseitige Ultra-Weitwinkelkamera","Appareil photo ultra grand angle arri\xE8re","C\xE1mara trasera con ultra gran angular","C\xE2mera Ultra-Angular Traseira","C\xE2mara ultra grande angular traseira","Fotocamera con ultra-grandangolo (posteriore)","\u540E\u7F6E\u8D85\u5E7F\u89D2\u76F8\u673A","\u5F8C\u7F6E\u8D85\u5EE3\u89D2\u76F8\u6A5F","\u80CC\u9762\u8D85\u5E83\u89D2\u30AB\u30E1\u30E9","\u0417\u0430\u0434\u043D\u044F\u044F \u0441\u0432\u0435\u0440\u0445\u0448\u0438\u0440\u043E\u043A\u043E\u0443\u0433\u043E\u043B\u044C\u043D\u0430\u044F \u043A\u0430\u043C\u0435\u0440\u0430","Ultra Geni\u015F Kamera Arka Y\xFCz\xFC","Ultrabrede camera aan achterzijde","\u0643\u0627\u0645\u064A\u0631\u0627 \u062E\u0644\u0641\u064A\u0629 \u0639\u0631\u064A\u0636\u0629 \u062C\u062F\u064B\u0627","\u0E01\u0E25\u0E49\u0E2D\u0E07\u0E14\u0E49\u0E32\u0E19\u0E2B\u0E25\u0E31\u0E07\u0E21\u0E38\u0E21\u0E01\u0E27\u0E49\u0E32\u0E07\u0E2D\u0E31\u0E25\u0E15\u0E23\u0E49\u0E32","Ultravidvinkelkamera p\xE5 baksidan","Ultravidvinkelkameraet p\xE5 bagsiden","Camera c\u1EF1c r\u1ED9ng m\u1EB7t sau","Ultravidvinkelkamera bak","Tylny aparat ultraszerokok\u0105tny","Ultralaajakulmainen takakamera","Kamera Ultra Lebar Belakang","\u05DE\u05E6\u05DC\u05DE\u05D4 \u05D0\u05D5\u05DC\u05D8\u05E8\u05D4 \u05E8\u05D7\u05D1\u05D4 \u05D0\u05D7\u05D5\u05E8\u05D9\u05EA","\u03A0\u03AF\u03C3\u03C9 \u03C5\u03C0\u03B5\u03C1\u03B5\u03C5\u03C1\u03B5\u03AF\u03B1 \u03BA\u03AC\u03BC\u03B5\u03C1\u03B1","Camer\u0103 cu obiectiv ultra\u2011superangular spate","H\xE1ts\xF3, ultrasz\xE9les l\xE1t\xF3sz\xF6g\u0171 kamera","Zadn\xED ultra \u0161iroko\xFAhl\xFD fotoapar\xE1t","C\xE0mera posterior amb ultra gran angular","Zadn\xE1 ultra\u0161irokouhl\xE1 kamera","\u0417\u0430\u0434\u043D\u044F \u043D\u0430\u0434\u0448\u0438\u0440\u043E\u043A\u043E\u043A\u0443\u0442\u043D\u0430 \u043A\u0430\u043C\u0435\u0440\u0430","Stra\u017Enja ultra \u0161iroka kamera","Kamera Ultralebar Belakang","\u092C\u0948\u0915 \u0905\u0932\u094D\u091F\u094D\u0930\u093E \u0935\u093E\u0907\u0921 \u0915\u0948\u092E\u0930\u093E"]),d,D=!1;l.mainCameraForPositionOverridesOnDesktop=new Map,l.deviceIdToCameraObjects=new Map,l.inaccessibleDeviceIds=new Set;function ee(e,i){l.mainCameraForPositionOverridesOnDesktop.set(e,i);}l.setMainCameraForPositionOverridesOnDesktop=ee;function ae(){l.mainCameraForPositionOverridesOnDesktop.clear();}l.clearMainCameraForPositionOverridesOnDesktop=ae;function F(){return navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices)}function N(){if(typeof navigator.enumerateDevices=="function")return navigator.enumerateDevices.bind(navigator);if(typeof navigator.mediaDevices=="object"&&typeof navigator.mediaDevices.enumerateDevices=="function")return navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices)}function S(){D=!0;}function B(e){let i=e.toLowerCase();return P.some(a=>i.includes(a))}function w(e){return v.has(e)}l.isIOSFrontCameraLabel=w;function E(e){return x.has(e)}l.isIOSBackCameraLabel=E;function M(e){return c.has(e)}l.isIOSBackDualWideCameraLabel=M;function K(e){return O.has(e)}l.isIOSUltraWideBackCameraLabel=K;function I(e){var a;let i=e.message==="Invalid constraint"?"OverconstrainedError":(a=U.get(e.name))!=null?a:e.name;Object.defineProperty(e,"name",{value:i});}function W(e){if(e.length===0)return {areSomeCameraLabelsFilled:!1,areAllCameraLabelsFilled:!1,areAllCameraLabelsUnfilled:!1};let i=e.every(r=>r.label!==""),a=e.every(r=>r.label==="");return {areSomeCameraLabelsFilled:!a&&!i,areAllCameraLabelsFilled:i,areAllCameraLabelsUnfilled:a}}function R(e,i){var a;return (a=l.mainCameraForPositionOverridesOnDesktop.get(i))!=null?a:e.find(n=>n.position===i)}function j(e,i){if(i==="worldFacing"){let a=e.find(r=>M(r.label));if(a!=null)return a;let n=e.find(r=>E(r.label));if(n!=null)return n}else {let a=e.find(n=>w(n.label));if(a!=null)return a}}function z(e,i){let{areSomeCameraLabelsFilled:a$1,areAllCameraLabelsUnfilled:n}=W(e);if(n)return e[i==="userFacing"?0:e.length-1];if(a$1){let r=e.filter(t=>t.position===i);return r.length===1?r[0]:r[i==="userFacing"?0:r.length-1]}if(a.getUserAgentInfo().getOS().name==="iOS"){let r=j(e,i);if(r)return r}return e.filter(r=>r.position===i).sort((r,t)=>r.label.localeCompare(t.label))[0]}function re(e,i){return a.isDesktopDevice()?R(e,i):z(e,i)}l.getMainCameraForPosition=re;function k(e,i){return e.unshift(e.splice(i,1)[0])}function ie(e,i){function a$1(t,o){let s=l.mainCameraForPositionOverridesOnDesktop.get(o);return s!=null&&t.includes(s)&&(t=t.filter(f=>f!==s),t.unshift(s)),t}let n=e.filter(t=>t.position==="userFacing"),r=e.filter(t=>t.position==="worldFacing");return a.isDesktopDevice()?(n=a$1(n,"userFacing"),r=a$1(r,"worldFacing")):e.every(t=>t.label==="")?r.reverse():(n.sort((t,o)=>t.label.localeCompare(o.label)),r.sort((t,o)=>t.label.localeCompare(o.label)),a.getUserAgentInfo().getOS().name==="iOS"&&(n.some((t,o)=>w(t.label)&&k(n,o)>=0),r.some((t,o)=>K(t.label)&&k(r,o)>=0),r.some((t,o)=>M(t.label)&&k(r,o)>=0)||r.some((t,o)=>E(t.label)&&k(r,o)>=0))),i==="userFacing"?[...n,...r]:[...r,...n]}l.sortCamerasForCameraPosition=ie;function _(e,i){let a=e.getVideoTracks();if(a.length>0){let n=a[0],r;typeof n.getSettings=="function"&&(r=n.getSettings(),r.facingMode!=null&&r.facingMode.length>0&&(i.position=r.facingMode==="environment"?"worldFacing":"userFacing"));let{label:t=""}=n;t.length>0&&(i.label=t);}}l.adjustCameraFromMediaStream=_;function H(e,i,a$1){if(l.deviceIdToCameraObjects.has(e.deviceId))return l.deviceIdToCameraObjects.get(e.deviceId);let{label:n="",deviceId:r}=e,t;return !a.isDesktopDevice()&&a$1.every(o=>o.label===""&&!l.deviceIdToCameraObjects.has(o.deviceId))?t=a$1.length===1||i+1<=Math.floor(a$1.length/2)?"userFacing":"worldFacing":t=B(n)?"worldFacing":"userFacing",{position:t,label:n,deviceId:r}}function A(e){let i=e.map((a,n,r)=>H(a,n,r)).map(a=>(a.deviceId!==""&&l.deviceIdToCameraObjects.set(a.deviceId,a),a)).filter(a=>!/\b(?:ir|infrared)\b/i.test(a.label)).filter(a=>!p.has(a.label)).filter(a=>!l.inaccessibleDeviceIds.has(a.deviceId));if(!a.isDesktopDevice()&&i.length>1&&!i.some(a=>a.position==="worldFacing")){let a=i.length-1,n=i.map(r=>{let t=/\b(\d+)mp?\b/i.exec(r.label);return t!=null?Number.parseInt(t[1],10):Number.NaN});n.some(r=>Number.isNaN(r))||(a=n.lastIndexOf(Math.max(...n))),i[a].position="worldFacing";}return i}async function V(){if(d!=null&&d.length>0&&d.every(e=>e.label===""&&!l.deviceIdToCameraObjects.has(e.deviceId)))try{return await F()({video:!0,audio:!1})}catch(e){}}function G(e,i){var a,n;if(i.length>0&&e.length===i.length&&!i.every((r,t)=>e[t].deviceId===r.deviceId)){let r={};for(let[t,o]of e.entries()){let s=l.deviceIdToCameraObjects.get(o.deviceId);if(s==null||s.label!==((n=(a=i[t])==null?void 0:a.label)!=null?n:""))continue;let f=i[t].deviceId;r[s.deviceId]=f,l.inaccessibleDeviceIds.has(s.deviceId)&&l.inaccessibleDeviceIds.add(f),s.deviceId=f,l.deviceIdToCameraObjects.set(f,s);}a$2.log(a$2.Level.Debug,"Detected updated camera deviceId information and updated it accordingly",r);}}function Z(){typeof navigator.mediaDevices.addEventListener=="function"?navigator.mediaDevices.addEventListener("devicechange",S):navigator.mediaDevices.ondevicechange=S;}async function y(){let e,i=N();if(i)e=await i();else throw new a$1({fullSupport:!1,scannerSupport:!0,missingFeatures:["mediaDevices"]});return e.filter(a=>a.kind==="videoinput")}async function te(e=!1,i=!1){var r;let a$3=a.checkBrowserCompatibility();if(!a$3.fullSupport)throw new a$1(a$3);if(Z(),d==null||e||D){D=!1;let t,o=d!=null?d:[];d=[];try{d=await y(),i||(t=await V(),t!=null&&(d=await y())),a$2.log(a$2.Level.Debug,"Camera list (devices):",...d),d.length>0&&d.every(s=>s.deviceId==="")&&a$2.log(a$2.Level.Debug,"Incomplete camera information listed due to user permission denial, cameras will not be accessible"),G(o,d);}catch(s){throw I(s),s}finally{for(let s of (r=t==null?void 0:t.getVideoTracks())!=null?r:[])s.stop();}}let n=A(d);return a$2.log(a$2.Level.Debug,"Camera list (cameras): ",...n),[...n]}l.getCameras=te;async function Y(e){return a$2.log(a$2.Level.Debug,"Attempt to access camera (parameters):",e.video),new Promise((i,a)=>{window.setTimeout(()=>{let n=F()(e);if(n==null){a(new a$3({name:"AbortError",message:"Cannot get stream from getUserMedia function."}));return}i(n);},0);})}function X(e,i){let a={resizeMode:"none"};switch(e){case 0:return {...a,width:{min:2880,ideal:i==="fourToThree"?2880:3840,max:4096},height:{min:1800,ideal:2160,max:2400}};case 1:return {...a,width:{min:1440,ideal:i==="fourToThree"?1440:1920,max:2160},height:{min:900,ideal:1080,max:1440}};case 2:return {...a,width:{min:960,ideal:i==="fourToThree"?960:1280,max:1440},height:{min:480,ideal:720,max:960}};case 3:return {...a,width:{min:640,ideal:640,max:800},height:{min:360,ideal:i==="fourToThree"?480:360,max:640}};default:return {}}}l.getUserMediaVideoParameters=X;function q(e){e.deviceId!==""&&(a$2.log(a$2.Level.Debug,"Camera marked to be inaccessible:",e),l.inaccessibleDeviceIds.add(e.deviceId));}l.markCameraAsInaccessible=q;async function ne(e,i,a){a$2.log(a$2.Level.Debug,"Attempt to access camera (camera):",e);let n={audio:!1,video:X(i,a)};e.deviceId===""?n.video.facingMode={ideal:e.position==="worldFacing"?"environment":"user"}:n.video.deviceId={exact:e.deviceId};try{let r=await Y(n);return _(r,e),r}catch(r){throw I(r),["OverconstrainedError","NotReadableError","NotAllowedError"].includes(r.name)||q(e),r}}l.accessCameraStream=ne;})(T||(T={}));export{J as a,Q as b,$ as c,T as d};
|
|
1
|
+
import {a as a$1}from'./chunk-GPJEB376.js';import {a as a$2}from'./chunk-XR65N6EG.js';import {a as a$3}from'./chunk-QCZSSQAQ.js';import {a}from'./chunk-MU4VAJIM.js';var q=(p=>(p.WorldFacing="worldFacing",p.UserFacing="userFacing",p))(q||{}),J=(c=>(c[c.ULTRA_HD=0]="ULTRA_HD",c[c.FULL_HD=1]="FULL_HD",c[c.HD=2]="HD",c[c.SD=3]="SD",c[c.NONE=4]="NONE",c))(J||{}),Q=(v=>(v.AUTO="auto",v.FOUR_TO_THREE="fourToThree",v.SIXTEEN_TO_NINE="sixteenToNine",v))(Q||{}),U;(l=>{let T=new Map([["DeviceCaptureError","AbortError"],["NotSupportedError","AbortError"],["ScreenCaptureError","AbortError"],["TabCaptureError","AbortError"],["TypeError","AbortError"],["InvalidStateError","NotAllowedError"],["MediaDeviceFailedDueToShutdown","NotAllowedError"],["MediaDeviceKillSwitchOn","NotAllowedError"],["PermissionDeniedError","NotAllowedError"],["PermissionDismissedError","NotAllowedError"],["DevicesNotFoundError","NotFoundError"],["SourceUnavailableError","NotReadableError"],["TrackStartError","NotReadableError"],["ConstraintNotSatisfiedError","OverconstrainedError"]]),P=["rear","back","r\xFCck","arri\xE8re","trasera","tr\xE1s","traseira","posteriore","\u540E\u9762","\u5F8C\u9762","\u80CC\u9762","\u540E\u7F6E","\u5F8C\u7F6E","\u80CC\u7F6E","\u0437\u0430\u0434\u043D\u0435\u0439","\u0627\u0644\u062E\u0644\u0641\u064A\u0629","\uD6C4","arka","achterzijde","\u0E2B\u0E25\u0E31\u0E07","baksidan","bagside","sau","bak","tylny","takakamera","belakang","\u05D0\u05D7\u05D5\u05E8\u05D9\u05EA","\u03C0\u03AF\u03C3\u03C9","spate","h\xE1ts\xF3","zadn\xED","darrere","posterior","zadn\xE1","\u0437\u0430\u0434\u043D\u044F","stra\u017Enja","belakang","\u092C\u0948\u0915"],p=new Set(["Desk View Camera","Schreibtischansicht-Kamera","Cam\xE9ra Desk\xA0View","C\xE1mara de Vista Cenital","C\xE2mara da Vista de Secret\xE1ria","Fotocamera di Panoramica Scrivania","\u684C\u4E0A\u89C6\u89D2\u76F8\u673A","\u30C7\u30B9\u30AF\u30D3\u30E5\u30FC\u30AB\u30E1\u30E9","\u041A\u0430\u043C\u0435\u0440\u0430 \u041E\u0431\u0437\u043E\u0440\u0430 \u0441\u0442\u043E\u043B\u0430","Masa G\xF6r\xFCnt\xFCs\xFC Kameras\u0131","Bureauweergave-camera","\u0643\u0627\u0645\u064A\u0631\u0627 \u0627\u0644\u0639\u0631\u0636 \u0627\u0644\u0631\u0623\u0633\u064A","\u0E01\u0E25\u0E49\u0E2D\u0E07\u0E14\u0E39\u0E14\u0E49\u0E32\u0E19\u0E2B\u0E19\u0E49\u0E32\u0E42\u0E15\u0E4A\u0E30","Bordsvisningskamera","Kamera til Visning af skrivebord","Camera Desk View","Bordvisning-kamera","Kamera w\xA0aplikacji Widok blatu","Ty\xF6p\xF6yt\xE4n\xE4kym\xE4n kamera","Kamera Tampilan Meja","\u05DE\u05E6\u05DC\u05DE\u05EA \u05F4\u05EA\u05E6\u05D5\u05D2\u05EA \u05E9\u05D5\u05DC\u05D7\u05DF\u05F4","\u039A\u03AC\u03BC\u03B5\u03C1\u03B1 \u03C4\u03B7\u03C2 \u03A0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE\u03C2 \u03B3\u03C1\u03B1\u03C6\u03B5\u03AF\u03BF\u03C5","Camer\u0103 Vizualizare birou","\xCDr\xF3asztal n\xE9zet kamer\xE1ja","Stoln\xED kamera","C\xE0mera de l\u2019app Vista de l\u2019Escriptori"]),v=new Set(["Front Camera","Frontkamera","Appareil photo avant","C\xE1mara frontal","C\xE2mera Frontal","C\xE2mara frontal","Fotocamera (anteriore)","\u524D\u7F6E\u76F8\u673A","\u524D\u7F6E\u76F8\u6A5F","\u524D\u9762\u30AB\u30E1\u30E9","\u041A\u0430\u043C\u0435\u0440\u0430 \u043D\u0430 \u043F\u0435\u0440\u0435\u0434\u043D\u0435\u0439 \u043F\u0430\u043D\u0435\u043B\u0438","\xD6n Kamera","Camera aan voorzijde","\u0627\u0644\u0643\u0627\u0645\u064A\u0631\u0627 \u0627\u0644\u0623\u0645\u0627\u0645\u064A\u0629","\u0E01\u0E25\u0E49\u0E2D\u0E07\u0E14\u0E49\u0E32\u0E19\u0E2B\u0E19\u0E49\u0E32","Kamera p\xE5 framsidan","Forsidekamera","Camera m\u1EB7t tr\u01B0\u1EDBc","Kamera foran","Przedni aparat","Etukamera","Kamera Depan","\u05DE\u05E6\u05DC\u05DE\u05D4 \u05E7\u05D3\u05DE\u05D9\u05EA","\u039C\u03C0\u03C1\u03BF\u03C3\u03C4\u03B9\u03BD\u03AE \u03BA\u03AC\u03BC\u03B5\u03C1\u03B1","Camer\u0103 fa\u021B\u0103","El\xFCls\u0151 kamera","P\u0159edn\xED fotoapar\xE1t","C\xE0mera frontal","Predn\xE1 kamera","\u041F\u0435\u0440\u0435\u0434\u043D\u044F \u043A\u0430\u043C\u0435\u0440\u0430","Prednja kamera","Kamera Depan","\u092B\u093C\u094D\u0930\u0902\u091F \u0915\u0948\u092E\u0930\u093E"]),x=new Set(["Back Camera","R\xFCckkamera","Cam\xE9ra arri\xE8re","C\xE1mara trasera","C\xE2mera Traseira","C\xE2mara traseira","Fotocamera (posteriore)","\u540E\u7F6E\u76F8\u673A","\u5F8C\u7F6E\u76F8\u6A5F","\u80CC\u9762\u30AB\u30E1\u30E9","\u041A\u0430\u043C\u0435\u0440\u0430 \u043D\u0430 \u0437\u0430\u0434\u043D\u0435\u0439 \u043F\u0430\u043D\u0435\u043B\u0438","Arka Kamera","Camera aan achterzijde","\u0627\u0644\u0643\u0627\u0645\u064A\u0631\u0627 \u0627\u0644\u062E\u0644\u0641\u064A\u0629","\u0E01\u0E25\u0E49\u0E2D\u0E07\u0E14\u0E49\u0E32\u0E19\u0E2B\u0E25\u0E31\u0E07","Kamera p\xE5 baksidan","Bagsidekamera","Camera m\u1EB7t sau","Kamera bak","Tylny aparat","Takakamera","Kamera Belakang","\u05DE\u05E6\u05DC\u05DE\u05D4 \u05D0\u05D7\u05D5\u05E8\u05D9\u05EA","\u03A0\u03AF\u03C3\u03C9 \u03BA\u03AC\u03BC\u03B5\u03C1\u03B1","Camer\u0103 spate","H\xE1ts\xF3 kamera","Zadn\xED fotoapar\xE1t","C\xE0mera posterior","Zadn\xE1 kamera","\u0417\u0430\u0434\u043D\u044F \u043A\u0430\u043C\u0435\u0440\u0430","Stra\u017Enja kamera","Kamera Belakang","\u092C\u0948\u0915 \u0915\u0948\u092E\u0930\u093E"]),c=new Set(["Back Dual Wide Camera","R\xFCckseitige Dual-Weitwinkelkamera","Double appareil photo grand angle arri\xE8re","C\xE1mara trasera dual con gran angular","C\xE2mera Dupla Grande-Angular Traseira","C\xE2mara grande angular dupla traseira","Fotocamera doppia con grandangolo (posteriore)","\u540E\u7F6E\u53CC\u5E7F\u89D2\u955C\u5934","\u5F8C\u7F6E\u96D9\u5EE3\u89D2\u76F8\u6A5F","\u80CC\u9762\u30C7\u30E5\u30A2\u30EB\u5E83\u89D2\u30AB\u30E1\u30E9","\u0417\u0430\u0434\u043D\u044F\u044F \u0434\u0432\u043E\u0439\u043D\u0430\u044F \u0448\u0438\u0440\u043E\u043A\u043E\u0443\u0433\u043E\u043B\u044C\u043D\u0430\u044F \u043A\u0430\u043C\u0435\u0440\u0430","\xC7ift Geni\u015F Kamera Arka Y\xFCz\xFC","\u0643\u0627\u0645\u064A\u0631\u0627 \u062E\u0644\u0641\u064A\u0629 \u0645\u0632\u062F\u0648\u062C\u0629 \u0639\u0631\u064A\u0636\u0629","\u0E01\u0E25\u0E49\u0E2D\u0E07\u0E04\u0E39\u0E48\u0E14\u0E49\u0E32\u0E19\u0E2B\u0E25\u0E31\u0E07\u0E21\u0E38\u0E21\u0E01\u0E27\u0E49\u0E32\u0E07","Dubbel vidvinkelkamera p\xE5 baksidan","Camera k\xE9p r\u1ED9ng m\u1EB7t sau","Dobbelt vidvinkelkamera bak","Tylny dwuobiektywowy aparat szerokok\u0105tny","Laajakulmainen kaksoistakakamera","Kamera Lebar Belakang Ganda","\u05DE\u05E6\u05DC\u05DE\u05D4 \u05DB\u05E4\u05D5\u05DC\u05D4 \u05E8\u05D7\u05D1\u05D4 \u05D0\u05D7\u05D5\u05E8\u05D9\u05EA","\u03A0\u03AF\u03C3\u03C9 \u03B4\u03B9\u03C0\u03BB\u03AE \u03B5\u03C5\u03C1\u03B5\u03AF\u03B1 \u03BA\u03AC\u03BC\u03B5\u03C1\u03B1","Camer\u0103 dubl\u0103 cu obiectiv superangular spate","H\xE1ts\xF3, kett\u0151s, sz\xE9les l\xE1t\xF3sz\xF6g\u0171 kamera","Zadn\xED du\xE1ln\xED \u0161iroko\xFAhl\xFD fotoapar\xE1t","C\xE0mera dual posterior amb gran angular","Zadn\xE1 du\xE1lna \u0161irokouhl\xE1 kamera","\u0417\u0430\u0434\u043D\u044F \u0437\u0434\u0432\u043E\u0454\u043D\u0430 \u0448\u0438\u0440\u043E\u043A\u043E\u043A\u0443\u0442\u043D\u0430 \u043A\u0430\u043C\u0435\u0440\u0430","Stra\u017Enja dvostruka \u0161iroka kamera","Dwikamera Lebar Belakang","\u092C\u0948\u0915 \u0921\u094D\u092F\u0941\u0905\u0932 \u0935\u093E\u0907\u0921 \u0915\u0948\u092E\u0930\u093E"]),O=new Set(["Back Ultra Wide Camera","R\xFCckseitige Ultra-Weitwinkelkamera","Appareil photo ultra grand angle arri\xE8re","C\xE1mara trasera con ultra gran angular","C\xE2mera Ultra-Angular Traseira","C\xE2mara ultra grande angular traseira","Fotocamera con ultra-grandangolo (posteriore)","\u540E\u7F6E\u8D85\u5E7F\u89D2\u76F8\u673A","\u5F8C\u7F6E\u8D85\u5EE3\u89D2\u76F8\u6A5F","\u80CC\u9762\u8D85\u5E83\u89D2\u30AB\u30E1\u30E9","\u0417\u0430\u0434\u043D\u044F\u044F \u0441\u0432\u0435\u0440\u0445\u0448\u0438\u0440\u043E\u043A\u043E\u0443\u0433\u043E\u043B\u044C\u043D\u0430\u044F \u043A\u0430\u043C\u0435\u0440\u0430","Ultra Geni\u015F Kamera Arka Y\xFCz\xFC","Ultrabrede camera aan achterzijde","\u0643\u0627\u0645\u064A\u0631\u0627 \u062E\u0644\u0641\u064A\u0629 \u0639\u0631\u064A\u0636\u0629 \u062C\u062F\u064B\u0627","\u0E01\u0E25\u0E49\u0E2D\u0E07\u0E14\u0E49\u0E32\u0E19\u0E2B\u0E25\u0E31\u0E07\u0E21\u0E38\u0E21\u0E01\u0E27\u0E49\u0E32\u0E07\u0E2D\u0E31\u0E25\u0E15\u0E23\u0E49\u0E32","Ultravidvinkelkamera p\xE5 baksidan","Ultravidvinkelkameraet p\xE5 bagsiden","Camera c\u1EF1c r\u1ED9ng m\u1EB7t sau","Ultravidvinkelkamera bak","Tylny aparat ultraszerokok\u0105tny","Ultralaajakulmainen takakamera","Kamera Ultra Lebar Belakang","\u05DE\u05E6\u05DC\u05DE\u05D4 \u05D0\u05D5\u05DC\u05D8\u05E8\u05D4 \u05E8\u05D7\u05D1\u05D4 \u05D0\u05D7\u05D5\u05E8\u05D9\u05EA","\u03A0\u03AF\u03C3\u03C9 \u03C5\u03C0\u03B5\u03C1\u03B5\u03C5\u03C1\u03B5\u03AF\u03B1 \u03BA\u03AC\u03BC\u03B5\u03C1\u03B1","Camer\u0103 cu obiectiv ultra\u2011superangular spate","H\xE1ts\xF3, ultrasz\xE9les l\xE1t\xF3sz\xF6g\u0171 kamera","Zadn\xED ultra \u0161iroko\xFAhl\xFD fotoapar\xE1t","C\xE0mera posterior amb ultra gran angular","Zadn\xE1 ultra\u0161irokouhl\xE1 kamera","\u0417\u0430\u0434\u043D\u044F \u043D\u0430\u0434\u0448\u0438\u0440\u043E\u043A\u043E\u043A\u0443\u0442\u043D\u0430 \u043A\u0430\u043C\u0435\u0440\u0430","Stra\u017Enja ultra \u0161iroka kamera","Kamera Ultralebar Belakang","\u092C\u0948\u0915 \u0905\u0932\u094D\u091F\u094D\u0930\u093E \u0935\u093E\u0907\u0921 \u0915\u0948\u092E\u0930\u093E"]),d,D=!1;l.mainCameraForPositionOverridesOnDesktop=new Map,l.deviceIdToCameraObjects=new Map,l.inaccessibleDeviceIds=new Set;function ee(e,i){l.mainCameraForPositionOverridesOnDesktop.set(e,i);}l.setMainCameraForPositionOverridesOnDesktop=ee;function ae(){l.mainCameraForPositionOverridesOnDesktop.clear();}l.clearMainCameraForPositionOverridesOnDesktop=ae;function F(){return navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices)}function N(){if(typeof navigator.enumerateDevices=="function")return navigator.enumerateDevices.bind(navigator);if(typeof navigator.mediaDevices=="object"&&typeof navigator.mediaDevices.enumerateDevices=="function")return navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices)}function S(){D=!0;}function B(e){let i=e.toLowerCase();return P.some(a=>i.includes(a))}function w(e){return v.has(e)}l.isIOSFrontCameraLabel=w;function E(e){return x.has(e)}l.isIOSBackCameraLabel=E;function M(e){return c.has(e)}l.isIOSBackDualWideCameraLabel=M;function W(e){return O.has(e)}l.isIOSUltraWideBackCameraLabel=W;function I(e){var a;let i=e.message==="Invalid constraint"?"OverconstrainedError":(a=T.get(e.name))!=null?a:e.name;Object.defineProperty(e,"name",{value:i});}function K(e){if(e.length===0)return {areSomeCameraLabelsFilled:!1,areAllCameraLabelsFilled:!1,areAllCameraLabelsUnfilled:!1};let i=e.every(r=>r.label!==""),a=e.every(r=>r.label==="");return {areSomeCameraLabelsFilled:!a&&!i,areAllCameraLabelsFilled:i,areAllCameraLabelsUnfilled:a}}function R(e,i){var a;return (a=l.mainCameraForPositionOverridesOnDesktop.get(i))!=null?a:e.find(n=>n.position===i)}function j(e,i){if(i==="worldFacing"){let a=e.find(r=>M(r.label));if(a!=null)return a;let n=e.find(r=>E(r.label));if(n!=null)return n}else {let a=e.find(n=>w(n.label));if(a!=null)return a}}function z(e,i){let{areSomeCameraLabelsFilled:a$1,areAllCameraLabelsUnfilled:n}=K(e);if(n)return e[i==="userFacing"?0:e.length-1];if(a$1){let r=e.filter(t=>t.position===i);return r.length===1?r[0]:r[i==="userFacing"?0:r.length-1]}if(a.getUserAgentInfo().getOS().name==="iOS"){let r=j(e,i);if(r)return r}return e.filter(r=>r.position===i).sort((r,t)=>r.label.localeCompare(t.label))[0]}function re(e,i){return a.isDesktopDevice()?R(e,i):z(e,i)}l.getMainCameraForPosition=re;function k(e,i){return e.unshift(e.splice(i,1)[0])}function ie(e,i){function a$1(t,o){let s=l.mainCameraForPositionOverridesOnDesktop.get(o);return s!=null&&t.includes(s)&&(t=t.filter(f=>f!==s),t.unshift(s)),t}let n=e.filter(t=>t.position==="userFacing"),r=e.filter(t=>t.position==="worldFacing");return a.isDesktopDevice()?(n=a$1(n,"userFacing"),r=a$1(r,"worldFacing")):e.every(t=>t.label==="")?r.reverse():(n.sort((t,o)=>t.label.localeCompare(o.label)),r.sort((t,o)=>t.label.localeCompare(o.label)),a.getUserAgentInfo().getOS().name==="iOS"&&(n.some((t,o)=>w(t.label)&&k(n,o)>=0),r.some((t,o)=>W(t.label)&&k(r,o)>=0),r.some((t,o)=>M(t.label)&&k(r,o)>=0)||r.some((t,o)=>E(t.label)&&k(r,o)>=0))),i==="userFacing"?[...n,...r]:[...r,...n]}l.sortCamerasForCameraPosition=ie;function _(e,i){let a=e.getVideoTracks();if(a.length>0){let n=a[0],r;typeof n.getSettings=="function"&&(r=n.getSettings(),r.facingMode!=null&&r.facingMode.length>0&&(i.position=r.facingMode==="environment"?"worldFacing":"userFacing"));let{label:t=""}=n;t.length>0&&(i.label=t);}}l.adjustCameraFromMediaStream=_;function H(e,i,a$1){if(l.deviceIdToCameraObjects.has(e.deviceId))return l.deviceIdToCameraObjects.get(e.deviceId);let{label:n="",deviceId:r}=e,t;return !a.isDesktopDevice()&&a$1.every(o=>o.label===""&&!l.deviceIdToCameraObjects.has(o.deviceId))?t=a$1.length===1||i+1<=Math.floor(a$1.length/2)?"userFacing":"worldFacing":t=B(n)?"worldFacing":"userFacing",{position:t,label:n,deviceId:r}}function V(e){let i=e.map((a,n,r)=>H(a,n,r)).map(a=>(a.deviceId!==""&&l.deviceIdToCameraObjects.set(a.deviceId,a),a)).filter(a=>!/\b(?:ir|infrared)\b/i.test(a.label)||/^IR UVC WebCam$/i.test(a.label.toUpperCase())).filter(a=>!p.has(a.label)).filter(a=>!l.inaccessibleDeviceIds.has(a.deviceId));if(!a.isDesktopDevice()&&i.length>1&&!i.some(a=>a.position==="worldFacing")){let a=i.length-1,n=i.map(r=>{let t=/\b(\d+)mp?\b/i.exec(r.label);return t!=null?Number.parseInt(t[1],10):Number.NaN});n.some(r=>Number.isNaN(r))||(a=n.lastIndexOf(Math.max(...n))),i[a].position="worldFacing";}return i}async function A(){if(d!=null&&d.length>0&&d.every(e=>e.label===""&&!l.deviceIdToCameraObjects.has(e.deviceId)))try{return await F()({video:!0,audio:!1})}catch(e){}}function G(e,i){var a,n;if(i.length>0&&e.length===i.length&&!i.every((r,t)=>e[t].deviceId===r.deviceId)){let r={};for(let[t,o]of e.entries()){let s=l.deviceIdToCameraObjects.get(o.deviceId);if(s==null||s.label!==((n=(a=i[t])==null?void 0:a.label)!=null?n:""))continue;let f=i[t].deviceId;r[s.deviceId]=f,l.inaccessibleDeviceIds.has(s.deviceId)&&l.inaccessibleDeviceIds.add(f),s.deviceId=f,l.deviceIdToCameraObjects.set(f,s);}a$2.log(a$2.Level.Debug,"Detected updated camera deviceId information and updated it accordingly",r);}}function Z(){typeof navigator.mediaDevices.addEventListener=="function"?navigator.mediaDevices.addEventListener("devicechange",S):navigator.mediaDevices.ondevicechange=S;}async function y(){let e,i=N();if(i)e=await i();else throw new a$1({fullSupport:!1,scannerSupport:!0,missingFeatures:["mediaDevices"]});return e.filter(a=>a.kind==="videoinput")}async function te(e=!1,i=!1){var r;let a$3=a.checkBrowserCompatibility();if(!a$3.fullSupport)throw new a$1(a$3);if(Z(),d==null||e||D){D=!1;let t,o=d!=null?d:[];d=[];try{d=await y(),i||(t=await A(),t!=null&&(d=await y())),a$2.log(a$2.Level.Debug,"Camera list (devices):",...d),d.length>0&&d.every(s=>s.deviceId==="")&&a$2.log(a$2.Level.Debug,"Incomplete camera information listed due to user permission denial, cameras will not be accessible"),G(o,d);}catch(s){throw I(s),s}finally{for(let s of (r=t==null?void 0:t.getVideoTracks())!=null?r:[])s.stop();}}let n=V(d);return a$2.log(a$2.Level.Debug,"Camera list (cameras): ",...n),[...n]}l.getCameras=te;async function Y(e){return a$2.log(a$2.Level.Debug,"Attempt to access camera (parameters):",e.video),new Promise((i,a)=>{window.setTimeout(()=>{let n=F()(e);if(n==null){a(new a$3({name:"AbortError",message:"Cannot get stream from getUserMedia function."}));return}i(n);},0);})}function X(e,i){let a={resizeMode:"none"};switch(e){case 0:return {...a,width:{min:2880,ideal:i==="fourToThree"?2880:3840,max:4096},height:{min:1800,ideal:2160,max:2400}};case 1:return {...a,width:{min:1440,ideal:i==="fourToThree"?1440:1920,max:2160},height:{min:900,ideal:1080,max:1440}};case 2:return {...a,width:{min:960,ideal:i==="fourToThree"?960:1280,max:1440},height:{min:480,ideal:720,max:960}};case 3:return {...a,width:{min:640,ideal:640,max:800},height:{min:360,ideal:i==="fourToThree"?480:360,max:640}};default:return {}}}l.getUserMediaVideoParameters=X;function $(e){e.deviceId!==""&&(a$2.log(a$2.Level.Debug,"Camera marked to be inaccessible:",e),l.inaccessibleDeviceIds.add(e.deviceId));}l.markCameraAsInaccessible=$;async function ne(e,i,a){a$2.log(a$2.Level.Debug,"Attempt to access camera (camera):",e);let n={audio:!1,video:X(i,a)};e.deviceId===""?n.video.facingMode={ideal:e.position==="worldFacing"?"environment":"user"}:n.video.deviceId={exact:e.deviceId};try{let r=await Y(n);return _(r,e),r}catch(r){throw I(r),["OverconstrainedError","NotReadableError","NotAllowedError"].includes(r.name)||$(e),r}}l.accessCameraStream=ne;})(U||(U={}));export{q as a,J as b,Q as c,U as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$6}from'./chunk-TCJPGGHY.js';import {b as b$1}from'./chunk-ULRY4SXF.js';import {b}from'./chunk-FTD535WI.js';import {a as a$1}from'./chunk-R6E4CT22.js';import {a}from'./chunk-JKL2W65E.js';import {d}from'./chunk-BIGR7VVJ.js';import {a as a$3}from'./chunk-XR65N6EG.js';import {a as a$4}from'./chunk-QCZSSQAQ.js';import {a as a$2}from'./chunk-MU4VAJIM.js';import {f,a as a$5,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$1(this.handleVideoResize.bind(this),500);this.videoTrackEndedListener=this.videoTrackEndedRecovery.bind(this);this.videoTrackMuteListener=this.videoTrackMuteRecovery.bind(this);this._synchronousFrameHandling=!1;this._glFrameReaders={GRAYSCALE:null,RGBA:null};this._frameReaderType="RGBA";this.isVideoStreamPaused=!1;this.cameraPosition="worldFacing",this.gui={isCameraRecoveryVisible:()=>!1,setCameraRecoveryVisible:()=>{}},this.isWebGLSupported=!a$2.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:!0}),this._canvas2dContext==null&&a$3.log(a$3.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$3.log(a$3.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:!1,antialias:!1}))!=null?e:this.canvas.getContext("experimental-webgl",{alpha:!1,antialias:!1});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$4(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$4(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 !1}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)===!0):!1}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$3.log(a$3.Level.Debug,"Camera reinitialization delayed");else {a$3.log(a$3.Level.Debug,"Reinitialize camera:",this.activeCamera);try{let e=this.activeCamera;await this.stopStream(),await this.initializeCameraWithSettings(e,this.activeCameraSettings);}catch(e){throw a$3.log(a$3.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))===!0){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))===!0&&(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)===!0){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=!1);})}pauseStream(){if(this.mediaStream){for(let e of this.mediaStream.getVideoTracks())e.enabled=!1;this.isVideoStreamPaused=!0,a$3.log(a$3.Level.Debug,"Paused camera video stream",this.mediaStream);}}resumeStream(){if(this.mediaStream){for(let e of this.mediaStream.getVideoTracks())e.enabled=!0;this.isVideoStreamPaused=!1,a$3.log(a$3.Level.Debug,"Resumed camera video stream",this.mediaStream);}}async stopStream(e=!1){this.activeCamera&&(this.activeCamera.currentResolution=void 0),this.activeCamera=void 0,this.torchEnabled=!1,this.isVideoStreamPaused=!1,this.mediaStream&&(a$3.log(a$3.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$3.log(a$3.Level.Debug,`Change frame reader type to ${this._frameReaderType} mode`));}async allowPictureInPicture(e){e?(this.videoElement.disablePictureInPicture=!1,this.videoElement.removeAttribute("controlslist"),this.videoElement.removeAttribute("disablepictureinpicture")):(this.videoElement.disablePictureInPicture=!0,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$5(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$3.log(a$3.Level.Warn,"Couldn't access camera:",i,r),i=t.shift();continue}throw r}throw new a$4(o.noCameraErrorParameters)}getFrameReaderOptions(e){return e?{minPoolCapacity:0,maxPoolCapacity:1}:a$2.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$6(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$3.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:!0}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$3.log(a$3.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$3.log(a$3.Level.Debug,"Camera video stream access failure (video data load timeout):",e),this.gui.setCameraRecoveryVisible(!0),i(r);},this.setCameraAccessTimeout();})}checkCameraVideoStreamAccessIfVisible(){document.visibilityState==="visible"&&(a$3.log(a$3.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$3.log(a$3.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$3.log(a$3.Level.Warn,"Camera video stream access failure (valid video metadata timeout):",e),window.clearInterval(this.videoMetadataCheckInterval),await this.stopStream(!0),i(new a$4(o.notReadableErrorParameters));return}return}window.clearInterval(this.videoMetadataCheckInterval),this.updateActiveCameraCurrentResolution(e),a$3.log(a$3.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$3.log(a$3.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$3.log(a$3.Level.Warn,"Camera video stream access failure (no camera with such type error)",e,i),i;a$3.log(a$3.Level.Warn,"Detected non-existent deviceId error, attempt to find and reaccess updated camera",e,i);let r=e.deviceId;if(await d.getCameras(!0),r===e.deviceId)throw a$3.log(a$3.Level.Warn,"Camera video stream access failure (updated camera not found after non-existent deviceId error)",e,i),d.markCameraAsInaccessible(e),i;return a$3.log(a$3.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$3.log(a$3.Level.Warn,"WebGL context has been lost, restoring..."),this._canvasWebGLContext=void 0,this.canvasWebGLContext?(this.handleVideoResize(),a$3.log(a$3.Level.Warn,"WebGL context restored")):a$3.log(a$3.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(!1),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$2.isIPhone()?this.initializeStreamForResolution(e,this.constraint):this.updateStreamForResolution(e,this.constraint)):await this.initializeStreamForResolution(e,this.constraint);}async initializeStreamForResolution(e,t,i=!1){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$3.log(a$3.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$3.log(a$3.Level.Debug,"Camera video stream access failure (invalid video metadata):",e),t===4)throw new a$4(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=!0){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(!0),(e=this.cameraAccessRejectCallback)==null||e.call(this,new a$4(o.notReadableErrorParameters))):(a$3.log(a$3.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(!1,!0),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$2.isDesktopDevice()&&(d.setMainCameraForPositionOverridesOnDesktop(this.cameraPosition,n),d.setMainCameraForPositionOverridesOnDesktop(n.position,n)),r.length===1||d.getMainCameraForPosition(r,this.cameraPosition)===n){a$3.log(a$3.Level.Debug,"Initial camera access was correct (main camera), keep camera:",n),this.setSelectedCamera(n),this.updateActiveCameraCurrentResolution(n),await this.recoverStreamIfNeeded();return}a$3.log(a$3.Level.Debug,"Initial camera access was incorrect (not main camera), change camera",{...i,deviceId:s});}else a$3.log(a$3.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=!0,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"))===!0),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(),!1));}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$3.log(a$3.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:!0});});let s=this.mediaStream.getVideoTracks()[0].getSettings();a$3.log(a$3.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$3.log(a$3.Level.Debug,'Detected video track "ended" event, try to reinitialize camera'),await this.reinitializeCamera();}catch(e){}else a$3.log(a$3.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$3.log(a$3.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$3.log(a$3.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:!1,willReadFrequently:!1});return r?(t.addEventListener("play",this.drawClippedFrame.bind(this,this.clipArea,t,r),{once:!0}),t.addEventListener("pause",this.cleanupClippedStream.bind(this,t),{once:!0}),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.MIRRORED_CLASS_NAME,o._instance=null;var L=o;export{k as a,F as b,P as c,L as d};
|
|
1
|
+
import {a as a$6}from'./chunk-TCJPGGHY.js';import {b as b$1}from'./chunk-ULRY4SXF.js';import {b}from'./chunk-FTD535WI.js';import {a as a$1}from'./chunk-R6E4CT22.js';import {a}from'./chunk-JKL2W65E.js';import {d}from'./chunk-7QNII4K3.js';import {a as a$3}from'./chunk-XR65N6EG.js';import {a as a$4}from'./chunk-QCZSSQAQ.js';import {a as a$2}from'./chunk-MU4VAJIM.js';import {f,a as a$5,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$1(this.handleVideoResize.bind(this),500);this.videoTrackEndedListener=this.videoTrackEndedRecovery.bind(this);this.videoTrackMuteListener=this.videoTrackMuteRecovery.bind(this);this._synchronousFrameHandling=!1;this._glFrameReaders={GRAYSCALE:null,RGBA:null};this._frameReaderType="RGBA";this.isVideoStreamPaused=!1;this.cameraPosition="worldFacing",this.gui={isCameraRecoveryVisible:()=>!1,setCameraRecoveryVisible:()=>{}},this.isWebGLSupported=!a$2.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:!0}),this._canvas2dContext==null&&a$3.log(a$3.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$3.log(a$3.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:!1,antialias:!1}))!=null?e:this.canvas.getContext("experimental-webgl",{alpha:!1,antialias:!1});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$4(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$4(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 !1}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)===!0):!1}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$3.log(a$3.Level.Debug,"Camera reinitialization delayed");else {a$3.log(a$3.Level.Debug,"Reinitialize camera:",this.activeCamera);try{let e=this.activeCamera;await this.stopStream(),await this.initializeCameraWithSettings(e,this.activeCameraSettings);}catch(e){throw a$3.log(a$3.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))===!0){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))===!0&&(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)===!0){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=!1);})}pauseStream(){if(this.mediaStream){for(let e of this.mediaStream.getVideoTracks())e.enabled=!1;this.isVideoStreamPaused=!0,a$3.log(a$3.Level.Debug,"Paused camera video stream",this.mediaStream);}}resumeStream(){if(this.mediaStream){for(let e of this.mediaStream.getVideoTracks())e.enabled=!0;this.isVideoStreamPaused=!1,a$3.log(a$3.Level.Debug,"Resumed camera video stream",this.mediaStream);}}async stopStream(e=!1){this.activeCamera&&(this.activeCamera.currentResolution=void 0),this.activeCamera=void 0,this.torchEnabled=!1,this.isVideoStreamPaused=!1,this.mediaStream&&(a$3.log(a$3.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$3.log(a$3.Level.Debug,`Change frame reader type to ${this._frameReaderType} mode`));}async allowPictureInPicture(e){e?(this.videoElement.disablePictureInPicture=!1,this.videoElement.removeAttribute("controlslist"),this.videoElement.removeAttribute("disablepictureinpicture")):(this.videoElement.disablePictureInPicture=!0,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$5(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$3.log(a$3.Level.Warn,"Couldn't access camera:",i,r),i=t.shift();continue}throw r}throw new a$4(o.noCameraErrorParameters)}getFrameReaderOptions(e){return e?{minPoolCapacity:0,maxPoolCapacity:1}:a$2.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$6(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$3.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:!0}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$3.log(a$3.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$3.log(a$3.Level.Debug,"Camera video stream access failure (video data load timeout):",e),this.gui.setCameraRecoveryVisible(!0),i(r);},this.setCameraAccessTimeout();})}checkCameraVideoStreamAccessIfVisible(){document.visibilityState==="visible"&&(a$3.log(a$3.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$3.log(a$3.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$3.log(a$3.Level.Warn,"Camera video stream access failure (valid video metadata timeout):",e),window.clearInterval(this.videoMetadataCheckInterval),await this.stopStream(!0),i(new a$4(o.notReadableErrorParameters));return}return}window.clearInterval(this.videoMetadataCheckInterval),this.updateActiveCameraCurrentResolution(e),a$3.log(a$3.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$3.log(a$3.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$3.log(a$3.Level.Warn,"Camera video stream access failure (no camera with such type error)",e,i),i;a$3.log(a$3.Level.Warn,"Detected non-existent deviceId error, attempt to find and reaccess updated camera",e,i);let r=e.deviceId;if(await d.getCameras(!0),r===e.deviceId)throw a$3.log(a$3.Level.Warn,"Camera video stream access failure (updated camera not found after non-existent deviceId error)",e,i),d.markCameraAsInaccessible(e),i;return a$3.log(a$3.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$3.log(a$3.Level.Warn,"WebGL context has been lost, restoring..."),this._canvasWebGLContext=void 0,this.canvasWebGLContext?(this.handleVideoResize(),a$3.log(a$3.Level.Warn,"WebGL context restored")):a$3.log(a$3.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(!1),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$2.isIPhone()?this.initializeStreamForResolution(e,this.constraint):this.updateStreamForResolution(e,this.constraint)):await this.initializeStreamForResolution(e,this.constraint);}async initializeStreamForResolution(e,t,i=!1){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$3.log(a$3.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$3.log(a$3.Level.Debug,"Camera video stream access failure (invalid video metadata):",e),t===4)throw new a$4(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=!0){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(!0),(e=this.cameraAccessRejectCallback)==null||e.call(this,new a$4(o.notReadableErrorParameters))):(a$3.log(a$3.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(!1,!0),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$2.isDesktopDevice()&&(d.setMainCameraForPositionOverridesOnDesktop(this.cameraPosition,n),d.setMainCameraForPositionOverridesOnDesktop(n.position,n)),r.length===1||d.getMainCameraForPosition(r,this.cameraPosition)===n){a$3.log(a$3.Level.Debug,"Initial camera access was correct (main camera), keep camera:",n),this.setSelectedCamera(n),this.updateActiveCameraCurrentResolution(n),await this.recoverStreamIfNeeded();return}a$3.log(a$3.Level.Debug,"Initial camera access was incorrect (not main camera), change camera",{...i,deviceId:s});}else a$3.log(a$3.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=!0,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"))===!0),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(),!1));}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$3.log(a$3.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:!0});});let s=this.mediaStream.getVideoTracks()[0].getSettings();a$3.log(a$3.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$3.log(a$3.Level.Debug,'Detected video track "ended" event, try to reinitialize camera'),await this.reinitializeCamera();}catch(e){}else a$3.log(a$3.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$3.log(a$3.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$3.log(a$3.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:!1,willReadFrequently:!1});return r?(t.addEventListener("play",this.drawClippedFrame.bind(this,this.clipArea,t,r),{once:!0}),t.addEventListener("pause",this.cleanupClippedStream.bind(this,t),{once:!0}),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.MIRRORED_CLASS_NAME,o._instance=null;var L=o;export{k as a,F as b,P as c,L as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$3}from'./chunk-
|
|
1
|
+
import {a as a$3}from'./chunk-FPCLZS52.js';import {a as a$2}from'./chunk-UUGROS73.js';import {e as e$1}from'./chunk-YKP6UYCY.js';import {a as a$1}from'./chunk-EV4OEANA.js';import {a as a$6}from'./chunk-3A4KLILV.js';import {a as a$4}from'./chunk-MU6SADSF.js';import {a as a$5}from'./chunk-LSZZVJ6B.js';var b=(i=>(i.DidShow="didshow",i.DidHide="didhide",i.WillShow="willshow",i))(b||{}),o="--text-size",s="--text-color",n="--text-alignment",a="--text-weight",r="--line-height",l="--background-color",c="--corner-radius",h="--max-lines",x="ease-in-out",e=class e extends a$1{constructor(){super();this.toast=null;this._hintStyle=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
2
|
<div class="toast">
|
|
3
3
|
<slot name="first-child"></slot>
|
|
4
4
|
<div class="left">
|