@scandit/web-datacapture-core 8.2.1 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/js/{Camera-DhGjpcjv.d.ts → Camera-Cc__1Nc-.d.ts} +3 -1
- package/build/js/Camera.d.ts +1 -1
- package/build/js/Camera.js +1 -1
- package/build/js/CameraRelated.d.ts +1 -1
- package/build/js/{DataCaptureContext-Dvdr7st4.d.ts → DataCaptureContext-BcSpF9Dt.d.ts} +43 -4
- package/build/js/DataCaptureContext.d.ts +4 -2
- package/build/js/DataCaptureContext.js +1 -1
- package/build/js/DataCaptureContextRelated.d.ts +5 -3
- package/build/js/DataCaptureVersion.js +1 -1
- package/build/js/DataCaptureView.d.ts +5 -3
- package/build/js/DataCaptureView.js +1 -1
- package/build/js/Feedback.js +1 -1
- package/build/js/FrameData.d.ts +4 -2
- package/build/js/ImageFrameSource.d.ts +1 -1
- package/build/js/ImageFrameSource.js +1 -1
- package/build/js/NotificationPresenter/index.d.ts +4 -2
- package/build/js/NotificationPresenter/private/ConcreteNotificationPresenter.d.ts +4 -2
- package/build/js/NotificationPresenter/private/presets.d.ts +4 -2
- package/build/js/ScanditIcon.js +1 -1
- package/build/js/ScanditIconBuilder.js +1 -1
- package/build/js/SingleImageUploader.d.ts +1 -1
- package/build/js/Sound.d.ts +4 -0
- package/build/js/Sound.js +1 -1
- package/build/js/Vibration.js +1 -1
- package/build/js/browserHelper.d.ts +10 -0
- package/build/js/browserHelper.js +1 -1
- package/build/js/chunks/chunk-22UMTZI6.js +1 -0
- package/build/js/chunks/{chunk-6JHZVRXK.js → chunk-2MK5Y4IL.js} +1 -1
- package/build/js/chunks/{chunk-UQVVJP5Z.js → chunk-2OCDIZIS.js} +1 -1
- package/build/js/chunks/{chunk-QFSNPY5Y.js → chunk-2SGKGZ6F.js} +1 -1
- package/build/js/chunks/{chunk-O7EM4VIM.js → chunk-33ZWDLU7.js} +1 -1
- package/build/js/chunks/chunk-6AQGNP4S.js +1 -0
- package/build/js/chunks/chunk-6IHWEHG3.js +1 -0
- package/build/js/chunks/{chunk-3MKSI2DV.js → chunk-6IM6NGGI.js} +1 -1
- package/build/js/chunks/{chunk-7HYFN4JO.js → chunk-A3ZT7PJA.js} +1 -1
- package/build/js/chunks/chunk-A5G2NHT2.js +1 -0
- package/build/js/chunks/chunk-AAPD5YU3.js +1 -0
- package/build/js/chunks/chunk-AKGGJKCA.js +35 -0
- package/build/js/chunks/{chunk-DGIQ3GF7.js → chunk-ARODHCN7.js} +1 -1
- package/build/js/chunks/{chunk-QUWP3ILW.js → chunk-BSX3V75N.js} +1 -1
- package/build/js/chunks/chunk-DZE2EYSZ.js +1 -0
- package/build/js/chunks/chunk-EEWGHHL4.js +1 -0
- package/build/js/chunks/{chunk-GLSB4QTY.js → chunk-EIOVYBFS.js} +1 -1
- package/build/js/chunks/chunk-EYBP3672.js +1 -0
- package/build/js/chunks/chunk-F3Y2X52X.js +1 -0
- package/build/js/chunks/{chunk-VSROWPI6.js → chunk-FCXZZH3O.js} +1 -1
- package/build/js/chunks/{chunk-O4HDBWKK.js → chunk-FMOB7R2T.js} +1 -1
- package/build/js/chunks/{chunk-U7ETOWGJ.js → chunk-GS7VZDY5.js} +1 -1
- package/build/js/chunks/chunk-HHA4HDG5.js +6 -0
- package/build/js/chunks/{chunk-QUBJJDLC.js → chunk-HILZP6OW.js} +1 -1
- package/build/js/chunks/{chunk-NXAYIU7F.js → chunk-IASACVTH.js} +1 -1
- package/build/js/chunks/{chunk-DTREAYZQ.js → chunk-KVRNF3VA.js} +1 -1
- package/build/js/chunks/{chunk-UERKPMRV.js → chunk-L66S4DN2.js} +1 -1
- package/build/js/chunks/chunk-LV6LGCDC.js +1 -0
- package/build/js/chunks/{chunk-YE2GYNRP.js → chunk-NMXQDQYI.js} +1 -1
- package/build/js/chunks/chunk-NYYGU4ZV.js +1 -0
- package/build/js/chunks/{chunk-BBOKPRKO.js → chunk-O5D4KVS5.js} +1 -1
- package/build/js/chunks/{chunk-I4F6XB6S.js → chunk-PDJEYYPX.js} +1 -1
- package/build/js/chunks/chunk-QHBYNYWX.js +1 -0
- package/build/js/chunks/chunk-QHNV2CFJ.js +1 -0
- package/build/js/chunks/{chunk-WVVNJRUA.js → chunk-QMLTR5JH.js} +1 -1
- package/build/js/chunks/chunk-QWKATH4N.js +1 -0
- package/build/js/chunks/{chunk-XYZYNUX3.js → chunk-RXDVYEE5.js} +1 -1
- package/build/js/chunks/chunk-RY2EW3RR.js +1 -0
- package/build/js/chunks/chunk-S2GRD6GO.js +1 -0
- package/build/js/chunks/chunk-SJIN27Q5.js +1 -0
- package/build/js/chunks/{chunk-RP4YFAF2.js → chunk-SSTFVERQ.js} +1 -1
- package/build/js/chunks/{chunk-7OFC24NE.js → chunk-SX5ZLP2O.js} +1 -1
- package/build/js/chunks/{chunk-V2OKMBZD.js → chunk-UJYGOVXB.js} +1 -1
- package/build/js/chunks/{chunk-HQKKXJJY.js → chunk-VWEJFI2M.js} +1 -1
- package/build/js/chunks/chunk-W3X3ZRQZ.js +1 -0
- package/build/js/chunks/{chunk-JCP7NQPV.js → chunk-WFKB322J.js} +1 -1
- package/build/js/chunks/{chunk-VJ7ZYB4V.js → chunk-WJOT37ST.js} +1 -1
- package/build/js/chunks/{chunk-NY2HBST4.js → chunk-X653DLOR.js} +1 -1
- package/build/js/chunks/chunk-Y3TODCJD.js +1 -0
- package/build/js/chunks/{chunk-QPR2YHD4.js → chunk-YJNJGCAN.js} +1 -1
- package/build/js/chunks/chunk-YONR3EGV.js +2 -0
- package/build/js/chunks/{chunk-6EEMWSEO.js → chunk-YP53ND2Q.js} +1 -1
- package/build/js/chunks/{chunk-NT5WI2PS.js → chunk-YUZDO2PC.js} +1 -1
- package/build/js/chunks/chunk-ZAXZRQYF.js +1 -0
- package/build/js/chunks/{chunk-5OF76LWH.js → chunk-ZCEA7BEH.js} +1 -1
- package/build/js/controls/CameraFOVSwitchControl.d.ts +4 -2
- package/build/js/controls/CameraFOVSwitchControl.js +1 -1
- package/build/js/controls/CameraSwitchControl.d.ts +4 -2
- package/build/js/controls/CameraSwitchControl.js +1 -1
- package/build/js/controls/TorchSwitchControl.d.ts +4 -2
- package/build/js/controls/TorchSwitchControl.js +1 -1
- package/build/js/controls/common.d.ts +4 -2
- package/build/js/controls/index.d.ts +4 -2
- package/build/js/controls/index.js +1 -1
- package/build/js/defaults/DefaultsCamera.d.ts +4 -2
- package/build/js/defaults/DefaultsCameraSettings.d.ts +1 -1
- package/build/js/defaults/DefaultsDataCaptureView.js +1 -1
- package/build/js/global.d.d.ts +1 -0
- package/build/js/index.d.ts +5 -3
- package/build/js/index.js +1 -1
- package/build/js/moduleLoader.d.ts +4 -2
- package/build/js/private/AdditionalLayerPosition.d.ts +6 -0
- package/build/js/private/AdditionalLayerPosition.js +1 -0
- package/build/js/private/BatteryInterface.d.ts +81 -0
- package/build/js/private/BatteryInterface.js +1 -0
- package/build/js/private/CameraAccess.d.ts +1 -1
- package/build/js/private/CameraAccess.js +1 -1
- package/build/js/private/CameraManager.d.ts +5 -3
- package/build/js/private/CameraManager.js +1 -1
- package/build/js/private/CameraPool.d.ts +5 -2
- package/build/js/private/CameraPool.js +1 -1
- package/build/js/private/CanvasDrawerWithMetrics.d.ts +4 -2
- package/build/js/private/CoreModuleLicenseTextProvider.d.ts +4 -2
- package/build/js/private/CoreModuleLicenseTextProvider.js +1 -1
- package/build/js/private/CustomLocationsView.js +1 -1
- package/build/js/private/DataCaptureContextRelated.d.ts +4 -2
- package/build/js/private/FrameReaders/FrameReader.d.ts +4 -2
- package/build/js/private/FrameReaders/FrameReader.js +1 -1
- package/build/js/private/FrameReaders/FrameReaderAbstract.d.ts +4 -2
- package/build/js/private/FrameReaders/GrayScaleFrameReader.d.ts +4 -2
- package/build/js/private/FrameReaders/GrayScaleFrameReader.js +1 -1
- package/build/js/private/FrameReaders/index.d.ts +4 -2
- package/build/js/private/FrameReaders/index.js +1 -1
- package/build/js/private/NormalizedModuleLoaderOptions.d.ts +4 -2
- package/build/js/private/OrientationObserver.js +1 -1
- package/build/js/private/SingleImageUploaderView.d.ts +4 -2
- package/build/js/private/SingleImageUploaderView.js +1 -1
- package/build/js/private/ViewControls+related.js +1 -1
- package/build/js/private/ViewControls_related.d.ts +4 -2
- package/build/js/private/ViewStyles.js +1 -1
- package/build/js/private/ViewsRegistry.d.ts +4 -2
- package/build/js/private/customHowler/AudioCache.d.ts +37 -0
- package/build/js/private/customHowler/AudioCache.js +1 -0
- package/build/js/private/customHowler/Howl.d.ts +189 -0
- package/build/js/private/customHowler/Howl.js +1 -0
- package/build/js/private/customHowler/HowlRegistry.d.ts +18 -0
- package/build/js/private/customHowler/HowlRegistry.js +1 -0
- package/build/js/private/customHowler/Html5Sound.d.ts +52 -0
- package/build/js/private/customHowler/Html5Sound.js +1 -0
- package/build/js/private/customHowler/UnlockManager.d.ts +39 -0
- package/build/js/private/customHowler/UnlockManager.js +1 -0
- package/build/js/private/customHowler/WebAudioContextManager.d.ts +161 -0
- package/build/js/private/customHowler/WebAudioContextManager.js +1 -0
- package/build/js/private/customHowler/debug.d.ts +28 -0
- package/build/js/private/customHowler/debug.js +1 -0
- package/build/js/private/customHowler/index.d.ts +2 -0
- package/build/js/private/customHowler/index.js +1 -0
- package/build/js/private/customHowler/setup.d.ts +55 -0
- package/build/js/private/customHowler/setup.js +1 -0
- package/build/js/private/hybridDesktopPlatformHelpers.js +1 -1
- package/build/js/private/ui/atoms/AimerSvgIcon.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/Backdrop.js +1 -1
- package/build/js/private/ui/atoms/CalendarExclamationMarkSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/CameraFOVUltrawideSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/CameraFOVWideSvgIcon.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/Card.js +1 -1
- package/build/js/private/ui/atoms/CardList.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/DeleteSvgIcon.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/KeyboardSvgIcon.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/PauseSvgIcon.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/RestartSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/RoundedCheckSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/RoundedCrossSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/RoundedExclamationMarkSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/ScanSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/ShutterButton.js +1 -1
- package/build/js/private/ui/atoms/SlashSvgIcon.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.d.ts +4 -2
- package/build/js/private/ui/atoms/Toast.js +1 -1
- package/build/js/private/ui/atoms/TorchOffSvgIcon.js +1 -1
- package/build/js/private/ui/atoms/TorchOnSvgIcon.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/CameraFOVSwitchButton.js +1 -1
- package/build/js/private/ui/molecules/CameraSwitchButton.js +1 -1
- package/build/js/private/ui/molecules/ControlsLayout.js +1 -1
- package/build/js/private/ui/molecules/HintPresenter.d.ts +4 -2
- package/build/js/private/ui/molecules/HintPresenter.js +1 -1
- package/build/js/private/ui/molecules/LoadingOverlay.js +1 -1
- package/build/js/private/ui/molecules/TorchSwitchIconButton.d.ts +1 -1
- package/build/js/private/ui/molecules/TorchSwitchIconButton.js +1 -1
- package/build/js/private/utils/index.js +1 -1
- package/build/js/private/utils/polyfillLoader.js +1 -1
- package/build/js/private/utils/replaceImagesInViewUtils.d.ts +4 -2
- package/build/js/private/utils/warnMultithreadingUnavailable.js +1 -1
- package/build/js/worker/ImageConverterForwarder.d.ts +4 -2
- package/build/js/worker/ViewInfoHelper.d.ts +4 -2
- package/build/js/worker/WorkerMain.d.ts +4 -2
- package/build/js/worker/WorkerMain.js +1 -1
- package/build/js/worker/coreCapture.inlineWorker.d.ts +4 -2
- package/build/js/worker/coreCapture.inlineWorker.js +1 -1
- package/build/js/worker/dataCaptureEngine.d.ts +4 -2
- package/build/js/worker/dataCaptureEngine.js +1 -1
- package/build/js/worker/dataCaptureLoader.d.ts +4 -2
- package/build/js/worker/dataCaptureLoader.js +1 -1
- package/build/js/worker/dataCaptureWorkerRelated.d.ts +4 -2
- package/build/js/worker/dataCaptureWorkerRelated.js +1 -1
- package/build/js/worker/index.d.ts +4 -2
- package/build/js/worker/index.js +1 -1
- package/package.json +6 -6
- package/build/js/chunks/chunk-4J3Y5IIL.js +0 -1
- package/build/js/chunks/chunk-A225YZFY.js +0 -2
- package/build/js/chunks/chunk-IBDUCVB4.js +0 -1
- package/build/js/chunks/chunk-LH2NI5UL.js +0 -2
- package/build/js/chunks/chunk-Q5WJX5JB.js +0 -1
- package/build/js/chunks/chunk-RVAHEVSC.js +0 -1
- package/build/js/chunks/chunk-SYGWA3T6.js +0 -35
- package/build/js/chunks/chunk-TR5HATUD.js +0 -1
- package/build/js/chunks/chunk-TTMLHWYT.js +0 -6
- package/build/js/chunks/chunk-UOQFOEG6.js +0 -1
- package/build/js/chunks/chunk-VQYVIA64.js +0 -1
- package/build/js/chunks/chunk-ZDROGZFO.js +0 -1
- /package/build/js/chunks/{chunk-TU2LKPHV.js → chunk-YRQQE3NR.js} +0 -0
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a as a$2}from'./chunk-KXAJHLEO.js';import {a as a$3}from'./chunk-AAEQZ45T.js';import {c,d,b as b$1,a as a$1,e}from'./chunk-SBC5K7IT.js';import {a,b}from'./chunk-TR3NGINC.js';var Ae=a((J,le)=>{(function(O,w){var be="1.0.40",V="",_="?",q="function",M="undefined",Q="object",K="string",ee="major",i="model",t="name",e="type",o="vendor",n="version",A="architecture",W="console",b="mobile",u="tablet",k="smarttv",E="wearable",ie="embedded",Y=500,z="Amazon",I="Apple",ce="ASUS",ue="BlackBerry",F="Browser",X="Chrome",pe="Edge",G="Firefox",j="Google",$="Huawei",a="LG",s="Microsoft",r="Motorola",d="Opera",g="Samsung",h="Sharp",x="Sony",y="Xiaomi",B="Zebra",oe="Facebook",P="Chromium OS",L="Mac OS",te=" Browser",ne=function(p,m){var c={};for(var v in p)m[v]&&m[v].length%2===0?c[v]=m[v].concat(p[v]):c[v]=p[v];return c},N=function(p){for(var m={},c=0;c<p.length;c++)m[p[c].toUpperCase()]=p[c];return m},D=function(p,m){return typeof p===K?R(m).indexOf(R(p))!==-1:false},R=function(p){return p.toLowerCase()},re=function(p){return typeof p===K?p.replace(/[^\d\.]/g,V).split(".")[0]:w},we=function(p,m){if(typeof p===K)return p=p.replace(/^\s\s*/,V),typeof m===M?p:p.substring(0,Y)},Z=function(p,m){for(var c=0,v,U,C,f,l,T;c<m.length&&!l;){var de=m[c],ge=m[c+1];for(v=U=0;v<de.length&&!l&&de[v];)if(l=de[v++].exec(p),l)for(C=0;C<ge.length;C++)T=l[++U],f=ge[C],typeof f===Q&&f.length>0?f.length===2?typeof f[1]==q?this[f[0]]=f[1].call(this,T):this[f[0]]=f[1]:f.length===3?typeof f[1]===q&&!(f[1].exec&&f[1].test)?this[f[0]]=T?f[1].call(this,T,f[2]):w:this[f[0]]=T?T.replace(f[1],f[2]):w:f.length===4&&(this[f[0]]=T?f[3].call(this,T.replace(f[1],f[2])):w):this[f]=T||w;c+=2;}},ae=function(p,m){for(var c in m)if(typeof m[c]===Q&&m[c].length>0){for(var v=0;v<m[c].length;v++)if(D(m[c][v],p))return c===_?w:c}else if(D(m[c],p))return c===_?w:c;return m.hasOwnProperty("*")?m["*"]:p},Te={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},me={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},fe={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[n,[t,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[n,[t,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[t,n],[/opios[\/ ]+([\w\.]+)/i],[n,[t,d+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[n,[t,d+" GX"]],[/\bopr\/([\w\.]+)/i],[n,[t,d]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[n,[t,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[n,[t,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[t,n],[/quark(?:pc)?\/([-\w\.]+)/i],[n,[t,"Quark"]],[/\bddg\/([\w\.]+)/i],[n,[t,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[n,[t,"UC"+F]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[n,[t,"WeChat"]],[/konqueror\/([\w\.]+)/i],[n,[t,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[n,[t,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[n,[t,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[n,[t,"Smart Lenovo "+F]],[/(avast|avg)\/([\w\.]+)/i],[[t,/(.+)/,"$1 Secure "+F],n],[/\bfocus\/([\w\.]+)/i],[n,[t,G+" Focus"]],[/\bopt\/([\w\.]+)/i],[n,[t,d+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[n,[t,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[n,[t,"Dolphin"]],[/coast\/([\w\.]+)/i],[n,[t,d+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[n,[t,"MIUI"+te]],[/fxios\/([\w\.-]+)/i],[n,[t,G]],[/\bqihoobrowser\/?([\w\.]*)/i],[n,[t,"360"]],[/\b(qq)\/([\w\.]+)/i],[[t,/(.+)/,"$1Browser"],n],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[t,/(.+)/,"$1"+te],n],[/samsungbrowser\/([\w\.]+)/i],[n,[t,g+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[n,[t,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[t,"Sogou Mobile"],n],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[t,n],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[t],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[n,t],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[t,oe],n],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[t,n],[/\bgsa\/([\w\.]+) .*safari\//i],[n,[t,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[n,[t,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[n,[t,X+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[t,X+" WebView"],n],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[n,[t,"Android "+F]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[t,n],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[n,[t,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[n,t],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[t,[n,ae,Te]],[/(webkit|khtml)\/([\w\.]+)/i],[t,n],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[t,"Netscape"],n],[/(wolvic|librewolf)\/([\w\.]+)/i],[t,n],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[n,[t,G+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[t,[n,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[t,[n,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[A,"amd64"]],[/(ia32(?=;))/i],[[A,R]],[/((?:i[346]|x)86)[;\)]/i],[[A,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[A,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[A,"armhf"]],[/windows (ce|mobile); ppc;/i],[[A,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[A,/ower/,V,R]],[/(sun4\w)[;\)]/i],[[A,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[A,R]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[i,[o,g],[e,u]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[i,[o,g],[e,b]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[i,[o,I],[e,b]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[i,[o,I],[e,u]],[/(macintosh);/i],[i,[o,I]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[i,[o,h],[e,b]],[/(?:honor)([-\w ]+)[;\)]/i],[i,[o,"Honor"],[e,b]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[i,[o,$],[e,u]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[i,[o,$],[e,b]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[i,/_/g," "],[o,y],[e,b]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[i,/_/g," "],[o,y],[e,u]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[i,[o,"OPPO"],[e,b]],[/\b(opd2\d{3}a?) bui/i],[i,[o,"OPPO"],[e,u]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[i,[o,"Vivo"],[e,b]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[i,[o,"Realme"],[e,b]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[i,[o,r],[e,b]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[i,[o,r],[e,u]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[i,[o,a],[e,u]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[i,[o,a],[e,b]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[i,[o,"Lenovo"],[e,u]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[i,/_/g," "],[o,"Nokia"],[e,b]],[/(pixel c)\b/i],[i,[o,j],[e,u]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[i,[o,j],[e,b]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[i,[o,x],[e,b]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[i,"Xperia Tablet"],[o,x],[e,u]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[i,[o,"OnePlus"],[e,b]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[i,[o,z],[e,u]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[i,/(.+)/g,"Fire Phone $1"],[o,z],[e,b]],[/(playbook);[-\w\),; ]+(rim)/i],[i,o,[e,u]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[i,[o,ue],[e,b]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[i,[o,ce],[e,u]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[i,[o,ce],[e,b]],[/(nexus 9)/i],[i,[o,"HTC"],[e,u]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[o,[i,/_/g," "],[e,b]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[i,[o,"TCL"],[e,u]],[/(itel) ((\w+))/i],[[o,R],i,[e,ae,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[i,[o,"Acer"],[e,u]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[i,[o,"Meizu"],[e,b]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[i,[o,"Ulefone"],[e,b]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[i,[o,"Energizer"],[e,b]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[i,[o,"Cat"],[e,b]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[i,[o,"Smartfren"],[e,b]],[/droid.+; (a(?:015|06[35]|142p?))/i],[i,[o,"Nothing"],[e,b]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[o,i,[e,b]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[o,i,[e,u]],[/(surface duo)/i],[i,[o,s],[e,u]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[i,[o,"Fairphone"],[e,b]],[/(u304aa)/i],[i,[o,"AT&T"],[e,b]],[/\bsie-(\w*)/i],[i,[o,"Siemens"],[e,b]],[/\b(rct\w+) b/i],[i,[o,"RCA"],[e,u]],[/\b(venue[\d ]{2,7}) b/i],[i,[o,"Dell"],[e,u]],[/\b(q(?:mv|ta)\w+) b/i],[i,[o,"Verizon"],[e,u]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[i,[o,"Barnes & Noble"],[e,u]],[/\b(tm\d{3}\w+) b/i],[i,[o,"NuVision"],[e,u]],[/\b(k88) b/i],[i,[o,"ZTE"],[e,u]],[/\b(nx\d{3}j) b/i],[i,[o,"ZTE"],[e,b]],[/\b(gen\d{3}) b.+49h/i],[i,[o,"Swiss"],[e,b]],[/\b(zur\d{3}) b/i],[i,[o,"Swiss"],[e,u]],[/\b((zeki)?tb.*\b) b/i],[i,[o,"Zeki"],[e,u]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[o,"Dragon Touch"],i,[e,u]],[/\b(ns-?\w{0,9}) b/i],[i,[o,"Insignia"],[e,u]],[/\b((nxa|next)-?\w{0,9}) b/i],[i,[o,"NextBook"],[e,u]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[o,"Voice"],i,[e,b]],[/\b(lvtel\-)?(v1[12]) b/i],[[o,"LvTel"],i,[e,b]],[/\b(ph-1) /i],[i,[o,"Essential"],[e,b]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[i,[o,"Envizen"],[e,u]],[/\b(trio[-\w\. ]+) b/i],[i,[o,"MachSpeed"],[e,u]],[/\btu_(1491) b/i],[i,[o,"Rotor"],[e,u]],[/(shield[\w ]+) b/i],[i,[o,"Nvidia"],[e,u]],[/(sprint) (\w+)/i],[o,i,[e,b]],[/(kin\.[onetw]{3})/i],[[i,/\./g," "],[o,s],[e,b]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[i,[o,B],[e,u]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[i,[o,B],[e,b]],[/smart-tv.+(samsung)/i],[o,[e,k]],[/hbbtv.+maple;(\d+)/i],[[i,/^/,"SmartTV"],[o,g],[e,k]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[o,a],[e,k]],[/(apple) ?tv/i],[o,[i,I+" TV"],[e,k]],[/crkey/i],[[i,X+"cast"],[o,j],[e,k]],[/droid.+aft(\w+)( bui|\))/i],[i,[o,z],[e,k]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[i,[o,h],[e,k]],[/(bravia[\w ]+)( bui|\))/i],[i,[o,x],[e,k]],[/(mitv-\w{5}) bui/i],[i,[o,y],[e,k]],[/Hbbtv.*(technisat) (.*);/i],[o,i,[e,k]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[o,we],[i,we],[e,k]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[e,k]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[o,i,[e,W]],[/droid.+; (shield) bui/i],[i,[o,"Nvidia"],[e,W]],[/(playstation [345portablevi]+)/i],[i,[o,x],[e,W]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[i,[o,s],[e,W]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[i,[o,g],[e,E]],[/((pebble))app/i],[o,i,[e,E]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[i,[o,I],[e,E]],[/droid.+; (glass) \d/i],[i,[o,j],[e,E]],[/droid.+; (wt63?0{2,3})\)/i],[i,[o,B],[e,E]],[/droid.+; (glass) \d/i],[i,[o,j],[e,E]],[/(pico) (4|neo3(?: link|pro)?)/i],[o,i,[e,E]],[/; (quest( \d| pro)?)/i],[i,[o,oe],[e,E]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[o,[e,ie]],[/(aeobc)\b/i],[i,[o,z],[e,ie]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[i,[e,b]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[i,[e,u]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[e,u]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[e,b]],[/(android[-\w\. ]{0,9});.+buil/i],[i,[o,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[n,[t,pe+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[t,n],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[n,[t,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[t,n],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[n,t]],os:[[/microsoft (windows) (vista|xp)/i],[t,n],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[t,[n,ae,me]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[n,ae,me],[t,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[n,/_/g,"."],[t,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[t,L],[n,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[n,t],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[t,n],[/\(bb(10);/i],[n,[t,ue]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[n,[t,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[n,[t,G+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[n,[t,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[n,[t,"watchOS"]],[/crkey\/([\d\.]+)/i],[n,[t,X+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[t,P],n],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[t,n],[/(sunos) ?([\w\.\d]*)/i],[[t,"Solaris"],n],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[t,n]]},S=function(p,m){if(typeof p===Q&&(m=p,p=w),!(this instanceof S))return new S(p,m).getResult();var c=typeof O!==M&&O.navigator?O.navigator:w,v=p||(c&&c.userAgent?c.userAgent:V),U=c&&c.userAgentData?c.userAgentData:w,C=m?ne(fe,m):fe,f=c&&c.userAgent==v;return this.getBrowser=function(){var l={};return l[t]=w,l[n]=w,Z.call(l,v,C.browser),l[ee]=re(l[n]),f&&c&&c.brave&&typeof c.brave.isBrave==q&&(l[t]="Brave"),l},this.getCPU=function(){var l={};return l[A]=w,Z.call(l,v,C.cpu),l},this.getDevice=function(){var l={};return l[o]=w,l[i]=w,l[e]=w,Z.call(l,v,C.device),f&&!l[e]&&U&&U.mobile&&(l[e]=b),f&&l[i]=="Macintosh"&&c&&typeof c.standalone!==M&&c.maxTouchPoints&&c.maxTouchPoints>2&&(l[i]="iPad",l[e]=u),l},this.getEngine=function(){var l={};return l[t]=w,l[n]=w,Z.call(l,v,C.engine),l},this.getOS=function(){var l={};return l[t]=w,l[n]=w,Z.call(l,v,C.os),f&&!l[t]&&U&&U.platform&&U.platform!="Unknown"&&(l[t]=U.platform.replace(/chrome os/i,P).replace(/macos/i,L)),l},this.getResult=function(){return {ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return v},this.setUA=function(l){return v=typeof l===K&&l.length>Y?we(l,Y):l,this},this.setUA(v),this};S.VERSION=be,S.BROWSER=N([t,n,ee]),S.CPU=N([A]),S.DEVICE=N([i,o,e,W,b,k,u,E,ie]),S.ENGINE=S.OS=N([t,n]),typeof J!==M?(typeof le!==M&&le.exports&&(J=le.exports=S),J.UAParser=S):typeof define===q&&define.amd?define(function(){return S}):typeof O!==M&&(O.UAParser=S);var H=typeof O!==M&&(O.jQuery||O.Zepto);if(H&&!H.ua){var se=new S;H.ua=se.getResult(),H.ua.get=function(){return se.getUA()},H.ua.set=function(p){se.setUA(p);var m=se.getResult();for(var c in m)H.ua[c]=m[c];};}})(typeof window=="object"?window:J);});var Ce=b(Ae(),1);var Re=(_=>(_.Standalone="standalone",_.Fullscreen="fullscreen",_.MinimalUI="minimal-ui",_.Browser="browser",_))(Re||{}),Ee;($=>{let O;function w(){return O==null&&(O=new Ce.default(navigator.userAgent)),O}$.getUserAgentInfo=w;function be(){var r;if("orientation"in window)return false;let a="(any-pointer: coarse)",s=(r=window.matchMedia)==null?void 0:r.call(window,a);return navigator.maxTouchPoints===0||(s==null?void 0:s.media)===a&&!(s!=null&&s.matches)}$.isDesktopDevice=be;function V(){return w().getDevice().model==="iPhone"}$.isIPhone=V;function _(){var h,x,y,B;let a=w(),s=(x=(h=a.getOS().name)==null?void 0:h.toLowerCase())!=null?x:"",r=a.getDevice(),d=(B=(y=r.model)==null?void 0:y.toLowerCase())!=null?B:"",g=r.type;return s.includes("ios")&&(g==="tablet"||d.includes("ipad"))}$.isIPad=_;function q(){var g,h,x,y;let a=(h=(g=w().getOS().name)==null?void 0:g.toLowerCase())!=null?h:"",s=w().getDevice(),r=s.type,d=(y=(x=s.model)==null?void 0:x.toLowerCase())!=null?y:"";return a.includes("mac")&&(r==="laptop"||d.includes("macintosh"))}$.isMacBook=q;function M(){return V()||_()||q()}$.isAppleDevice=M;function Q(){let a=w().getOS();return a.name==="iOS"&&a.version!=null&&a.version.localeCompare("16.3",void 0,{numeric:true})>=0}$.isIOSDeviceWithExtendedCameraAccess=Q;function K(){return "document"in window?window.document.createElement("canvas"):null}$.getCanvas=K;function ee(a){return a.name==="iOS"&&a.version!=null&&["11.2.2","11.2.5","11.2.6"].includes(a.version)}async function i(){return c()}$.hasSIMDSupport=i;async function t(){return d()}$.hasThreadsSupport=t;function e$1(a,s,r){let d=a[s[0]];return d==null?false:s.length===1?typeof d===r:(typeof d=="function"||typeof d=="object")&&e$1(d,s.slice(1),r)}function o(){var h;let a=true,s=null,r=null,d=null,g=null;try{if(s=$.getCanvas(),r=$.getCanvas(),d=s==null?void 0:s.getContext("webgl"),g=r==null?void 0:r.getContext("experimental-webgl"),!e$1(window,["WebGLRenderingContext"],"function")||d==null&&g==null)throw new Error("WebGLRenderingContext is not supported")}catch{a=false;}finally{for(let x of [d,g])typeof(x==null?void 0:x.getExtension)=="function"&&((h=x.getExtension("WEBGL_lose_context"))==null||h.loseContext());d=null,g=null,s=null,r=null;}return a}function n(){let a=true,s=true,r=new Set;location.protocol.startsWith("http")||r.add("httpProtocol"),e$1(window,["isSecureContext"],"boolean")&&!window.isSecureContext&&r.add("secureContext"),!e$1(navigator,["mediaDevices","getUserMedia"],"function")&&!e$1(navigator,["enumerateDevices"],"function")&&!e$1(window,["MediaStreamTrack","getSources"],"function")&&(r.add("mediaDevices"),a=false),e$1(window,["Worker"],"function")||(r.add("webWorkers"),a=false,s=false),e$1(window,["WebAssembly"],"object")||(r.add("webAssembly"),a=false,s=false),e$1(window,["Blob"],"function")||(r.add("blob"),a=false,s=false),e$1(window,["URL","createObjectURL"],"function")||(r.add("urlObject"),a=false,s=false),e$1(window,["OffscreenCanvas"],"function")||r.add("offscreenCanvas"),o()||r.add("webGL");let d=w().getOS();return ee(d)&&(r.add("webAssemblyErrorFree"),a=false,s=false),b$1()||r.add("sharedArrayBuffer"),a$1()||r.add("crossOriginIsolated"),F()||r.add("animationApi"),{fullSupport:a,scannerSupport:s,missingFeatures:[...r]}}$.checkBrowserCompatibility=n;async function A(){return e()}$.checkMultithreadingSupport=A;async function W(){let a="scandit-device-id",s=a$2.getInstanceFor("localStorage"),r=s.getItem(a);if(r!=null&&r!=="")return r;let g=await a$3().get(a);if(r=g==null?void 0:g.value,r!=null&&r!=="")return s.setItem(a,r),r;let h=new Uint8Array(20);return crypto.getRandomValues(h),r=[...h].map(x=>{let y=x.toString(16);return y.length===1?`0${y}`:y}).join(""),s.setItem(a,r),r}$.getDeviceId=W;function b(a){return a instanceof HTMLElement||a!=null&&typeof a=="object"&&typeof a.tagName=="string"}$.isValidHTMLElement=b;function u(){var d,g;let a=w().getOS();if(a.name!=="iOS")return true;let[s,r]=(g=(d=a.version)==null?void 0:d.split(".").map(Number))!=null?g:[];return s>14||s===14&&r>=6}$.isSupportedIOSVersion=u;function k(){var a,s;return (s=(a=w().getBrowser().name)==null?void 0:a.toLowerCase().includes("safari"))!=null?s:false}$.isSafari=k;function E(){var s,r;return /iphone|ipod|ipad/.test((r=(s=w().getDevice().model)==null?void 0:s.toLowerCase())!=null?r:"")&&!k()}$.isIosWebView=E;async function ie(){var s;return ((s=w().getOS().name)==null?void 0:s.toLowerCase())!=="android"?false:w().getUA().includes("wv")?true:[...(await fetch(document.location.toString(),{method:"HEAD"})).headers].some(([r])=>r.toLowerCase()==="x-requested-with")}$.isAndroidWebView=ie;function Y(){return w().getOS().name==="Windows"}$.isWindows=Y;function z(){return w().getBrowser().name==="Firefox"}$.isFirefox=z;function I(){if("navigator"in globalThis){for(let a of ["vibrate","webkitVibrate","msVibrate","mozVibrate"])if(typeof navigator[a]=="function")return navigator[a]}}$.getSupportedVibrationMethod=I;function ce(){return I()!=null&&!be()&&!Y()&&!z()}$.isVibrationAvailable=ce;function ue(){return w().getOS().name==="iOS"}$.isIOS=ue;function F(){return typeof globalThis.Animation<"u"&&typeof globalThis.KeyframeEffect<"u"&&typeof globalThis.Element.prototype.animate<"u"}$.isAnimationApiSupported=F;function X(){return "virtualKeyboard"in navigator}$.hasVirtualKeyboardSupport=X;function pe(a){var d;let s=`(display-mode: ${a})`,r=(d=globalThis.matchMedia)==null?void 0:d.call(globalThis,s);return (r==null?void 0:r.matches)===true?true:a==="standalone"&&typeof navigator=="object"&&"standalone"in navigator&&typeof navigator.standalone=="boolean"?navigator.standalone===true:false}$.isPwaDisplayMode=pe;function G(a,s,r){let d=P=>P.split(".").map(L=>Number.parseInt(L,10)||0),g=d(a),h=d(s),x=d(r),y=(P,L)=>{var ne,N;let te=Math.max(P.length,L.length);for(let D=0;D<te;D++){let R=(ne=P[D])!=null?ne:0,re=(N=L[D])!=null?N:0;if(R>re)return 1;if(R<re)return -1}return 0},B=y(g,h)>=0,oe=y(g,x)<0;return B&&oe}function j(){let s="26.3";if(M()){let r=w(),d=r.getOS(),g=r.getBrowser(),h=k()?g.version:d.version;return h?G(h,"26",s):false}return false}$.isFixedMemoryRequired=j;})(Ee||(Ee={}));
|
|
2
|
-
export{Re as a,Ee as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-LFJUGRQV.js';import {a as a$1}from'./chunk-XR65N6EG.js';var p=class{constructor(){this.cameraPool=new Set;}getOrCreate(a$1){var e;let{position:l,deviceId:n,label:s}=a$1,c=(e=a$1._isBestGuess)!=null?e:false;if(this.cameraPool.size===0)return this.push(a$1);let o=this.allCamerasNoDeviceId(),i=Array.from(this.cameraPool);if(n){let t=i.find(r=>r.deviceId===n);if(t)return t;if(o){let r=i.find(h=>h.position===l);if(r)return r[a].setDeviceId(n),r[a].setLabel(s),r}}if(c){let t=i.find(r=>r._isBestGuess);if(t)return t}if(o&&!n){let t=i.find(r=>r.position===l);if(t)return t}return this.push(a$1)}integrateIncomingVideoDevices(a$2){let l=Array.from(this.cameraPool),n=new Set,s=[...a$2].reverse();for(let o=s.length-1;o>=0;o--){let i=s[o];if(!i.deviceId)continue;let e=l.find(t=>t.deviceId===i.deviceId&&!n.has(t));e&&(e[a].setLabel(i.label),e.position=i.position,n.add(e),s.splice(o,1),this.debugLog("Updated pool camera by deviceId",{deviceId:e.deviceId,label:e.label,position:e.position}));}for(let o=s.length-1;o>=0;o--){let i=s[o],e=l.find(t=>t.position===i.position&&!n.has(t));e&&(e[a].setDeviceId(i.deviceId),e[a].setLabel(i.label),n.add(e),s.splice(o,1),this.debugLog("Updated pool camera by position",{deviceId:e.deviceId,label:e.label,position:e.position}));}if(s.length>0){let o=l.filter(i=>!n.has(i));if(o.length>0){for(let i=0;i<Math.min(s.length,o.length);i++){let e=o[i],t=s[i];e[a].setDeviceId(t.deviceId),e[a].setLabel(t.label),e.position=t.position,n.add(e),this.debugLog("Force updated pool camera",{deviceId:e.deviceId,label:e.label,position:e.position});}s.splice(0,Math.min(s.length,o.length));}for(let i of s)this.cameraPool.add(i),this.debugLog("Added new camera to pool",{deviceId:i.deviceId,label:i.label,position:i.position});}let c=l.filter(o=>!n.has(o));if(c.length>0){a$1.warn("Some cameras were created but could not be mapped to cameras found on the device. This happens when you create more Cameras than it exists. These cameras will not be accessible.");for(let o of c)a$1.warn("Removing non-updated camera:",{deviceId:o.deviceId,label:o.label,position:o.position}),o[a].markAsUnmappedToDeviceCameras(),this.cameraPool.delete(o);}this.debugLog("Camera pool state after reconciliation:"),this.logPool();}allCamerasNoDeviceId(){return Array.from(this.cameraPool).every(a=>a.deviceId==="")}get(){return Array.from(this.cameraPool)}push(a){return this.debugLog("adding camera to pool",JSON.stringify({deviceId:a.deviceId,position:a.position,label:a.label})),this.cameraPool.add(a),a}debugLog(...a){}logPool(){}dumpAsSimpleObjects(){return [...this.cameraPool].map(a=>({deviceId:a.deviceId,label:a.label,position:a.position}))}},v={[a]:{CameraPool:p}};var u=new p;export{v as a,u as b};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-XR65N6EG.js';import {a,b as b$1}from'./chunk-TR3NGINC.js';var F=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=false,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator=typeof window<"u"&&window.navigator?window.navigator:null,e.masterGain=null,e.noAudio=false,e.usingWebAudio=true,e.autoSuspend=true,e.ctx=null,e.autoUnlock=true,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?true: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{e.noAudio=true;}else e.noAudio=true;try{var t=new Audio;t.muted&&(e.noAudio=true);}catch{}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||r,t=null;try{t=typeof Audio<"u"?new Audio:null;}catch{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,d=o.match(/Version\/(.*?) /),m=a&&d&&parseInt(d[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=false,e.autoUnlock=false,!e._mobileUnloaded&&e.ctx.sampleRate!==44100&&(e._mobileUnloaded=true,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=true,e._releaseHtml5Audio(o);}catch{e.noAudio=true;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 d=e._howls[l]._soundById(s[a]);d&&d._node&&!d._node._unlocked&&(d._node._unlocked=true,d._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=true,document.removeEventListener("touchstart",t,true),document.removeEventListener("touchend",t,true),document.removeEventListener("click",t,true),document.removeEventListener("keydown",t,true);for(var y=0;y<e._howls.length;y++)e._howls[y]._emit("unlock");};};return document.addEventListener("touchstart",t,true),document.addEventListener("touchend",t,true),document.addEventListener("click",t,true),document.addEventListener("keydown",t,true),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=true),e}};var r=new g,u=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);};u.prototype={init:function(e){var t=this;return r.ctx||A(),t._autoplay=e.autoplay||false,t._format=typeof e.format!="string"?e.format:[e.format],t._html5=e.html5||false,t._muted=e.mute||false,t._loop=e.loop||false,t._pool=e.pool||5,t._preload=typeof e.preload=="boolean"||e.preload==="metadata"?e.preload:true,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:false},t._duration=0,t._state="unloaded",t._sounds=[],t._endTimers={},t._queue=[],t._playLock=false,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=true,e._webAudio=false),new i(e),e._webAudio&&_(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=false;var d=a._id;return n._queue.push({event:"play",action:function(){n.play(d);}}),d}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=false;var I=function(){a._paused=false,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 O=function(){n._playLock=false,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"?O():(n._playLock=true,n.once("resume",O),n._clearTimer(a._id));}else {var H=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=true,I(),x.then(function(){n._playLock=false,v._unlocked=true,t?n._loadQueue():n._emit("play",a._id);}).catch(function(){n._playLock=false,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=true,a._paused=true;})):t||(n._playLock=false,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],false);},v.addEventListener("ended",n._endTimers[a._id],false));}catch(E){n._emit("playerror",a._id,E);}};v.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(v.src=n._src,v.load());var D=window&&window.ejecta||!v.readyState&&r._navigator.isCocoonJS;if(v.readyState>=3||D)H();else {n._playLock=true,n._state="loading";var P=function(){n._state="loaded",H(),v.removeEventListener(r._canPlayEvent,P,false);};v.addEventListener(r._canPlayEvent,P,false),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=true,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=true,s._ended=true,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?true: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 d=0;d<o.length;d++)a=e._soundById(o[d]),a&&(a._volume=n,t[2]||e._stopFade(o[d]),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 d=l._soundById(s[a]);if(d){if(o||l._stopFade(s[a]),l._webAudio&&!d._muted){var m=r.ctx.currentTime,y=m+n/1e3;d._volume=e,d._node.gain.setValueAtTime(e,m),d._node.gain.linearRampToValueAtTime(t,y);}l._startFadeInterval(d,e,t,n,s[a],typeof o>"u");}}return l},_startFadeInterval:function(e,t,n,o,l,s){var a=this,d=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(),d+=m*S,d=Math.round(d*100)/100,m<0?d=Math.max(n,d):d=Math.min(n,d),a._webAudio?e._volume=d:a.volume(d,e._id,true),s&&(a._volume=d),(n<t&&d<=n||n>t&&d>=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:false;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],true),e.play(s[a],true)))));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 d=0;d<o.length;d++)if(a=e._soundById(o[d]),a){e.playing(o[d])&&(a._rateSeek=e.seek(o[d]),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[d]),y=(e._sprite[a._sprite][0]+e._sprite[a._sprite][1])/1e3-m,w=y*1e3/Math.abs(a._rate);(e._endTimers[o[d]]||!a._paused)&&(e._clearTimer(o[d]),e._endTimers[o[d]]=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 d=e.playing(o);d&&e.pause(o,true),a._seek=n,a._ended=false,e._clearTimer(o),!e._webAudio&&a._node&&!isNaN(a._node.duration)&&(a._node.currentTime=n);var m=function(){d&&e.play(o,true),e._emit("seek",o);};if(d&&!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:false}for(var o=0;o<t._sounds.length;o++)if(!t._sounds[o]._paused)return true;return false},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,false),t[n]._node.removeEventListener(r._canPlayEvent,t[n]._loadFn,false),t[n]._node.removeEventListener("ended",t[n]._endFn,false),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=true;for(n=0;n<r._howls.length;n++)if(r._howls[n]._src===e._src||e._src.indexOf(r._howls[n]._src)>=0){l=false;break}return c&&l&&delete c[e._src],r.noAudio=false,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 d=Object.keys(o);for(s=0;s<d.length;s++)d[s].indexOf("_on")===0&&Array.isArray(o[d[s]])&&(o[d[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,true).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=true,e._ended=true,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,true),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],false);}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 i(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{}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 i=function(e){this._parent=e,this.init();};i.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=true,e._ended=true,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=true,e._node.connect(r.masterGain)):r.noAudio||(e._node=r._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,false),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(r._canPlayEvent,e._loadFn,false),e._endFn=e._endListener.bind(e),e._node.addEventListener("ended",e._endFn,false),e._node.src=t._src,e._node.preload=t._preload===true?"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=true,e._ended=true,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,false);},_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,false);},_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,false);}};var c={},_=function(e){var t=e._src;if(c[t]){e._duration=c[t].duration,f(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,true),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=true,e._webAudio=false,e._sounds=[],delete c[t],e.load());},h(s);}},h=function(e){try{e.send();}catch{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,f(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);},f=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=false;}catch{r.usingWebAudio=false;}r.ctx||(r.usingWebAudio=false);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=false);}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:u}}),typeof k<"u"&&(k.Howler=r,k.Howl=u),typeof global<"u"?(global.HowlerGlobal=g,global.Howler=r,global.Howl=u,global.Sound=i):typeof window<"u"&&(window.HowlerGlobal=g,window.Howler=r,window.Howl=u,window.Sound=i);})();(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(r){var u=this;if(!u.ctx||!u.ctx.listener)return u;for(var i=u._howls.length-1;i>=0;i--)u._howls[i].stereo(r);return u},HowlerGlobal.prototype.pos=function(r,u,i){var c=this;if(!c.ctx||!c.ctx.listener)return c;if(u=typeof u!="number"?c._pos[1]:u,i=typeof i!="number"?c._pos[2]:i,typeof r=="number")c._pos=[r,u,i],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,u,i,c,_,h){var p=this;if(!p.ctx||!p.ctx.listener)return p;var f=p._orientation;if(u=typeof u!="number"?f[1]:u,i=typeof i!="number"?f[2]:i,c=typeof c!="number"?f[3]:c,_=typeof _!="number"?f[4]:_,h=typeof h!="number"?f[5]:h,typeof r=="number")p._orientation=[r,u,i,c,_,h],typeof p.ctx.listener.forwardX<"u"?(p.ctx.listener.forwardX.setTargetAtTime(r,Howler.ctx.currentTime,.1),p.ctx.listener.forwardY.setTargetAtTime(u,Howler.ctx.currentTime,.1),p.ctx.listener.forwardZ.setTargetAtTime(i,Howler.ctx.currentTime,.1),p.ctx.listener.upX.setTargetAtTime(c,Howler.ctx.currentTime,.1),p.ctx.listener.upY.setTargetAtTime(_,Howler.ctx.currentTime,.1),p.ctx.listener.upZ.setTargetAtTime(h,Howler.ctx.currentTime,.1)):p.ctx.listener.setOrientation(r,u,i,c,_,h);else return f;return p},Howl.prototype.init=(function(r){return function(u){var i=this;return i._orientation=u.orientation||[1,0,0],i._stereo=u.stereo||null,i._pos=u.pos||null,i._pannerAttr={coneInnerAngle:typeof u.coneInnerAngle<"u"?u.coneInnerAngle:360,coneOuterAngle:typeof u.coneOuterAngle<"u"?u.coneOuterAngle:360,coneOuterGain:typeof u.coneOuterGain<"u"?u.coneOuterGain:0,distanceModel:typeof u.distanceModel<"u"?u.distanceModel:"inverse",maxDistance:typeof u.maxDistance<"u"?u.maxDistance:1e4,panningModel:typeof u.panningModel<"u"?u.panningModel:"HRTF",refDistance:typeof u.refDistance<"u"?u.refDistance:1,rolloffFactor:typeof u.rolloffFactor<"u"?u.rolloffFactor:1},i._onstereo=u.onstereo?[{fn:u.onstereo}]:[],i._onpos=u.onpos?[{fn:u.onpos}]:[],i._onorientation=u.onorientation?[{fn:u.onorientation}]:[],r.call(this,u)}})(Howl.prototype.init),Howl.prototype.stereo=function(r,u){var i=this;if(!i._webAudio)return i;if(i._state!=="loaded")return i._queue.push({event:"stereo",action:function(){i.stereo(r,u);}}),i;var c=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof u>"u")if(typeof r=="number")i._stereo=r,i._pos=[r,0,0];else return i._stereo;for(var _=i._getSoundIds(u),h=0;h<_.length;h++){var p=i._soundById(_[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)),i._emit("stereo",p._id);else return p._stereo}return i},Howl.prototype.pos=function(r,u,i,c){var _=this;if(!_._webAudio)return _;if(_._state!=="loaded")return _._queue.push({event:"pos",action:function(){_.pos(r,u,i,c);}}),_;if(u=typeof u!="number"?0:u,i=typeof i!="number"?-0.5:i,typeof c>"u")if(typeof r=="number")_._pos=[r,u,i];else return _._pos;for(var h=_._getSoundIds(c),p=0;p<h.length;p++){var f=_._soundById(h[p]);if(f)if(typeof r=="number")f._pos=[r,u,i],f._node&&((!f._panner||f._panner.pan)&&g(f,"spatial"),typeof f._panner.positionX<"u"?(f._panner.positionX.setValueAtTime(r,Howler.ctx.currentTime),f._panner.positionY.setValueAtTime(u,Howler.ctx.currentTime),f._panner.positionZ.setValueAtTime(i,Howler.ctx.currentTime)):f._panner.setPosition(r,u,i)),_._emit("pos",f._id);else return f._pos}return _},Howl.prototype.orientation=function(r,u,i,c){var _=this;if(!_._webAudio)return _;if(_._state!=="loaded")return _._queue.push({event:"orientation",action:function(){_.orientation(r,u,i,c);}}),_;if(u=typeof u!="number"?_._orientation[1]:u,i=typeof i!="number"?_._orientation[2]:i,typeof c>"u")if(typeof r=="number")_._orientation=[r,u,i];else return _._orientation;for(var h=_._getSoundIds(c),p=0;p<h.length;p++){var f=_._soundById(h[p]);if(f)if(typeof r=="number")f._orientation=[r,u,i],f._node&&(f._panner||(f._pos||(f._pos=_._pos||[0,0,-0.5]),g(f,"spatial")),typeof f._panner.orientationX<"u"?(f._panner.orientationX.setValueAtTime(r,Howler.ctx.currentTime),f._panner.orientationY.setValueAtTime(u,Howler.ctx.currentTime),f._panner.orientationZ.setValueAtTime(i,Howler.ctx.currentTime)):f._panner.setOrientation(r,u,i)),_._emit("orientation",f._id);else return f._orientation}return _},Howl.prototype.pannerAttr=function(){var r=this,u=arguments,i,c,_;if(!r._webAudio)return r;if(u.length===0)return r._pannerAttr;if(u.length===1)if(typeof u[0]=="object")i=u[0],typeof c>"u"&&(i.pannerAttr||(i.pannerAttr={coneInnerAngle:i.coneInnerAngle,coneOuterAngle:i.coneOuterAngle,coneOuterGain:i.coneOuterGain,distanceModel:i.distanceModel,maxDistance:i.maxDistance,refDistance:i.refDistance,rolloffFactor:i.rolloffFactor,panningModel:i.panningModel}),r._pannerAttr={coneInnerAngle:typeof i.pannerAttr.coneInnerAngle<"u"?i.pannerAttr.coneInnerAngle:r._coneInnerAngle,coneOuterAngle:typeof i.pannerAttr.coneOuterAngle<"u"?i.pannerAttr.coneOuterAngle:r._coneOuterAngle,coneOuterGain:typeof i.pannerAttr.coneOuterGain<"u"?i.pannerAttr.coneOuterGain:r._coneOuterGain,distanceModel:typeof i.pannerAttr.distanceModel<"u"?i.pannerAttr.distanceModel:r._distanceModel,maxDistance:typeof i.pannerAttr.maxDistance<"u"?i.pannerAttr.maxDistance:r._maxDistance,refDistance:typeof i.pannerAttr.refDistance<"u"?i.pannerAttr.refDistance:r._refDistance,rolloffFactor:typeof i.pannerAttr.rolloffFactor<"u"?i.pannerAttr.rolloffFactor:r._rolloffFactor,panningModel:typeof i.pannerAttr.panningModel<"u"?i.pannerAttr.panningModel:r._panningModel});else return _=r._soundById(parseInt(u[0],10)),_?_._pannerAttr:r._pannerAttr;else u.length===2&&(i=u[0],c=parseInt(u[1],10));for(var h=r._getSoundIds(c),p=0;p<h.length;p++)if(_=r._soundById(h[p]),_){var f=_._pannerAttr;f={coneInnerAngle:typeof i.coneInnerAngle<"u"?i.coneInnerAngle:f.coneInnerAngle,coneOuterAngle:typeof i.coneOuterAngle<"u"?i.coneOuterAngle:f.coneOuterAngle,coneOuterGain:typeof i.coneOuterGain<"u"?i.coneOuterGain:f.coneOuterGain,distanceModel:typeof i.distanceModel<"u"?i.distanceModel:f.distanceModel,maxDistance:typeof i.maxDistance<"u"?i.maxDistance:f.maxDistance,refDistance:typeof i.refDistance<"u"?i.refDistance:f.refDistance,rolloffFactor:typeof i.rolloffFactor<"u"?i.rolloffFactor:f.rolloffFactor,panningModel:typeof i.panningModel<"u"?i.panningModel:f.panningModel};var A=_._panner;A||(_._pos||(_._pos=r._pos||[0,0,-0.5]),g(_,"spatial"),A=_._panner),A.coneInnerAngle=f.coneInnerAngle,A.coneOuterAngle=f.coneOuterAngle,A.coneOuterGain=f.coneOuterGain,A.distanceModel=f.distanceModel,A.maxDistance=f.maxDistance,A.refDistance=f.refDistance,A.rolloffFactor=f.rolloffFactor,A.panningModel=f.panningModel;}return r},Sound.prototype.init=(function(r){return function(){var u=this,i=u._parent;u._orientation=i._orientation,u._stereo=i._stereo,u._pos=i._pos,u._pannerAttr=i._pannerAttr,r.call(this),u._stereo?i.stereo(u._stereo):u._pos&&i.pos(u._pos[0],u._pos[1],u._pos[2],u._id);}})(Sound.prototype.init),Sound.prototype.reset=(function(r){return function(){var u=this,i=u._parent;return u._orientation=i._orientation,u._stereo=i._stereo,u._pos=i._pos,u._pannerAttr=i._pannerAttr,u._stereo?i.stereo(u._stereo):u._pos?i.pos(u._pos[0],u._pos[1],u._pos[2],u._id):u._panner&&(u._panner.disconnect(0),u._panner=void 0,i._refreshBuffer(u)),r.call(this)}})(Sound.prototype.reset);var g=function(r,u){u=u||"spatial",u==="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,true).play(r._id,true);};})();});var B=b$1(F(),1),G=new Map;G.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,u,i;if(this.resource==null||this.resource===""){a$1.warn("Sound resource is null or empty string. Cannot be played.");return}if(!this.audio){let c=await((i=(u=(r=G.get(this.resource))==null?void 0:r())==null?void 0:u.then(_=>(_==null?void 0:_.beepSound)||this.resource))!=null?i:Promise.resolve(this.resource));this.audio=new B.Howl({src:c,html5:true});}this.audio.play();}};b._defaultSound=null;var L=b;
|
|
2
|
-
export{L as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-NY2HBST4.js';var t=new a(globalThis,{get:()=>globalThis.Module,set:e=>{globalThis.Module=e;}});function l(e){}export{t as a,l as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$4}from'./chunk-DN32UPQC.js';import {a as a$8}from'./chunk-DZKTI5AJ.js';import {a as a$9}from'./chunk-G2BRTVN7.js';import {a}from'./chunk-GQ7A6533.js';import {c as c$1,a as a$a}from'./chunk-4W2T3TLN.js';import {c}from'./chunk-UWLAKRB2.js';import {a as a$1}from'./chunk-CAUB35PV.js';import {a as a$2}from'./chunk-QIWPWOQG.js';import {a as a$6}from'./chunk-TR5HATUD.js';import {d}from'./chunk-AIC4H5KG.js';import {a as a$5}from'./chunk-O7TZTIHO.js';import {a as a$3}from'./chunk-XR65N6EG.js';import {a as a$7}from'./chunk-QCZSSQAQ.js';var P=class P{constructor(e,t){this.hintPresenterV2=null;this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=5;this.redrawInterval=1e3/30;this.redrawRequests=[];this._isDrawLoopRunning=false;this.frameDataPool=new Map;this.lastFrameColorType="RGBA";this.lastFrameId=null;this.poorMansBenchmarkLogs=false;this.writableDataPathStandard="/scandit_sync_folder";this.resourceFilesSubfolder="resources";this.performanceMetricsReporterTimer=void 0;this.lastMetricsReportTime=0;this.metricsReportInterval=1e3;this.performanceMetrics={frameDataPoolSize:0,cameraOutputFrames:0,redrawRequestsCount:0,actualRedrawsCount:0,frameProcessingStartedCount:0,frameProcessedCount:0,frameSkippedCount:0};this.frameProcessingStartedCount=0;this.frameProcessingFinishedCount=0;this.gestureListener=null;this.webPlatformHintPresenter=null;this.lastViewInfo=new a(null);this.lastFrameProcessingStartedCount=0;this.lastFrameProcessingFinishedCount=0;this.moduleHandler=e,this.workerFunctions=t,this._loadProgressCallback=this._loadProgressCallback.bind(this),c(this.getWasmMetadata());}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0);}get isDrawLoopRunning(){return this._isDrawLoopRunning}prepareFrameForListener(e){let t=this.lastFrameId;if(this.frameDataPool.size>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL){let l=this.frameDataPool.keys().next().value;l!=null&&this.frameDataPool.delete(l);}let r=e.getFrameData(),i=new Uint8ClampedArray(r);this.frameDataPool.set(t,{data:i,colorType:this.lastFrameColorType,frameId:t,width:e.getWidth(),height:e.getHeight()});let a=this.lastUsedModuleMirrorAxis==null?false:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return {frameId:t,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:a,colorType:this.lastFrameColorType}}createContext(e){var f,p,C,b,M;let t=this.getModeDeserializers(),r=c$1(location);(r==="localhost"||r==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(r+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,r,this.parentDomain,t,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let i=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(i==null){let s=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${s}`)}let a=i.getView();this.context=i.getContext(),i.delete();let l=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(s,o)=>{this.contextDidChangeStatus(JSON.parse(o.toJson())),s.delete();},didStartObservingContext:s=>{this.didStartObservingContext(),s.delete();},didStopObservingContext:s=>{s.delete();}}),u=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:s=>{s.delete();},onObservationStopped:s=>{s.delete();},onFrameProcessingStarted:(s,o)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),o.delete(),s.delete();},onFrameProcessingFinished:(s,o)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),o.delete(),s.delete();},onFrameSkipped:(s,o)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),o.delete(),s.delete();}}),h=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(s,o)=>{var w;(w=this.gestureListener)==null||w.delete(),this.gestureListener=s.clone(),s.delete();}});(f=this.gestureRecognizer)==null||f.delete(),this.gestureRecognizer=new h;let g=new l;this.context.addListener(g),g.delete();let c=new u;this.context.addFrameListener(c),c.delete(),this.setView(a),(p=this.view)==null||p.setGestureRecognizer(this.gestureRecognizer);let m=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:s=>{s.delete();},showToast:s=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(s)});},hideToast:s=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(s)});},showGuidance:s=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(s)});},hideGuidance:s=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(s)});},startUpdateTimer:s=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:s}}});},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"});}});(C=this.hintPresenterV2)==null||C.delete(),this.hintPresenterV2=null,(b=this.webPlatformHintPresenter)==null||b.delete(),this.webPlatformHintPresenter=null,this.webPlatformHintPresenter=new m,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(M=this.view)==null||M.setHintPresenterV2(this.hintPresenterV2)),this.webImageConverterInstance=this.getImageConverterInstance({quality:1}),this.Module.ImageConverter.setInstance(this.webImageConverterInstance);}convertToJPEGResult(e,t){this.webImageConverterInstance instanceof a$1&&this.webImageConverterInstance.onConvertToJPEGResult(e,t);}getImageConverterInstance(e){return this.workerFunctions.getOffscreenCanvas()!=null?new a$2(e):new a$1(this.workerFunctions,e)}onTap(e){var t;(t=this.gestureListener)==null||t.onTap(JSON.stringify(e));}hintPresenterV2Update(){var e;(e=this.hintPresenterV2)==null||e.update();}startReportingPerformanceMetrics(){this.performanceMetricsReporterTimer==null&&(this.lastMetricsReportTime=performance.now(),this.scheduleMetricsReporting());}scheduleMetricsReporting(){this.performanceMetricsReporterTimer=setTimeout(()=>{this.checkAndReportMetrics();},100);}checkAndReportMetrics(){let e=performance.now();e-this.lastMetricsReportTime>=this.metricsReportInterval&&(this.reportPerformanceMetrics(),this.performanceMetrics.cameraOutputFrames=0,this.performanceMetrics.redrawRequestsCount=0,this.performanceMetrics.actualRedrawsCount=0,this.lastMetricsReportTime=e),this._isDrawLoopRunning&&this.scheduleMetricsReporting();}async reportPerformanceMetrics(){let e=this.frameProcessingStartedCount-this.lastFrameProcessingStartedCount,r=this.frameProcessingFinishedCount-this.lastFrameProcessingFinishedCount;this.lastFrameProcessingStartedCount=this.frameProcessingStartedCount,this.lastFrameProcessingFinishedCount=this.frameProcessingFinishedCount;let i={cameraOutputFrames:this.performanceMetrics.cameraOutputFrames,redrawRequestsCount:this.performanceMetrics.redrawRequestsCount,actualRedrawsCount:this.performanceMetrics.actualRedrawsCount,frameDataPoolSize:this.performanceMetrics.frameDataPoolSize,frameProcessingStartedCount:e,frameProcessedCount:r,frameSkippedCount:this.performanceMetrics.frameSkippedCount};this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:i});}deleteFrameData(e){this.frameDataPool.delete(e);}dispose(){var e,t,r,i;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=false,this.cleanupMetricsReporting(),(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(t=this.gestureListener)==null||t.delete(),this.gestureListener=null,(r=this.hintPresenterV2)==null||r.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null;}cleanupMetricsReporting(){this.performanceMetricsReporterTimer!=null&&(typeof this.performanceMetricsReporterTimer=="number"?cancelAnimationFrame(this.performanceMetricsReporterTimer):clearTimeout(this.performanceMetricsReporterTimer),this.performanceMetricsReporterTimer=void 0);}flushAnalytics(){this.context.flushAnalytics();}extractCentaurusLicense(e){return {payload:{centaurus:{licenseKey:this.Module.LicenseUtils[P.get3dPartyLicenseKeyMethodName](e)}}}}getModeDeserializers(){return new this.Module.VectorDataCaptureModeDeserializer}loadLibrary(e){return this.libraryLoadingPromise!=null?this.libraryLoadingPromise:(this.libraryLoadingPromise=this.setup(e),this.libraryLoadingPromise)}processFrame(e){var a;if(this.context==null)return a$3.debug("[processFrame] Context is null, returning frame without processing"),{payload:e,transferables:[e.data.buffer]};this.lastFrameId=e.frameId;let t=e.data,r=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888;this.lastFrameColorType=e.colorType==="GRAYSCALE"?"GRAYSCALE":"RGBA";let i=this.Module.allocateUint8Array(t.byteLength);return this.Module.HEAPU8.set(t,i),(a=this.imageFrameSource)==null||a.outputFrame(i,e.width,e.height,r),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus);}requestFrameData(e){let t=this.frameDataPool.get(e);if(t==null)return {payload:{data:null,frameId:null,colorType:null}};if(t.data.buffer.byteLength===0)return this.frameDataPool.delete(e),{payload:{data:null,frameId:null,colorType:null}};let r=t.data;t.colorType==="GRAYSCALE"&&(r=a$4(t.data,t.width,t.height));let i={payload:{data:r,frameId:t.frameId,colorType:t.colorType},transferables:[r.buffer]};return this.frameDataPool.delete(e),i}scheduleRedraw(e,t){this.addRedrawRequest(t),this.isDrawLoopRunning||this.startDrawLoop(e);}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer]);}setFrameSource(e,t){var r;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(r=this.imageFrameSource)==null||r.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,t,0),this.context.setFrameSource(this.imageFrameSource);}startDrawLoop(e){this.isDrawLoopRunning=true;let t=a=>this.redrawRequests.length>0&&this.redrawRequests[0]<=a,r=a=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=a;)this.redrawRequests.shift();},i=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let a=performance.now();if(t(a)){r(a),e.draw();let l=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(l));}i();},this.redrawInterval);};i();}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let t=this.onBeforeUpdateContextHook(e),r=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(t.context));if(r==null){let a=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${a}`)}this.context.delete(),this.context=r.getContext();let i=r.getView();r.delete(),i!=null&&t.view!=null&&(i.setViewSize(t.view.width,t.view.height,t.view.orientation),i.draw()),!this.hintPresenterV2&&this.webPlatformHintPresenter&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter)),i!=null&&this.hintPresenterV2&&i.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&(i==null||i.setGestureRecognizer(this.gestureRecognizer)),this.setView(i),this.notifyMainThreadOnViewInfoChanged(i),a$3.debug("context updated",t);}}notifyMainThreadOnViewInfoChanged(e){let t=this.getViewInfo(e);this.lastViewInfo.isSame(t)||(this.lastViewInfo.update(t),this.workerFunctions.postMessage({type:"viewSizeChanged",payload:t}));}getViewInfo(e){if(e!=null)try{let t=JSON.parse(e.getViewInfo());if(t!=null){let r=this.getOrientationFromNumber(t.orientation);return {...t,orientation:r}}}catch(t){a$3.error("Failed to get view size",t);}return null}getOrientationFromNumber(e){switch(e){case 90:return "landscapeRight";case 180:return "portraitUpsideDown";case 270:return "landscapeLeft";default:return "portrait"}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics();}isFeatureSupported(e){return {payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,t;return {payload:{isDisplayingViewfinder:(t=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?t:false,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return {payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,t){return t?e?globalThis.SDC_WASM_CORE_MT_SIMD_HASH:globalThis.SDC_WASM_CORE_MT_HASH:e?globalThis.SDC_WASM_CORE_SIMD_HASH:""}getWasmCoreFileName(e,t){return t?e?globalThis.SDC_WASM_CORE_MT_SIMD_FILE_NAME:globalThis.SDC_WASM_CORE_MT_FILE_NAME:e?globalThis.SDC_WASM_CORE_SIMD_FILE_NAME:""}getWasmMetadata(){return globalThis.WASM_METADATA}getWasmSideModuleFileName(){return ""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e});}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((t,r)=>t-r);}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${c$1(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e});}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"});}mapMirrorAxisOnModule(e){switch(e){case "None":return this.Module.Axis.None;case "X":return this.Module.Axis.X;case "Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=false,this.sendViewRefreshCommands(new Uint8Array([])));}addNativeOverlay(e){a$3.warn("addNativeOverlay has not been implemented for this module",e);}removeNativeOverlay(e){a$3.warn("removeNativeOverlay has not been implemented for this module",e);}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let t=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),r=new t;e.setNeedsRedrawDelegate(r),e.isViewRefreshHandlerSet=true;}setupDataDecoding(){let e=this.moduleHandler.get(),t=e.DataDecoding.extend("DataDecoding",{decode(r,i){try{let a=JSON.parse(i),l=[];for(let u of a){let h=new TextDecoder(u.ianaName,{fatal:true});l.push(h.decode(r.slice(u.startIndex,u.endIndex)));}return l.join("")}catch{return ""}}});e.setDataDecoding(new t);}start(e,t,r){e&&t&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||r());}getWritableDataPath(e){return e!=null?(a$3.debug(`IndexedDB database name override in use to recover from blocked standard database: ${e}`),e):this.writableDataPathStandard}numOfMBToPages(e){return Math.ceil(1024*e*1024/64/1024)}async setup({libraryLocation:e,locationPath:t,writableDataPathOverride:r,indexedDBTimeoutMs:i,verifyResponseHash:a,referredOrigin:l,fixedWasmMemory:u,simdSupport:h,threadsSupport:g}){var F;let c=false,m=false;this.writableDataPath=this.getWritableDataPath(r),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,globalThis.path=t;let{resolve:f,reject:p,promise:C}=new a$5,b=a$6.sdkVersion();if(b==="")throw new a$7({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let M=this.getWasmCoreFileName(h,g),s=d(b,e,M),{jsURI:o,wasmURI:w}=s,W={instantiateWasm:(d,N)=>(a$a({importObject:d,wasmURI:w,expectedHash:this.getWasmCoreExpectedHash(h,g),verifyResponseHash:a,successCallback:N,progressCallback:this._loadProgressCallback,errorCallback:H=>{p(H);},referredOrigin:l}),{})},y=u===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(u),maximum:this.numOfMBToPages(300),shared:g});return y!==null&&a$3.log(a$3.Level.Debug,"Fixed wasmMemory set",y),this.moduleHandler.set({...y?{wasmMemory:y}:{},mainScriptUrlOrBlob:o,canvas:(F=this.workerFunctions.getOffscreenCanvas())!=null?F:{getContext:()=>null},...W,dynamicLibraries:this.getWasmDynamicLibraries(w),locateFile:d=>e+d,noInitialRun:true,preRun:[async()=>{try{await a$8({writableDataPath:this.writableDataPath,indexedDBTimeoutMs:i});}catch(d){if(d.name==="BlockedIndexedDB"){p(d.toString());return}a$3.log(a$3.Level.Debug,"No IndexedDB support, some data will not be persisted:",d);}m=true,this.start(m,c,f);}],onMainComplete:()=>{if([c,m].includes(false)){a$3.log(a$3.Level.Warn,{runtimeLoaded:c,fileSystemSynced:m},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),p("onMainComplete has been called but runtime or file system was not ready.");return}f();},onRuntimeInitialized:()=>{c=true,this.start(m,c,f);},print:d=>{a$3.info(d);}}),await a$9(o,b)||p(`Couldn't retrieve Scandit Data Capture library at ${o}, did you configure the path for it correctly?`),C}};P.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var V=P;export{V as a};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {a as a$4}from'./chunk-3A7LM5JG.js';import {a}from'./chunk-NQF3GUK2.js';import {a as a$2}from'./chunk-QHBIT2WY.js';import {b,a as a$3}from'./chunk-SK6L34IF.js';import {a as a$6}from'./chunk-ZKROZLQ4.js';import {d}from'./chunk-NT5WI2PS.js';import {a as a$9}from'./chunk-E4XJ4GKD.js';import {a as a$b}from'./chunk-QOCHMKNY.js';import {a as a$a}from'./chunk-KAFNKP6O.js';import {b as b$3}from'./chunk-FTD535WI.js';import {a as a$5}from'./chunk-R6E4CT22.js';import {a as a$7,b as b$2}from'./chunk-CX2R2XQK.js';import {a as a$c}from'./chunk-4BP7D26M.js';import {b as b$1}from'./chunk-A225YZFY.js';import {a as a$1}from'./chunk-XR65N6EG.js';import {a as a$8}from'./chunk-QCZSSQAQ.js';var N=`
|
|
2
|
-
attribute vec2 a_position;
|
|
3
|
-
varying vec2 v_texcoord;
|
|
4
|
-
|
|
5
|
-
void main() {
|
|
6
|
-
gl_Position = vec4(a_position, 0, 1);
|
|
7
|
-
v_texcoord = a_position * 0.5 + 0.5;
|
|
8
|
-
}
|
|
9
|
-
`,O=`
|
|
10
|
-
precision mediump float;
|
|
11
|
-
varying vec2 v_texcoord;
|
|
12
|
-
uniform sampler2D u_texture;
|
|
13
|
-
uniform float x_spacing; // Uniform for x-spacing between pixels
|
|
14
|
-
|
|
15
|
-
// Function to calculate grayscale
|
|
16
|
-
float toGray(vec4 color) {
|
|
17
|
-
return dot(color.rgb, vec3(0.299, 0.587, 0.114));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
void main() {
|
|
21
|
-
// Sample adjacent pixels with spacing of 1/width
|
|
22
|
-
vec4 a = texture2D(u_texture, v_texcoord + vec2(0.0 * x_spacing, 0.0));
|
|
23
|
-
vec4 b = texture2D(u_texture, v_texcoord + vec2(1.0 * x_spacing, 0.0));
|
|
24
|
-
vec4 c = texture2D(u_texture, v_texcoord + vec2(2.0 * x_spacing, 0.0));
|
|
25
|
-
vec4 d = texture2D(u_texture, v_texcoord + vec2(3.0 * x_spacing, 0.0));
|
|
26
|
-
|
|
27
|
-
// Calculate grayscale values
|
|
28
|
-
float grayscaleA = toGray(a);
|
|
29
|
-
float grayscaleB = toGray(b);
|
|
30
|
-
float grayscaleC = toGray(c);
|
|
31
|
-
float grayscaleD = toGray(d);
|
|
32
|
-
|
|
33
|
-
// Set the final color with grayscale values
|
|
34
|
-
gl_FragColor = vec4(grayscaleA, grayscaleB, grayscaleC, grayscaleD);
|
|
35
|
-
}`,T=class extends a{constructor(t,i){super(t,i);this.colorType="GRAYSCALE";this._useRgbaFallback=false;this._positions=new Float32Array([-1,-1,-1,1,1,-1,1,-1,-1,1,1,1]);this._canvas=document.createElement("canvas");}get _webglContext(){var t;if(!this._ctx){if(this._ctx=(t=this._canvas)==null?void 0:t.getContext("webgl",{antialias:false}),!this._ctx)throw new Error("Cannot get WebGL context");this.setup();}return this._ctx}readFromSource(t){var R,_;let i=(R=t==null?void 0:t.videoWidth)!=null?R:this._contextWebGL.drawingBufferWidth,a=i%4!==0;if(a!==this._useRgbaFallback&&(a?(a$1.debug("[GrayScaleFrameReader] Video width not divisible by 4, falling back to RGBA reader for better performance",{width:i}),this._rgbaFallbackReader||(this._rgbaFallbackReader=new v(this._contextWebGL,{minPoolCapacity:this._minPoolCapacity,maxPoolCapacity:this._maxPoolCapacity}),this._rgbaFallbackReader.setup())):a$1.log(a$1.Level.Info,"[GrayScaleFrameReader] Video width now divisible by 4, using optimized grayscale reader",{width:i}),this._useRgbaFallback=a),this._useRgbaFallback&&this._rgbaFallbackReader)return this._rgbaFallbackReader.readFromSource(t);this.updateCanvasSizeIfNeeded(),this.updateFrameSizeIfNeeded();let{drawingBufferWidth:s,drawingBufferHeight:o,TEXTURE_2D:c,RGBA:d,UNSIGNED_BYTE:l,TRIANGLES:p}=this._webglContext;this._webglContext.viewport(0,0,s,o);let b=this._webglContext.getUniformLocation(this._shaderProgram,"x_spacing"),u=1/i;this._webglContext.uniform1f(b,u),this._webglContext.texImage2D(c,0,d,d,l,t),this._webglContext.drawArrays(p,0,6);let h=(_=this._framePool)==null?void 0:_.pop();if(!h)throw new Error("Frame pool found empty!");let g=s*o*4;return h.length!==g&&(a$1.warn("[GrayScaleFrameReader] Buffer from pool has wrong size, allocating new one",{bufferLength:h.length,requiredSize:g}),h=new Uint8ClampedArray(g)),this._webglContext.readPixels(0,0,s,o,d,l,h),{width:i,height:o,data:new Uint8ClampedArray(h.buffer,0,i*o),frameId:E(),colorType:"GRAYSCALE"}}setup(){this.initShaderProgram(),this.initBuffers(),this.initTexture();}dispose(){var t;this._ctx&&(this._shaderProgram&&(this._ctx.deleteProgram(this._shaderProgram),this._shaderProgram=null),this._positionBuffer&&(this._ctx.deleteBuffer(this._positionBuffer),this._positionBuffer=null),this._texture&&(this._ctx.deleteTexture(this._texture),this._texture=null),this._ctx=null),this._rgbaFallbackReader&&(this._rgbaFallbackReader.dispose(),this._rgbaFallbackReader=null),(t=this._framePool)==null||t.empty(),this._canvas=void 0;}updateCanvasSizeIfNeeded(){if(!this._canvas)return;let t=Math.ceil(this._contextWebGL.drawingBufferWidth/4);(this._canvas.width!==t||this._canvas.height!==this._contextWebGL.drawingBufferHeight)&&(this._canvas.width=t,this._canvas.height=this._contextWebGL.drawingBufferHeight);}updateFrameSizeIfNeeded(){let{drawingBufferWidth:t,drawingBufferHeight:i}=this._webglContext,a=t*i*4;this._frameSize!==a&&(this._frameSize=a,this._framePool&&this._framePool.empty(),this._framePool=new a$2({capacity:this._maxPoolCapacity,lowWaterMark:this._minPoolCapacity,createItem:()=>new Uint8ClampedArray(this._frameSize)}));}initShaderProgram(){let t=b(this._webglContext,this._webglContext.VERTEX_SHADER,N),i=b(this._webglContext,this._webglContext.FRAGMENT_SHADER,O);if(!t||!i)throw new Error("Shaders cannot be created");this._shaderProgram=a$3(this._webglContext,t,i),this._webglContext.useProgram(this._shaderProgram);}initBuffers(){this._positionBuffer=this._webglContext.createBuffer(),this._webglContext.bindBuffer(this._webglContext.ARRAY_BUFFER,this._positionBuffer),this._webglContext.bufferData(this._webglContext.ARRAY_BUFFER,this._positions,this._webglContext.STATIC_DRAW);let t=this._webglContext.getAttribLocation(this._shaderProgram,"a_position");this._webglContext.enableVertexAttribArray(t),this._webglContext.bindBuffer(this._webglContext.ARRAY_BUFFER,this._positionBuffer),this._webglContext.vertexAttribPointer(t,2,this._webglContext.FLOAT,false,0,0);}initTexture(){this._texture=this._webglContext.createTexture(),this._webglContext.bindTexture(this._webglContext.TEXTURE_2D,this._texture),this._webglContext.texParameteri(this._webglContext.TEXTURE_2D,this._webglContext.TEXTURE_WRAP_S,this._webglContext.CLAMP_TO_EDGE),this._webglContext.texParameteri(this._webglContext.TEXTURE_2D,this._webglContext.TEXTURE_WRAP_T,this._webglContext.CLAMP_TO_EDGE),this._webglContext.texParameteri(this._webglContext.TEXTURE_2D,this._webglContext.TEXTURE_MIN_FILTER,this._webglContext.LINEAR),this._webglContext.texParameteri(this._webglContext.TEXTURE_2D,this._webglContext.TEXTURE_MAG_FILTER,this._webglContext.LINEAR);let t=this._webglContext.getUniformLocation(this._shaderProgram,"u_texture");this._webglContext.uniform1i(t,0);}};var B=(a=>(a.CONTINUOUS="continuous",a.MANUAL="manual",a.NONE="none",a.SINGLE_SHOT="single-shot",a))(B||{}),H=(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))(H||{});function E(){return a$4()}var Z=(t=>(t.CAMERA_PROPERTIES="cameraProperties",t.CAMERA_ACCESS_ERROR="cameraAccessError",t))(Z||{}),n=class n{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$5(this.handleVideoResize.bind(this),500);this.videoTrackEndedListener=this.videoTrackEndedRecovery.bind(this);this.videoTrackMuteListener=this.videoTrackMuteRecovery.bind(this);this._synchronousFrameHandling=false;this._glFrameReaders={GRAYSCALE:null,RGBA:null};this._frameReaderType="RGBA";this.isVideoStreamPaused=false;this.handleVideoPauseHandler=this.handleVideoPause.bind(this);this.cameraPosition="worldFacing",this.gui={isCameraRecoveryVisible:()=>false,setCameraRecoveryVisible:()=>{}},this.isWebGLSupported=!b$1.checkBrowserCompatibility().missingFeatures.includes("webGL"),this.videoElement=document.createElement("video"),this.videoElement.autoplay=true,this.videoElement.playsInline=true,this.videoElement.muted=true,this.videoElement.style.opacity="0",this.videoElement.poster=a$6,this.canvas=document.createElement("canvas"),this.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLostListener);}get mediaStream(){return this._mediaStream}set mediaStream(e){this._mediaStream=e,e&&(this.mediaTrackCapabilitiesPromise=new Promise(t=>{this.mediaTrackCapabilitiesPromiseResolver=t;}));}get synchronousFrameHandling(){return this._synchronousFrameHandling}get canvas2dContext(){return this._canvas2dContext||(this._canvas2dContext=this.canvas.getContext("2d",{willReadFrequently:true}),this._canvas2dContext==null&&a$1.warn("Unable to get 2d canvas context"),this.handleVideoResize()),this._canvas2dContext}get canvasWebGLContext(){var e;if(!this._canvas2dContext&&!this._canvasWebGLContext){if(!this.isWebGLSupported){a$1.warn("WebGL context not supported, falling back to 2d canvas context. This may impact the scanning performance.");return}let t=(e=this.canvas.getContext("webgl",{alpha:false,antialias:false}))!=null?e:this.canvas.getContext("experimental-webgl",{alpha:false,antialias:false});t!=null&&(this._canvasWebGLContext=t,this.handleVideoResize());}return this._canvasWebGLContext}static instance(){return n._instance==null&&(n._instance=new n),n._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):a$7(e)}cancelVideoFrame(e,t=this.videoElement){if("cancelVideoFrameCallback"in HTMLVideoElement.prototype){t.cancelVideoFrameCallback(e);return}b$2(e);}addListener(e,t){var a;let i=(a=this.listeners.get(e))!=null?a:[];i.includes(t)||this.listeners.set(e,[...i,t]);}async applyCameraSettings(e){if(this.selectedCameraSettings=e,this.activeCamera==null)throw new a$8(n.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$8(n.noCameraErrorParameters);return this.setSelectedCamera(e),this.selectedCameraSettings=t,this.activeCameraSettings=t,this.cameraInitializationPromise=this.initializeCameraAndCheckUpdatedSettings(e),this.cameraInitializationPromise}isMirrorImageEnabled(){if(this.selectedCamera&&this.activeCamera){let e=this.mirrorImageOverrides.get(this.activeCamera);return e!=null?e:this.activeCamera.position==="userFacing"}return false}isPinchToZoomEnabled(){return this.pinchToZoomEnabled}isTapToFocusEnabled(){return this.tapToFocusEnabled}async isTorchAvailable(){var e;return this.mediaStream?(await this.waitForCapabilities(),((e=this.mediaTrackCapabilities)==null?void 0:e.torch)===true):false}async playVideo(){return new Promise(e=>{this._canvas2dContext&&this._canvas2dContext.clearRect(0,0,this.canvas.width,this.canvas.height);let t=this.videoElement.play();t==null?e():t.then(e).catch(()=>{e();});})}async reinitializeCamera(){if(this.activeCamera==null)a$1.debug("Camera reinitialization delayed");else {a$1.debug("Reinitialize camera:",this.activeCamera);try{let e=this.activeCamera;await this.stopStream(),await this.initializeCameraWithSettings(e,this.activeCameraSettings);}catch(e){throw a$1.warn("Couldn't access camera:",this.activeCamera,e),this.emit("cameraAccessError",e),e}}}removeListener(e,t){var s;let a=((s=this.listeners.get(e))!=null?s:[]).filter(o=>o!==t);this.listeners.set(e,a);}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 a,s,o,c,d,l,p,b;let t=(s=(a=this.mediaStream)==null?void 0:a.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=(o=this.mediaTrackCapabilities)==null?void 0:o.exposureMode)==null?void 0:c.includes(i))===true){if(await t[0].applyConstraints({advanced:[{exposureMode:i}]}),e.time!=null&&e.time>0&&this.mediaTrackCapabilities.exposureTime){let u=Math.max((d=this.mediaTrackCapabilities.exposureTime.min)!=null?d:.01,Math.min(e.time,(l=this.mediaTrackCapabilities.exposureTime.max)!=null?l:1e5));await t[0].applyConstraints({advanced:[{exposureTime:u}]});}else if(e.compensation!=null&&i==="continuous"&&this.mediaTrackCapabilities.exposureCompensation){let u=Math.max((p=this.mediaTrackCapabilities.exposureCompensation.min)!=null?p:-10,Math.min(e.compensation,(b=this.mediaTrackCapabilities.exposureCompensation.max)!=null?b:10));await t[0].applyConstraints({advanced:[{exposureCompensation:u}]});}}}async setFocus(e){var i,a,s,o,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(((a=(i=this.mediaTrackCapabilities)==null?void 0:i.focusMode)==null?void 0:a.includes(d))===true&&(await t[0].applyConstraints({advanced:[{focusMode:d}]}),d==="manual"&&this.mediaTrackCapabilities.focusDistance)){let l=Math.max(0,Math.min(e,1))*(((s=this.mediaTrackCapabilities.focusDistance.max)!=null?s:1e3)-((o=this.mediaTrackCapabilities.focusDistance.min)!=null?o:.01))+((c=this.mediaTrackCapabilities.focusDistance.min)!=null?c:.01);await t[0].applyConstraints({advanced:[{focusDistance:l}]});}}}async setFrameRate(e){var t,i,a;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 o=Math.min((i=this.mediaTrackCapabilities.frameRate.max)!=null?i:240,(a=e.max)!=null?a:240);await s[0].applyConstraints({advanced:[{frameRate:o}]});}}}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(n.MIRRORED_CLASS_NAME),this.canvas.classList.add(n.MIRRORED_CLASS_NAME)):(this.videoElement.classList.remove(n.MIRRORED_CLASS_NAME),this.canvas.classList.remove(n.MIRRORED_CLASS_NAME)),t&&this.mirrorImageOverrides.set(this.selectedCamera,e));}setPinchToZoomEnabled(e){this.pinchToZoomEnabled=e,this.mediaStream&&(this.pinchToZoomEnabled?this.enablePinchToZoomListeners():this.disablePinchToZoomListeners());}setSelectedCamera(e){this.selectedCamera=e;}setSelectedCameraSettings(e){this.selectedCameraSettings=e;}setTapToFocusEnabled(e){this.tapToFocusEnabled=e,this.mediaStream&&(this.tapToFocusEnabled?this.enableTapToFocusListeners():this.disableTapToFocusListeners());}async setTorchEnabled(e){var t;if(this.mediaStream&&((t=this.mediaTrackCapabilities)==null?void 0:t.torch)===true){this.torchEnabled=e;let i=this.mediaStream.getVideoTracks();i.length>0&&typeof i[0].applyConstraints=="function"&&await i[0].applyConstraints({advanced:[{torch:e}]});}}async setZoom(e){var t,i,a;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 o=Math.max((i=this.mediaTrackCapabilities.zoom.min)!=null?i:1,Math.min(e,(a=this.mediaTrackCapabilities.zoom.max)!=null?a:16));await s[0].applyConstraints({advanced:[{zoom:o}]});}}}async setupCameras(){if(this.cameraSetupPromise)return this.cameraSetupPromise;let e=this.isVideoStreamPaused;return this.cameraSetupPromise=this.setupCamerasAndStream(),this.cameraSetupPromise.then(()=>{e||(this.isVideoStreamPaused=false);})}pauseStream(){if(this.mediaStream){for(let e of this.mediaStream.getVideoTracks())e.enabled=false;this.isVideoStreamPaused=true,a$1.debug("Paused camera video stream",this.mediaStream);}}resumeStream(){if(this.mediaStream){for(let e of this.mediaStream.getVideoTracks())e.enabled=true;this.isVideoStreamPaused=false,a$1.debug("Resumed camera video stream",this.mediaStream);}}async stopStream(e=false){this.activeCamera&&(this.activeCamera.currentResolution=void 0),this.activeCamera=void 0,this.torchEnabled=false,this.isVideoStreamPaused=false,this.mediaStream&&(a$1.debug(`Stop camera video stream access${e?" (abort access detection)":""}:`,this.mediaStream),a$1.debug("Stopping camera video stream access",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,a,s;for(let o of (a=(i=this.mediaStream)==null?void 0:i.getVideoTracks())!=null?a:[])o.removeEventListener("ended",this.videoTrackEndedListener),o.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$1.log(a$1.Level.Debug,`Change frame reader type to ${this._frameReaderType} mode`));}async allowPictureInPicture(e){e?(this.videoElement.disablePictureInPicture=false,this.videoElement.removeAttribute("controlslist"),this.videoElement.removeAttribute("disablepictureinpicture")):(this.videoElement.disablePictureInPicture=true,this.videoElement.setAttribute("controlslist","nodownload"),this.videoElement.setAttribute("disablepictureinpicture","true")),await this.reinitializeCamera();}setFrameHandling(e){var t;this._synchronousFrameHandling=e,this._frameReaderOptions=this.getFrameReaderOptions(e),(t=this._glFrameReaders[this._frameReaderType])==null||t.dispose(),delete this._glFrameReaders[this._frameReaderType];}async setClipArea(e){if(this.activeCamera&&this.isVideoAndContextStateValid()){this.clipArea=e?this.frameRectFromViewRect(e):void 0,await this.initializeStreamForResolution(this.activeCamera,this.constraint,this.isVideoStreamPaused);return}this.clipArea=e;}frameRectFromViewRect(e){let t=this.videoElement.videoWidth/this.videoElement.clientWidth||1,i=this.videoElement.videoHeight/this.videoElement.clientHeight||1;return new a$9(new a$a(e.origin.x*t,e.origin.y*i),new a$b(e.size.width*t,e.size.height*i))}async accessAutoselectedCamera(e){let t=d.sortCamerasForCameraPosition(e,this.cameraPosition),i=t.shift();for(;i;)try{await this.initializeCameraWithSettings(i,this.selectedCameraSettings);return}catch(a){if(this.setSelectedCamera(),t.length>0){a$1.log(a$1.Level.Warn,"Couldn't access camera:",i,a),i=t.shift();continue}throw a}throw new a$8(n.noCameraErrorParameters)}getFrameReaderOptions(e){return e?{minPoolCapacity:0,maxPoolCapacity:1}:b$1.isDesktopDevice()?{maxPoolCapacity:2,minPoolCapacity:1}:{maxPoolCapacity:10,minPoolCapacity:3}}getFrameReader(){var t;if(this._glFrameReaders[this._frameReaderType])return this._glFrameReaders[this._frameReaderType];if(!this._canvasWebGLContext)return null;let e=(t=this._frameReaderOptions)!=null?t:this.getFrameReaderOptions(this._synchronousFrameHandling);switch(this._frameReaderType){case "GRAYSCALE":{this._glFrameReaders.GRAYSCALE=new T(this._canvasWebGLContext,e),this._glFrameReaders.RGBA=new v(this._canvasWebGLContext,{minPoolCapacity:1,maxPoolCapacity:2});break}case "RGBA":{this._glFrameReaders.RGBA=new v(this._canvasWebGLContext,e);break}default:b$3(this._frameReaderType);}return a$1.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{}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,i=E();return {colorType:"RGBA",data:this.canvas2dContext.getImageData(0,0,e,t).data,frameId:i,width:e,height:t}}areVideoAndWebGLSizeMismatching(){return this.canvasWebGLContext?this.canvasWebGLContext.drawingBufferWidth!==this.videoElement.videoWidth||this.canvasWebGLContext.drawingBufferHeight!==this.videoElement.videoHeight:true}captureImageForWebGLContext(){if(!this.isVideoAndContextStateValid()||!this.canvasWebGLContext||this.canvasWebGLContext.drawingBufferWidth<=2||this.canvasWebGLContext.drawingBufferHeight<=2||this.areVideoAndWebGLSizeMismatching()||this.getFrameReader()==null)return null;let e=this.getFrameReader().readFromSource(this.videoElement);if(e.data[3]!==255&&e.colorType==="RGBA"){if(a$1.log(a$1.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=a=>{a$1.log(a$1.Level.Debug,"Camera video stream access failure (video data load timeout):",e),this.gui.setCameraRecoveryVisible(true),i(a);},this.setCameraAccessTimeout();})}checkCameraVideoStreamAccessIfVisible(){document.visibilityState==="visible"&&(a$1.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$1.log(a$1.Level.Debug,"Camera video stream access success:",e),t();return}let a=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()-a>n.videoMetadataCheckTimeoutMs){a$1.log(a$1.Level.Warn,"Camera video stream access failure (valid video metadata timeout):",e),window.clearInterval(this.videoMetadataCheckInterval),await this.stopStream(true),i(new a$8(n.notReadableErrorParameters));return}return}window.clearInterval(this.videoMetadataCheckInterval),this.updateActiveCameraCurrentResolution(e),a$1.log(a$1.Level.Debug,"Camera video stream access success:",e),t();},n.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 a;let i=(a=this.listeners.get(e))!=null?a:[];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(a=>a.deviceId===i||a.label!==""&&a.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$1.log(a$1.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$1.log(a$1.Level.Warn,"Camera video stream access failure (no camera with such type error)",e,i),i;a$1.log(a$1.Level.Warn,"Detected non-existent deviceId error, attempt to find and reaccess updated camera",e,i);let a=e.deviceId;if(await d.getCameras(true),a===e.deviceId)throw a$1.log(a$1.Level.Warn,"Camera video stream access failure (updated camera not found after non-existent deviceId error)",e,i),d.markCameraAsInaccessible(e),i;return a$1.log(a$1.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$1.log(a$1.Level.Warn,"WebGL context has been lost, restoring..."),this._canvasWebGLContext=void 0,this.canvasWebGLContext?(this.handleVideoResize(),a$1.log(a$1.Level.Warn,"WebGL context restored")):a$1.log(a$1.Level.Error,"WebGL context restore failed");}async initializeCameraAndCheckUpdatedSettings(e){var t,i,a,s,o;try{if(await this.initializeCameraForResolution(e),this.selectedCameraSettings!==this.activeCameraSettings&&(this.selectedCameraSettings==null||this.activeCameraSettings==null||Object.keys(this.selectedCameraSettings).some(u=>{var h,g;return ((h=this.selectedCameraSettings)==null?void 0:h[u])!==((g=this.activeCameraSettings)==null?void 0:g[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=(a=this.activeCameraSettings)==null?void 0:a.getProperty("manualLensPosition");l!=null&&await this.setFocus(l);let p=(s=this.activeCameraSettings)==null?void 0:s.getProperty("exposureTargetBias"),b=(o=this.activeCameraSettings)==null?void 0:o.getProperty("exposureDuration");(p!=null||b!=null)&&await this.setExposure({compensation:p,time:b});}finally{this.cameraInitializationPromise=void 0;}}async initializeCameraForResolution(e,t){var i;this.gui.setCameraRecoveryVisible(false),this.constraint=t!=null?t:this.getInitialCameraResolutionConstraint(e),this.mediaStream!=null&&e.deviceId!==""&&((i=this.activeCamera)==null?void 0:i.deviceId)===e.deviceId?await(b$1.isIPhone()?this.initializeStreamForResolution(e,this.constraint):this.updateStreamForResolution(e,this.constraint)):await this.initializeStreamForResolution(e,this.constraint);}async initializeStreamForResolution(e,t,i=false){var a;await this.stopStream();try{let s=(a=this.activeCameraSettings)==null?void 0:a.getProperty("preferredAspectRatio"),o=await d.accessCameraStream(e,t,s),c=await this.clipMediaStreamIfNeeded(o);if(a$1.log(a$1.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$1.log(a$1.Level.Debug,"Camera video stream access failure (invalid video metadata):",e),t===4)throw new a$8(n.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();},n.getCapabilitiesTimeoutMs);}async recoverStreamIfNeeded(){var t,i;let e=(t=this.mediaStream)==null?void 0:t.getVideoTracks();((i=e==null?void 0:e[0])==null?void 0:i.readyState)==="ended"&&await this.reinitializeCamera();}reportCameraProperties(e,t,i=true){this.emit("cameraProperties",{deviceId:e,isFrontFacing:t==="userFacing",hasAutofocus:i});}setCameraAccessTimeout(){window.clearTimeout(this.cameraAccessTimeout),this.cameraAccessTimeout=window.setTimeout(async()=>{var e;document.visibilityState==="visible"?(await this.stopStream(true),(e=this.cameraAccessRejectCallback)==null||e.call(this,new a$8(n.notReadableErrorParameters))):(a$1.debug("Page is currently not visible, delay camera video stream access detection"),document.addEventListener("visibilitychange",this.checkCameraVideoStreamAccessIfVisibleListener));},n.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),n.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(a=>{this.abortedCameraInitializationResolveCallback=a;})]);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 a=await d.getCameras(false,true),s=(t=(e=this.mediaStream)==null?void 0:e.getVideoTracks()[0])==null?void 0:t.getSettings().deviceId;if(this.mediaStream&&i){let o=this.getActiveCamera(a,i.label,s);if(o){if(d.adjustCameraFromMediaStream(this.mediaStream,o),b$1.isDesktopDevice()&&(d.setMainCameraForPositionOverridesOnDesktop(this.cameraPosition,o),d.setMainCameraForPositionOverridesOnDesktop(o.position,o)),a.length===1||d.getMainCameraForPosition(a,this.cameraPosition)===o){a$1.debug("Initial camera access was correct (main camera), keep camera:",o),this.setSelectedCamera(o),this.updateActiveCameraCurrentResolution(o),await this.recoverStreamIfNeeded();return}a$1.debug("Initial camera access was incorrect (not main camera), change camera",{...i,deviceId:s});}else a$1.debug("Initial camera access was incorrect (unknown camera), change camera",{...i,deviceId:s});}if(this.selectedCamera==null){await this.accessAutoselectedCamera(a);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{}}}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");},n.manualToAutofocusResumeTimeoutMs);let e=true,t=this.mediaStream.getVideoTracks();t.length>0&&typeof t[0].getConstraints=="function"&&(e=((i=t[0].getConstraints().advanced)==null?void 0:i.some(a=>a.focusMode==="manual"))===true),e?(await this.triggerFocusMode("continuous"),this.manualFocusWaitTimeout=window.setTimeout(async()=>{await this.triggerFocusMode("manual");},n.manualFocusWaitTimeoutMs)):await this.triggerFocusMode("manual");}async triggerManualFocusForSingleShot(){window.clearInterval(this.autofocusInterval),this.manualToAutofocusResumeTimeout=window.setTimeout(()=>{this.autofocusInterval=window.setInterval(this.triggerAutoFocus.bind(this),n.autofocusIntervalMs);},n.manualToAutofocusResumeTimeoutMs);try{await this.triggerFocusMode("single-shot");}catch{}}async triggerZoomMove(e){this.pinchToZoomDistance==null||(e==null?void 0:e.touches.length)!==2||e.preventDefault();}triggerZoomStart(e){var a,s,o,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||!((a=this.mediaTrackCapabilities)!=null&&a.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=(o=i.advanced.find(l=>"zoom"in l))==null?void 0:o.zoom;d!=null&&(this.pinchToZoomInitialZoom=typeof d=="number"?d:(c=d.ideal)!=null?c:1);}}updateActiveCameraCurrentResolution(e){this.videoElement.videoWidth>2&&this.videoElement.videoHeight>2&&(e.currentResolution={width:this.videoElement.videoWidth,height:this.videoElement.videoHeight}),e.deviceId!==""&&(this.activeCamera=e,this.setMirrorImageEnabled(this.isMirrorImageEnabled(),false));}async updateStreamForResolution(e,t){var i;if(this.mediaStream==null)await this.initializeCameraForResolution(e,t);else try{let a=(i=this.activeCameraSettings)==null?void 0:i.getProperty("preferredAspectRatio");a$1.debug("Setting new resolution for active camera video stream..."),await this.mediaStream.getVideoTracks()[0].applyConstraints(d.getUserMediaVideoParameters(t,a)),await new Promise(o=>{this.videoElement.addEventListener("timeupdate",()=>{o();},{once:true});});let s=this.mediaStream.getVideoTracks()[0].getSettings();a$1.debug("New active camera video stream resolution set",{width:s.width,height:s.height});}catch(a){if(t===4)throw a;await this.updateStreamForResolution(e,t+1);}}async videoTrackEndedRecovery(){if(document.visibilityState==="visible")try{a$1.debug('Detected video track "ended" event, try to reinitialize camera'),await this.reinitializeCamera();}catch{}else a$1.debug("Page is currently not visible, delay camera reinitialization until visible"),document.addEventListener("visibilitychange",this.checkCameraVideoStreamAccessIfVisibleListener);}videoTrackMuteRecovery(e){if(this.videoElement.onloadeddata!=null){a$1.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$1.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 a=i.getContext("2d",{alpha:false,willReadFrequently:false});return a?(t.addEventListener("play",this.drawClippedFrame.bind(this,this.clipArea,t,a),{once:true}),t.addEventListener("pause",this.cleanupClippedStream.bind(this,t),{once:true}),await t.play(),i.captureStream()):e}drawClippedFrame(e,t,i){i.drawImage(t,e.origin.x,e.origin.y,e.size.width,e.size.height,0,0,e.size.width,e.size.height),this.clippedFrameRequestID=this.requestVideoFrame(this.drawClippedFrame.bind(this,e,t,i),t);}cleanupClippedStream(e){this.clippedFrameRequestID&&(this.cancelVideoFrame(this.clippedFrameRequestID,e),this.clippedFrameRequestID=void 0);}connectedCallback(e){e.replaceWith(this.videoElement),this.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLostListener),this.videoElement.addEventListener("pause",this.handleVideoPauseHandler),this.playVideo();}disconnectedCallback(){this.canvas.removeEventListener("webglcontextlost",this.handleWebGLContextLostListener),this.videoElement.removeEventListener("pause",this.handleVideoPauseHandler),this.videoElement.remove(),this.videoElement.removeAttribute("width"),this.videoElement.removeAttribute("height"),this.videoElement.style.removeProperty("visibility");}getVideoElement(){return this.videoElement}handleVideoPause(){this.playVideo();}};n.autofocusIntervalMs=1500,n.cameraAccessTimeoutMs=4e3,n.getCapabilitiesTimeoutMs=500,n.manualFocusWaitTimeoutMs=400,n.manualToAutofocusResumeTimeoutMs=5e3,n.noCameraErrorParameters={name:"NoCameraAvailableError",message:"No camera available"},n.notReadableErrorParameters={name:"NotReadableError",message:"Could not initialize camera correctly"},n.videoMetadataCheckIntervalMs=50,n.videoMetadataCheckTimeoutMs=4e3,n.MIRRORED_CLASS_NAME=a$c.MIRRORED_CLASS_NAME,n._instance=null;var V=n;var v=class extends a{constructor(){super(...arguments);this.colorType="RGBA";}get _initialized(){return this._texture!=null&&this._framebuffer!=null}readFromSource(t){this._initialized||this.setup(),this.updateFrameSizeIfNeeded();let i=this._framePool.pop();return this._contextWebGL.texImage2D(this._contextWebGL.TEXTURE_2D,0,this._contextWebGL.RGBA,this._contextWebGL.RGBA,this._contextWebGL.UNSIGNED_BYTE,t),this._contextWebGL.readPixels(0,0,this._contextWebGL.drawingBufferWidth,this._contextWebGL.drawingBufferHeight,this._contextWebGL.RGBA,this._contextWebGL.UNSIGNED_BYTE,i),{width:this._contextWebGL.drawingBufferWidth,height:this._contextWebGL.drawingBufferHeight,data:i,frameId:E(),colorType:this.colorType}}setup(){this._texture=this._contextWebGL.createTexture(),this._texture==null&&a$1.warn("Could not create texture from WebGLRenderingContext"),this._contextWebGL.bindTexture(this._contextWebGL.TEXTURE_2D,this._texture),this._framebuffer=this._contextWebGL.createFramebuffer(),this._framebuffer==null&&a$1.warn("Could not create frameBuffer from WebGLRenderingContext"),this._contextWebGL.bindFramebuffer(this._contextWebGL.FRAMEBUFFER,this._framebuffer),this._contextWebGL.framebufferTexture2D(this._contextWebGL.FRAMEBUFFER,this._contextWebGL.COLOR_ATTACHMENT0,this._contextWebGL.TEXTURE_2D,this._texture,0),this._contextWebGL.texParameteri(this._contextWebGL.TEXTURE_2D,this._contextWebGL.TEXTURE_WRAP_S,this._contextWebGL.CLAMP_TO_EDGE),this._contextWebGL.texParameteri(this._contextWebGL.TEXTURE_2D,this._contextWebGL.TEXTURE_WRAP_T,this._contextWebGL.CLAMP_TO_EDGE),this._contextWebGL.texParameteri(this._contextWebGL.TEXTURE_2D,this._contextWebGL.TEXTURE_MIN_FILTER,this._contextWebGL.NEAREST),this._contextWebGL.texParameteri(this._contextWebGL.TEXTURE_2D,this._contextWebGL.TEXTURE_MAG_FILTER,this._contextWebGL.NEAREST);}dispose(){var t;this._texture!=null&&(this._contextWebGL.deleteTexture(this._texture),this._texture=null),this._framebuffer!=null&&(this._contextWebGL.deleteFramebuffer(this._framebuffer),this._framebuffer=null),(t=this._framePool)==null||t.empty();}updateFrameSizeIfNeeded(){var s;let{drawingBufferWidth:t,drawingBufferHeight:i}=this._contextWebGL,a=t*i*4;this._frameSize!==a&&(this._frameSize=a,(s=this._framePool)==null||s.empty(),this._framePool=new a$2({capacity:this._maxPoolCapacity,lowWaterMark:this._minPoolCapacity,createItem:()=>new Uint8ClampedArray(this._frameSize)}));}};export{v as a,T as b,B as c,H as d,E as e,Z as f,V as g};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e;(o=>{function i(){let r="8.2.1";return r}o.sdkVersion=i;})(e||(e={}));export{e as a};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import {a as a$4}from'./chunk-ACFJP5SR.js';import {a as a$7}from'./chunk-BBOKPRKO.js';import {a as a$a,c as c$2,b as b$3}from'./chunk-UERKPMRV.js';import {a as a$h}from'./chunk-BA3RP6L2.js';import {a as a$8}from'./chunk-AIC4H5KG.js';import {a as a$f}from'./chunk-KSCFPJAW.js';import {a as a$d}from'./chunk-JS3T7K2Z.js';import {b as b$2}from'./chunk-6H6FKGVE.js';import {a as a$c}from'./chunk-N5YZEC56.js';import {a as a$6}from'./chunk-VJB527QZ.js';import {a as a$5}from'./chunk-GHTCNOQN.js';import {a as a$1}from'./chunk-LXOZUOZU.js';import {a as a$e}from'./chunk-FGO2SSRS.js';import {g as g$1,e as e$1}from'./chunk-SYGWA3T6.js';import {a as a$9}from'./chunk-GPJEB376.js';import {b as b$1}from'./chunk-A225YZFY.js';import {c as c$1,e}from'./chunk-SBC5K7IT.js';import {a as a$3}from'./chunk-XR65N6EG.js';import {f}from'./chunk-3D2HNEVH.js';import {a as a$g}from'./chunk-WUHKODFA.js';import {a as a$2}from'./chunk-7SW2PEHB.js';import {a as a$b}from'./chunk-QCZSSQAQ.js';import {c}from'./chunk-TR3NGINC.js';var q=[{from:"unconfigured",to:"configuring"},{from:"configuring",to:"configured"},{from:"configuring",to:"unconfigured"},{from:"configured",to:"creating-context"},{from:"creating-context",to:"ready"},{from:"creating-context",to:"unconfigured"},{from:"ready",to:"unconfigured"},{from:"configured",to:"unconfigured"}];function v(C,e,t){let r=t.value;return t.value=function(...n){let i=g.stateMachine;return i.currentState==="ready"&&g.mainDataCaptureLoader!=null?r.apply(this,n):i.isInitializing||i.currentState==="configured"?i.waitForState("ready").then(()=>r.apply(this,n)):Promise.reject(new Error(`Please call DataCaptureContext.forLicenseKey() before calling ${String(e)}`))},t}function B(C){return C[a$h]!=null}function x(C){return "skipSerialization"in C||C[a$h]!=null}var U,$,G,a=class a{constructor(){this._asyncImageConverterInstance=void 0;this.framework="web";this.runtimeEnvironment={deviceOS:(U=b$1.getUserAgentInfo().getOS().name)!=null?U:"",browser:($=b$1.getUserAgentInfo().getBrowser().name)!=null?$:"",browserVersion:(G=b$1.getUserAgentInfo().getBrowser().version)!=null?G:"",get deviceModelName(){let{model:e,vendor:t}=b$1.getUserAgentInfo().getDevice();return (t==null||t==="")&&(t="Unknown"),(e==null||e==="")&&(e="Unknown"),[t,e].join(" ")}};this.settings=new a$2;this._frameSource=null;this._view=null;this.modes=new Set;this.components=[];this.listeners=[];this.updateListeners=new Set;this.cameraPropertiesReportListener=this.reportCameraProperties.bind(this);this.cameraAccessErrorListener=this.onCameraAccessError.bind(this);this.onWorkerMessageListener=this.onWorkerMessage.bind(this);this.onVisibilityChangeListener=this.onVisibilityChange.bind(this);this.pendingWorkerMessageListeners=new Set;this.delayedRegistration=false;this.highEndBlurryRecognition=false;this._frameHandlers=[];this._useSynchronousFrameFlow=false;}static get moduleLicenseTextProviders(){return [new b]}static get sharedInstance(){return a._sharedInstance==null&&(a._sharedInstance=new a),a._sharedInstance}static get currentState(){return a.stateMachine.currentState}static get isReady(){return a.stateMachine.currentState==="ready"}static get isInitializing(){return a.stateMachine.isInitializing}static addStateListener(e){a.stateMachine.addListener(e);}static removeStateListener(e){a.stateMachine.removeListener(e);}async initializeWithOptions(e){var t,r,n,i,s,o,u,c,p;a.deviceID===""&&(a.deviceID=await b$1.getDeviceId()),this.licenseKey=(r=(t=e.licenseKey)!=null?t:a.userLicenseKey)!=null?r:"",this.deviceName=(n=e.deviceName)!=null?n:"",this.dataCaptureInstance=(i=e.dataCaptureInstance)!=null?i:a.mainDataCaptureLoader,this.delayedRegistration=(s=e.delayedRegistration)!=null?s:false,e.settings!=null&&(this.settings=e.settings),this.highEndBlurryRecognition=(p=(c=(o=e.dataCaptureInstance)==null?void 0:o.highEndBlurryRecognition)!=null?c:(u=a.mainDataCaptureLoader)==null?void 0:u.highEndBlurryRecognition)!=null?p:false;for(let S of this.pendingWorkerMessageListeners)this.dataCaptureInstance.addWorkerListener(S);this.pendingWorkerMessageListeners.clear(),this.settings!=null&&await this.applySettings(this.settings),await this.createContext();}get frameSource(){return this._frameSource}get workerCommand(){if(this.dataCaptureInstance==null)throw new Error("Cannot call workerCommand before dataCaptureInstance is set");return this.dataCaptureInstance.workerCommand.bind(this.dataCaptureInstance)}static async forLicenseKey(e,t){return a$3.debug(`forLicenseKey called, current state: ${a.stateMachine.currentState}`),a.stateMachine.currentState==="ready"?(a$3.debug("DataCaptureContext is already ready, returning existing instance"),a.sharedInstance):a.stateMachine.isInitializing?(a$3.debug("DataCaptureContext is already initializing, waiting for completion"),await a.stateMachine.waitForState("ready"),a.sharedInstance):(a.stateMachine.currentState==="unconfigured"&&(a$3.debug("Starting initialization from unconfigured state"),await a.stateMachine.executeAsyncTransition({targetState:"configuring",action:async()=>{await a.internalConfigure(e,t);},onSuccess:"configured",onError:"unconfigured"}),await a.stateMachine.executeAsyncTransition({targetState:"creating-context",action:async()=>{await a.sharedInstance.initializeWithOptions({licenseKey:e,deviceName:t.deviceName,settings:t.settings});},onSuccess:"ready",onError:"unconfigured"})),a.sharedInstance)}static async internalConfigure(e$1,t){var S;a$4(),a$5.getInstance().updateIfMissing(a$6);let{forceAllPolyfills:r,overrideThreadsSupport:n,overrideSimdSupport:i}=a.getOverridesFromQueryString(),[s,o,u]=await Promise.all([a$7({forceAllPolyfills:r}),c$1(),e()]);n!=="auto"&&(a$3.warn(`Threads support override: was ${u} is now ${n==="on"}`),u=n==="on"),i!=="auto"&&(a$3.warn(`SIMD support override: was ${o} is now ${i==="on"}`),o=i==="on"),a.capabilityInfo={simdSupport:o,threadsSupport:u},a$3.debug(`Capability info detected - SIMD: ${o}, Threads: ${u}`),await a.validateOptions({...t,licenseKey:e$1});let c={licenseKey:e$1,libraryLocation:a$8(t.libraryLocation),moduleLoaders:t.moduleLoaders,logLevel:(S=t.logLevel)!=null?S:a$3.Level.Debug,verifyResponseHash:true,loadProgressNotifier:b$2.notify.bind(b$2),simdSupport:o,threadsSupport:u};a$3.setLevel(c.logLevel),a.userLicenseKey=c.licenseKey,a.libraryLocation=c.libraryLocation,b$2.subscribe(a.updateViewsWithProgress);let p=b$1.checkBrowserCompatibility();if(!p.fullSupport&&!p.scannerSupport)throw new a$9(p);b$1.isSupportedIOSVersion()||a$3.warn(`Warning: Minimum supported iOS version is 14.6.
|
|
2
|
-
Please check the minimum system requirements here:
|
|
3
|
-
https://docs.scandit.com/system-requirements#browser-compatibility`),a.dataCaptureLoaders=await a.loadModules(c.moduleLoaders,c),a.mainDataCaptureLoader=[...a.dataCaptureLoaders.entries()][0][1],b$2.unsubscribe(a.updateViewsWithProgress);}static async forLicenseKeyInElectronPath(e,t){if(!a$a())throw new a$b({name:"MisconfigurationError",message:"forLicenseKeyInElectronPath can only be used in Electron applications"});let r=await c$2({licenseDataPath:e});if(r==null)throw new a$b({name:"NoLicenseKeyError",message:`Cannot retrieve license key for Electron app at ${e}`});return a.forLicenseKey(r.licenseKey,{...t})}static updateViewsWithProgress({percentage:e}){for(let t of a$c.values())t.setProgressBarPercentage(e);}static getOverridesFromQueryString(){var s,o,u;function e(c){return ["auto","off","on"].includes(c)}let t=new URLSearchParams(window.location.search),[r="auto",n="auto",i=false]=[(s=t.get("pthreads"))==null?void 0:s.toLowerCase(),(o=t.get("simd"))==null?void 0:o.toLowerCase(),((u=t.get("forceAllPolyfills"))==null?void 0:u.toLowerCase())==="true"];return {overrideThreadsSupport:e(r)?r:"auto",overrideSimdSupport:e(n)?n:"auto",forceAllPolyfills:i}}static async validateOptions(e){if(e.licenseKey==null||e.licenseKey.trim().length<64)throw new a$b({name:"NoLicenseKeyError",message:"No license key provided"});if(typeof e.libraryLocation!="string")throw new a$b({name:"MisconfigurationError",message:'Option "libraryLocation" was not provided'});if(!Array.isArray(e.moduleLoaders)||e.moduleLoaders.length===0)throw new a$b({name:"MisconfigurationError",message:'Option "moduleLoaders" is missing or empty'});let t=e.moduleLoaders.map(r=>r.moduleName);if(!["BarcodeCapture","IdCapture","LabelCapture"].includes(t[0]))throw new a$b({name:"MisconfigurationError",message:'Main modules must be loaded before side modules. For example "BarcodeCapture" must be loaded before "Parser".'})}static async loadModules(e,t){let r=new Map,n=new Map;for(let i of e)n.set(i.moduleName,i.load(t));await Promise.all(n.values());for(let[i,s]of n)r.set(i,await s);return r}static async getOpenSourceSoftwareLicenseInfo(){let e=[];for(let r of a.moduleLicenseTextProviders){let n=await r.getLicenseText();e.push(n);}let t=e.join(`
|
|
4
|
-
|
|
5
|
-
`);return new a$d(t)}async setFrameSource(e){let t=e!==this._frameSource;if(this._frameSource!==null&&(this._frameSource.context=null),this._frameSource=e!=null?e:null,e&&(e.context=this,await this.workerCommand("setFrameSource",{mirrorAxis:this.getMirrorAxisForFrameSource(e),isCameraFrameSource:f(e)})),await this.update([{type:"frameSourceState",newValue:this.frameSource}]),t)for(let r of this.listeners)r.didChangeFrameSource&&r.didChangeFrameSource(this,this._frameSource);}addListener(e){this.listeners.includes(e)||this.listeners.push(e);}async flushAnalytics(){await this.workerCommand("flushAnalytics",{});}removeListener(e){this.listeners.includes(e)&&this.listeners.splice(this.listeners.indexOf(e),1);}async addMode(e){this.modes.add(e),await e.attachedToContext(this),this.updateCameraFrameFlow(),await this.update([],{updateContext:!x(e)});}async removeMode(e){this.modes.delete(e),await e.detachedFromContext(),this.updateCameraFrameFlow(),await this.update([],{updateContext:!x(e)});}async setMode(e){this.modes.has(e)||(this.modes.clear(),this.modes.add(e),await e.attachedToContext(this),this.updateCameraFrameFlow(),await this.update());}async removeCurrentMode(){for(let e of this.modes)await e.detachedFromContext();this.modes.clear(),await this.update();}async removeAllModes(){let e=Array.from(this.modes);for(let t of e)await this.removeMode(t);}async dispose(){if(a.stateMachine.currentState!=="unconfigured")try{await a.stateMachine.executeAsyncTransition({targetState:"unconfigured",action:async()=>{g$1.instance().removeListener("cameraProperties",this.cameraPropertiesReportListener),g$1.instance().removeListener("cameraAccessError",this.cameraAccessErrorListener),this.unsubscribeToVisibilityChange(this.onVisibilityChangeListener);for(let e of this.modes)await e.detachedFromContext();this._view&&(await this._view.setContext(null),this._view=null),this.dataCaptureInstance&&(await this.dataCaptureInstance.terminateDataCaptureWorker(true).catch(()=>{}),this.dataCaptureInstance=void 0),a.deviceID="";},onSuccess:"unconfigured",onError:"unconfigured"});}catch(e){if(a.stateMachine.currentState==="unconfigured")return;throw e}finally{this.modes.clear(),this.listeners=[],this.components.length=0,this.updateListeners.clear(),this.pendingWorkerMessageListeners.clear(),this.delayedRegistration=false,this.highEndBlurryRecognition=false,this._frameHandlers.length=0,this.frameSource&&(this.frameSource.context=null,this._frameSource=null),this.licenseKey="",this.deviceName="";}}async applySettings(e){this.settings=e,await this.update();}toJSONObject(){var e,t;return {licenseKey:this.licenseKey,framework:this.framework,deviceName:this.deviceName,...this.runtimeEnvironment,modes:[...this.modes].filter(r=>!x(r)).map(r=>r.toJSONObject()),components:this.components.map(r=>r.toJSONObject()),frameSource:this.frameSource?this.frameSource.toJSONObject():null,settings:this.settings.toJSONObject(),view:(t=(e=this._view)==null?void 0:e.toJSONObject())!=null?t:null}}getView(){return this._view}async setView(e){return this._view=e,this.update([{type:"viewSet",newValue:e}])}async getAppName(){let e=null;if(a$a()){let t=await b$3();if((t==null?void 0:t.appName)==null||t.appName==="")throw new Error("Cannot retrieve electron appName. Did you set it up in package.json? https://www.electronjs.org/docs/latest/api/app#appgetname");e=t.appName;}return e}urlToHostname(e){try{return new URL(e!=null?e:"").hostname}catch{return ""}}getParentDomain(){var t;let e="";return parent!==window&&(e||(e=this.urlToHostname((t=location.ancestorOrigins)==null?void 0:t[0])),e||(e=this.urlToHostname(document.referrer)),e||(e="")),e.startsWith("[")&&e.endsWith("]")&&(e=e.slice(1,-1)),e}async createContext(){await this.workerCommand("createContext",{context:this.toJSONObject(),deviceId:a.deviceID,delayedRegistration:this.delayedRegistration,highEndBlurryRecognition:this.highEndBlurryRecognition,appName:await this.getAppName(),parentDomain:this.getParentDomain()}),this.subscribeToWorkerMessages(this.onWorkerMessageListener),this.subscribeToCameraManagerEvents(),this.subscribeToVisibilityChange(this.onVisibilityChangeListener),this._view!=null&&await this.setView(this._view),this.frameSource!=null&&await this.setFrameSource(this.frameSource);}subscribeToVisibilityChange(e){document.addEventListener("visibilitychange",e);}unsubscribeToVisibilityChange(e){document.removeEventListener("visibilitychange",e);}async requestFrameData(e){return this.workerCommand("requestFrameData",{frameId:e})}performanceMark(e){a$e(globalThis.performance)&&typeof globalThis.performance.mark=="function"&&performance.mark(e);}async sendFrameToProcessor(e){var n,i;let t=e instanceof ImageData?{data:e.data,width:e.width,height:e.height,frameId:(n=e.frameId)!=null?n:e$1(),colorType:(i=e.colorType)!=null?i:"RGBA"}:e,r=await this.sendFrameToHandlers(t);return t.data=r.capture.data,r.skip?r.capture:(this.performanceMark("processFrameBeforeSDC"),this.sendFrameToSDC(t))}async sendFrameToHandlers(e){for(let t of this._frameHandlers)if((await t(e)).action==="skip")return {skip:true,capture:e};return {skip:false,capture:e}}async sendFrameToSDC(e){return this.workerCommand("processFrame",e,[e.data.buffer])}registerFrameHandler(e){this._frameHandlers.includes(e)||this._frameHandlers.push(e);}unregisterFrameHandler(e){this._frameHandlers.includes(e)&&this._frameHandlers.splice(this._frameHandlers.indexOf(e),1);}onVisibilityChange(){this.workerCommand("documentVisibility",{state:document.visibilityState});}getImageConverterInstance(e){return this._asyncImageConverterInstance==null&&(this._asyncImageConverterInstance=new a$f(e)),this._asyncImageConverterInstance}onWorkerMessage(e){if(e.type==="contextDidChangeStatus"){e.payload.isValid||a$3.error(e.payload);for(let t of this.listeners)t.didChangeStatus&&t.didChangeStatus(this,a$g.fromJSON(e.payload));}if(e.type==="didStartObservingContext")for(let t of this.listeners)t.didStartObservingContext&&t.didStartObservingContext(this);e.type==="onFrameProcessingFinished"&&this.performanceMark("processFrameAfterSDC"),e.type==="convertToJPEG"&&this.convertImageToJPEG(e);}async convertImageToJPEG(e){let{imageId:t,width:r,height:n,data:i,planes:s,orientation:o,quality:u}=e,c={getWidth:()=>r,getHeight:()=>n,getPlanes:()=>s,toBitmap:()=>i,getBitmapRepresentationFromYUV:()=>{throw new Error("Not implemented")},deepCopy:()=>{throw new Error("Not implemented")}},p=await this.getImageConverterInstance({quality:u}).convertToJpeg(c,o);return this.workerCommand("convertToJPEGResult",{imageId:t,result:p})}subscribeToCameraManagerEvents(){g$1.instance().addListener("cameraProperties",this.cameraPropertiesReportListener),g$1.instance().addListener("cameraAccessError",this.cameraAccessErrorListener);}async reportCameraProperties(e){return this.workerCommand("reportCameraProperties",e)}onCameraAccessError(e){for(let t of this.listeners)t.didChangeStatus&&t.didChangeStatus(this,a$g.fromJSON({code:33794,isValid:true,message:typeof(e==null?void 0:e.toString)=="function"?e.toString():"Unknown error"}));}async update(e=[],{updateContext:t=true}={}){var r,n;t&&await this.updateContext();for(let i of e){switch(i.type){case "frameSourceState":{await((r=this._view)==null?void 0:r.onFrameSourceChange(this.frameSource));break}case "singleImageModeUploaderSettings":{(n=this._view)==null||n.onSingleImageUploaderSettingsChange(i.newValue);break}case "addOverlay":{await this.addNativeOverlay(i.newValue);break}case "removeOverlay":{await this.removeNativeOverlay(i.newValue);break}}for(let s of this.updateListeners){let o=s(i);o instanceof Promise&&await o;}}}async updateContext(){await this.workerCommand("updateContext",{context:this.toJSONObject(),...this.getViewInfo()}).catch(e=>a$3.warn("Error while updating context:",e,this.toJSONObject()));}getViewInfo(){return this._view!=null?{view:{width:this._view.width,height:this._view.height,visible:this._view.width>0&&this._view.height>0,orientation:this._view.orientation}}:{view:null}}getMirrorAxisForFrameSource(e){let t="None";return f(e)&&e.getMirrorImageEnabled()&&(t="Y"),t}async addComponent(e){if(!this.components.includes(e))return this.components.push(e),e._context=this,this.update()}async addNativeOverlay(e){if(B(e))return this.workerCommand("addNativeOverlay",{overlayHandle:e[a$h]})}async removeNativeOverlay(e){if(B(e))return this.workerCommand("removeNativeOverlay",{overlayHandle:e[a$h]})}subscribeToWorkerMessages(e){this.dataCaptureInstance?this.dataCaptureInstance.addWorkerListener(e):this.pendingWorkerMessageListeners.add(e);}unsubscribeToWorkerMessages(e){this.dataCaptureInstance&&this.dataCaptureInstance.removeWorkerListener(e),this.pendingWorkerMessageListeners.delete(e);}hasEnabledMode(){return [...this.modes].some(e=>e.isEnabled())}updateCameraFrameFlow(){let e=[...this.modes].some(t=>t._synchronousFrameFlow===true);g$1.instance().setFrameHandling(e);}async isFeatureSupported(e){return (await this.workerCommand("isFeatureSupported",{feature:e})).supported}};a.deviceID="",a.stateMachine=new a$1("unconfigured",q),a.mainDataCaptureLoader=void 0,a.dataCaptureLoaders=new Map,a.libraryLocation=void 0,a.userLicenseKey=null,a.capabilityInfo=void 0,c([v],a.prototype,"setFrameSource",1),c([v],a.prototype,"addMode",1),c([v],a.prototype,"removeMode",1),c([v],a.prototype,"setMode",1),c([v],a.prototype,"removeCurrentMode",1),c([v],a.prototype,"isFeatureSupported",1);var g=a;var b=class{constructor(e=g,t=a$3,r=globalThis.fetch.bind(globalThis)){this.staticContext=g;this.staticContext=e,this.logger=t,this.fetch=r;}get workerCommand(){var e;return (e=this.staticContext.mainDataCaptureLoader)==null?void 0:e.workerCommand.bind(this.staticContext.mainDataCaptureLoader)}async getLicenseText(){var i,s;let e=this.staticContext.stateMachine.currentState;if(e==="unconfigured"||e==="configuring")return this.logger.warn('You must call "DataCaptureContext.forLicenseKey" before retrieving open source license text info.'),"";let t=new URL(`${((i=this.staticContext.libraryLocation)!=null?i:"").replace(/\/$/,"")}/license/web-core-license.txt`),[r,n]=await Promise.all([(s=this.workerCommand)==null?void 0:s.call(this,"getOpenSourceSoftwareLicenseInfo",{}),this.fetchWebLicenseText(t.toString())]);return [r==null?void 0:r.licenseText,n].filter(o=>o!=null).join(`
|
|
6
|
-
`)}async fetchWebLicenseText(e){return this.fetch(e,{mode:"cors",credentials:"include",headers:{"Content-Type":"text/plain"}}).then(async t=>{if(!t.ok)throw new Error(`${t.status} ${t.statusText}`);return t.text()}).catch(t=>(this.logger.warn(`Failed to fetch license from ${e}: ${t.toString()}`),null))}};export{b as a,g as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-TPHGDMKG.js';import {a as a$2}from'./chunk-LSZZVJ6B.js';function a(){let i=a$2`@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$2`.${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:#00000080;text-align:center;z-index:6}.${a$1.CAMERA_RECOVERY_CLASS_NAME}[hidden],.${a$1.ERROR_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%}`,A=a$2`.${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$2`.${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 [i,o,A,n]}export{a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {c,a as a$1,b}from'./chunk-JFRSUCMO.js';import {a as a$3}from'./chunk-EQRBQJYM.js';import {a as a$2}from'./chunk-GHTCNOQN.js';import {e}from'./chunk-SYGWA3T6.js';import {a as a$4}from'./chunk-XR65N6EG.js';var a=class a{constructor(e){this.canUploadFile=false;this._mounted=false;this._loading=false;this._htmlRoot=void 0;this._canvas=void 0;this._onInputCheck=void 0;this._onBeforeFileRead=void 0;this._onImageLoadError=void 0;this._onFileReaderError=void 0;this._onCaptureReady=void 0;this._resizedImageSizeLimit=1440;this._inputElement=void 0;this._buttonElement=void 0;this._informationElement=void 0;this._chooseImageText="";this._localizationSubscription=void 0;this._onLocalizationUpdated=this.onLocalizationUpdated.bind(this);this._settings=e;}get canvas(){return this._canvas||(this._canvas=document.createElement("canvas")),this._canvas}get canvasContext(){return this._canvasContext||(this._canvasContext=this.canvas.getContext("2d",{willReadFrequently:true})),this._canvasContext}mount(e){var g;if(this._mounted)return;if(!document.head.querySelector(`[data-component=${a.componentName}]`)){let s=document.createElement("style");s.dataset.component=a.componentName,s.textContent=c,document.head.append(s);}let t=document.createElement("div");t.className=a$1.SINGLE_IMAGE_UPLOADER_CONTAINER,Object.assign(t.style,b.SINGLE_IMAGE_UPLOADER_CONTAINER_STYLE,this._settings.containerStyle),e.append(t);let{iconElement:n,iconStyle:r,informationElement:i,informationStyle:l,buttonElement:d,buttonStyle:h,onlyCameraCapture:p}=this._settings;Object.assign(n.style,b.SINGLE_IMAGE_UPLOADER_ICON_STYLE,r,{maxWidth:"100px",maxHeight:"100px"}),t.append(n),i.hasAttribute(a.DEFAULT_DOM_ATTRIBUTE)&&(Object.assign(i.style,b.SINGLE_IMAGE_UPLOADER_INFORMATION_STYLE,l),i.textContent=a$2.getInstance().get("core.singleImageUploader.title")),t.append(i);let o=document.createElement("input");o.type="file",o.accept="image/*",p&&(o.capture="environment",o.dataset.onlyCaptureOnMobile="environment"),o.addEventListener("change",s=>{this.onFileUpload(s);}),o.addEventListener("click",s=>{var m;(m=this._onInputCheck)==null||m.call(this,s);}),o.addEventListener("keydown",s=>{var m;(m=this._onInputCheck)==null||m.call(this,s);});let v=document.createElement("label");v.append(o),d.hasAttribute(a.DEFAULT_DOM_ATTRIBUTE)&&Object.assign(d.style,b.SINGLE_IMAGE_UPLOADER_BUTTON_STYLE,h),v.append(d),t.append(v);let E=document.createRange().createContextualFragment(atob(a$3)).firstElementChild;Object.assign(E.style,{position:"absolute",bottom:"1em",right:"1em",width:"10em"}),t.append(E),this._htmlRoot=t,this._mounted=true,this._inputElement=o,this._buttonElement=d,this._chooseImageText=(g=d.textContent)!=null?g:"",this._informationElement=i,this._localizationSubscription=a$2.getInstance().subscribe(this._onLocalizationUpdated);}unmount(){var e,t,n;this._mounted&&((e=this._htmlRoot)==null||e.remove(),(t=document.head.querySelector(`[data-component=${a.componentName}]`))==null||t.remove(),(n=this._localizationSubscription)==null||n.cancel(),this._mounted=false);}setButtonState(e){this._inputElement&&(this._inputElement.disabled=e==="disabled");}getButtonState(){return this._inputElement?this._inputElement.disabled?"disabled":"enabled":"disabled"}onInputCheck(e){this._onInputCheck=e;}onBeforeFileRead(e){this._onBeforeFileRead=e;}onImageLoadError(e){this._onImageLoadError=e;}onFileReaderError(e){this._onFileReaderError=e;}onCaptureReady(e){this._onCaptureReady=e;}onAfterImageProcessed(){this.setLoading(false);}onLocalizationUpdated(){var e,t;(e=this._buttonElement)!=null&&e.hasAttribute(a.DEFAULT_DOM_ATTRIBUTE)&&(this._buttonElement.textContent=a$2.getInstance().get("core.singleImageUploader.button")),(t=this._informationElement)!=null&&t.hasAttribute(a.DEFAULT_DOM_ATTRIBUTE)&&(this._informationElement.textContent=a$2.getInstance().get("core.singleImageUploader.title"));}setLoading(e){this._buttonElement&&(this.setButtonState(e?"disabled":"enabled"),this._buttonElement.textContent=e?"...":this._chooseImageText,this._loading=e);}getResizedImageDimensions(e,t){return e<=this._resizedImageSizeLimit&&t<=this._resizedImageSizeLimit?{width:e,height:t}:e>t?{width:this._resizedImageSizeLimit,height:Math.round(t/e*this._resizedImageSizeLimit)}:{width:Math.round(e/t*this._resizedImageSizeLimit),height:this._resizedImageSizeLimit}}onImageLoad(e$1){var i;let{height:t,width:n}=this.getResizedImageDimensions(e$1.naturalWidth,e$1.naturalHeight);this.canvasContext.canvas.width=n,this.canvasContext.canvas.height=t,this.canvasContext.drawImage(e$1,0,0,n,t);let r={data:this.canvasContext.getImageData(0,0,n,t).data,frameId:e(),width:n,height:t};(i=this._onCaptureReady)==null||i.call(this,r);}onFileReaderLoad(e,t,n){e.value="",t.result!=null&&(n.addEventListener("load",()=>{this.onImageLoad(n);},{once:true}),n.addEventListener("error",r=>{var i;(i=this._onImageLoadError)==null||i.call(this,r),this.setLoading(false);},{once:true}),n.src=t.result);}async onFileUpload(e){var d;this.setLoading(true);let t=e.currentTarget,{files:n}=t;if(n==null||n.length===0){this.setLoading(false);return}let r=(d=this._onBeforeFileRead)==null?void 0:d.call(this,e);if(r instanceof Promise&&await r,!this.canUploadFile){t.value="",a$4.warn("Can't upload file, no capture mode enabled."),this.setLoading(false);return}let i=new Image,l=new FileReader;l.addEventListener("load",()=>{this.onFileReaderLoad(t,l,i);}),l.addEventListener("error",h=>{var p;(p=this._onFileReaderError)==null||p.call(this,h),this.setLoading(false);}),l.readAsDataURL(n[0]);}};a.componentName="SingleImageUploaderView",a.DEFAULT_DOM_ATTRIBUTE="data-scandit-default";var C=a;export{C as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {b as b$2}from'./chunk-QUBJJDLC.js';import {a as a$a}from'./chunk-DGIQ3GF7.js';import {a as a$9}from'./chunk-U7ETOWGJ.js';import {b,a as a$4}from'./chunk-XYZYNUX3.js';import {a as a$h}from'./chunk-VQYVIA64.js';import {a as a$j}from'./chunk-UOQFOEG6.js';import {a as a$b}from'./chunk-TPHGDMKG.js';import {a as a$f}from'./chunk-GPPCTFZF.js';import {a as a$l}from'./chunk-Y7V35LNT.js';import {b as b$1}from'./chunk-24MGHMOY.js';import {a as a$e}from'./chunk-DTREAYZQ.js';import {a as a$g}from'./chunk-XIAF6V7E.js';import {a as a$c}from'./chunk-KYNYQBNF.js';import {a as a$7}from'./chunk-RSQRPDVQ.js';import {a}from'./chunk-UQVVJP5Z.js';import {a as a$6}from'./chunk-IJQG3OU6.js';import {a as a$8}from'./chunk-I6SWF3FQ.js';import {a as a$3}from'./chunk-N5YZEC56.js';import {a as a$2}from'./chunk-VJB527QZ.js';import {a as a$1}from'./chunk-GHTCNOQN.js';import {a as a$d}from'./chunk-UWBNF47P.js';import {g}from'./chunk-SYGWA3T6.js';import {a as a$n}from'./chunk-E4XJ4GKD.js';import {a as a$k}from'./chunk-QOCHMKNY.js';import {a as a$5}from'./chunk-KAFNKP6O.js';import {a as a$i}from'./chunk-XR65N6EG.js';import {a as a$m}from'./chunk-WUHKODFA.js';var P="core.camera.recovery",q=class ${constructor(){this.focusGesture=a.focusGesture;this.zoomGesture=a.zoomGesture;this._scanAreaMargins=a.scanAreaMargins;this._pointOfInterest=a.pointOfInterest;this._logoStyle=a.logoStyle;this._logoAnchor=a.logoAnchor;this._logoOffset=a.logoOffset;this._context=null;this.overlays=new Set;this.controls=new Set;this.frameSourceListener={didChangeState:this.onFrameSourceChange.bind(this)};this._previewCamera=null;this.isConnected=false;this.controlsElement=void 0;this.frozenFrameCanvas=document.createElement("canvas");this.listeners=[];this.isVideoElementDetached=false;this.orientation="portrait";this.hiddenProperties={stopVideoTracksOnVisibilityChange:true,freezeFrameWhenStoppingFrameSource:true};this.orientationObserver=new b;this.onOrientationChangeListener=this.onOrientationChange.bind(this);this.onHintPresenterUpdateHandler=this.onHintPresenterUpdate.bind(this);this.onViewFinderUpdateRequestedHandler=this.onViewFinderUpdateRequested.bind(this);this.onWorkerMessageHandler=this.onWorkerMessage.bind(this);this.htmlElementDidChangeHandler=this.htmlElementDidChange.bind(this);this.htmlElementDisconnectedHandler=this.htmlElementDisconnected.bind(this);this.notificationPresenter=null;this.visibilityListener=this.onVisibilityChange.bind(this),this.cameraRecoveryListener=this.cameraRecovery.bind(this),a$1.getInstance().updateIfMissing(a$2);}get videoElement(){return g.instance().getVideoElement()}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$1.getInstance().get(P)}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 $;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&&t.hasModes()))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,t){var i,n,r,a;this.isConnected||(this.orientationObserver.register(),this.setupHtmlElement(e),(i=this.canvasDrawer)==null||i.startObservingCanvasResize(),this.htmlElementDidChange(),a$3.add(this),this.orientation=this.orientationObserver.orientation.value,this.orientationObserver.addEventListener(a$4,this.onOrientationChangeListener),(n=this.hintPresenter)==null||n.addEventListener("hintpresenterupdate",this.onHintPresenterUpdateHandler),(r=this.hintPresenter)==null||r.addEventListener("hintpresenterviewfinderupdaterequested",this.onViewFinderUpdateRequestedHandler),this.localizationSubscription=a$1.getInstance().subscribe(s=>{s[P]!=null&&(this.cameraRecoveryElement.textContent=s[P]);}),this._previewCamera=(a=t==null?void 0:t.camera)!=null?a:null,this._previewCamera&&(this._previewCamera.addListener(this.frameSourceListener),this.onFrameSourceChange(this._previewCamera)),this.updateControls(),this.isConnected=true);}detachFromElement(){var e,t,i,n,r,a,s,h;if(this.isConnected){(e=this.htmlElementState)==null||e.removeListeners(),this.removeStyles(),(t=this.canvasDrawer)==null||t.endObservingCanvasResize(),document.removeEventListener("visibilitychange",this.visibilityListener);for(let m of ["touchend","mousedown"])this.cameraRecoveryElement.removeEventListener(m,this.cameraRecoveryListener);(i=this.loadingOverlay)==null||i.remove(),(n=this.customLocationsView)==null||n.unmount(),this.notificationPresenter=null,this.htmlElementDidChange(),(r=this.gestureRecognizer)==null||r.removeAllListeners(),this.clearHtmlElementContent(),a$3.delete(this),this.orientationObserver.unregister(),this.orientationObserver.removeEventListener(a$4,this.onOrientationChangeListener),(a=this.hintPresenter)==null||a.removeEventListener("hintpresenterupdate",this.onHintPresenterUpdateHandler),(s=this.hintPresenter)==null||s.removeEventListener("hintpresenterviewfinderupdaterequested",this.onViewFinderUpdateRequestedHandler),(h=this.localizationSubscription)==null||h.cancel(),g.instance().disconnectedCallback(),this._previewCamera&&(this._previewCamera.removeListener(this.frameSourceListener),this._previewCamera=null);for(let m of this.controls)this.removeControl(m);this.isConnected=false;}}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,view:this}])));}async removeOverlay(e){var t;this.overlays.has(e)&&(await((t=this.privateContext)==null?void 0:t.update([{type:"removeOverlay",newValue:e,view:this}])),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 u,L,V,D,F,R,M,A;let t={width:(L=(u=this.htmlElementState)==null?void 0:u.width)!=null?L:0,height:(D=(V=this.htmlElementState)==null?void 0:V.height)!=null?D:0},i={width:(R=(F=this.videoElement)==null?void 0:F.videoWidth)!=null?R:0,height:(A=(M=this.videoElement)==null?void 0:M.videoHeight)!=null?A:0},n=t.width/t.height,r=i.width/i.height,a=n>r?t.width/i.width:t.height/i.height,s={x:e.x*a,y:e.y*a},h=(i.width*a-t.width)/2,m=(i.height*a-t.height)/2;return new a$5(s.x-h,s.y-m)}viewQuadrilateralForFrameQuadrilateral(e){let t=this.viewPointForFramePoint(e.topLeft),i=this.viewPointForFramePoint(e.topRight),n=this.viewPointForFramePoint(e.bottomLeft),r=this.viewPointForFramePoint(e.bottomRight);return new a$6(t,i,r,n)}addControl(e){this.controls.has(e)||(this.controls.add(e),e.install(this).then(t=>{var i;t&&((i=this.privateContext)==null||i.update([{type:"addControl",newValue:e}]));}));}removeControl(e){var t;this.controls.has(e)&&(e.remove(true),this.controls.delete(e),(t=this.privateContext)==null||t.update([{type:"removeControl",newValue:e}]));}toJSONObject(){var e;return {scanAreaMargins:this.scanAreaMargins.toJSONObject(),pointOfInterest:this.pointOfInterest.toJSONObject(),logoAnchor:this.logoAnchor,logoOffset:this.logoOffset.toJSONObject(),logoHidden:(e=this.logoHidden)!=null?e:false,logoStyle:this.logoStyle,overlays:[...this.overlays].map(t=>t.toJSONObject()),controls:[...this.controls].map(t=>t.toJSONObject()),focusGesture:this.focusGesture?this.focusGesture.toJSONObject():null,zoomGesture:this.zoomGesture?this.zoomGesture.toJSONObject():null}}isCameraRecoveryVisible(){return !this.cameraRecoveryElement.hidden}setCameraRecoveryVisible(e){this.cameraRecoveryElement.hidden=!e;}async allowPictureInPicture(e){await g.instance().allowPictureInPicture(e);}viewAnchorPositionsForFrameAnchorPositions(e){let t=this.viewPointForFramePoint(e.topLeft),i=this.viewPointForFramePoint(e.topRight),n=this.viewPointForFramePoint(e.bottomLeft),r=this.viewPointForFramePoint(e.bottomRight),a=this.viewPointForFramePoint(e.centerLeft),s=this.viewPointForFramePoint(e.centerRight),h=this.viewPointForFramePoint(e.topCenter),m=this.viewPointForFramePoint(e.bottomCenter),u=this.viewPointForFramePoint(e.center);return new a$7(t,i,r,n,a,h,s,m,u)}setDidTapCustomLocationsViewListener(e){this.customLocationsView&&this.customLocationsView.listener===null&&(this.customLocationsView.listener=e);}renderCustomLocationsView(e){this.customLocationsView!=null&&(this.customLocationsView.setMirrored(g.instance().isMirrorImageEnabled()),Object.keys(e).includes("removedIds")?this.customLocationsView.render(e):this.customLocationsView.renderDomView(e));}getNotificationPresenter(){var e;if(!this.notificationPresenter){let t=(e=this.htmlElement)==null?void 0:e.querySelector(b$2.tag);if(!t)throw new Error("Notification presenter cannot be found. Please ensure the DataCaptureView is connected.");this.notificationPresenter=new a$8(t);}return this.notificationPresenter}removeStyles(){for(let e of document.querySelectorAll("style[scandit]"))e.remove();}onHintPresenterUpdate(e){var t;(t=this.privateContext)==null||t.workerCommand("hintPresenterV2update",{});}async onViewFinderUpdateRequested(e){var i;let t=await((i=this.privateContext)==null?void 0:i.workerCommand("getViewfinderInfo",{}));t!=null&&this.updateHintPresenterViewFinderRect(t.rect);}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 r,a,s;this.createStyles(),this.htmlElement=e,b$2.register(),a$9.register(),a$a.register();let t=a$d`<div class="${a$b.CONTAINER_CLASS_NAME}"><div class="${a$b.PAINTBOARDS_CONTAINER_CLASS_NAME}"><div data-js-id="loading-overlay"></div><div class="${a$b.PAINTBOARD_CLASS_NAME}" data-js-id="camera-paintboard"><div data-js-id="video-container"></div><img class="${a$b.FROZEN_FRAME}" data-js-id="frozen-frame" alt="frozen-frame" hidden /><canvas></canvas><div data-js-id="${a$c.CUSTOM_VIEW_CONTAINER}"></div><${b$2.tag}></${b$2.tag}><${a$9.tag}></${a$9.tag}><div class="${a$b.CAMERA_RECOVERY_CLASS_NAME}" hidden>${this.cameraRecoveryText}</div><div class="${a$b.ERROR_CLASS_NAME}" hidden></div></div><div class="${a$b.PAINTBOARD_CLASS_NAME}" data-js-id="singleimage-paintboard"></div></div></div>`;this.htmlElement.innerHTML=t,g.instance().connectedCallback(this.htmlElement.querySelector('[data-js-id="video-container"]')),this.isVideoElementDetached=false,this.hintPresenter=this.htmlElement.querySelector(b$2.tag),this.notificationPresenter=this.hintPresenter?new a$8(this.hintPresenter):null,this.loadingOverlay&&this.loadingOverlay.remove(),this.loadingOverlay=a$a.create(),this.loadingOverlay.hide(),(r=this.htmlElement.querySelector('[data-js-id="loading-overlay"]'))==null||r.replaceWith(this.loadingOverlay),this.customLocationsView&&this.customLocationsView.unmount(),this.customLocationsView=new a$e,this.customLocationsView.mount(this.htmlElement.querySelector(`[data-js-id="${a$c.CUSTOM_VIEW_CONTAINER}"]`)),this.customLocationsView.mapViewAnchorPositionsForFramePoint=h=>this.viewAnchorPositionsForFrameAnchorPositions(h),this.containerElement=this.htmlElement.querySelector(`.${a$b.CONTAINER_CLASS_NAME}`),this.cameraPaintboardElement=this.containerElement.querySelector('[data-js-id="camera-paintboard"]'),this.singleImageUploaderPaintboardElement=this.containerElement.querySelector('[data-js-id="singleimage-paintboard"]');let i=this.cameraPaintboardElement.querySelector("canvas");this.canvasElement==null?this.canvasElement=i:i.replaceWith(this.canvasElement);let n=this.cameraPaintboardElement.querySelector('[data-js-id="frozen-frame"]');this.frozenFrame==null?this.frozenFrame=n:n.replaceWith(this.frozenFrame),this.controlsElement=this.cameraPaintboardElement.querySelector(a$9.tag),this.cameraRecoveryElement=this.cameraPaintboardElement.querySelector(`.${a$b.CAMERA_RECOVERY_CLASS_NAME}`),this.errorElement=this.cameraPaintboardElement.querySelector(`.${a$b.ERROR_CLASS_NAME}`),this.lastFrameSourceState!=null&&((s=(a=this._context)==null?void 0:a.frameSource)==null||s.switchToDesiredState(this.lastFrameSourceState)),document.addEventListener("visibilitychange",this.visibilityListener);for(let h of ["touchend","mousedown"])this.cameraRecoveryElement.addEventListener(h,this.cameraRecoveryListener);this.htmlElementState&&this.htmlElementState.removeListeners(),this.htmlElementState=new a$f(this.htmlElement),this.htmlElementState.onStateChanged(this.htmlElementDidChangeHandler),this.htmlElementState.onDisconnected(this.htmlElementDisconnectedHandler),this.gestureRecognizer=new a$g(this.htmlElement),this.gestureRecognizer.addListener({onTap:async h=>{var m;(m=this.privateContext)==null||m.workerCommand("onTap",{point:h.toJSONObject()});}});}setupHtmlElementSingleImageUploader(e){var i;if(this.singleImageUploaderPaintboardElement==null)return;this.singleImageUploaderView&&this.singleImageUploaderView.unmount(),this.singleImageUploaderView=new a$h(e),this.singleImageUploaderView.mount(this.containerElement.querySelector('[data-js-id="singleimage-paintboard"]'));let t=(i=this._context)==null?void 0:i.frameSource;this.singleImageUploaderView.onInputCheck(n=>{t.getCurrentState()!=="starting"&&n.preventDefault();}),this.singleImageUploaderView.onBeforeFileRead(()=>{t._context&&this.singleImageUploaderView&&(this.singleImageUploaderView.canUploadFile=t._context.hasEnabledMode());}),this.singleImageUploaderView.onImageLoadError(()=>{t.currentState="starting",a$i.log(a$i.Level.Error,"Could not load image from selected file");}),this.singleImageUploaderView.onFileReaderError(n=>{var a,s;let r=n.target;t.currentState="starting",a$i.log(a$i.Level.Error,`Error while reading the file: ${(s=(a=r.error)==null?void 0:a.toString())!=null?s:""}`);}),this.singleImageUploaderView.onCaptureReady(async n=>{await t.processUploadedFileCapture(n);}),this.singleImageUploaderView.setButtonState(t.getCurrentState()==="starting"?"enabled":"disabled"),t.addView(this.singleImageUploaderView);}setupHtmlElementVisibility(e){this.cameraPaintboardElement!=null&&(this.cameraPaintboardElement.hidden=e!=="camera"),this.singleImageUploaderPaintboardElement!=null&&(this.singleImageUploaderPaintboardElement.hidden=e!=="singleImageUploader");}createStyles(){if(document.querySelector("style[scandit]")===null){let e=a$j();for(let[t,i]of Object.entries(e))i.setAttribute("scandit",`data-capture-sdk-${t}`),document.head.append(i);}}async onOrientationChange(e){var t,i;this.orientation=e.detail.value,await((i=this.privateContext)==null?void 0:i.update([{type:"viewChange",newValue:{...(t=this.htmlElementState)==null?void 0:t.toJSONObject(),orientation:this.orientation}}]));}htmlElementDidChange(){var i,n;if(!this.htmlElementState)return;let e=this.htmlElementState,t=e.toJSONObject();if(!a$f.areEquivalentJSONStates(this.lastHtmlElementState,t)){this.orientation=this.orientationObserver.orientation.value,(i=this.privateContext)==null||i.update([{type:"viewChange",newValue:{...e.toJSONObject(),orientation:this.orientation}}]),this.lastHtmlElementState=t,(n=this.canvasDrawer)==null||n.updateCanvasSizeAttributes(this.width,this.height),this.handleVideoDisplay(t.visible);for(let r of this.listeners)typeof r.didChangeSize=="function"&&r.didChangeSize(this,new a$k(t.size.width.value,t.size.height.value),this.orientation);}}async htmlElementDisconnected(){var e,t,i,n,r,a;g.instance().disconnectedCallback(),this.lastFrameSourceState=(t=(e=this._context)==null?void 0:e.frameSource)==null?void 0:t.getCurrentState(),await((n=(i=this._context)==null?void 0:i.frameSource)==null?void 0:n.switchToDesiredState("off")),await((a=this.privateContext)==null?void 0:a.update([{type:"viewChange",newValue:{...(r=this.htmlElementState)==null?void 0:r.toJSONObject(),orientation:this.orientation}}])),this.isConnected=false;}handleVideoDisplay(e){this.videoElement==null||this.cameraPaintboardElement==null||(!e&&!this.isVideoElementDetached?(this.videoElement.width=0,this.videoElement.height=0,this.videoElement.style.opacity="0",this.videoElement.style.visibility="hidden",document.body.append(this.videoElement),this.isVideoElementDetached=true):e&&this.isVideoElementDetached&&(this.cameraPaintboardElement.insertAdjacentElement("afterbegin",this.videoElement),this.isVideoElementDetached=false,this.videoElement.style.removeProperty("visibility"),this.videoElement.removeAttribute("width"),this.videoElement.removeAttribute("height"),this.videoElement.style.removeProperty("opacity")));}isCanvasDrawerWithMetrics(e){return e instanceof a$l}onWorkerMessage(e){var t,i;switch(e.type){case "draw":{this.drawEngineCommands(e.payload);break}case "performanceMetricsReport":{let n=this._canvasDrawer;n!=null&&this.isCanvasDrawerWithMetrics(n)&&n.setPerformanceMetrics(e.payload);break}case "contextDidChangeStatus":{let n=a$m.fromJSON(e.payload);(t=this.loadingOverlay)==null||t.hide(),n.isValid?(this.clearError(),this.setVideoElementOpacity("1")):this.displayError(n);break}case "viewSizeChanged":{let n=e.payload;if(n==null)return;this.onSDCViewSizeChangedCallback(n);break}default:{(i=this.hintPresenter)==null||i.handleMessage(e);break}}}onSDCViewSizeChangedCallback(e){this.updateHintPresenterViewFinderRect(e.viewFinderRect);}updateHintPresenterViewFinderRect(e){var t;(t=this.hintPresenter)==null||t.setViewFinderRect(new a$n(new a$5(e.origin.x,e.origin.y),new a$k(e.size.width,e.size.height)));}drawEngineCommands(e){var t;(t=this.canvasDrawer)==null||t.draw(e);}displayError(e){this.errorElement.textContent=`Error ${e.code}: ${e.message}`,this.errorElement.hidden=false;}clearError(){this.errorElement.textContent="",this.errorElement.hidden=true;}updateControls(){var e;for(let t of this.controls)(e=t.update)==null||e.call(t,this);}async onFrameSourceChange(e){let t=e==null?void 0:e.type;if(this.setupHtmlElementVisibility(t),t==="camera"){let i=e==null?void 0:e.getCurrentState();i!=null&&await this.onCameraStateChanged(i);}else t==="singleImageUploader"&&this.setupHtmlElementSingleImageUploader(e.settings);}async onCameraStateChanged(e){var t;switch((t=this.cameraPaintboardElement)==null||t.classList.toggle(a$b.PAINTBOARD_CLASS_NAME_STATE_ON,e==="on"),e){case "stopping":{this.hiddenProperties.freezeFrameWhenStoppingFrameSource&&this.freezeFrame(),this.setVideoElementOpacity("0");return}case "starting":case "bootingUp":case "wakingUp":{if(!this.htmlElement){a$i.error("cannot set frame source stream before connecting view to an HTML element");return}this.videoElement&&(g.instance().gui.isCameraRecoveryVisible=this.isCameraRecoveryVisible.bind(this),g.instance().gui.setCameraRecoveryVisible=this.setCameraRecoveryVisible.bind(this),this.setVideoElementOpacity("0"));return}case "off":{this.setVideoElementOpacity("0"),this.updateControls();return}case "on":{await g.instance().waitForCapabilities(),this.updateControls(),this.unfreezeFrame(),this.setVideoElementOpacity("1");break}case "goingToSleep":{this.freezeFrame();break}}}setVideoElementOpacity(e){this.videoElement&&(this.videoElement.style.opacity=e),this.canvasElement&&(this.canvasElement.style.opacity=e);}onSingleImageUploaderSettingsChange(e){this.setupHtmlElementSingleImageUploader(e);}setHiddenProperty(e,t){this.hiddenProperties[e]=t;}async onVisibilityChange(){var t,i;let e=(t=this.videoElement)==null?void 0:t.srcObject;if(this.hiddenProperties.stopVideoTracksOnVisibilityChange&&(document.visibilityState==="hidden"&&g.instance().stopVideoTracks(),document.visibilityState==="visible"&&g.instance().activeCamera!=null&&e!=null))if(!e.active||(i=e.getVideoTracks()[0])!=null&&i.muted)try{a$i.debug('Detected visibility change ("visible") event with inactive video source, try to reinitialize camera'),await g.instance().reinitializeCamera();}catch{}else a$i.debug('Detected visibility change ("visible") event with active video source, replay video'),g.instance().playVideo();}async cameraRecovery(e){e.preventDefault(),g.instance().activeCamera=g.instance().selectedCamera,await g.instance().reinitializeCamera();}freezeFrame(){var i;if(!this.frozenFrame)return;let e=g.instance().getCurrentFrame();if(!e)return;let t=new ImageData(e.data,e.width,e.height);this.frozenFrameCanvas.width=t.width,this.frozenFrameCanvas.height=t.height,this.frozenFrame.width=t.width,this.frozenFrame.height=t.height,(i=this.frozenFrameCanvas.getContext("2d"))==null||i.putImageData(t,0,0),this.frozenFrame.src=this.frozenFrameCanvas.toDataURL("image/jpeg",.4),this.frozenFrame.classList.toggle(a$b.MIRRORED_CLASS_NAME,g.instance().isMirrorImageEnabled()),this.frozenFrame.hidden=false;}unfreezeFrame(){this.frozenFrame&&(this.frozenFrame.src="",this.frozenFrame.hidden=true);}};export{q as a};
|
|
File without changes
|