@scandit/web-datacapture-barcode 8.2.0-beta.1 → 8.2.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.
Files changed (57) hide show
  1. package/build/js/ar/BarcodeAr.js +1 -1
  2. package/build/js/ar/BarcodeArFeedback.js +1 -1
  3. package/build/js/ar/BarcodeArPresenter.js +1 -1
  4. package/build/js/ar/BarcodeArView.js +1 -1
  5. package/build/js/ar/ui/organisms/BarcodeArInfoAnnotation.js +1 -1
  6. package/build/js/ar/ui/organisms/BarcodeArPopoverAnnotation.js +1 -1
  7. package/build/js/ar/ui/organisms/BarcodeArResponsiveAnnotation.js +1 -1
  8. package/build/js/chunks/{chunk-R3MQ2GAV.js → chunk-2PM6DH45.js} +1 -1
  9. package/build/js/chunks/{chunk-PPDCIIID.js → chunk-3N7HH72O.js} +1 -1
  10. package/build/js/chunks/chunk-5V3FWMGO.js +1 -0
  11. package/build/js/chunks/{chunk-LJ4IUIWE.js → chunk-A5R67FIL.js} +1 -1
  12. package/build/js/chunks/{chunk-XAWS6DZM.js → chunk-DSVREVQZ.js} +1 -1
  13. package/build/js/chunks/chunk-FBW5J2QT.js +1 -0
  14. package/build/js/chunks/chunk-HRYJX4QW.js +1 -0
  15. package/build/js/chunks/{chunk-REQQ7LQL.js → chunk-I6NAW3SE.js} +1 -1
  16. package/build/js/chunks/{chunk-V4ZOB2BB.js → chunk-LOUBDHG7.js} +1 -1
  17. package/build/js/chunks/{chunk-JN5AM36S.js → chunk-N4WXAKY6.js} +1 -1
  18. package/build/js/chunks/{chunk-35THSZYB.js → chunk-NG3U2CXL.js} +1 -1
  19. package/build/js/chunks/{chunk-VBKC4EKT.js → chunk-NU4EA3HH.js} +1 -1
  20. package/build/js/chunks/{chunk-WE5JRHIG.js → chunk-OCYHIAM2.js} +1 -1
  21. package/build/js/chunks/{chunk-DUG75YJ6.js → chunk-OH47PSIL.js} +1 -1
  22. package/build/js/chunks/{chunk-CAFOTEQ6.js → chunk-QRG4J3CL.js} +1 -1
  23. package/build/js/chunks/{chunk-HPRAVXW3.js → chunk-RF4KC5J3.js} +1 -1
  24. package/build/js/chunks/{chunk-ZAXHRY5Z.js → chunk-WMKH42FG.js} +1 -1
  25. package/build/js/chunks/chunk-Z4OVKU6T.js +2 -0
  26. package/build/js/defaults/Defaults.js +1 -1
  27. package/build/js/find/BarcodeFind.js +1 -1
  28. package/build/js/find/BarcodeFindView.js +1 -1
  29. package/build/js/find/index.js +1 -1
  30. package/build/js/find/ui/molecules/CardListContainer.js +1 -1
  31. package/build/js/find/ui/organisms/FindLayout.js +1 -1
  32. package/build/js/index.js +1 -1
  33. package/build/js/moduleLoader.js +1 -1
  34. package/build/js/spark/index.js +1 -1
  35. package/build/js/spark/ui/SparkScanView.js +1 -1
  36. package/build/js/spark/ui/SparkScanViewPresenter.d.ts +0 -1
  37. package/build/js/spark/ui/SparkScanViewPresenter.js +1 -1
  38. package/build/js/spark/ui/index.js +1 -1
  39. package/build/js/worker/BarcodeCaptureWorkerManager.js +1 -1
  40. package/build/js/worker/BarcodeFindMode.js +1 -1
  41. package/build/js/worker/WorkerMain.js +1 -1
  42. package/build/js/worker/barcodeCapture.inlineWorker.js +1 -1
  43. package/build/js/worker/dataCaptureEngine.js +1 -1
  44. package/package.json +2 -2
  45. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.js +1 -1
  46. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.wasm +0 -0
  47. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.js +1 -1
  48. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.wasm +0 -0
  49. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.js +1 -1
  50. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.wasm +0 -0
  51. package/sdc-lib/scandit-datacapture-sdk-barcode.js +1 -1
  52. package/sdc-lib/scandit-datacapture-sdk-barcode.wasm +0 -0
  53. package/build/js/chunks/chunk-6SI4PD2N.js +0 -1
  54. package/build/js/chunks/chunk-ETK5MP22.js +0 -2
  55. package/build/js/chunks/chunk-S2M7NGPW.js +0 -1
  56. package/build/js/chunks/chunk-X5BA2RQY.js +0 -1
  57. /package/build/js/chunks/{chunk-2KS5VTVC.js → chunk-VLGDYIWY.js} +0 -0
@@ -1 +1 @@
1
- export{a as BarcodeAr}from'../chunks/chunk-HPRAVXW3.js';
1
+ export{a as BarcodeAr}from'../chunks/chunk-RF4KC5J3.js';
@@ -1 +1 @@
1
- export{a as BarcodeArFeedback}from'../chunks/chunk-2KS5VTVC.js';
1
+ export{a as BarcodeArFeedback}from'../chunks/chunk-VLGDYIWY.js';
@@ -1 +1 @@
1
- export{a as BarcodeArPresenter}from'../chunks/chunk-VBKC4EKT.js';
1
+ export{a as BarcodeArPresenter}from'../chunks/chunk-NU4EA3HH.js';
@@ -1 +1 @@
1
- export{a as BarcodeArView}from'../chunks/chunk-XAWS6DZM.js';
1
+ export{a as BarcodeArView}from'../chunks/chunk-DSVREVQZ.js';
@@ -1 +1 @@
1
- export{d as BarcodeArInfoAnnotation,a as BarcodeArInfoAnnotationAnchor,c as BarcodeArInfoAnnotationEvent,b as BarcodeArInfoAnnotationWidthPreset}from'../../../chunks/chunk-REQQ7LQL.js';
1
+ export{d as BarcodeArInfoAnnotation,a as BarcodeArInfoAnnotationAnchor,c as BarcodeArInfoAnnotationEvent,b as BarcodeArInfoAnnotationWidthPreset}from'../../../chunks/chunk-I6NAW3SE.js';
@@ -1 +1 @@
1
- export{b as BarcodeArPopoverAnnotation,a as BarcodeArPopoverAnnotationAnchor}from'../../../chunks/chunk-DUG75YJ6.js';
1
+ export{b as BarcodeArPopoverAnnotation,a as BarcodeArPopoverAnnotationAnchor}from'../../../chunks/chunk-OH47PSIL.js';
@@ -1 +1 @@
1
- export{a as BarcodeArResponsiveAnnotation}from'../../../chunks/chunk-CAFOTEQ6.js';
1
+ export{a as BarcodeArResponsiveAnnotation}from'../../../chunks/chunk-QRG4J3CL.js';
@@ -1 +1 @@
1
- import {a as a$2,b}from'./chunk-HTKUJZG2.js';import {a}from'./chunk-M4AENTE5.js';import {a as a$3}from'./chunk-55SHUUX6.js';import {a as a$1}from'./chunk-DHKABHFE.js';import {CameraSettings,convertToPublicFrameData}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var l=class u{constructor(){this.feedback=a.createDefaultFeedback();this.skipSerialization=true;this.type="barcodeFind";this._isEnabled=true;this._context=null;this.listeners=new Set;this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);this._transformer=null;}static get recommendedCameraSettings(){return new CameraSettings(a$1.CameraSettings.settings)}get context(){return this._context}get allListeners(){return [...this.privateListeners,...this.listeners]}static async forSettings(e){warnMultithreadingUnavailable();let a=new u;return a.settings=e,a}isEnabled(){return this._isEnabled}async setEnabled(e){var a;this._isEnabled=e,await this.workerCommand("barcodeFindSetEnabled",{enabled:e}),await((a=this.context)==null?void 0:a.update([{type:"modeEnabled",newValue:e}],{updateContext:false}));}async applySettings(e){this.settings=e,await this.workerCommand("barcodeFindApplySettings",{settings:e.toJSONObject()});}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}async setItemList(e){var a;for(let r of this.privateListeners)(a=r.onSetItemList)==null||a.call(r,e);return this.workerCommand("barcodeFindSetItemList",{itemList:e.map(r=>r.toJSONObject())})}async setBarcodeTransformer(e){var a;return this._transformer=e,this.workerCommand("barcodeFindSetTransformerFunction",{functionAsString:(a=this._transformer)==null?void 0:a.transformBarcodeData.toString()})}async start(){return this.workerCommand("barcodeFindSearchStart",{})}async stop(){return this.workerCommand("barcodeFindSearchStop",{})}async pause(){return this.workerCommand("barcodeFindSearchPause",{})}toJSONObject(){return {type:this.type,enabled:this.isEnabled(),settings:this.settings.toJSONObject()}}async workerCommand(e,a){this.context!=null&&await this.context.workerCommand(e,a);}async attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),await this.workerCommand("barcodeFindForSettings",{settings:this.settings.toJSONObject()});}async detachedFromContext(){var e;await this.workerCommand("barcodeFindModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}async onWorkerMessage(e){var a,r,d;switch(e.type){case "barcodeFindDidUpdateSession":{if(this._context==null)return;for(let t of this.allListeners)(a=t.onDidUpdateSession)==null||a.call(t,this,a$3.fromJSON(e.payload.session),convertToPublicFrameData(e.payload.frameData,this._context));break}case "barcodeFindSearchPaused":{for(let t of this.allListeners){let i=e.payload.foundItems.map(o=>new a$2(new b(o),null));t.didPauseSearch(i);}break}case "barcodeFindSearchStarted":{for(let t of this.allListeners)t.didStartSearch();break}case "barcodeFindSearchStopped":{for(let t of this.allListeners){let i=e.payload.foundItems.map(o=>new a$2(new b(o),null));t.didStopSearch(i);}break}case "barcodeFindListUpdatedFeedback":{for(let t of this.allListeners)(r=t.onFindListUpdatedFeedback)==null||r.call(t);break}case "barcodeFindFeedback":{for(let t of this.allListeners)(d=t.onFeedback)==null||d.call(t);break}}}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}};export{l as a};
1
+ import {a as a$2,b}from'./chunk-HTKUJZG2.js';import {a}from'./chunk-M4AENTE5.js';import {a as a$1}from'./chunk-DHKABHFE.js';import {a as a$3}from'./chunk-55SHUUX6.js';import {CameraSettings,convertToPublicFrameData}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var l=class u{constructor(){this.feedback=a.createDefaultFeedback();this.skipSerialization=true;this.type="barcodeFind";this._isEnabled=true;this._context=null;this.listeners=new Set;this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);this._transformer=null;}static get recommendedCameraSettings(){return new CameraSettings(a$1.CameraSettings.settings)}get context(){return this._context}get allListeners(){return [...this.privateListeners,...this.listeners]}static async forSettings(e){warnMultithreadingUnavailable();let a=new u;return a.settings=e,a}isEnabled(){return this._isEnabled}async setEnabled(e){var a;this._isEnabled=e,await this.workerCommand("barcodeFindSetEnabled",{enabled:e}),await((a=this.context)==null?void 0:a.update([{type:"modeEnabled",newValue:e}],{updateContext:false}));}async applySettings(e){this.settings=e,await this.workerCommand("barcodeFindApplySettings",{settings:e.toJSONObject()});}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}async setItemList(e){var a;for(let r of this.privateListeners)(a=r.onSetItemList)==null||a.call(r,e);return this.workerCommand("barcodeFindSetItemList",{itemList:e.map(r=>r.toJSONObject())})}async setBarcodeTransformer(e){var a;return this._transformer=e,this.workerCommand("barcodeFindSetTransformerFunction",{functionAsString:(a=this._transformer)==null?void 0:a.transformBarcodeData.toString()})}async start(){return this.workerCommand("barcodeFindSearchStart",{})}async stop(){return this.workerCommand("barcodeFindSearchStop",{})}async pause(){return this.workerCommand("barcodeFindSearchPause",{})}toJSONObject(){return {type:this.type,enabled:this.isEnabled(),settings:this.settings.toJSONObject()}}async workerCommand(e,a){this.context!=null&&await this.context.workerCommand(e,a);}async attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),await this.workerCommand("barcodeFindForSettings",{settings:this.settings.toJSONObject()});}async detachedFromContext(){var e;await this.workerCommand("barcodeFindModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}async onWorkerMessage(e){var a,r,d;switch(e.type){case "barcodeFindDidUpdateSession":{if(this._context==null)return;for(let t of this.allListeners)(a=t.onDidUpdateSession)==null||a.call(t,this,a$3.fromJSON(e.payload.session),convertToPublicFrameData(e.payload.frameData,this._context));break}case "barcodeFindSearchPaused":{for(let t of this.allListeners){let i=e.payload.foundItems.map(o=>new a$2(new b(o),null));t.didPauseSearch(i);}break}case "barcodeFindSearchStarted":{for(let t of this.allListeners)t.didStartSearch();break}case "barcodeFindSearchStopped":{for(let t of this.allListeners){let i=e.payload.foundItems.map(o=>new a$2(new b(o),null));t.didStopSearch(i);}break}case "barcodeFindListUpdatedFeedback":{for(let t of this.allListeners)(r=t.onFindListUpdatedFeedback)==null||r.call(t);break}case "barcodeFindFeedback":{for(let t of this.allListeners)(d=t.onFeedback)==null||d.call(t);break}}}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}};export{l as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-7IFO52E7.js';import {ScanditHTMLElement,html,defineCustomElements,css}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';import {Card}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Card.js';import {CardList,CardListEvents}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/CardList.js';var l="cubic-bezier(0.4, 0, 0.2, 1)",L=(n=>(n.TextForCollapseCardsButton="text-for-collapse-cards-button",n))(L||{}),i=class i extends ScanditHTMLElement{constructor(){super();this.onCarListTapHandler=this.onCarListTap.bind(this);this.onCardListWillExpandHandler=this.onCardListWillExpand.bind(this);this.onCarouselButtonClickHandler=this.onCarouselButtonClick.bind(this);this.textNode=document.createTextNode("");let t=this.attachShadow({mode:"open"});t.append(i.createStyleElement().cloneNode(true));let s=document.createElement("div");s.id="root",s.innerHTML=html`<${a.tag} class="hide"></${a.tag}><${CardList.tag} collapsed></${CardList.tag}>`,t.append(s),this.carouselButton.append(this.textNode);}set"text-for-collapse-cards-button"(t){this.textNode.textContent=t;}get"text-for-collapse-cards-button"(){return this.textNode.textContent}get cardsList(){return this.shadowRoot.querySelector(CardList.tag)}get carouselButton(){return this.shadowRoot.querySelector(a.tag)}static create(){return document.createElement(i.tag)}static register(){defineCustomElements({[i.tag]:i,[a.tag]:a,[CardList.tag]:CardList,[Card.tag]:Card});}static createStyleElement(){return css`:host #root{align-items:center;display:flex;flex-direction:column;gap:.5rem;height:100%}:host #root ${a.tag}{opacity:1;transform:translateY(0);transition:opacity ${l} .5s,transform ${l} .5s}:host #root ${a.tag}.hide{opacity:0;transform:translateY(100%)}`}attributeChangeCallback(t,s,c){t==="text-for-collapse-cards-button"&&(this["text-for-collapse-cards-button"]=c);}connectedCallback(){this.textNode.textContent=this.getAttribute("text-for-collapse-cards-button"),this.carouselButton.addEventListener("click",this.onCarouselButtonClickHandler),this.cardsList.addEventListener(CardListEvents.Tap,this.onCarListTapHandler),this.cardsList.addEventListener(CardListEvents.WillExpand,this.onCardListWillExpandHandler);}disconnectedCallback(){this.carouselButton.removeEventListener("click",this.onCarouselButtonClickHandler),this.cardsList.removeEventListener(CardListEvents.Tap,this.onCarListTapHandler),this.cardsList.removeEventListener(CardListEvents.WillExpand,this.onCardListWillExpandHandler);}collapse(){this.carouselButton.classList.add("hide"),this.cardsList.collapsed=true;}expand(){this.carouselButton.classList.remove("hide"),this.cardsList.collapsed=false;}renderCards(t){this.cardsList.clearCards(),this.cardsList.renderCards(t);}async unshiftCard(t){return this.cardsList.unshift(t)}getCardBySelector(t){return this.cardsList.querySelector(t)}updateHeight(t){let s=this.carouselButton.clientHeight;this.cardsList.style.setProperty("--list-height",`${t}px`),this.cardsList.style.setProperty("--top-offset",`calc(${s===0?32:s}px + 5rem)`);}onCardListWillExpand(){this.carouselButton.classList.remove("hide");}onCarListTap(){this.cardsList.collapsed=false;}onCarouselButtonClick(){this.carouselButton.classList.add("hide"),this.cardsList.collapsed=true;}};i.tag="scandit-find-card-list-container",i.observedAttributes=["text-for-collapse-cards-button"];var o=i;o.register();export{L as a,o as b};
1
+ import {a}from'./chunk-7IFO52E7.js';import {ScanditHTMLElement,html,defineCustomElements,css}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';import {Card}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Card.js';import {CardList,CardListEvents}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/CardList.js';var l="cubic-bezier(0.4, 0, 0.2, 1)",L=(n=>(n.TextForCollapseCardsButton="text-for-collapse-cards-button",n))(L||{}),i=class i extends ScanditHTMLElement{constructor(){super();this.onCarListTapHandler=this.onCarListTap.bind(this);this.onCardListWillExpandHandler=this.onCardListWillExpand.bind(this);this.onCarouselButtonClickHandler=this.onCarouselButtonClick.bind(this);this.textNode=document.createTextNode("");let t=this.attachShadow({mode:"open"});t.append(i.createStyleElement().cloneNode(true));let s=document.createElement("div");s.id="root",s.innerHTML=html`<${a.tag} class="hide"></${a.tag}><${CardList.tag} collapsed></${CardList.tag}>`,t.append(s),this.carouselButton.append(this.textNode);}set"text-for-collapse-cards-button"(t){this.textNode.textContent=t;}get"text-for-collapse-cards-button"(){return this.textNode.textContent}get cardsList(){return this.shadowRoot.querySelector(CardList.tag)}get carouselButton(){return this.shadowRoot.querySelector(a.tag)}static create(){return document.createElement(i.tag)}static register(){defineCustomElements({[i.tag]:i,[a.tag]:a,[CardList.tag]:CardList,[Card.tag]:Card});}static createStyleElement(){return css`:host #root{align-items:center;display:flex;flex-direction:column;gap:.5rem;height:100%}:host #root ${a.tag}{opacity:1;transform:translateY(0);transition:opacity ${l} .5s,transform ${l} .5s}:host #root ${a.tag}.hide{opacity:0;transform:translateY(100%)}`}attributeChangeCallback(t,s,c){t==="text-for-collapse-cards-button"&&(this["text-for-collapse-cards-button"]=c);}connectedCallback(){this.textNode.textContent=this.getAttribute("text-for-collapse-cards-button"),this.carouselButton.addEventListener("click",this.onCarouselButtonClickHandler),this.cardsList.addEventListener(CardListEvents.Tap,this.onCarListTapHandler),this.cardsList.addEventListener(CardListEvents.WillExpand,this.onCardListWillExpandHandler);}disconnectedCallback(){this.carouselButton.removeEventListener("click",this.onCarouselButtonClickHandler),this.cardsList.removeEventListener(CardListEvents.Tap,this.onCarListTapHandler),this.cardsList.removeEventListener(CardListEvents.WillExpand,this.onCardListWillExpandHandler);}collapse(){this.carouselButton.classList.add("hide"),this.cardsList.collapsed=true;}expand(){this.carouselButton.classList.remove("hide"),this.cardsList.collapsed=false;}renderCards(t){this.cardsList.clearCards(),this.cardsList.renderCards(t);}async unshiftCard(t){return this.cardsList.unshift(t)}getCardBySelector(t){return this.cardsList.querySelector(t)}updateHeight(t){let s=this.carouselButton.clientHeight;t>0&&this.cardsList.style.setProperty("--list-height",`${t}px`),this.cardsList.style.setProperty("--top-offset",`calc(${s===0?32:s}px + 5rem)`);}onCardListWillExpand(){this.carouselButton.classList.remove("hide");}onCarListTap(){this.cardsList.collapsed=false;}onCarouselButtonClick(){this.carouselButton.classList.add("hide"),this.cardsList.collapsed=true;}};i.tag="scandit-find-card-list-container",i.observedAttributes=["text-for-collapse-cards-button"];var o=i;o.register();export{L as a,o as b};
@@ -0,0 +1 @@
1
+ import {Orientation}from'@scandit/web-datacapture-core';import {GestureRecognizer}from'@scandit/web-datacapture-core/build/js/private/GestureRecognizer/GestureRecognizer.js';import {OrientationObserver,orientationChangeEvent}from'@scandit/web-datacapture-core/build/js/private/OrientationObserver.js';import {ScanditHTMLElement,debounce,html,defineCustomElements,css,safeRequestAnimationFrame}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var O=(r=>(r.onTap="onlayouttap",r))(O||{}),n=class n extends ScanditHTMLElement{constructor(){super();this.orientationObserver=new OrientationObserver;this.onOrientationChangeHandler=debounce(this.onOrientationChange.bind(this),50);let t=this.attachShadow({mode:"open"});t.append(n.createStyleElement().cloneNode(true));let e=document.createElement("div");e.id="root",this.absoluteContainer=document.createElement("div"),this.absoluteContainer.classList.add("absolute-container"),this.absoluteContainer.innerHTML="<slot></slot>",t.insertBefore(this.absoluteContainer,e.nextElementSibling),e.innerHTML=html`<div class="wrapper"><div class="header"><slot name="progress"></slot><div class="controls top"><div class="control left"><slot name="top-controls-left"></slot></div><div class="control center"><slot name="top-controls-center"></slot></div><div class="control right"><slot name="top-controls-right"></slot></div></div></div><div class="main"><slot name="card-list"></slot></div></div><div class="controls"><div class="control left"><slot name="bottom-controls-left"></slot></div><div class="control center"><slot name="bottom-controls-center"></slot></div><div class="control right"><slot name="bottom-controls-right"></slot></div></div>`,t.append(e),this.gestureRecognizer=new GestureRecognizer(this.absoluteContainer);}get cardListContainer(){return this.querySelector('[slot="card-list"]')}get main(){var t;return (t=this.shadowRoot)==null?void 0:t.querySelector(".main")}static create(){return document.createElement(n.tag)}static register(){defineCustomElements({[n.tag]:n});}static createStyleElement(){return css`:host{inset:0;overflow:hidden;position:absolute;z-index:1}:host #root{--padding:1rem;box-sizing:border-box;display:flex;flex-direction:column;gap:.5rem;height:100%;justify-content:space-between;margin:0 auto;max-width:960px;padding:calc(var(--padding))}:host .absolute-container{height:100%;overflow:hidden;position:absolute;width:100%}.main{overflow:hidden}.main,.wrapper{display:flex;flex-direction:column}.wrapper{gap:.5rem;height:100%;justify-content:space-between}.controls{align-items:center;display:flex;flex-direction:row;justify-content:space-evenly;min-height:85px;z-index:1}@media (orientation:landscape){.controls{flex-direction:column}.wrapper{flex:0 70%;margin:0 auto}:host #root{flex-direction:row}}.controls .control{align-items:center;display:flex;flex:1 1 25%;flex-direction:row;justify-content:center}.controls .control.center{flex:1 1 50%;max-width:5rem}.controls.top{min-height:auto}.controls.top .control.left{justify-content:flex-start}.controls.top .control.right{justify-content:flex-end}.header{display:flex;flex-direction:column;gap:1.5rem;position:relative}::slotted([hidden]){display:none}`}connectedCallback(){this.orientationObserver.addEventListener(orientationChangeEvent,this.onOrientationChangeHandler),this.orientationObserver.register(),this.gestureRecognizer.addListener(this);}disconnectedCallback(){this.orientationObserver.unregister(),this.orientationObserver.removeEventListener(orientationChangeEvent,this.onOrientationChangeHandler),this.gestureRecognizer.removeListener(this);}toggleVisibility(t,e){var o;(o=this.querySelector(t))==null||o.toggleAttribute("hidden",!e);}onTap(t,e){let o=new CustomEvent("onlayouttap",{detail:{point:t,target:e.target}});this.dispatchEvent(o);}onOrientationChange(t){var o,a,s,l;let e=this.shadowRoot.querySelector(".controls.top");t.detail.value===Orientation.Portrait?(a=(o=this.shadowRoot)==null?void 0:o.querySelector(".header"))==null||a.append(e):(l=(s=this.shadowRoot)==null?void 0:s.querySelector("#root"))==null||l.prepend(e),safeRequestAnimationFrame(()=>{var c,d,p,m,u;(c=this.main)==null||c.style.setProperty("height","100%");let v=(p=(d=this.main)==null?void 0:d.getBoundingClientRect().height)!=null?p:0;(m=this.cardListContainer)==null||m.updateHeight(v),(u=this.main)==null||u.style.setProperty("height","unset");});}};n.tag="scandit-find-layout";var i=n;i.register();export{O as a,i as b};
@@ -1 +1 @@
1
- import {b}from'./chunk-S2M7NGPW.js';import {b as b$1}from'./chunk-PPDCIIID.js';import {a as a$6}from'./chunk-TKSABJXC.js';import {a}from'./chunk-HHYYL23G.js';import {a as a$8}from'./chunk-RZWYP24A.js';import {a as a$9}from'./chunk-PJKEAS4K.js';import {a as a$1}from'./chunk-DDLFCE34.js';import {a as a$7}from'./chunk-ZPKXVCG3.js';import {a as a$3}from'./chunk-R3MQ2GAV.js';import {a as a$4}from'./chunk-POONUNDO.js';import {b as b$2}from'./chunk-6KDQGEUY.js';import {a as a$5}from'./chunk-DHKABHFE.js';import {a as a$2}from'./chunk-I53W7VSB.js';import {Anchor,Localization,DataCaptureView,Size,Point}from'@scandit/web-datacapture-core';import {ShutterButton}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/ShutterButton.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {html}from'@scandit/web-datacapture-core/build/js/private/utils/html.js';import {Card}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Card.js';import {TorchSwitchIconButton}from'@scandit/web-datacapture-core/build/js/private/ui/molecules/TorchSwitchIconButton.js';var l={FinishButton:a$1.tag,ShutterButton:ShutterButton.tag,ProgressBarWithLabel:a.tag,CardListContainer:b$1.tag,TorchSwitchIconButton:TorchSwitchIconButton.tag},u=class u extends ScanditHTMLElement{constructor(){super(...arguments);this.shouldShowCarousel=true;this.shouldShowPauseButton=true;this.shouldShowFinishButton=true;this.shouldShowProgressBar=true;this.torchControlPosition=Anchor.TopLeft;this.textForItemListUpdatedWhenPausedHint=null;this.textForItemListUpdatedHint=null;this.textForTapShutterToResumeSearchHint=null;this.textForTapShutterToPauseScreenHint=null;this.textForMoveCloserToBarcodesHint=null;this.textForPointAtBarcodesToSearchHint=null;this.textForAllItemsFoundSuccessfullyHint=null;this.textForCollapseCardsButton=Localization.getInstance().get("barcode.find.view.textForCollapseCardsButton");this.barcodeFindViewUiListener=null;this.shutterButton=null;this.finishButton=null;this.progressBar=null;this.cardList=null;this.onShutterButtonClickedHandler=this.onShutterButtonClicked.bind(this);this.onFinishButtonClickedHandler=this.onFinishButtonClicked.bind(this);this.onTorchButtonClickedHandler=this.onTorchButtonClicked.bind(this);this.torchSwitchIconButton=null;this._shouldShowTorchControl=false;this._isTorchAvailable=false;this.onDotClickHandler=this.onDotClick.bind(this);}set shouldShowTorchControl(t){this._shouldShowTorchControl=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(t&&this._isTorchAvailable));}get shouldShowTorchControl(){return this._shouldShowTorchControl}get camera(){return this.presenter.context.frameSource}static async createWithSettings(t,o,i,s,r){let e=document.createElement(u.tag);return e.barcodeFindViewSettings=s,e.layout=b.create(),e.layout.innerHTML=html`<${a.tag} slot="progress" value="0" max="1" ${e.shouldShowProgressBar?"":"hidden"}></${a.tag}><${TorchSwitchIconButton.tag} slot="top-controls-left" ${e.shouldShowTorchControl?"":"hidden"}></${TorchSwitchIconButton.tag}><${b$1.tag} slot="card-list" hidden text-for-collapse-cards-button=${e.textForCollapseCardsButton}></${b$1.tag}><${ShutterButton.tag} slot="bottom-controls-center" variant="play" ${e.shouldShowPauseButton?"":"hidden"}></${ShutterButton.tag}><${a$1.tag} slot="bottom-controls-right" ${e.shouldShowFinishButton?"":"hidden"}></${a$1.tag}>`,e.append(e.layout),a$2(t)?(e.dataCaptureView=t,t.htmlElement.prepend(e),await o.setMode(i),await t.setContext(o)):(e.dataCaptureView=await DataCaptureView.forContext(o),e.dataCaptureView.connectToElement(t),t.prepend(e)),e.presenter=new b$2(e,o,i,s,r!=null?r:a$3.recommendedCameraSettings),await e.presenter.prepare(),e.barcodeFindBasicOverlay=await a$4.withBarcodeFind(i,e.dataCaptureView),e}static async create(t,o,i){return u.register(),u.createWithSettings(t,o,i,a$5.BarcodeFindViewSettings.settings,a$3.recommendedCameraSettings)}static register(){defineCustomElements({[u.tag]:u,[TorchSwitchIconButton.tag]:TorchSwitchIconButton,[ShutterButton.tag]:ShutterButton,[a.tag]:a,[b$1.tag]:b$1,[a$1.tag]:a$1,[b.tag]:b});}async startSearching(){return this.onShutterButtonClickedHandler()}async stopSearching(){return this.presenter.stopSearching()}async pauseSearching(){return this.onShutterButtonClickedHandler()}setListener(t){this.barcodeFindViewUiListener=t,this.presenter.barcodeFindViewUiListener=this.barcodeFindViewUiListener;}async setShouldShowUserGuidanceView(t){return this.shouldShowUserGuidance=t,this.barcodeFindBasicOverlay.setUserGuidanceEnabled(this.shouldShowUserGuidance)}async setShouldShowHints(t){return this.shouldShowHints=t,this.barcodeFindBasicOverlay.setShouldShowHint(this.shouldShowHints)}setShouldShowCarousel(t){this.shouldShowCarousel=t,this.layout.toggleVisibility(l.CardListContainer,t);}setShouldShowPauseButton(t){this.shouldShowPauseButton=t,this.layout.toggleVisibility(l.ShutterButton,t);}setShouldShowFinishButton(t){this.shouldShowFinishButton=t,this.layout.toggleVisibility(l.FinishButton,t);}setShouldShowProgressBar(t){this.shouldShowProgressBar=t,this.layout.toggleVisibility(l.ProgressBarWithLabel,t);}setShouldShowTorchControl(t){this.shouldShowTorchControl=t;}setTorchAvailable(t){this._isTorchAvailable=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(this._shouldShowTorchControl&&this._isTorchAvailable));}setTorchControlPosition(t){var i;this.torchControlPosition=t,[Anchor.TopCenter,Anchor.TopLeft,Anchor.TopRight,Anchor.BottomLeft].includes(t)||(this.torchControlPosition=Anchor.TopLeft);let o={[Anchor.TopCenter]:"top-controls-center",[Anchor.TopLeft]:"top-controls-left",[Anchor.TopRight]:"top-controls-right",[Anchor.BottomLeft]:"bottom-controls-left"}[this.torchControlPosition];(i=this.torchSwitchIconButton)==null||i.setAttribute("slot",o);}setTextForCollapseCardsButton(t){this.textForCollapseCardsButton=t,this.cardList!=null&&(this.cardList["text-for-collapse-cards-button"]=t);}async setTextForAllItemsFoundSuccessfullyHint(t){return this.textForAllItemsFoundSuccessfullyHint=t,this.barcodeFindBasicOverlay.setTextForAllItemsFoundSuccessfullyHint(this.textForAllItemsFoundSuccessfullyHint)}async setTextForPointAtBarcodesToSearchHint(t){return this.textForPointAtBarcodesToSearchHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForPointAtBarcodesToSearchHint)}async setTextForMoveCloserToBarcodesHint(t){return this.textForMoveCloserToBarcodesHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForMoveCloserToBarcodesHint)}async setTextForTapShutterToPauseScreenHint(t){return this.textForTapShutterToPauseScreenHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForTapShutterToPauseScreenHint)}async setTextForTapShutterToResumeSearchHint(t){return this.textForTapShutterToResumeSearchHint=t,this.barcodeFindBasicOverlay.setTextForTapShutterToResumeScreenHint(this.textForTapShutterToResumeSearchHint)}async setTextForItemListUpdatedWhenPausedHint(t){return this.textForItemListUpdatedWhenPausedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedWhenPausedHint(this.textForItemListUpdatedWhenPausedHint)}async setTextForItemListUpdatedHint(t){return this.textForItemListUpdatedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedWhenPausedHint(this.textForItemListUpdatedHint)}connectedCallback(){var t,o,i;this.shutterButton=this.layout.querySelector(l.ShutterButton),this.finishButton=this.layout.querySelector(l.FinishButton),this.progressBar=this.layout.querySelector(l.ProgressBarWithLabel),this.cardList=this.layout.querySelector(l.CardListContainer),this.torchSwitchIconButton=this.layout.querySelector(l.TorchSwitchIconButton),(t=this.torchSwitchIconButton)==null||t.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(o=this.shutterButton)==null||o.addEventListener("pointerdown",this.onShutterButtonClickedHandler),(i=this.finishButton)==null||i.addEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.addEventListener("onlayouttap",this.onDotClickHandler);}disconnectedCallback(){var t,o,i;(t=this.shutterButton)==null||t.removeEventListener("pointerdown",this.onShutterButtonClickedHandler),(o=this.torchSwitchIconButton)==null||o.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(i=this.finishButton)==null||i.removeEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.removeEventListener("onlayouttap",this.onDotClickHandler),this.presenter.dispose();}async onShutterButtonClicked(){this.presenter.onShutterButtonClicked();}async onTorchButtonClicked(){this.presenter.onTorchButtonClicked();}updateProgressBar(t,o){this.progressBar&&(this.progressBar.value!==t&&(this.progressBar.value=t),o!=null&&this.progressBar.max!==o&&(this.progressBar.max=o));}setShutterButtonPulse(t){this.shutterButton!=null&&(this.shutterButton.pulse=t);}switchToPaused(t,o){var s,r,e,h,a,g,f,y,L,P,H,x;let i=[];for(let c of t){let C=Card.create();C.id=`${String(c.uid)}`;let p=a$6.create();if(C.append(p),p.title=(r=(s=c.content)==null?void 0:s.info)!=null?r:c.searchOptions.barcodeData,((e=c.content)==null?void 0:e.additionalInfo)!=null&&(p.subtitle=(a=(h=c.content)==null?void 0:h.additionalInfo)!=null?a:""),o.find(n=>n.searchOptions.barcodeData===c.searchOptions.barcodeData)!=null){let n=a$7.create();n.slot="right",p.append(n);}if(((g=c.content)==null?void 0:g.image)==null){let n=a$8.create();n.slot="image-left",p.append(n);}else {let n=document.createElement("img");n.slot="image-left",n.src=(y=(f=c.content)==null?void 0:f.image)!=null?y:"",n.alt=(P=(L=c.content)==null?void 0:L.additionalInfo)!=null?P:"",p.append(n);}i.push(C);}(H=this.cardList)==null||H.renderCards(i),(x=this.cardList)==null||x.removeAttribute("hidden"),this.shutterButton.variant="play",this.shutterButton.pulse=false,this.toggleDotPulse(false);}moveCardOnTheFront(t){var i,s;if(!t)return;let o=(i=this.cardList)==null?void 0:i.getCardBySelector(`${Card.tag}#${t.uid}`);o!=null&&((s=this.cardList)==null||s.unshiftCard(o));}switchToStarted(){var t;this.clearDots(),(t=this.cardList)==null||t.setAttribute("hidden",""),this.shutterButton.variant="pause";}toggleTorchIcon(t){this.torchSwitchIconButton&&(this.torchSwitchIconButton.state=t);}onFinishButtonClicked(){this.presenter.onFinishButtonClicked();}clearDots(){let t=this.layout.querySelectorAll("[data-identifier]");for(let o of t)o.remove();}toggleDotPulse(t){let o=[...this.layout.querySelectorAll("[data-identifier]")];for(let i of o)i.pulse=t;}pointTransformation(t){return `translate3d(calc(${t.x}px - 50%), calc(${t.y}px - 50%), 0px)`}onDotClick(t){let o=t.detail.target;if(o.dataset.identifier!=null){for(let i of this.layout.querySelectorAll(a$9.tag))i.pulse=false,o===i&&o.variant==="target"&&(o.pulse=true);this.presenter.onDotClick(o.dataset.identifier);}}renderDots(t){var o,i,s;for(let r of t.removedTrackedBarcodes){let e=this.layout.querySelector(`[data-identifier="${r}"]`);e==null||e.remove();}if(t.addedTrackedBarcodes.length>0){let r=document.createDocumentFragment();for(let e of t.addedTrackedBarcodes){let h=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(e.anchorPositions),a=a$9.createWithColors(this.barcodeFindViewSettings.inListItemColor,this.barcodeFindViewSettings.notInListItemColor);a.style.setProperty("position","absolute"),a.style.setProperty("transform",this.pointTransformation(h.center)),a.dataset.identifier=`${e.identifier}`,e.barcode.data!=null&&((o=t.foundTrackedBarcodesInLastProcessedFrame[`${e.identifier}`])==null?void 0:o.barcode.data)===e.barcode.data&&(a.setAttribute("variant","target"),a.pulse=true),r.append(a);}this.layout.append(r);}for(let r of t.updatedTrackedBarcodes){let e=this.layout.querySelector(`[data-identifier="${r.identifier}"]`),{center:h}=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(r.anchorPositions);if(e){let a=(s=(i=this.camera)==null?void 0:i.getMirrorImageEnabled())!=null?s:false,g=new Size(this.dataCaptureView.width,this.dataCaptureView.height);e.style.setProperty("position","absolute");let f=a?Point.mirrorX(h,g):h;e.style.setProperty("transform",this.pointTransformation(f));}}}};u.tag="scandit-barcode-find-view";var O=u;export{O as a};
1
+ import {a as a$7}from'./chunk-ZPKXVCG3.js';import {b as b$1}from'./chunk-3N7HH72O.js';import {a as a$6}from'./chunk-TKSABJXC.js';import {a}from'./chunk-HHYYL23G.js';import {b}from'./chunk-5V3FWMGO.js';import {a as a$8}from'./chunk-RZWYP24A.js';import {a as a$9}from'./chunk-PJKEAS4K.js';import {a as a$1}from'./chunk-DDLFCE34.js';import {a as a$3}from'./chunk-2PM6DH45.js';import {a as a$4}from'./chunk-POONUNDO.js';import {b as b$2}from'./chunk-6KDQGEUY.js';import {a as a$5}from'./chunk-DHKABHFE.js';import {a as a$2}from'./chunk-I53W7VSB.js';import {Anchor,Localization,DataCaptureView,Size,Point}from'@scandit/web-datacapture-core';import {ShutterButton}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/ShutterButton.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {html}from'@scandit/web-datacapture-core/build/js/private/utils/html.js';import {Card}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Card.js';import {TorchSwitchIconButton}from'@scandit/web-datacapture-core/build/js/private/ui/molecules/TorchSwitchIconButton.js';var l={FinishButton:a$1.tag,ShutterButton:ShutterButton.tag,ProgressBarWithLabel:a.tag,CardListContainer:b$1.tag,TorchSwitchIconButton:TorchSwitchIconButton.tag},u=class u extends ScanditHTMLElement{constructor(){super(...arguments);this.shouldShowCarousel=true;this.shouldShowPauseButton=true;this.shouldShowFinishButton=true;this.shouldShowProgressBar=true;this.torchControlPosition=Anchor.TopLeft;this.textForItemListUpdatedWhenPausedHint=null;this.textForItemListUpdatedHint=null;this.textForTapShutterToResumeSearchHint=null;this.textForTapShutterToPauseScreenHint=null;this.textForMoveCloserToBarcodesHint=null;this.textForPointAtBarcodesToSearchHint=null;this.textForAllItemsFoundSuccessfullyHint=null;this.textForCollapseCardsButton=Localization.getInstance().get("barcode.find.view.textForCollapseCardsButton");this.barcodeFindViewUiListener=null;this.shutterButton=null;this.finishButton=null;this.progressBar=null;this.cardList=null;this.onShutterButtonClickedHandler=this.onShutterButtonClicked.bind(this);this.onFinishButtonClickedHandler=this.onFinishButtonClicked.bind(this);this.onTorchButtonClickedHandler=this.onTorchButtonClicked.bind(this);this.torchSwitchIconButton=null;this._shouldShowTorchControl=false;this._isTorchAvailable=false;this.onDotClickHandler=this.onDotClick.bind(this);}set shouldShowTorchControl(t){this._shouldShowTorchControl=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(t&&this._isTorchAvailable));}get shouldShowTorchControl(){return this._shouldShowTorchControl}get camera(){return this.presenter.context.frameSource}static async createWithSettings(t,o,i,s,r){let e=document.createElement(u.tag);return e.barcodeFindViewSettings=s,e.layout=b.create(),e.layout.innerHTML=html`<${a.tag} slot="progress" value="0" max="1" ${e.shouldShowProgressBar?"":"hidden"}></${a.tag}><${TorchSwitchIconButton.tag} slot="top-controls-left" ${e.shouldShowTorchControl?"":"hidden"}></${TorchSwitchIconButton.tag}><${b$1.tag} slot="card-list" hidden text-for-collapse-cards-button=${e.textForCollapseCardsButton}></${b$1.tag}><${ShutterButton.tag} slot="bottom-controls-center" variant="play" ${e.shouldShowPauseButton?"":"hidden"}></${ShutterButton.tag}><${a$1.tag} slot="bottom-controls-right" ${e.shouldShowFinishButton?"":"hidden"}></${a$1.tag}>`,e.append(e.layout),a$2(t)?(e.dataCaptureView=t,t.htmlElement.prepend(e),await o.setMode(i),await t.setContext(o)):(e.dataCaptureView=await DataCaptureView.forContext(o),e.dataCaptureView.connectToElement(t),t.prepend(e)),e.presenter=new b$2(e,o,i,s,r!=null?r:a$3.recommendedCameraSettings),await e.presenter.prepare(),e.barcodeFindBasicOverlay=await a$4.withBarcodeFind(i,e.dataCaptureView),e}static async create(t,o,i){return u.register(),u.createWithSettings(t,o,i,a$5.BarcodeFindViewSettings.settings,a$3.recommendedCameraSettings)}static register(){defineCustomElements({[u.tag]:u,[TorchSwitchIconButton.tag]:TorchSwitchIconButton,[ShutterButton.tag]:ShutterButton,[a.tag]:a,[b$1.tag]:b$1,[a$1.tag]:a$1,[b.tag]:b});}async startSearching(){return this.onShutterButtonClickedHandler()}async stopSearching(){return this.presenter.stopSearching()}async pauseSearching(){return this.onShutterButtonClickedHandler()}setListener(t){this.barcodeFindViewUiListener=t,this.presenter.barcodeFindViewUiListener=this.barcodeFindViewUiListener;}async setShouldShowUserGuidanceView(t){return this.shouldShowUserGuidance=t,this.barcodeFindBasicOverlay.setUserGuidanceEnabled(this.shouldShowUserGuidance)}async setShouldShowHints(t){return this.shouldShowHints=t,this.barcodeFindBasicOverlay.setShouldShowHint(this.shouldShowHints)}setShouldShowCarousel(t){this.shouldShowCarousel=t,this.layout.toggleVisibility(l.CardListContainer,t);}setShouldShowPauseButton(t){this.shouldShowPauseButton=t,this.layout.toggleVisibility(l.ShutterButton,t);}setShouldShowFinishButton(t){this.shouldShowFinishButton=t,this.layout.toggleVisibility(l.FinishButton,t);}setShouldShowProgressBar(t){this.shouldShowProgressBar=t,this.layout.toggleVisibility(l.ProgressBarWithLabel,t);}setShouldShowTorchControl(t){this.shouldShowTorchControl=t;}setTorchAvailable(t){this._isTorchAvailable=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(this._shouldShowTorchControl&&this._isTorchAvailable));}setTorchControlPosition(t){var i;this.torchControlPosition=t,[Anchor.TopCenter,Anchor.TopLeft,Anchor.TopRight,Anchor.BottomLeft].includes(t)||(this.torchControlPosition=Anchor.TopLeft);let o={[Anchor.TopCenter]:"top-controls-center",[Anchor.TopLeft]:"top-controls-left",[Anchor.TopRight]:"top-controls-right",[Anchor.BottomLeft]:"bottom-controls-left"}[this.torchControlPosition];(i=this.torchSwitchIconButton)==null||i.setAttribute("slot",o);}setTextForCollapseCardsButton(t){this.textForCollapseCardsButton=t,this.cardList!=null&&(this.cardList["text-for-collapse-cards-button"]=t);}async setTextForAllItemsFoundSuccessfullyHint(t){return this.textForAllItemsFoundSuccessfullyHint=t,this.barcodeFindBasicOverlay.setTextForAllItemsFoundSuccessfullyHint(this.textForAllItemsFoundSuccessfullyHint)}async setTextForPointAtBarcodesToSearchHint(t){return this.textForPointAtBarcodesToSearchHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForPointAtBarcodesToSearchHint)}async setTextForMoveCloserToBarcodesHint(t){return this.textForMoveCloserToBarcodesHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForMoveCloserToBarcodesHint)}async setTextForTapShutterToPauseScreenHint(t){return this.textForTapShutterToPauseScreenHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForTapShutterToPauseScreenHint)}async setTextForTapShutterToResumeSearchHint(t){return this.textForTapShutterToResumeSearchHint=t,this.barcodeFindBasicOverlay.setTextForTapShutterToResumeScreenHint(this.textForTapShutterToResumeSearchHint)}async setTextForItemListUpdatedWhenPausedHint(t){return this.textForItemListUpdatedWhenPausedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedWhenPausedHint(this.textForItemListUpdatedWhenPausedHint)}async setTextForItemListUpdatedHint(t){return this.textForItemListUpdatedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedWhenPausedHint(this.textForItemListUpdatedHint)}connectedCallback(){var t,o,i;this.shutterButton=this.layout.querySelector(l.ShutterButton),this.finishButton=this.layout.querySelector(l.FinishButton),this.progressBar=this.layout.querySelector(l.ProgressBarWithLabel),this.cardList=this.layout.querySelector(l.CardListContainer),this.torchSwitchIconButton=this.layout.querySelector(l.TorchSwitchIconButton),(t=this.torchSwitchIconButton)==null||t.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(o=this.shutterButton)==null||o.addEventListener("pointerdown",this.onShutterButtonClickedHandler),(i=this.finishButton)==null||i.addEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.addEventListener("onlayouttap",this.onDotClickHandler);}disconnectedCallback(){var t,o,i;(t=this.shutterButton)==null||t.removeEventListener("pointerdown",this.onShutterButtonClickedHandler),(o=this.torchSwitchIconButton)==null||o.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(i=this.finishButton)==null||i.removeEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.removeEventListener("onlayouttap",this.onDotClickHandler),this.presenter.dispose();}async onShutterButtonClicked(){this.presenter.onShutterButtonClicked();}async onTorchButtonClicked(){this.presenter.onTorchButtonClicked();}updateProgressBar(t,o){this.progressBar&&(this.progressBar.value!==t&&(this.progressBar.value=t),o!=null&&this.progressBar.max!==o&&(this.progressBar.max=o));}setShutterButtonPulse(t){this.shutterButton!=null&&(this.shutterButton.pulse=t);}switchToPaused(t,o){var s,r,e,h,a,g,f,y,L,P,H,x;let i=[];for(let c of t){let C=Card.create();C.id=`${String(c.uid)}`;let p=a$6.create();if(C.append(p),p.title=(r=(s=c.content)==null?void 0:s.info)!=null?r:c.searchOptions.barcodeData,((e=c.content)==null?void 0:e.additionalInfo)!=null&&(p.subtitle=(a=(h=c.content)==null?void 0:h.additionalInfo)!=null?a:""),o.find(n=>n.searchOptions.barcodeData===c.searchOptions.barcodeData)!=null){let n=a$7.create();n.slot="right",p.append(n);}if(((g=c.content)==null?void 0:g.image)==null){let n=a$8.create();n.slot="image-left",p.append(n);}else {let n=document.createElement("img");n.slot="image-left",n.src=(y=(f=c.content)==null?void 0:f.image)!=null?y:"",n.alt=(P=(L=c.content)==null?void 0:L.additionalInfo)!=null?P:"",p.append(n);}i.push(C);}(H=this.cardList)==null||H.renderCards(i),(x=this.cardList)==null||x.removeAttribute("hidden"),this.shutterButton.variant="play",this.shutterButton.pulse=false,this.toggleDotPulse(false);}moveCardOnTheFront(t){var i,s;if(!t)return;let o=(i=this.cardList)==null?void 0:i.getCardBySelector(`${Card.tag}#${t.uid}`);o!=null&&((s=this.cardList)==null||s.unshiftCard(o));}switchToStarted(){var t;this.clearDots(),(t=this.cardList)==null||t.setAttribute("hidden",""),this.shutterButton.variant="pause";}toggleTorchIcon(t){this.torchSwitchIconButton&&(this.torchSwitchIconButton.state=t);}onFinishButtonClicked(){this.presenter.onFinishButtonClicked();}clearDots(){let t=this.layout.querySelectorAll("[data-identifier]");for(let o of t)o.remove();}toggleDotPulse(t){let o=[...this.layout.querySelectorAll("[data-identifier]")];for(let i of o)i.pulse=t;}pointTransformation(t){return `translate3d(calc(${t.x}px - 50%), calc(${t.y}px - 50%), 0px)`}onDotClick(t){let o=t.detail.target;if(o.dataset.identifier!=null){for(let i of this.layout.querySelectorAll(a$9.tag))i.pulse=false,o===i&&o.variant==="target"&&(o.pulse=true);this.presenter.onDotClick(o.dataset.identifier);}}renderDots(t){var o,i,s;for(let r of t.removedTrackedBarcodes){let e=this.layout.querySelector(`[data-identifier="${r}"]`);e==null||e.remove();}if(t.addedTrackedBarcodes.length>0){let r=document.createDocumentFragment();for(let e of t.addedTrackedBarcodes){let h=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(e.anchorPositions),a=a$9.createWithColors(this.barcodeFindViewSettings.inListItemColor,this.barcodeFindViewSettings.notInListItemColor);a.style.setProperty("position","absolute"),a.style.setProperty("transform",this.pointTransformation(h.center)),a.dataset.identifier=`${e.identifier}`,e.barcode.data!=null&&((o=t.foundTrackedBarcodesInLastProcessedFrame[`${e.identifier}`])==null?void 0:o.barcode.data)===e.barcode.data&&(a.setAttribute("variant","target"),a.pulse=true),r.append(a);}this.layout.append(r);}for(let r of t.updatedTrackedBarcodes){let e=this.layout.querySelector(`[data-identifier="${r.identifier}"]`),{center:h}=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(r.anchorPositions);if(e){let a=(s=(i=this.camera)==null?void 0:i.getMirrorImageEnabled())!=null?s:false,g=new Size(this.dataCaptureView.width,this.dataCaptureView.height);e.style.setProperty("position","absolute");let f=a?Point.mirrorX(h,g):h;e.style.setProperty("transform",this.pointTransformation(f));}}}};u.tag="scandit-barcode-find-view";var O=u;export{O as a};
@@ -1 +1 @@
1
- import {a as a$7}from'./chunk-ZPCWOA3Y.js';import {a as a$6}from'./chunk-MHOUYN7K.js';import {a}from'./chunk-HDLJOQJY.js';import {a as a$9}from'./chunk-KMEGIFKL.js';import {a as a$5}from'./chunk-CAFOTEQ6.js';import {b as b$1}from'./chunk-33EFB3RJ.js';import {b}from'./chunk-DUG75YJ6.js';import {a as a$1}from'./chunk-I53W7VSB.js';import {a as a$8}from'./chunk-O5SUMSOC.js';import {a as a$2}from'./chunk-VBKC4EKT.js';import {a as a$4}from'./chunk-I3PK5YW4.js';import {a as a$3}from'./chunk-HPRAVXW3.js';import {Anchor,DataCaptureView,Direction,Point,Size}from'@scandit/web-datacapture-core';import {Backdrop}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Backdrop.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {css}from'@scandit/web-datacapture-core/build/js/private/utils/css.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {calculateArea,calculateWidth,calculateHeight}from'@scandit/web-datacapture-core/build/js/private/utils/quadrilateralUtils.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';import {TorchSwitchIconButton}from'@scandit/web-datacapture-core/build/js/private/ui/molecules/TorchSwitchIconButton.js';var W={async highlightForBarcode(E,T){let t=a$9.create(E);T(t);}},c=class c extends ScanditHTMLElement{constructor(){super(...arguments);this.torchSwitchIconButton=null;this.cameraSwitchButton=null;this.zoomButton=null;this._shouldShowTorchControl=false;this._isTorchAvailable=false;this.onTorchButtonClickHandler=this.onTorchButtonClick.bind(this);this.onCameraSwitchButtonHandler=this.onCameraSwitchButtonClick.bind(this);this.onZoomButtonHandler=this.onZoomButtonClick.bind(this);this.onLayoutPointerDownHandler=this.onLayoutPointerDown.bind(this);this.onInfoAnnotationTapHandler=this.onInfoAnnotationTap.bind(this);this.pendingDeletionTimeout=null;}set shouldShowZoomControl(t){this.zoomButton&&(this.zoomButton.hidden=!t);}get shouldShowZoomControl(){return this.zoomButton===null?false:!this.zoomButton.hidden}set shouldShowCameraSwitchControl(t){this.cameraSwitchButton&&(this.cameraSwitchButton.hidden=!t);}get shouldShowCameraSwitchControl(){return this.cameraSwitchButton===null?false:!this.cameraSwitchButton.hidden}set shouldShowTorchControl(t){this.torchSwitchIconButton!==null&&(this._shouldShowTorchControl=t,this.torchSwitchIconButton.hidden=!(t&&this._isTorchAvailable));}get shouldShowTorchControl(){return this._shouldShowTorchControl}set torchControlPosition(t){var o;(o=this.torchSwitchIconButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopLeft:t}`);}get torchControlPosition(){var o,e;let t=(e=(o=this.torchSwitchIconButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopLeft:t.replace("controls-","")}set zoomControlPosition(t){var o;(o=this.zoomButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.BottomRight:t}`);}get zoomControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.BottomRight:t.replace("controls-","")}set cameraSwitchControlPosition(t){var o;(o=this.cameraSwitchButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopRight:t}`);}get cameraSwitchControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopRight:t.replace("controls-","")}static async createWithSettings(t,o,e,i,n){c.register();let r=document.createElement(c.tag);return r.barcodeArViewSettings=i,r.layout=a.create(),r.append(r.layout),a$1(t)?(r.dataCaptureView=t,r.dataCaptureView.containerElement.prepend(r),await t.setContext(o)):(r.dataCaptureView=await DataCaptureView.forContext(o),r.dataCaptureView.connectToElement(t),r.dataCaptureView.containerElement.prepend(r)),r.presenter=new a$2(r,o,e,i,n!=null?n:a$3.createRecommendedCameraSettings()),await r.presenter.prepare(),r}static async create(t,o,e){return c.createWithSettings(t,o,e,new a$4)}static register(){defineCustomElements({[a.tag]:a,[a$7.tag]:a$7,[a$6.tag]:a$6,[TorchSwitchIconButton.tag]:TorchSwitchIconButton,[c.tag]:c,[Backdrop.tag]:Backdrop,[a$5.tag]:a$5});}static createStyleElement(){return css`[data-could-be-deleted=true]{display:none!important}[data-on-foreground=true]{z-index:3}${c.tag}{inset:0;position:absolute;z-index:1}`}getHighlightForBarcode(t){return this.queryHighlightByDataId(a$8(t))}getAnnotationForBarcode(t){return this.queryAnnotationByDataId(a$8(t))}async start(){return this.presenter.startSearching()}async stop(){return this.presenter.stopSearching()}async pause(){return this.presenter.pauseSearching()}reset(){this.deletePendingViews(),this.deleteAllViews();}getNotificationPresenter(){return this.dataCaptureView.getNotificationPresenter()}setTorchAvailable(t){this._isTorchAvailable=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(this._shouldShowTorchControl&&this._isTorchAvailable));}toggleTorchIcon(t){this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.state=t);}onTorchButtonClick(){this.presenter.onTorchButtonClicked();}onCameraSwitchButtonClick(){this.presenter.onCameraSwitchButtonClicked();}onZoomButtonClick(){this.presenter.onZoomButtonClicked();}changeZoomButtonIcon(t){this.zoomButton&&(this.zoomButton.zoom=`${t}x`);}connectedCallback(){this.torchSwitchIconButton=TorchSwitchIconButton.create(),this.torchSwitchIconButton.shadow=true,this.torchSwitchIconButton.size=36,this.torchSwitchIconButton.slot=`controls-${this.torchControlPosition}`,this.torchSwitchIconButton.hidden=true,this.torchSwitchIconButton.addEventListener("pointerdown",this.onTorchButtonClickHandler),this.cameraSwitchButton=a$7.create(),this.cameraSwitchButton.slot=`controls-${this.cameraSwitchControlPosition}`,this.cameraSwitchButton.hidden=true,this.cameraSwitchButton.addEventListener("pointerdown",this.onCameraSwitchButtonHandler),this.zoomButton=a$6.create(),this.zoomButton.slot=`controls-${this.zoomControlPosition}`,this.zoomButton.hidden=true,this.zoomButton.addEventListener("pointerdown",this.onZoomButtonHandler),this.layout.append(this.torchSwitchIconButton,this.cameraSwitchButton,this.zoomButton),this.layout.addEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.addEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler),this.backdrop=Backdrop.create(),this.layout.append(this.backdrop),this.pendingDeletionTimeout=new Timeout(1e3,()=>{this.deletePendingViews();}),this.prepend(c.createStyleElement());}disconnectedCallback(){var t,o,e;this.deleteAllViews(),(t=this.torchSwitchIconButton)==null||t.removeEventListener("pointerdown",this.onTorchButtonClickHandler),(o=this.cameraSwitchButton)==null||o.removeEventListener("pointerdown",this.onCameraSwitchButtonHandler),(e=this.zoomButton)==null||e.removeEventListener("pointerdown",this.onZoomButtonHandler),this.layout.removeEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.removeEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler);}isPopoverAnnotation(t){return t instanceof b}isAnnotation(t){var o;return ((o=t.dataset)==null?void 0:o.identifier)==null?false:t.dataset.identifier.endsWith("-annotation")}areMultiplePopoverAllowed(){for(let t of this.layout.querySelectorAll("[data-identifier$='-annotation']"))if(t&&this.isPopoverAnnotation(t)&&t.annotationTrigger==="highlightTapAndBarcodeScan")return true;return false}async onLayoutPointerDown(t){let o=t.target,e=o==null?void 0:o.closest("[data-identifier$='-highlight']"),i=o==null?void 0:o.closest(b.tag);if((e==null?void 0:e.dataset.id)!=null){await this.handleHighlightClick(e);return}if((i==null?void 0:i.dataset.id)!=null){await this.handleAnnotationClick(i);return}await this.handleClickOutside();}async handleHighlightClick(t){var e;this.presenter.emitTappedFeedback(),(e=this.listener)==null||e.didTapHighlightForBarcode(this.presenter.barcodeAr,t.barcode,t);let o=this.queryAnnotationByDataIdentifier(t.dataset.identifier.replace("-highlight",""));!o||o.annotationTrigger==="barcodeScan"||(this.isPopoverAnnotation(o)?await this.handlePopoverHighlightClick(o,t):o.hidden=!o.hidden);}async handlePopoverHighlightClick(t,o){var e;if(!this.areMultiplePopoverAllowed()){let i=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`),n=(e=i==null?void 0:i.dataset.identifier)==null?void 0:e.replace("-annotation","-highlight"),r=this.layout.querySelector(`[data-identifier="${n}"]`);i!=null&&r!=null&&await this.hideBarcodeArPopover(i,r,false);}await this.toggleBarcodeArPopover(t,o);}async handleAnnotationClick(t){var i;let o=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.toggleBarcodeArPopover(t,e);}async handleClickOutside(){var i;if(this.areMultiplePopoverAllowed())return;let t=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`);if(!t)return;let o=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.hideBarcodeArPopover(t,e);}onInfoAnnotationTap(){this.presenter.emitTappedFeedback();}async showBarcodeArPopover(t,o){t.dataset.onForeground="true",t.hidden=false,o.dataset.onForeground="true",this.backdrop.open=true;}async hideBarcodeArPopover(t,o,e=true){t.dataset.onForeground="false",t.hidden=true,o&&(o.dataset.onForeground="false"),e&&this.hideBackdropIfNoPopovers();}hideBackdropIfNoPopovers(){[...this.layout.querySelectorAll(`${b.tag}`)].every(o=>o.hidden)&&(this.backdrop.open=false);}async toggleBarcodeArPopover(t,o){t.hidden?await this.showBarcodeArPopover(t,o):await this.hideBarcodeArPopover(t,o);}deleteAllViews(){for(let t of this.layout.querySelectorAll("[data-identifier]"))t.remove();}deletePendingViews(){for(let t of this.layout.querySelectorAll("[data-could-be-deleted='true']"))t.remove();this.hideBackdropIfNoPopovers();}identifierForHighlight(t){return `${t}-highlight`}identifierForAnnotation(t){return `${t}-annotation`}async onHighlightsOrAnnotationForTrackedBarcode(t){var o,e,i;await((e=(o=this.highlightProvider)!=null?o:W)==null?void 0:e.highlightForBarcode(t.barcode,async n=>this.onHighlight(t,n))),await((i=this.annotationProvider)==null?void 0:i.annotationForBarcode(t.barcode,async n=>this.onAnnotation(t,n)));}async onAnnotation(t,o){let e=o,i=a$8(t.barcode);this.updateExistingAnnotation(i)||(await this.setupNewAnnotation(e,i,t),this.updateAnnotationPosition(t,e));}updateExistingAnnotation(t){let o=this.queryAnnotationByDataId(t);return o?(o.dataset.couldBeDeleted="false",true):false}async setupNewAnnotation(t,o,e){if(t.dataset.id=o,t.dataset.identifier=this.identifierForAnnotation(e.identifier),t.hidden=true,this.layout.append(t),this.isPopoverAnnotation(t)){if(t.direction=Direction.Vertical,t.anchor==null&&(t.anchor="bottom-center"),this.areMultiplePopoverAllowed()||t.annotationTrigger==="highlightTapAndBarcodeScan"){let i=this.queryHighlightByDataId(o);i&&await this.showBarcodeArPopover(t,i);}}else t.hidden=t.annotationTrigger==="highlightTap";}getAnnotationVariationForQuad(t,o){let e=Math.max(0,Math.min(1,o)),i=t.anchorPositions,n=calculateArea(i),r=this.dataCaptureView.width,l=this.dataCaptureView.height,d=r*l;if(n<=0||d<=0)return 0;let u=n/d;return Math.max(0,Math.min(1,u))<=e?2:1}async onHighlight(t,o){let e=a$8(t.barcode),i=this.queryHighlightByDataId(e);i?i.dataset.couldBeDeleted="false":(o.dataset.id=e,o.dataset.identifier=this.identifierForHighlight(t.identifier),this.updateHighlightPosition(t,o),this.layout.append(o));}queryHighlightByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-highlight"]`)}queryAnnotationByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-annotation"]`)}queryHighlightByDataId(t){return this.layout.querySelector(`[data-identifier$="-highlight"][data-id="${t}"]`)}queryAnnotationByDataId(t){return this.layout.querySelector(`[data-identifier$="-annotation"][data-id="${t}"]`)}updateRemovedTrackedBarcodes(t){var i,n,r,l,d;let o=this.querySelectorAll("[data-identifier]");if(Object.keys(t.allTrackedBarcodes).length===0){for(let u of o)u.dataset.couldBeDeleted="true";(i=this.pendingDeletionTimeout)!=null&&i.running||(n=this.pendingDeletionTimeout)==null||n.start();return}let e=new Set(t.removedTrackedBarcodes);for(let u of o){let p=(r=u.dataset.identifier)==null?void 0:r.replace("-highlight","").replace("-annotation","");p!=null&&e.has(p)&&(u.dataset.couldBeDeleted="true");}(l=this.pendingDeletionTimeout)!=null&&l.running||(d=this.pendingDeletionTimeout)==null||d.start();}render(t){for(let[o,e]of Object.entries(t.allTrackedBarcodes)){t.addedTrackedBarcodes[o]!=null&&this.onHighlightsOrAnnotationForTrackedBarcode(e);let i=a$8(e.barcode),n=this.queryAnnotationByDataId(i),r=this.queryHighlightByDataId(i);r&&(this.updateBrushSize(r,e),this.updateHighlightPosition(e,r)),n&&this.updateAnnotationPosition(e,n,r);}this.updateRemovedTrackedBarcodes(t);}updateHighlightPosition(t,o,e="center"){if(o.hidden)return;let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions),n=this.normalizedViewPointFromFrameAnchorPositions(i,e);o.updatePosition(n,new Point(-50,-50),this.calculateRotationAngle(i.topLeft,i.topRight));}updateBrushSize(t,o){if(t.width==null||t.height==null)return;let e=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(o.anchorPositions),i=Math.round(calculateWidth(e)),n=Math.round(calculateHeight(e));t.width!==i&&(t.width=i),t.height!==n&&(t.height=n);}getTransformOrigin(t){return {"top-center":new Point(-50,0),"bottom-center":new Point(-50,-100),"left-center":new Point(0,-50),"right-center":new Point(-100,-50)}[t]}calculateAnnotationPosition(t,o,e){var p,f;let n=t.orderVerticesByPosition(),r=this.normalizedViewPointFromFrameAnchorPositions(t,"center"),d={"bottom-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"topCenter");return new Point(s.x,s.y-7)},"top-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"bottomCenter");return new Point(s.x,s.y+7)},"right-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerLeft");return new Point(s.x-7,s.y)},"left-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerRight");return new Point(s.x+7,s.y)}}[o]();return e?e instanceof b$1?(p={"bottom-center":new Point(r.x,r.y-7-e.clientHeight/2),"top-center":new Point(r.x,r.y+7+e.clientHeight/2),"right-center":new Point(r.x-7-e.clientWidth/2,r.y),"left-center":new Point(r.x+7+e.clientWidth/2,r.y)}[o])!=null?p:d:(f={"bottom-center":new Point(r.x,r.y-7-e.clientHeight/2),"top-center":new Point(r.x,r.y+7+e.clientHeight/2),"right-center":new Point(r.x-7-e.clientWidth/2,r.y),"left-center":new Point(r.x+7+e.clientWidth/2,r.y)}[o])!=null?f:d:d}updateAnnotationPosition(t,o,e){let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions);if(o.anchor||(o.anchor="top-center"),o.annotationVariation!=null){let l=this.getAnnotationVariationForQuad(t,a$5.threshold);o.annotationVariation=l;}let n=this.getTransformOrigin(o.anchor),r=this.calculateAnnotationPosition(i,o.anchor,e);o.updatePosition(r,n,this.calculateRotationAngle(i.topLeft,i.topRight));}normalizedViewPointFromFrameAnchorPositions(t,o="center"){let e=this.presenter.currentCamera.getMirrorImageEnabled(),i=new Size(this.dataCaptureView.width,this.dataCaptureView.height);if(e){let r=t[{centerLeft:"centerRight",centerRight:"centerLeft",center:"center",topCenter:"topCenter",bottomCenter:"bottomCenter"}[o]];return Point.mirrorX(r,i)}return t[o]}calculateRotationAngle(t,o){let e=o.x-t.x,n=this.presenter.isCameraMirrored()?-(o.y-t.y):o.y-t.y,r=Math.atan2(n,e);return Math.round(r*(180/Math.PI))}};c.tag="scandit-barcode-ar-view";var k=c;export{k as a};
1
+ import {a as a$7}from'./chunk-ZPCWOA3Y.js';import {a as a$6}from'./chunk-MHOUYN7K.js';import {a}from'./chunk-HDLJOQJY.js';import {a as a$9}from'./chunk-KMEGIFKL.js';import {a as a$5}from'./chunk-QRG4J3CL.js';import {b as b$1}from'./chunk-33EFB3RJ.js';import {b}from'./chunk-OH47PSIL.js';import {a as a$1}from'./chunk-I53W7VSB.js';import {a as a$8}from'./chunk-O5SUMSOC.js';import {a as a$2}from'./chunk-NU4EA3HH.js';import {a as a$4}from'./chunk-I3PK5YW4.js';import {a as a$3}from'./chunk-RF4KC5J3.js';import {Anchor,DataCaptureView,Direction,Point,Size}from'@scandit/web-datacapture-core';import {Backdrop}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Backdrop.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {css}from'@scandit/web-datacapture-core/build/js/private/utils/css.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {calculateArea,calculateWidth,calculateHeight}from'@scandit/web-datacapture-core/build/js/private/utils/quadrilateralUtils.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';import {TorchSwitchIconButton}from'@scandit/web-datacapture-core/build/js/private/ui/molecules/TorchSwitchIconButton.js';var W={async highlightForBarcode(E,T){let t=a$9.create(E);T(t);}},c=class c extends ScanditHTMLElement{constructor(){super(...arguments);this.torchSwitchIconButton=null;this.cameraSwitchButton=null;this.zoomButton=null;this._shouldShowTorchControl=false;this._isTorchAvailable=false;this.onTorchButtonClickHandler=this.onTorchButtonClick.bind(this);this.onCameraSwitchButtonHandler=this.onCameraSwitchButtonClick.bind(this);this.onZoomButtonHandler=this.onZoomButtonClick.bind(this);this.onLayoutPointerDownHandler=this.onLayoutPointerDown.bind(this);this.onInfoAnnotationTapHandler=this.onInfoAnnotationTap.bind(this);this.pendingDeletionTimeout=null;}set shouldShowZoomControl(t){this.zoomButton&&(this.zoomButton.hidden=!t);}get shouldShowZoomControl(){return this.zoomButton===null?false:!this.zoomButton.hidden}set shouldShowCameraSwitchControl(t){this.cameraSwitchButton&&(this.cameraSwitchButton.hidden=!t);}get shouldShowCameraSwitchControl(){return this.cameraSwitchButton===null?false:!this.cameraSwitchButton.hidden}set shouldShowTorchControl(t){this.torchSwitchIconButton!==null&&(this._shouldShowTorchControl=t,this.torchSwitchIconButton.hidden=!(t&&this._isTorchAvailable));}get shouldShowTorchControl(){return this._shouldShowTorchControl}set torchControlPosition(t){var o;(o=this.torchSwitchIconButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopLeft:t}`);}get torchControlPosition(){var o,e;let t=(e=(o=this.torchSwitchIconButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopLeft:t.replace("controls-","")}set zoomControlPosition(t){var o;(o=this.zoomButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.BottomRight:t}`);}get zoomControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.BottomRight:t.replace("controls-","")}set cameraSwitchControlPosition(t){var o;(o=this.cameraSwitchButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopRight:t}`);}get cameraSwitchControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopRight:t.replace("controls-","")}static async createWithSettings(t,o,e,i,n){c.register();let r=document.createElement(c.tag);return r.barcodeArViewSettings=i,r.layout=a.create(),r.append(r.layout),a$1(t)?(r.dataCaptureView=t,r.dataCaptureView.containerElement.prepend(r),await t.setContext(o)):(r.dataCaptureView=await DataCaptureView.forContext(o),r.dataCaptureView.connectToElement(t),r.dataCaptureView.containerElement.prepend(r)),r.presenter=new a$2(r,o,e,i,n!=null?n:a$3.createRecommendedCameraSettings()),await r.presenter.prepare(),r}static async create(t,o,e){return c.createWithSettings(t,o,e,new a$4)}static register(){defineCustomElements({[a.tag]:a,[a$7.tag]:a$7,[a$6.tag]:a$6,[TorchSwitchIconButton.tag]:TorchSwitchIconButton,[c.tag]:c,[Backdrop.tag]:Backdrop,[a$5.tag]:a$5});}static createStyleElement(){return css`[data-could-be-deleted=true]{display:none!important}[data-on-foreground=true]{z-index:3}${c.tag}{inset:0;position:absolute;z-index:1}`}getHighlightForBarcode(t){return this.queryHighlightByDataId(a$8(t))}getAnnotationForBarcode(t){return this.queryAnnotationByDataId(a$8(t))}async start(){return this.presenter.startSearching()}async stop(){return this.presenter.stopSearching()}async pause(){return this.presenter.pauseSearching()}reset(){this.deletePendingViews(),this.deleteAllViews();}getNotificationPresenter(){return this.dataCaptureView.getNotificationPresenter()}setTorchAvailable(t){this._isTorchAvailable=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(this._shouldShowTorchControl&&this._isTorchAvailable));}toggleTorchIcon(t){this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.state=t);}onTorchButtonClick(){this.presenter.onTorchButtonClicked();}onCameraSwitchButtonClick(){this.presenter.onCameraSwitchButtonClicked();}onZoomButtonClick(){this.presenter.onZoomButtonClicked();}changeZoomButtonIcon(t){this.zoomButton&&(this.zoomButton.zoom=`${t}x`);}connectedCallback(){this.torchSwitchIconButton=TorchSwitchIconButton.create(),this.torchSwitchIconButton.shadow=true,this.torchSwitchIconButton.size=36,this.torchSwitchIconButton.slot=`controls-${this.torchControlPosition}`,this.torchSwitchIconButton.hidden=true,this.torchSwitchIconButton.addEventListener("pointerdown",this.onTorchButtonClickHandler),this.cameraSwitchButton=a$7.create(),this.cameraSwitchButton.slot=`controls-${this.cameraSwitchControlPosition}`,this.cameraSwitchButton.hidden=true,this.cameraSwitchButton.addEventListener("pointerdown",this.onCameraSwitchButtonHandler),this.zoomButton=a$6.create(),this.zoomButton.slot=`controls-${this.zoomControlPosition}`,this.zoomButton.hidden=true,this.zoomButton.addEventListener("pointerdown",this.onZoomButtonHandler),this.layout.append(this.torchSwitchIconButton,this.cameraSwitchButton,this.zoomButton),this.layout.addEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.addEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler),this.backdrop=Backdrop.create(),this.layout.append(this.backdrop),this.pendingDeletionTimeout=new Timeout(1e3,()=>{this.deletePendingViews();}),this.prepend(c.createStyleElement());}disconnectedCallback(){var t,o,e;this.deleteAllViews(),(t=this.torchSwitchIconButton)==null||t.removeEventListener("pointerdown",this.onTorchButtonClickHandler),(o=this.cameraSwitchButton)==null||o.removeEventListener("pointerdown",this.onCameraSwitchButtonHandler),(e=this.zoomButton)==null||e.removeEventListener("pointerdown",this.onZoomButtonHandler),this.layout.removeEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.removeEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler);}isPopoverAnnotation(t){return t instanceof b}isAnnotation(t){var o;return ((o=t.dataset)==null?void 0:o.identifier)==null?false:t.dataset.identifier.endsWith("-annotation")}areMultiplePopoverAllowed(){for(let t of this.layout.querySelectorAll("[data-identifier$='-annotation']"))if(t&&this.isPopoverAnnotation(t)&&t.annotationTrigger==="highlightTapAndBarcodeScan")return true;return false}async onLayoutPointerDown(t){let o=t.target,e=o==null?void 0:o.closest("[data-identifier$='-highlight']"),i=o==null?void 0:o.closest(b.tag);if((e==null?void 0:e.dataset.id)!=null){await this.handleHighlightClick(e);return}if((i==null?void 0:i.dataset.id)!=null){await this.handleAnnotationClick(i);return}await this.handleClickOutside();}async handleHighlightClick(t){var e;this.presenter.emitTappedFeedback(),(e=this.listener)==null||e.didTapHighlightForBarcode(this.presenter.barcodeAr,t.barcode,t);let o=this.queryAnnotationByDataIdentifier(t.dataset.identifier.replace("-highlight",""));!o||o.annotationTrigger==="barcodeScan"||(this.isPopoverAnnotation(o)?await this.handlePopoverHighlightClick(o,t):o.hidden=!o.hidden);}async handlePopoverHighlightClick(t,o){var e;if(!this.areMultiplePopoverAllowed()){let i=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`),n=(e=i==null?void 0:i.dataset.identifier)==null?void 0:e.replace("-annotation","-highlight"),r=this.layout.querySelector(`[data-identifier="${n}"]`);i!=null&&r!=null&&await this.hideBarcodeArPopover(i,r,false);}await this.toggleBarcodeArPopover(t,o);}async handleAnnotationClick(t){var i;let o=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.toggleBarcodeArPopover(t,e);}async handleClickOutside(){var i;if(this.areMultiplePopoverAllowed())return;let t=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`);if(!t)return;let o=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.hideBarcodeArPopover(t,e);}onInfoAnnotationTap(){this.presenter.emitTappedFeedback();}async showBarcodeArPopover(t,o){t.dataset.onForeground="true",t.hidden=false,o.dataset.onForeground="true",this.backdrop.open=true;}async hideBarcodeArPopover(t,o,e=true){t.dataset.onForeground="false",t.hidden=true,o&&(o.dataset.onForeground="false"),e&&this.hideBackdropIfNoPopovers();}hideBackdropIfNoPopovers(){[...this.layout.querySelectorAll(`${b.tag}`)].every(o=>o.hidden)&&(this.backdrop.open=false);}async toggleBarcodeArPopover(t,o){t.hidden?await this.showBarcodeArPopover(t,o):await this.hideBarcodeArPopover(t,o);}deleteAllViews(){for(let t of this.layout.querySelectorAll("[data-identifier]"))t.remove();}deletePendingViews(){for(let t of this.layout.querySelectorAll("[data-could-be-deleted='true']"))t.remove();this.hideBackdropIfNoPopovers();}identifierForHighlight(t){return `${t}-highlight`}identifierForAnnotation(t){return `${t}-annotation`}async onHighlightsOrAnnotationForTrackedBarcode(t){var o,e,i;await((e=(o=this.highlightProvider)!=null?o:W)==null?void 0:e.highlightForBarcode(t.barcode,async n=>this.onHighlight(t,n))),await((i=this.annotationProvider)==null?void 0:i.annotationForBarcode(t.barcode,async n=>this.onAnnotation(t,n)));}async onAnnotation(t,o){let e=o,i=a$8(t.barcode);this.updateExistingAnnotation(i)||(await this.setupNewAnnotation(e,i,t),this.updateAnnotationPosition(t,e));}updateExistingAnnotation(t){let o=this.queryAnnotationByDataId(t);return o?(o.dataset.couldBeDeleted="false",true):false}async setupNewAnnotation(t,o,e){if(t.dataset.id=o,t.dataset.identifier=this.identifierForAnnotation(e.identifier),t.hidden=true,this.layout.append(t),this.isPopoverAnnotation(t)){if(t.direction=Direction.Vertical,t.anchor==null&&(t.anchor="bottom-center"),this.areMultiplePopoverAllowed()||t.annotationTrigger==="highlightTapAndBarcodeScan"){let i=this.queryHighlightByDataId(o);i&&await this.showBarcodeArPopover(t,i);}}else t.hidden=t.annotationTrigger==="highlightTap";}getAnnotationVariationForQuad(t,o){let e=Math.max(0,Math.min(1,o)),i=t.anchorPositions,n=calculateArea(i),r=this.dataCaptureView.width,l=this.dataCaptureView.height,d=r*l;if(n<=0||d<=0)return 0;let u=n/d;return Math.max(0,Math.min(1,u))<=e?2:1}async onHighlight(t,o){let e=a$8(t.barcode),i=this.queryHighlightByDataId(e);i?i.dataset.couldBeDeleted="false":(o.dataset.id=e,o.dataset.identifier=this.identifierForHighlight(t.identifier),this.updateHighlightPosition(t,o),this.layout.append(o));}queryHighlightByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-highlight"]`)}queryAnnotationByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-annotation"]`)}queryHighlightByDataId(t){return this.layout.querySelector(`[data-identifier$="-highlight"][data-id="${t}"]`)}queryAnnotationByDataId(t){return this.layout.querySelector(`[data-identifier$="-annotation"][data-id="${t}"]`)}updateRemovedTrackedBarcodes(t){var i,n,r,l,d;let o=this.querySelectorAll("[data-identifier]");if(Object.keys(t.allTrackedBarcodes).length===0){for(let u of o)u.dataset.couldBeDeleted="true";(i=this.pendingDeletionTimeout)!=null&&i.running||(n=this.pendingDeletionTimeout)==null||n.start();return}let e=new Set(t.removedTrackedBarcodes);for(let u of o){let p=(r=u.dataset.identifier)==null?void 0:r.replace("-highlight","").replace("-annotation","");p!=null&&e.has(p)&&(u.dataset.couldBeDeleted="true");}(l=this.pendingDeletionTimeout)!=null&&l.running||(d=this.pendingDeletionTimeout)==null||d.start();}render(t){for(let[o,e]of Object.entries(t.allTrackedBarcodes)){t.addedTrackedBarcodes[o]!=null&&this.onHighlightsOrAnnotationForTrackedBarcode(e);let i=a$8(e.barcode),n=this.queryAnnotationByDataId(i),r=this.queryHighlightByDataId(i);r&&(this.updateBrushSize(r,e),this.updateHighlightPosition(e,r)),n&&this.updateAnnotationPosition(e,n,r);}this.updateRemovedTrackedBarcodes(t);}updateHighlightPosition(t,o,e="center"){if(o.hidden)return;let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions),n=this.normalizedViewPointFromFrameAnchorPositions(i,e);o.updatePosition(n,new Point(-50,-50),this.calculateRotationAngle(i.topLeft,i.topRight));}updateBrushSize(t,o){if(t.width==null||t.height==null)return;let e=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(o.anchorPositions),i=Math.round(calculateWidth(e)),n=Math.round(calculateHeight(e));t.width!==i&&(t.width=i),t.height!==n&&(t.height=n);}getTransformOrigin(t){return {"top-center":new Point(-50,0),"bottom-center":new Point(-50,-100),"left-center":new Point(0,-50),"right-center":new Point(-100,-50)}[t]}calculateAnnotationPosition(t,o,e){var p,f;let n=t.orderVerticesByPosition(),r=this.normalizedViewPointFromFrameAnchorPositions(t,"center"),d={"bottom-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"topCenter");return new Point(s.x,s.y-7)},"top-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"bottomCenter");return new Point(s.x,s.y+7)},"right-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerLeft");return new Point(s.x-7,s.y)},"left-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerRight");return new Point(s.x+7,s.y)}}[o]();return e?e instanceof b$1?(p={"bottom-center":new Point(r.x,r.y-7-e.clientHeight/2),"top-center":new Point(r.x,r.y+7+e.clientHeight/2),"right-center":new Point(r.x-7-e.clientWidth/2,r.y),"left-center":new Point(r.x+7+e.clientWidth/2,r.y)}[o])!=null?p:d:(f={"bottom-center":new Point(r.x,r.y-7-e.clientHeight/2),"top-center":new Point(r.x,r.y+7+e.clientHeight/2),"right-center":new Point(r.x-7-e.clientWidth/2,r.y),"left-center":new Point(r.x+7+e.clientWidth/2,r.y)}[o])!=null?f:d:d}updateAnnotationPosition(t,o,e){let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions);if(o.anchor||(o.anchor="top-center"),o.annotationVariation!=null){let l=this.getAnnotationVariationForQuad(t,a$5.threshold);o.annotationVariation=l;}let n=this.getTransformOrigin(o.anchor),r=this.calculateAnnotationPosition(i,o.anchor,e);o.updatePosition(r,n,this.calculateRotationAngle(i.topLeft,i.topRight));}normalizedViewPointFromFrameAnchorPositions(t,o="center"){let e=this.presenter.currentCamera.getMirrorImageEnabled(),i=new Size(this.dataCaptureView.width,this.dataCaptureView.height);if(e){let r=t[{centerLeft:"centerRight",centerRight:"centerLeft",center:"center",topCenter:"topCenter",bottomCenter:"bottomCenter"}[o]];return Point.mirrorX(r,i)}return t[o]}calculateRotationAngle(t,o){let e=o.x-t.x,n=this.presenter.isCameraMirrored()?-(o.y-t.y):o.y-t.y,r=Math.atan2(n,e);return Math.round(r*(180/Math.PI))}};c.tag="scandit-barcode-ar-view";var k=c;export{k as a};
@@ -0,0 +1 @@
1
+ import {HintAnchor,HintIcon,HintTextAlignment}from'@scandit/web-datacapture-core/build/js/worker/dataCaptureWorkerRelated.js';function y(o){return o.charAt(0).toUpperCase()+o.slice(1)}function l(o){return o}var u=class{constructor(e,i,t){this.barcodeFind=null;this.basicOverlay=null;this.transparentGuidanceHintStyle={backgroundColor:"00000000",cornerRadius:4,fitToText:false,isAnimatedToView:false,textAlignment:HintTextAlignment.Center,hintIcon:HintIcon.None,hintAnchor:HintAnchor.Center,hintAnchorOffset:0,horizontalMargin:0,iconColor:"00000000",lineHeight:-1,maxLines:1,maxWidthFraction:.8,textColor:"ffffffff",textSize:15,textWeight:600};this.customerTransformation=l;this.coreEngine=e,this.Module=i,this.workerFunctions=t;}async forSettings(e){var c;(c=this.barcodeFind)==null||c.delete(),this.barcodeFind=new this.Module.BarcodeFind(this.coreEngine.context,JSON.stringify(e));let i=this.Module.Feedback.extend("Feedback",{emit:()=>{this.listUpdatedFeedback();}}),t=this.Module.Feedback.extend("Feedback",{emit:()=>{this.barcodeFindFeedback();}}),r=this.Module.BarcodeFindTransformer.extend("BarcodeFindTransformer",{transformBarcodeData:n=>this.customerTransformation(n)}),d=this.Module.BarcodeFindListener.extend("BarcodeFindListener",{didUpdateSession:(n,s,a)=>{let p=this.coreEngine.prepareFrameForListener(a);this.workerFunctions.postMessage({type:"barcodeFindDidUpdateSession",payload:{session:JSON.parse(s.toJson()),frameData:p}}),n.delete(),s.delete(),a.delete();},onSearchPaused:n=>{let s=[];for(let a=0;a<n.size();a++)s.push(n.get(a));this.workerFunctions.postMessage({type:"barcodeFindSearchPaused",payload:{foundItems:s}});},onSearchStopped:n=>{let s=[];for(let a=0;a<n.size();a++)s.push(n.get(a));this.workerFunctions.postMessage({type:"barcodeFindSearchStopped",payload:{foundItems:s}});},onSearchStarted:()=>{this.workerFunctions.postMessage({type:"barcodeFindSearchStarted",payload:{}});}});this.barcodeFind.setBarcodeFindTransformer(new r),this.barcodeFind.addListener(new d,1),this.barcodeFind.setItemListUpdatedFeedback(new i),this.barcodeFind.setFeedback(new t),this.Module.addBarcodeFindToContext(this.coreEngine.context,this.barcodeFind);}barcodeFindFeedback(){this.workerFunctions.postMessage({type:"barcodeFindFeedback",payload:{}});}start(){var e;(e=this.barcodeFind)==null||e.start();}stop(){var e;(e=this.barcodeFind)==null||e.stop();}pause(){var e;(e=this.barcodeFind)==null||e.pause();}setEnabled(e){var i;(i=this.barcodeFind)==null||i.setEnabled(e);}setItemList(e){var i;(i=this.barcodeFind)==null||i.setItemList(JSON.stringify(e));}async removeMode(){this.barcodeFind!=null&&this.Module.removeBarcodeFindFromContext(this.coreEngine.context,this.barcodeFind);}addBasicOverlay(){var e;(e=this.basicOverlay)==null||e.delete(),this.basicOverlay=null,this.barcodeFind!=null&&(this.basicOverlay=new this.Module.BarcodeFindBasicOverlay(this.barcodeFind)),this.coreEngine.view!=null&&this.basicOverlay!=null&&(this.basicOverlay.setGuidanceHandler(this.createWebFindGuidanceHandler()),this.Module.addBarcodeFindBasicOverlayToView(this.coreEngine.view,this.basicOverlay));}removeBasicOverlay(){this.coreEngine.view!=null&&this.basicOverlay!=null&&this.Module.removeBarcodeFindBasicOverlayFromView(this.coreEngine.view,this.basicOverlay);}async applySettings(e){var i;(i=this.barcodeFind)==null||i.applySettings(JSON.stringify(e));}updateBasicOverlay(e){let i=Object.entries(e).filter(([t,r])=>t!=="type");for(let[t,r]of i){let d=`set${y(t)}`;this.basicOverlay!=null&&typeof this.basicOverlay[d]=="function"&&r!=null&&this.basicOverlay[d](r);}}setTransformerFunction(e){this.customerTransformation=e!=null?e:l;}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"});}listUpdatedFeedback(){this.workerFunctions.postMessage({type:"barcodeFindListUpdatedFeedback",payload:{}});}setToast(e,i){let t=this.coreEngine.hintPresenterV2;e?t==null||t.showToast(JSON.stringify(i)):t==null||t.hideToast(i.tag);}setGuidance(e,i,t){let r={tag:t,text:i,hintStyle:this.transparentGuidanceHintStyle};this.workerFunctions.postMessage({type:e?"showGuidance":"hideGuidance",payload:r});}createWebFindGuidanceHandler(){let e=this.Module.BarcodeFindGuidanceHandler.extend("BarcodeFindGuidanceHandler",{setInitialGuidance:(i,t)=>{this.setGuidance(i,t,"InitialGuidance");},setMoveCloserGuidance:(i,t)=>{this.setGuidance(false,t,"InitialGuidance"),this.setGuidance(i,t,"MoveCloserGuidance");},setTapShutterToPause:(i,t)=>{this.setGuidance(false,t,"InitialGuidance"),this.setGuidance(i,t,"TapShutterToPause");},setTapShutterToResume:(i,t)=>{this.setGuidance(false,t,"InitialGuidance"),this.setGuidance(i,t,"TapShutterResume");}});return new e}};export{u as a};
@@ -0,0 +1 @@
1
+ import {a as a$3}from'./chunk-3OCPZ3OV.js';import {a as a$4}from'./chunk-L6BUOAGT.js';import {a as a$1}from'./chunk-QCD3RIT4.js';import {c as c$1,b as b$2}from'./chunk-SZUPDKV5.js';import {a as a$5}from'./chunk-74NQM2AV.js';import {b}from'./chunk-RU7XJPB3.js';import {a as a$2,c,b as b$1}from'./chunk-PMTVYYAY.js';import {a as a$6}from'./chunk-V2WRHFW3.js';import {a as a$7}from'./chunk-KGVFOBRT.js';import {a as a$8}from'./chunk-HDODW33D.js';import {a}from'./chunk-OCYHIAM2.js';import {Logger,DataCaptureView,Anchor,LogoStyle,isCameraFrameSource,Camera,FrameSourceState,Color,CameraPosition,TorchState,NumberWithUnit,RadiusLocationSelection}from'@scandit/web-datacapture-core';import {SafeStorage}from'@scandit/web-datacapture-core/build/js/private/utils/safeStorage.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';function v(U,e,t){let a=t.value;return typeof a!="function"?(Logger.warn(`@afterPrepareScanning applied to non-function: ${e}`),t):a.constructor.name==="AsyncFunction"||a.constructor===(async()=>{}).constructor?(t.value=function(...r){return this._preparationPromise?this._preparationPromise.then(()=>a.apply(this,r)):Promise.reject(new Error(`prepare should be called before calling ${e} method`))},t):(Logger.warn(`@afterPrepareScanning applied to non-async method: ${e}`),t)}var l=class l{constructor(e,t){this._context=null;this._sparkScan=null;this._preparationPromise=null;this._stopScanningPromise=null;this._dataCaptureView=null;this.preferenceManager=new a$1(SafeStorage.getInstanceFor("localStorage"));this.defaultSuccessBrush=a$2.defaultSuccessBrush();this.defaultErrorBrush=a$2.defaultErrorBrush();this.sparkScanView=e,this.setSparkScanViewSettings(t);}get camera(){var e;return (e=this.context)==null?void 0:e.frameSource}set context(e){this._context!==e&&(this._preparationPromise=null,this._context=e,e&&(this.analyticsManager=b.forContext(e)));}get context(){return this._context}set sparkScan(e){this._sparkScan!==e&&(this._preparationPromise=null,this._sparkScan=e);}get sparkScan(){return this._sparkScan}get sparkScan$(){if(!this._sparkScan)throw new Error("SparkScan mode is required to be set before calling this method");return this._sparkScan}get context$(){if(!this._context)throw new Error("Context is required to be set before calling this method");return this._context}setSparkScanViewSettings(e){this.sparkScanViewSettings=e,this.stateManager=new a$3(this.sparkScanViewSettings,this.preferenceManager),this.feedbackManager=a$4.withDefaults(this.sparkScanViewSettings.soundEnabled,this.sparkScanViewSettings.hapticEnabled),this.triggerButtonCollapseTimeout=new Timeout(this.sparkScanViewSettings.triggerButtonCollapseTimeout,async()=>{this.stateManager.state!=="idle"&&this._preparationPromise&&await this.switchToIdleState({sessionStopReason:"timeout"});}),this.inactiveStateTimeout=new Timeout(this.sparkScanViewSettings.inactiveStateTimeout,async()=>{this.stateManager.state!=="inactive"&&!this.stateManager.holdingToScan&&this._preparationPromise&&await this.switchToInactiveState({sessionStopReason:"timeout"});}),this.stateTimeouts={active:this.inactiveStateTimeout,inactive:this.triggerButtonCollapseTimeout};}get portraitOrientationTriggerButtonTranslateX(){var e;return (e=this.stateManager.portraitOrientationTriggerButtonTranslateX)!=null?e:this.defaultTriggerButtonTranslateX}get portraitOrientationTriggerButtonTranslateY(){var e;return (e=this.stateManager.portraitOrientationTriggerButtonTranslateY)!=null?e:this.defaultTriggerButtonTranslateY}get landscapeOrientationTriggerButtonTranslateX(){var e;return (e=this.stateManager.landscapeOrientationTriggerButtonTranslateX)!=null?e:this.defaultTriggerButtonTranslateX}get landscapeOrientationTriggerButtonTranslateY(){var e;return (e=this.stateManager.landscapeOrientationTriggerButtonTranslateY)!=null?e:this.defaultTriggerButtonTranslateY}get portraitOrientationMiniPreviewTranslateX(){var e;return (e=this.stateManager.portraitOrientationMiniPreviewTranslateX)!=null?e:this.defaultMiniPreviewTranslateX}get portraitOrientationMiniPreviewTranslateY(){var e;return (e=this.stateManager.portraitOrientationMiniPreviewTranslateY)!=null?e:this.defaultMiniPreviewTranslateY}get landscapeOrientationMiniPreviewTranslateX(){var e;return (e=this.stateManager.landscapeOrientationMiniPreviewTranslateX)!=null?e:this.defaultMiniPreviewTranslateX}get landscapeOrientationMiniPreviewTranslateY(){var e;return (e=this.stateManager.landscapeOrientationMiniPreviewTranslateY)!=null?e:this.defaultMiniPreviewTranslateY}get defaultTriggerButtonTranslateX(){return this.parentViewSizes.width-Math.min(this.parentViewSizes.width/3,110)-90/2}get defaultTriggerButtonTranslateY(){return this.parentViewSizes.height-Math.min(this.parentViewSizes.height/3,250)-90/2}get defaultMiniPreviewTranslateX(){return this.parentViewSizes.width-225-16}get parentViewSizes(){var e,t;return {width:(e=this.sparkScanView.parentElement.clientWidth)!=null?e:window.innerWidth,height:(t=this.sparkScanView.parentElement.clientHeight)!=null?t:window.innerHeight}}get defaultMiniPreviewTranslateY(){return 16}static forView(e,t){return new l(e,t)}async prepareScanning(e){if(this._preparationPromise)return this._preparationPromise;this._stopScanningPromise&&await this._stopScanningPromise,this._preparationPromise=this._internalPrepareScanning(e);try{await this._preparationPromise;}catch(t){throw this._preparationPromise=null,t}return this._preparationPromise}async _internalPrepareScanning(e){let t=this.context$,a=this.sparkScan$;this._dataCaptureView=await DataCaptureView.forContext(t),this._dataCaptureView.logoAnchor=Anchor.BottomCenter,this._dataCaptureView.logoStyle=LogoStyle.Minimal,this._dataCaptureView.setHiddenProperty("stopVideoTracksOnVisibilityChange",false),this._dataCaptureView.setHiddenProperty("freezeFrameWhenStoppingFrameSource",false),this._dataCaptureView.connectToElement(e);let i=isCameraFrameSource(t.frameSource)?t.frameSource:Camera.pickBestGuessForPosition(this.sparkScanViewSettings.defaultCameraPosition);await t.setFrameSource(i),await i.applySettings(a$5.recommendedCameraSettings),await i.switchToDesiredState(FrameSourceState.Standby);let r=await i.isTorchAvailable();this.sparkScanView.setTorchAvailable(r),this.sparkScanView.setZoomAvailable(i.isZoomAvailable()),this.sparkScanView.cameraSwitchButtonTapped(r,i.position),await t.setMode(a),a.addListener(this),a.setDelegate(this),this.sparkScanOverlay=await a$6.withSparkScanForView(a,this._dataCaptureView),await this.sparkScanOverlay.setShouldRemoveLocationsAfterScan(this.stateManager.scanningBehavior==="continuous"),this.smartScanSelectionOverlay=a$7.forMode(a),this.sparkScanViewSettings.smartSelectionCandidateBrush?this.smartScanSelectionOverlay.setBrush(this.sparkScanViewSettings.smartSelectionCandidateBrush):this.smartScanSelectionOverlay.setBrush(this.sparkScanOverlay.getBrush()),this.smartScanSelectionOverlay.setErrorBrush(this.sparkScanOverlay.getErrorBrush()),this.analyticsManager.startSession({cameraPosition:this.camera.position,hapticEnabled:this.sparkScanViewSettings.hapticEnabled,scanningMode:this.stateManager.scanningMode,soundEnabled:this.sparkScanViewSettings.soundEnabled,torchState:this.camera.getDesiredTorchState()}),await this.applyPreferences(),await this.switchToIdleState();}async stopScanning(e){if(this._stopScanningPromise)return this._stopScanningPromise;if(this.stateManager.state!=="Initial"){this._preparationPromise=null,this._stopScanningPromise=this._internalStopScanning(e);try{await this._stopScanningPromise;}finally{this._stopScanningPromise=null;}}}async _internalStopScanning(e){var i,r;this.stopTimeouts();let t=this.context$,a=this.sparkScan$;await a.setEnabled(false),a.removeListener(this),a.setDelegate(void 0),await t.removeMode(a),await((i=this.camera)==null?void 0:i.switchToDesiredState(FrameSourceState.Off)),(r=this._dataCaptureView)==null||r.detachFromElement(),this.analyticsManager.setSessionStopReason(e.sessionStopReason),this.setState("Initial");}async startScanning(){await this.switchToActiveState();}async pauseScanning(){await this.switchToInactiveState({sessionStopReason:"user"});}async onTriggerButtonPointerDown(){this.stateManager.triggerButtonPressed=true;}async onTriggerButtonTap(){switch(this.stateManager.state){case "Initial":{this.stateManager.triggerButtonPressed=false;return}case "idle":case "inactive":{await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)});return}case "error":{await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)});return}case "active":{if(this.stateManager.inSmartScanSelection){this.restartTimeouts(),await this.sparkScan$.selectItemWithSmartScanSelection();return}await(this.stateManager.continuousModeEnabled?this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.noFeedback)}):this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}}}async onTriggerButtonLongPressStart(){var e;this.stateManager.triggerButtonPressed=true,this.sparkScanViewSettings.holdToScanEnabled&&(this.scanningBehaviorCache=this.stateManager.scanningBehavior,this.stateManager.scanningBehavior="continuous",this.stateManager.holdingToScan=true,await((e=this.sparkScanOverlay)==null?void 0:e.setShouldRemoveLocationsAfterScan(true)),await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}async onTriggerButtonLongPressEnd(){var e,t;this.sparkScanViewSettings.holdToScanEnabled&&this.stateManager.state!=="error"?(this.stateManager.scanningBehavior=(e=this.scanningBehaviorCache)!=null?e:"single",this.stateManager.holdingToScan=false,await((t=this.sparkScanOverlay)==null?void 0:t.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new b$1("",0,Color.fromRGBA(0,0,0,0),this.defaultErrorBrush,this.feedbackManager.noFeedback)})):this.stateManager.triggerButtonPressed=false;}async onClickOutside(){this.stateManager.idleState||await this.switchToIdleState({emitTapFeedback:true});}async onVisibilityChange(){await this.switchToIdleState();}async onTargetModeButtonTap(e,t=this.feedbackManager.tapFeedback,a=true){var o,s,c;t.emit();let i=String(e),r={true:e&&this.stateManager.scanningMode instanceof b$2,false:!e&&this.stateManager.scanningMode instanceof c$1}[i];r&&(this.stateManager.scanningMode=this.stateManager.scanningMode.changeMode()),this.enableTargetMode(e),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldDrawViewfinder(e)),this.startTimeoutForCurrentState(),this.sparkScanView.targetModeButtonTapped(e,a),r&&((c=(s=this.listener)==null?void 0:s.didChangeScanningMode)==null||c.call(s,this.stateManager.scanningMode),this.analyticsManager.setScanningMode(this.stateManager.scanningMode)),this.updateSizeControlVisibility();}async onScanningBehaviorButtonTap(e,t=this.feedbackManager.tapFeedback,a=true){var i;t.emit(),this.stateManager.scanningMode=this.stateManager.scanningMode.copyWith(e?"continuous":"single"),await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(e)),this.startTimeoutForCurrentState(),this.sparkScanView.scanningBehaviorButtonTapped(e,a),this.analyticsManager.setScanningMode(this.stateManager.scanningMode);}async onBarcodeFindButtonTap(){var e,t;await this.switchToIdleState({sessionStopReason:"user",emitTapFeedback:true}),(t=(e=this.listener)==null?void 0:e.didTapBarcodeFindButton)==null||t.call(e,this.sparkScanView),this.restartTimeouts();}async onLabelCaptureButtonTap(){var e,t;await this.switchToIdleState({sessionStopReason:"user",emitTapFeedback:true}),(t=(e=this.listener)==null?void 0:e.didTapLabelCaptureButton)==null||t.call(e,this.sparkScanView),this.restartTimeouts();}async onCameraSwitchButtonTap(){var a,i;if(this.feedbackManager.emitTapFeedback(),this.restartTimeouts(),!this.camera||this.stateManager.state==="error")return;let e={[CameraPosition.WorldFacing]:CameraPosition.UserFacing,[CameraPosition.UserFacing]:CameraPosition.WorldFacing}[(a=this.camera)==null?void 0:a.position],t=Camera.pickBestGuessForPosition(e);t&&(await((i=this.camera)==null?void 0:i.switchToDesiredState(FrameSourceState.Off)),await this.context$.setFrameSource(t),await t.applySettings(this.camera.settings),await t.switchToDesiredState(FrameSourceState.On),this.sparkScanView.cameraSwitchButtonTapped(await t.isTorchAvailable(),e),this.analyticsManager.setCameraPosition(e));}async onTorchButtonTap(e,t=this.feedbackManager.tapFeedback,a=true){var i,r;t.emit(),this.stateManager.torchState=e?TorchState.On:TorchState.Off,((i=this.camera)==null?void 0:i.getCurrentState())===FrameSourceState.On&&await((r=this.camera)==null?void 0:r.setDesiredTorchState(this.stateManager.torchState)),this.startTimeoutForCurrentState(),this.sparkScanView.torchButtonTapped(e,a),this.analyticsManager.setTorchState(this.stateManager.torchState);}restartTimeouts(){for(let e of [this.triggerButtonCollapseTimeout,this.inactiveStateTimeout,this.resumeCapturingTimeout])(e==null?void 0:e.running)===true&&e.start();}stopTimeouts(){for(let e of [this.triggerButtonCollapseTimeout,this.inactiveStateTimeout,this.resumeCapturingTimeout])e==null||e.stop();}async onMiniPreviewCloseButtonTap(){await this.switchToIdleState({sessionStopReason:"user",emitTapFeedback:true});}onMiniPreviewResizeButtonTap(){(this.stateManager.state==="active"||this.stateManager.state==="inactive")&&(this.feedbackManager.emitTapFeedback(),this.startTimeoutForCurrentState());}async onMiniPreviewZoomButtonTap(e){this.feedbackManager.emitTapFeedback(),this.stateManager.zoomFactor=e,this.camera&&(this.camera.settings.zoomFactor=e,await this.camera.applySettings(this.camera.settings)),this.startTimeoutForCurrentState();}async onMiniPreviewDrag(e,t){switch(this.stateManager.state==="active"&&await this.sparkScan$.setEnabled(false),t){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationMiniPreviewTranslateX=e.x,this.stateManager.landscapeOrientationMiniPreviewTranslateY=e.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationMiniPreviewTranslateX=e.x,this.stateManager.portraitOrientationMiniPreviewTranslateY=e.y;break}}this.restartTimeouts();}onMiniPreviewPointerMove(){this.restartTimeouts();}async onMiniPreviewPointerUp(){await this.switchToActiveState();}async onMiniPreviewDragEnd(){this.stateManager.state==="active"&&await this.sparkScan$.setEnabled(true);}async onMiniPreviewVisibilityChange(e){e&&this.sparkScanView.repositionMiniPreviewIfOutOfBounds(),this.stateManager.inSmartScanSelection&&!e&&await this.onSwitchedAwayFromSmartScanSelection();}onTriggerButtonDrag(e,t){switch(t){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationTriggerButtonTranslateX=e.x,this.stateManager.landscapeOrientationTriggerButtonTranslateY=e.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationTriggerButtonTranslateX=e.x,this.stateManager.portraitOrientationTriggerButtonTranslateY=e.y;break}}}async onOrientationChange(){if(this.stateManager.state==="active"&&this.stateManager.holdingToScan){this.restartTimeouts();return}this.stateManager.state==="error"&&await this.switchToInactiveState({sessionStopReason:"user"});}async didScan(e,t){if(!t.newlyRecognizedBarcode)return;let a=this.sparkScanView.feedbackDelegate.getFeedbackForBarcode(t.newlyRecognizedBarcode);if(a){if(a instanceof b$1){await this.switchToErrorState({barcodeFeedback:a}),this.restartTimeouts();return}if(a instanceof c){if(this.stateManager.continuousModeEnabled){await this.switchToActiveState({barcodeFeedback:a}),this.restartTimeouts();return}let i=true,r="user";await this.switchToInactiveState({barcodeFeedback:a,emitSuccessFeedback:i,sessionStopReason:r}),this.restartTimeouts();}}}setListener(e){this.listener=e;}async onSwitchedToSmartScanSelection(){var e,t;this.sparkScanOverlay&&this.smartScanSelectionOverlay&&(this.stateManager.inSmartScanSelection=true,this.stateManager.miniPreviewSizeBeforeSmartScanSelection=this.sparkScanView.miniPreviewSize,this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection=this.sparkScanView._previewSizeControlVisible,await((e=this._dataCaptureView)==null?void 0:e.removeOverlay(this.sparkScanOverlay)),await((t=this._dataCaptureView)==null?void 0:t.addOverlay(this.smartScanSelectionOverlay)),this.stateManager.targetModeEnabled||(this.sparkScanView.miniPreviewSize="expanded"),this.updateSizeControlVisibility());}async onSwitchedAwayFromSmartScanSelection(){var e,t;this.sparkScanOverlay&&this.smartScanSelectionOverlay&&this.stateManager.miniPreviewSizeBeforeSmartScanSelection&&(this.stateManager.inSmartScanSelection=false,await((e=this._dataCaptureView)==null?void 0:e.removeOverlay(this.smartScanSelectionOverlay)),await((t=this._dataCaptureView)==null?void 0:t.addOverlay(this.sparkScanOverlay)),this.sparkScanView.miniPreviewSize=this.stateManager.miniPreviewSizeBeforeSmartScanSelection,this.stateManager.miniPreviewSizeBeforeSmartScanSelection=void 0,this.updateSizeControlVisibility());}brushForFeedback(e){return e.brush}async switchToIdleState(e={}){var t,a,i,r,n;await this.sparkScan$.setEnabled(false),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),e.emitTapFeedback===true&&this.feedbackManager.emitTapFeedback(),await((a=this.sparkScanOverlay)==null?void 0:a.overlayReadyForDraw()),this.setState("idle"),(i=this.triggerButtonCollapseTimeout)==null||i.stop(),(r=this.inactiveStateTimeout)==null||r.stop(),(n=this.resumeCapturingTimeout)==null||n.stop(),this.stateManager.triggerButtonPressed=false,this.sparkScanView.switchToIdleState(),e.sessionStopReason!=null&&this.analyticsManager.setSessionStopReason(e.sessionStopReason);}async setBrushToOverlays(e){var t,a,i;this.sparkScanViewSettings.smartSelectionCandidateBrush?(t=this.smartScanSelectionOverlay)==null||t.setBrush(this.sparkScanViewSettings.smartSelectionCandidateBrush):(a=this.smartScanSelectionOverlay)==null||a.setBrush(e),await((i=this.sparkScanOverlay)==null?void 0:i.setBrush(e));}async switchToActiveState(e={}){var a,i,r,n,o,s,c$1,d;let t=this.stateManager.state;if(await((a=this.camera)==null?void 0:a.switchToDesiredState(FrameSourceState.On)),await((i=this.camera)==null?void 0:i.setDesiredTorchState(this.stateManager.torchState)),e.barcodeFeedback){let D=this.brushForFeedback(e.barcodeFeedback);await this.setBrushToOverlays(D);}await((r=this.sparkScanOverlay)==null?void 0:r.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await((n=this.sparkScanOverlay)==null?void 0:n.overlayReadyForDraw()),this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),this.stateManager.holdingToScan||(o=this.inactiveStateTimeout)==null||o.start(),(s=this.triggerButtonCollapseTimeout)==null||s.stop(),(c$1=this.resumeCapturingTimeout)==null||c$1.stop(),await this.sparkScanView.switchToActiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&e.barcodeFeedback instanceof c,this.stateManager.scanningBehavior,(d=e.barcodeFeedback)==null?void 0:d.visualFeedbackColor,this.stateManager.zoomedIn&&t!=="active"),await this.sparkScan$.setEnabled(true),this.setState("active");}async switchToInactiveState(e){var t,a,r,n,o,s,c$1;if(this.stateManager.inSmartScanSelection?await this.sparkScan$.setEnabled(false):this.stateManager.shouldEnableSuppression?await this.sparkScan$.setResultSuppressionEnabled(true):await this.sparkScan$.setEnabled(false),this.stateManager.triggerButtonPressed=false,this.stateManager.scanningMode.previewBehavior==="persistent"?e.barcodeFeedback instanceof c&&await((t=this.sparkScanOverlay)==null?void 0:t.setShouldRemoveLocationsAfterScan(true)):await((a=this.camera)==null?void 0:a.switchToDesiredState(FrameSourceState.Standby)),(e.emitSuccessFeedback)!=null||(e.emitSuccessFeedback=true),this.setState("inactive"),e.barcodeFeedback){let d=this.brushForFeedback(e.barcodeFeedback);await this.setBrushToOverlays(d);}this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),await((r=this.sparkScanOverlay)==null?void 0:r.overlayReadyForDraw()),(n=this.triggerButtonCollapseTimeout)==null||n.start(),(o=this.inactiveStateTimeout)==null||o.stop(),(s=this.resumeCapturingTimeout)==null||s.stop(),await this.sparkScanView.switchToInactiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&e.barcodeFeedback instanceof c&&e.emitSuccessFeedback,this.stateManager.scanningBehavior,this.stateManager.previewBehavior,(c$1=e.barcodeFeedback)==null?void 0:c$1.visualFeedbackColor),this.analyticsManager.setSessionStopReason(e.sessionStopReason);}async switchToErrorState(e){var a,i,r,n,o,s,c;let t=e.barcodeFeedback.resumeCapturingDelay>0;t&&(await this.sparkScan$.setEnabled(false),await((a=this.camera)==null?void 0:a.switchToDesiredState(FrameSourceState.Standby)),this.setState("error"),this.stateManager.scanningBehavior="single",this.resumeCapturingTimeout=new Timeout(e.barcodeFeedback.resumeCapturingDelay,async()=>{this.stateManager.state!=="active"&&this._preparationPromise&&await this.switchToActiveState();}),this.resumeCapturingTimeout.start()),(i=this.smartScanSelectionOverlay)==null||i.setErrorBrush(e.barcodeFeedback.brush),await((r=this.sparkScanOverlay)==null?void 0:r.setErrorBrush(e.barcodeFeedback.brush)),await((n=this.sparkScanOverlay)==null?void 0:n.overlayReadyForDraw()),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(e.barcodeFeedback.resumeCapturingDelay===0)),await this.sparkScan$.workerCommand("sparkScanEmitErrorFeedback",{shouldRemoveBrush:!t}),this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),(s=this.triggerButtonCollapseTimeout)==null||s.stop(),(c=this.inactiveStateTimeout)==null||c.stop(),await this.sparkScanView.switchToErrorState(e.barcodeFeedback,this.sparkScanViewSettings.visualFeedbackEnabled);}enableTargetModeLocationSelection(e){var r;let t=e?a$8.SparkScanSettings.targetModeLocationSelection.radius:a$8.SparkScanSettings.locationSelection.radius,a=e?a$8.SparkScanSettings.targetModeLocationSelection.unit:a$8.SparkScanSettings.locationSelection.unit,i=new NumberWithUnit(t,a);this.sparkScan$.settings.locationSelection=new RadiusLocationSelection(i),(r=this.sparkScanOverlay)==null||r.setRadius(i);}enableTargetMode(e){this.enableTargetModeLocationSelection(e);}async applyPreferences(){await this.onTargetModeButtonTap(this.stateManager.targetModeEnabled,this.feedbackManager.noFeedback,false),await this.onScanningBehaviorButtonTap(this.stateManager.continuousModeEnabled,this.feedbackManager.noFeedback,false),await this.onTorchButtonTap(this.stateManager.torchEnabled,this.feedbackManager.noFeedback,false),this.sparkScanView.repositionElementsIfOutOfBounds();}setState(e){var t,a;e!==this.stateManager.state&&(this.stateManager.state=e,(a=(t=this.listener)==null?void 0:t.didChangeViewState)==null||a.call(t,e));}startTimeoutForCurrentState(){let e=this.stateTimeouts[this.stateManager.state];e==null||e.start();}updateSizeControlVisibility(){if(!this.stateManager.inSmartScanSelection&&this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection!==void 0){this.sparkScanView.previewSizeControlVisible=this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection,this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection=void 0;return}let e=this.stateManager.inSmartScanSelection&&!this.stateManager.targetModeEnabled,t=this.sparkScanView._previewSizeControlVisible;this.sparkScanView.previewSizeControlVisible=t&&!e;}};a([v],l.prototype,"switchToActiveState",1),a([v],l.prototype,"switchToInactiveState",1),a([v],l.prototype,"switchToErrorState",1);var A=l;export{A as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-F7NAOKPF.js';import {a as a$1}from'./chunk-CYVVGAZ4.js';import {a as a$4}from'./chunk-KELYPKGG.js';import {a as a$2}from'./chunk-FD4QVJDW.js';import {a as a$3}from'./chunk-MHRGFVAW.js';import {Color,ScanditIcon}from'@scandit/web-datacapture-core';import {ScanditHTMLElement,html,defineCustomElements,css}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var m=(o=>(o[o.Top="top-center"]="Top",o[o.Bottom="bottom-center"]="Bottom",o[o.Left="left-center"]="Left",o[o.Right="right-center"]="Right",o))(m||{}),N=(e=>(e.Small="small",e.Medium="medium",e.Large="large",e))(N||{}),U=(T=>(T.InfoAnnotationTap="BarcodeArInfoAnnotationEventTap",T))(U||{}),h="slot[name='header']",p="slot[name='footer']",v="--arrow-background-color",s=class s extends ScanditHTMLElement{constructor(){super();this.isEntireAnnotationTappable=false;this.annotationTrigger="highlightTapAndBarcodeScan";this._widthPreset="small";this.onPointerUpListener=this.onPointerUp.bind(this);this.onSlotChangeListener=this.onSlotChange.bind(this);this.highlightableElementListenerMap=new Map;let t=this.attachShadow({mode:"open"});t.innerHTML=html`<div class="container arw-${m.Bottom} ${"small"}"><slot name="header"></slot><div class="body-container"><slot></slot></div><slot name="footer"></slot></div>`,this.containerElement=t.querySelector(".container"),t.append(s.createStyleElement().cloneNode(true)),t.append(a());}get barcode(){return this._barcode}set barcode(t){this._barcode=t;}updatePosition(t,e,o){a$1(this,t,e,0);}set anchor(t){for(let e of Object.values(m))this.containerElement.classList.remove(`arw-${e}`);this.containerElement.classList.add(`arw-${t}`),this.updateArrowColor();}get anchor(){for(let t of Object.values(m))if(this.containerElement.classList.contains(`arw-${t}`))return t;return m.Bottom}set widthPreset(t){this._widthPreset=t,this.containerElement.classList.remove("small","medium","large"),this.containerElement.classList.add(t);}get widthPreset(){switch(true){case this.containerElement.classList.contains("small"):return "small";case this.containerElement.classList.contains("medium"):return "medium";case this.containerElement.classList.contains("large"):return "large";default:return "small"}}get backgroundColor(){let t=this.containerElement.style.getPropertyValue("--background-color");return Color.fromHex(t)}set backgroundColor(t){this.containerElement.style.setProperty("--background-color",`#${t.toJSON()}`),this.updateArrowColor();}set body(t){this.append(...t);}get body(){var e,o;let t=(e=this.shadowRoot)==null?void 0:e.querySelector("slot:not([name])");return (o=t==null?void 0:t.assignedElements({flatten:true}))!=null?o:[]}set header(t){let e=this.querySelector(h);t!=null&&(e==null?void 0:e.assignedElements()[0])!==t&&(e==null||e.remove(),t.setAttribute("slot","header"),this.append(t));}get header(){var e,o;let t=(e=this.shadowRoot)==null?void 0:e.querySelector(h);return ((o=t==null?void 0:t.assignedElements())!=null?o:[])[0]}set footer(t){let e=this.querySelector(p);t!=null&&(e==null?void 0:e.assignedElements()[0])!==t&&(e==null||e.remove(),t.setAttribute("slot","footer"),this.append(t));}get footer(){var e,o;let t=(e=this.shadowRoot)==null?void 0:e.querySelector(p);return ((o=t==null?void 0:t.assignedElements())!=null?o:[])[0]}set hasTip(t){this.containerElement.classList.toggle(`arw-${this.anchor}`,t);}get hasTip(){return this.containerElement.classList.contains(`arw-${this.anchor}`)}static create(t){s.register();let e=document.createElement(s.tag);return e.barcode=t,e}static register(){defineCustomElements({[a$4.tag]:a$4,[a$3.tag]:a$3,[a$2.tag]:a$2,[s.tag]:s});}static createStyleElement(){return css`:host{--background-color:#fff;--arrow-size:7px;--arrow-background-color:var(--background-color);--arrow-offset:10px;font-family:SF Pro Display,sans-serif}.container{background-color:var(--background-color);border-radius:16px;display:flex;flex-direction:column;min-width:100px;position:relative;transition:opacity .3s ease;width:100%}.container.highlighted{opacity:.75}.container.${"small"}{width:180px}.container.${"medium"}{width:210px}.container.${"large"}{width:240px}.body-container{padding-bottom:1rem}`}connectedCallback(){var o,n;this.widthPreset=this._widthPreset,this.addEventListener("pointerup",this.onPointerUpListener);let t=(o=this.shadowRoot)==null?void 0:o.querySelector(h),e=(n=this.shadowRoot)==null?void 0:n.querySelector(p);t==null||t.addEventListener("slotchange",this.onSlotChangeListener),e==null||e.addEventListener("slotchange",this.onSlotChangeListener),this.onSlotChange(),this.isEntireAnnotationTappable&&this.makeHighlightable(this.containerElement);}disconnectedCallback(){var o,n;let t=(o=this.shadowRoot)==null?void 0:o.querySelector(h),e=(n=this.shadowRoot)==null?void 0:n.querySelector(p);t==null||t.removeEventListener("slotchange",this.onSlotChangeListener),e==null||e.removeEventListener("slotchange",this.onSlotChangeListener),this.removeEventListener("pointerup",this.onPointerUpListener);for(let[i,a]of this.highlightableElementListenerMap)i.removeEventListener("pointerdown",a.pointerdown),i.removeEventListener("pointerup",a.pointerup);}onSlotChange(){var i,a,c,d;let t=(i=this.shadowRoot)==null?void 0:i.querySelector(h),e=(a=this.shadowRoot)==null?void 0:a.querySelector(p),o=(c=t==null?void 0:t.assignedElements())!=null?c:[],n=(d=e==null?void 0:e.assignedElements())!=null?d:[];for(let r of o)r.style.setProperty("--top-left-corner-radius","16px"),r.style.setProperty("--top-right-corner-radius","16px"),this.isEntireAnnotationTappable||this.makeHighlightable(r);for(let r of n)r.style.setProperty("--bottom-left-corner-radius","16px"),r.style.setProperty("--bottom-right-corner-radius","16px"),this.isEntireAnnotationTappable||this.makeHighlightable(r);this.updateArrowColor();}updateArrowColor(){this.style.removeProperty(v),this.header||this.footer?this.header&&this.anchor.startsWith("top")?this.style.setProperty(v,`#${this.header.backgroundColor.toJSON()}`):this.footer&&this.anchor.startsWith("bottom")&&this.style.setProperty(v,`#${this.footer.backgroundColor.toJSON()}`):this.body.length>0&&!this.header&&!this.footer&&this.style.setProperty(v,`#${this.backgroundColor.toJSON()}`);}makeHighlightable(t){var i;let e=t.classList.contains("container")?t:(i=t.shadowRoot)==null?void 0:i.querySelector(".container");if(!e||this.highlightableElementListenerMap.has(e))return;let o=()=>{e.classList.add("highlighted");},n=()=>{e.classList.remove("highlighted");};e.addEventListener("pointerdown",o),e.addEventListener("pointerup",n),this.highlightableElementListenerMap.set(e,{pointerdown:o,pointerup:n});}onPointerUp(t){var a,c,d,r,B,f,I,u,S,g,w,b,P;let e=(a=t.target)==null?void 0:a.closest(a$3.tag),o=(c=t.target)==null?void 0:c.closest(a$2.tag),n=(d=t.target)==null?void 0:d.closest(`${a$4.tag} ${ScanditIcon.tag}`),i=new CustomEvent("BarcodeArInfoAnnotationEventTap",{bubbles:true});if(e&&((B=(r=this.listener)==null?void 0:r.onInfoAnnotationHeaderTapped)==null||B.call(r,this),this.dispatchEvent(i)),o&&((I=(f=this.listener)==null?void 0:f.onInfoAnnotationFooterTapped)==null||I.call(f,this),this.dispatchEvent(i)),(n==null?void 0:n.slot)==="left-barcode-icon"){let l=this.body.findIndex(y=>y.contains(n));this.body[l].isLeftIconTappable&&((S=(u=this.listener)==null?void 0:u.onInfoAnnotationLeftIconTapped)==null||S.call(u,this,this.body[l],l),this.dispatchEvent(i));}if((n==null?void 0:n.slot)==="right-barcode-icon"){let l=this.body.findIndex(y=>y.contains(n));this.body[l].isRightIconTappable&&((w=(g=this.listener)==null?void 0:g.onInfoAnnotationRightIconTapped)==null||w.call(g,this,this.body[l],l),this.dispatchEvent(i));}this.isEntireAnnotationTappable&&((P=(b=this.listener)==null?void 0:b.onInfoAnnotationTapped)==null||P.call(b,this),this.dispatchEvent(i));}};s.tag="scandit-barcode-ar-info-annotation";var H=s;export{m as a,N as b,U as c,H as d};
1
+ import {a}from'./chunk-F7NAOKPF.js';import {a as a$4}from'./chunk-KELYPKGG.js';import {a as a$2}from'./chunk-FD4QVJDW.js';import {a as a$3}from'./chunk-MHRGFVAW.js';import {a as a$1}from'./chunk-CYVVGAZ4.js';import {Color,ScanditIcon}from'@scandit/web-datacapture-core';import {ScanditHTMLElement,html,defineCustomElements,css}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var m=(o=>(o[o.Top="top-center"]="Top",o[o.Bottom="bottom-center"]="Bottom",o[o.Left="left-center"]="Left",o[o.Right="right-center"]="Right",o))(m||{}),N=(e=>(e.Small="small",e.Medium="medium",e.Large="large",e))(N||{}),U=(T=>(T.InfoAnnotationTap="BarcodeArInfoAnnotationEventTap",T))(U||{}),h="slot[name='header']",p="slot[name='footer']",v="--arrow-background-color",s=class s extends ScanditHTMLElement{constructor(){super();this.isEntireAnnotationTappable=false;this.annotationTrigger="highlightTapAndBarcodeScan";this._widthPreset="small";this.onPointerUpListener=this.onPointerUp.bind(this);this.onSlotChangeListener=this.onSlotChange.bind(this);this.highlightableElementListenerMap=new Map;let t=this.attachShadow({mode:"open"});t.innerHTML=html`<div class="container arw-${m.Bottom} ${"small"}"><slot name="header"></slot><div class="body-container"><slot></slot></div><slot name="footer"></slot></div>`,this.containerElement=t.querySelector(".container"),t.append(s.createStyleElement().cloneNode(true)),t.append(a());}get barcode(){return this._barcode}set barcode(t){this._barcode=t;}updatePosition(t,e,o){a$1(this,t,e,0);}set anchor(t){for(let e of Object.values(m))this.containerElement.classList.remove(`arw-${e}`);this.containerElement.classList.add(`arw-${t}`),this.updateArrowColor();}get anchor(){for(let t of Object.values(m))if(this.containerElement.classList.contains(`arw-${t}`))return t;return m.Bottom}set widthPreset(t){this._widthPreset=t,this.containerElement.classList.remove("small","medium","large"),this.containerElement.classList.add(t);}get widthPreset(){switch(true){case this.containerElement.classList.contains("small"):return "small";case this.containerElement.classList.contains("medium"):return "medium";case this.containerElement.classList.contains("large"):return "large";default:return "small"}}get backgroundColor(){let t=this.containerElement.style.getPropertyValue("--background-color");return Color.fromHex(t)}set backgroundColor(t){this.containerElement.style.setProperty("--background-color",`#${t.toJSON()}`),this.updateArrowColor();}set body(t){this.append(...t);}get body(){var e,o;let t=(e=this.shadowRoot)==null?void 0:e.querySelector("slot:not([name])");return (o=t==null?void 0:t.assignedElements({flatten:true}))!=null?o:[]}set header(t){let e=this.querySelector(h);t!=null&&(e==null?void 0:e.assignedElements()[0])!==t&&(e==null||e.remove(),t.setAttribute("slot","header"),this.append(t));}get header(){var e,o;let t=(e=this.shadowRoot)==null?void 0:e.querySelector(h);return ((o=t==null?void 0:t.assignedElements())!=null?o:[])[0]}set footer(t){let e=this.querySelector(p);t!=null&&(e==null?void 0:e.assignedElements()[0])!==t&&(e==null||e.remove(),t.setAttribute("slot","footer"),this.append(t));}get footer(){var e,o;let t=(e=this.shadowRoot)==null?void 0:e.querySelector(p);return ((o=t==null?void 0:t.assignedElements())!=null?o:[])[0]}set hasTip(t){this.containerElement.classList.toggle(`arw-${this.anchor}`,t);}get hasTip(){return this.containerElement.classList.contains(`arw-${this.anchor}`)}static create(t){s.register();let e=document.createElement(s.tag);return e.barcode=t,e}static register(){defineCustomElements({[a$4.tag]:a$4,[a$3.tag]:a$3,[a$2.tag]:a$2,[s.tag]:s});}static createStyleElement(){return css`:host{--background-color:#fff;--arrow-size:7px;--arrow-background-color:var(--background-color);--arrow-offset:10px;font-family:SF Pro Display,sans-serif}.container{background-color:var(--background-color);border-radius:16px;display:flex;flex-direction:column;min-width:100px;position:relative;transition:opacity .3s ease;width:100%}.container.highlighted{opacity:.75}.container.${"small"}{width:180px}.container.${"medium"}{width:210px}.container.${"large"}{width:240px}.body-container{padding-bottom:1rem}`}connectedCallback(){var o,n;this.widthPreset=this._widthPreset,this.addEventListener("pointerup",this.onPointerUpListener);let t=(o=this.shadowRoot)==null?void 0:o.querySelector(h),e=(n=this.shadowRoot)==null?void 0:n.querySelector(p);t==null||t.addEventListener("slotchange",this.onSlotChangeListener),e==null||e.addEventListener("slotchange",this.onSlotChangeListener),this.onSlotChange(),this.isEntireAnnotationTappable&&this.makeHighlightable(this.containerElement);}disconnectedCallback(){var o,n;let t=(o=this.shadowRoot)==null?void 0:o.querySelector(h),e=(n=this.shadowRoot)==null?void 0:n.querySelector(p);t==null||t.removeEventListener("slotchange",this.onSlotChangeListener),e==null||e.removeEventListener("slotchange",this.onSlotChangeListener),this.removeEventListener("pointerup",this.onPointerUpListener);for(let[i,a]of this.highlightableElementListenerMap)i.removeEventListener("pointerdown",a.pointerdown),i.removeEventListener("pointerup",a.pointerup);}onSlotChange(){var i,a,c,d;let t=(i=this.shadowRoot)==null?void 0:i.querySelector(h),e=(a=this.shadowRoot)==null?void 0:a.querySelector(p),o=(c=t==null?void 0:t.assignedElements())!=null?c:[],n=(d=e==null?void 0:e.assignedElements())!=null?d:[];for(let r of o)r.style.setProperty("--top-left-corner-radius","16px"),r.style.setProperty("--top-right-corner-radius","16px"),this.isEntireAnnotationTappable||this.makeHighlightable(r);for(let r of n)r.style.setProperty("--bottom-left-corner-radius","16px"),r.style.setProperty("--bottom-right-corner-radius","16px"),this.isEntireAnnotationTappable||this.makeHighlightable(r);this.updateArrowColor();}updateArrowColor(){this.style.removeProperty(v),this.header||this.footer?this.header&&this.anchor.startsWith("top")?this.style.setProperty(v,`#${this.header.backgroundColor.toJSON()}`):this.footer&&this.anchor.startsWith("bottom")&&this.style.setProperty(v,`#${this.footer.backgroundColor.toJSON()}`):this.body.length>0&&!this.header&&!this.footer&&this.style.setProperty(v,`#${this.backgroundColor.toJSON()}`);}makeHighlightable(t){var i;let e=t.classList.contains("container")?t:(i=t.shadowRoot)==null?void 0:i.querySelector(".container");if(!e||this.highlightableElementListenerMap.has(e))return;let o=()=>{e.classList.add("highlighted");},n=()=>{e.classList.remove("highlighted");};e.addEventListener("pointerdown",o),e.addEventListener("pointerup",n),this.highlightableElementListenerMap.set(e,{pointerdown:o,pointerup:n});}onPointerUp(t){var a,c,d,r,B,f,I,u,S,g,w,b,P;let e=(a=t.target)==null?void 0:a.closest(a$3.tag),o=(c=t.target)==null?void 0:c.closest(a$2.tag),n=(d=t.target)==null?void 0:d.closest(`${a$4.tag} ${ScanditIcon.tag}`),i=new CustomEvent("BarcodeArInfoAnnotationEventTap",{bubbles:true});if(e&&((B=(r=this.listener)==null?void 0:r.onInfoAnnotationHeaderTapped)==null||B.call(r,this),this.dispatchEvent(i)),o&&((I=(f=this.listener)==null?void 0:f.onInfoAnnotationFooterTapped)==null||I.call(f,this),this.dispatchEvent(i)),(n==null?void 0:n.slot)==="left-barcode-icon"){let l=this.body.findIndex(y=>y.contains(n));this.body[l].isLeftIconTappable&&((S=(u=this.listener)==null?void 0:u.onInfoAnnotationLeftIconTapped)==null||S.call(u,this,this.body[l],l),this.dispatchEvent(i));}if((n==null?void 0:n.slot)==="right-barcode-icon"){let l=this.body.findIndex(y=>y.contains(n));this.body[l].isRightIconTappable&&((w=(g=this.listener)==null?void 0:g.onInfoAnnotationRightIconTapped)==null||w.call(g,this,this.body[l],l),this.dispatchEvent(i));}this.isEntireAnnotationTappable&&((P=(b=this.listener)==null?void 0:b.onInfoAnnotationTapped)==null||P.call(b,this),this.dispatchEvent(i));}};s.tag="scandit-barcode-ar-info-annotation";var H=s;export{m as a,N as b,U as c,H as d};
@@ -1 +1 @@
1
- import {a as a$3}from'./chunk-X5BA2RQY.js';import {a as a$2}from'./chunk-QTKRK537.js';import {a as a$4}from'./chunk-SLZMFNXI.js';import {a as a$1}from'./chunk-2ZSOWJ2F.js';import {a}from'./chunk-YTPS5MHJ.js';import {b}from'./chunk-WE5JRHIG.js';import {DataCaptureEngine}from'@scandit/web-datacapture-core/build/js/worker/index.js';var c=class extends DataCaptureEngine{constructor(e,r){super(e,r);}getModeDeserializers(){this.barcodeCaptureMode=new a(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new a$1(this,this.Module,this.workerFunctions),this.sparkScanMode=new a$2(this,this.Module,this.workerFunctions),this.barcodeFindMode=new a$3(this,this.Module,this.workerFunctions),this.barcodeArMode=new a$4(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return ""}getWasmCoreFileName(e,r){return r?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":"scandit-datacapture-sdk-barcode.wasm"}getWasmCoreExpectedHash(e,r){return r?e?"5dd81f8aa18f913588a6f877d0159cfd8b578eb3bab8e9e467b3367fd884bef2":"ae89c47f1803c211df6b78a69afc2be5fa4b587c2e8e48877cc5e1637ddd7494":e?"fad5b5fbe343b873c36d202ebfaf8dddc8c30bba586f13ecbd5ed4c2f4761179":"d8bd859e7409f39e6a7d23246045e726491e2bf77b636a2416b970f0063c35d4"}getWasmMetadata(){return b}};export{c as a};
1
+ import {a}from'./chunk-YTPS5MHJ.js';import {a as a$3}from'./chunk-FBW5J2QT.js';import {a as a$2}from'./chunk-QTKRK537.js';import {a as a$4}from'./chunk-SLZMFNXI.js';import {a as a$1}from'./chunk-2ZSOWJ2F.js';import {b}from'./chunk-OCYHIAM2.js';import {DataCaptureEngine}from'@scandit/web-datacapture-core/build/js/worker/index.js';var c=class extends DataCaptureEngine{constructor(e,r){super(e,r);}getModeDeserializers(){this.barcodeCaptureMode=new a(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new a$1(this,this.Module,this.workerFunctions),this.sparkScanMode=new a$2(this,this.Module,this.workerFunctions),this.barcodeFindMode=new a$3(this,this.Module,this.workerFunctions),this.barcodeArMode=new a$4(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return ""}getWasmCoreFileName(e,r){return r?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":"scandit-datacapture-sdk-barcode.wasm"}getWasmCoreExpectedHash(e,r){return r?e?"6ea5df9121d5c015e1d5bdfa8afb5d3eed4452c187c3e7e3c8c7d095f279279f":"8c9907fe8bea3dfb7b4aad8b2fd59f8dd0278ac81452e864f5827eba99321480":e?"7cd946e7149a606b34879c4cfe8c563a633e86044702b76a2d2a1d4e69c1971c":"c820e8a917292c0cc7819b025602e71fa334e1a864c51a28329cb8b31374489d"}getWasmMetadata(){return b}};export{c as a};
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-ETK5MP22.js';import {a}from'./chunk-LKZBVQXD.js';import {Localization}from'@scandit/web-datacapture-core';import {normalizeLibraryLocation}from'@scandit/web-datacapture-core/build/js/private/Helper.js';function y(r){return Localization.getInstance().updateIfMissing({...a}),r!=null&&r.libraryLocation&&(r.libraryLocation=normalizeLibraryLocation(r.libraryLocation)),{moduleName:"BarcodeCapture",load:async d=>{var e,o;let a=d;return await a$1.create({...a,libraryLocation:(e=r==null?void 0:r.libraryLocation)!=null?e:a.libraryLocation,highEndBlurryRecognition:(o=r==null?void 0:r.highEndBlurryRecognition)!=null?o:false})}}}export{y as a};
1
+ import {a as a$1}from'./chunk-Z4OVKU6T.js';import {a}from'./chunk-LKZBVQXD.js';import {Localization}from'@scandit/web-datacapture-core';import {normalizeLibraryLocation}from'@scandit/web-datacapture-core/build/js/private/Helper.js';function y(r){return Localization.getInstance().updateIfMissing({...a}),r!=null&&r.libraryLocation&&(r.libraryLocation=normalizeLibraryLocation(r.libraryLocation)),{moduleName:"BarcodeCapture",load:async d=>{var e,o;let a=d;return await a$1.create({...a,libraryLocation:(e=r==null?void 0:r.libraryLocation)!=null?e:a.libraryLocation,highEndBlurryRecognition:(o=r==null?void 0:r.highEndBlurryRecognition)!=null?o:false})}}}export{y as a};
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-TRITJ43A.js';import {a}from'./chunk-V4ZOB2BB.js';import {unknownErrorToString}from'@scandit/web-datacapture-core/build/js/private/utils/unknownErrorToString.js';import {WorkerMain}from'@scandit/web-datacapture-core/build/js/worker/index.js';var i=class extends WorkerMain{constructor(t,a$1){super(t,a$1),this.dataCaptureInstance=new a(a$1,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)});}async respondWith(t,a,r){let d=null,e;try{e=r(),e instanceof Promise&&(e=await e);}catch(c){e=void 0,d=unknownErrorToString(c);}let s={type:"workerTaskId",command:t,id:a,payload:this.hasPayload(e)?e.payload:void 0};d!=null&&(s.error=d),this.postMessage(s,this.hasTransferables(e)?e.transferables:[]);}onMessage(t){switch(t.data.command){case "sparkScanEmitErrorFeedback":{let{data:a}=t;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(a.shouldRemoveBrush);}),true}case "sparkScanOverlayReadyForDraw":{let{data:a}=t;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw();}),true}case "sparkScanAnalyticsManagerPropertyChanged":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(a.property);}),true}case "sparkScanSelectItemWithSmartScanSelection":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.selectItemWithSmartScanSelection();}),true}case "sparkScanModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.sparkScanMode.removeMode()),true}case "barcodeFindForSettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(a.settings)),true}case "barcodeFindModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.removeMode()),true}case "barcodeFindSearchStart":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.start();}),true;case "barcodeFindSearchPause":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.pause();}),true;case "barcodeFindSearchStop":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.stop();}),true;case "barcodeFindSetItemList":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(a.itemList);}),true}case "barcodeFindSetEnabled":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(a.enabled);}),true}case "barcodeFindApplySettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(a.settings)),true}case "barcodeFindAddBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay();}),true}case "barcodeFindRemoveBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay();}),true}case "barcodeFindUpdateBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(a.jsonOverlay);}),true}case "barcodeFindSetTransformerFunction":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{let r=a$1(a.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(r);}),true}case "barcodeArForSettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.forSettings(a.settings)),true}case "barcodeArModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.removeMode()),true}case "barcodeArSearchStart":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.start();}),true;case "barcodeArSearchPause":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.pause();}),true;case "barcodeArSearchStop":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.stop();}),true;case "barcodeArSetEnabled":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.setEnabled(a.enabled);}),true}case "barcodeArApplySettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeArMode.applySettings(a.settings);}),true}default:return super.onMessage(t)}}};export{i as a};
1
+ import {a}from'./chunk-LOUBDHG7.js';import {a as a$1}from'./chunk-TRITJ43A.js';import {unknownErrorToString}from'@scandit/web-datacapture-core/build/js/private/utils/unknownErrorToString.js';import {WorkerMain}from'@scandit/web-datacapture-core/build/js/worker/index.js';var i=class extends WorkerMain{constructor(t,a$1){super(t,a$1),this.dataCaptureInstance=new a(a$1,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)});}async respondWith(t,a,r){let d=null,e;try{e=r(),e instanceof Promise&&(e=await e);}catch(c){e=void 0,d=unknownErrorToString(c);}let s={type:"workerTaskId",command:t,id:a,payload:this.hasPayload(e)?e.payload:void 0};d!=null&&(s.error=d),this.postMessage(s,this.hasTransferables(e)?e.transferables:[]);}onMessage(t){switch(t.data.command){case "sparkScanEmitErrorFeedback":{let{data:a}=t;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(a.shouldRemoveBrush);}),true}case "sparkScanOverlayReadyForDraw":{let{data:a}=t;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw();}),true}case "sparkScanAnalyticsManagerPropertyChanged":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(a.property);}),true}case "sparkScanSelectItemWithSmartScanSelection":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.selectItemWithSmartScanSelection();}),true}case "sparkScanModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.sparkScanMode.removeMode()),true}case "barcodeFindForSettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(a.settings)),true}case "barcodeFindModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.removeMode()),true}case "barcodeFindSearchStart":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.start();}),true;case "barcodeFindSearchPause":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.pause();}),true;case "barcodeFindSearchStop":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.stop();}),true;case "barcodeFindSetItemList":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(a.itemList);}),true}case "barcodeFindSetEnabled":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(a.enabled);}),true}case "barcodeFindApplySettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(a.settings)),true}case "barcodeFindAddBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay();}),true}case "barcodeFindRemoveBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay();}),true}case "barcodeFindUpdateBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(a.jsonOverlay);}),true}case "barcodeFindSetTransformerFunction":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{let r=a$1(a.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(r);}),true}case "barcodeArForSettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.forSettings(a.settings)),true}case "barcodeArModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.removeMode()),true}case "barcodeArSearchStart":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.start();}),true;case "barcodeArSearchPause":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.pause();}),true;case "barcodeArSearchStop":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.stop();}),true;case "barcodeArSetEnabled":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.setEnabled(a.enabled);}),true}case "barcodeArApplySettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeArMode.applySettings(a.settings);}),true}default:return super.onMessage(t)}}};export{i as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-2KS5VTVC.js';import {TorchState,isCameraFrameSource,Camera,CameraPosition,FrameSourceState}from'@scandit/web-datacapture-core';var l=class{constructor(e,t,a,o,r){this.torchState=TorchState.Off;this.cameraSupportMap=new Map;this.zoomFactor=1;this.cameras=[];this.view=e,this.context=t,this.barcodeAr=a,this.viewSettings=o,this.cameraSettings=r;}get currentCamera(){if(isCameraFrameSource(this.context.frameSource))return this.context.frameSource;throw new Error("The current frame source is not a Camera")}isCameraMirrored(){return this.currentCamera.getMirrorImageEnabled()}async prepare(){var a$1,o,r;await this.barcodeAr.setEnabled(false),this.barcodeAr.feedback=await a.createWithOptions(true,true),this.barcodeAr.addPrivateListener(this),this.cameras=await Camera.getAll(false,isCameraFrameSource(this.context.frameSource));let e=isCameraFrameSource(this.context.frameSource)?this.context.frameSource:(r=(o=(a$1=this.cameras.find(s=>s.position===this.viewSettings.defaultCameraPosition))!=null?a$1:this.cameras.find(s=>s.position===(this.viewSettings.defaultCameraPosition===CameraPosition.WorldFacing?CameraPosition.UserFacing:CameraPosition.WorldFacing)))!=null?o:this.cameras[0])!=null?r:Camera.pickBestGuess();await this.context.setFrameSource(e),await this.currentCamera.applySettings(this.cameraSettings),await this.currentCamera.switchToDesiredState(FrameSourceState.Standby),this.zoomFactor=this.currentCamera.settings.zoomFactor,this.view.changeZoomButtonIcon(this.zoomFactor);let t=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(t);}async dispose(){var e;this.view.deleteAllViews(),await this.context.removeMode(this.barcodeAr),this.barcodeAr.removePrivateListener(this),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off));}async startSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.On)),await this.barcodeAr.setEnabled(true),await this.barcodeAr.start();}async stopSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),await this.barcodeAr.setEnabled(false),await this.barcodeAr.stop();}async pauseSearching(){var e;this.view.deletePendingViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Standby)),await this.barcodeAr.setEnabled(false),await this.barcodeAr.pause();}emitTappedFeedback(){this.barcodeAr.feedback.tapped.emit();}didUpdateSession(e,t){Object.keys(t.addedTrackedBarcodes).length>0&&this.barcodeAr.feedback.scanned.emit(),this.view.render(t);}async isTorchAvailableForCurrentCamera(){let e=this.currentCamera.label,t=this.cameraSupportMap.get(e);if(t!==void 0)return t.torch;let a=await this.currentCamera.isTorchAvailable();return this.cameraSupportMap.set(e,{torch:a}),a}async onTorchButtonClicked(){let e=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(e),e&&(await this.currentCamera.setDesiredTorchState(this.torchState===TorchState.Off?TorchState.On:TorchState.Off),this.torchState=this.torchState===TorchState.Off?TorchState.On:TorchState.Off,this.view.toggleTorchIcon(this.torchState));}async onZoomButtonClicked(){var t;if(!this.currentCamera.isZoomAvailable())return;let e=(t={1:2,2:1}[this.zoomFactor])!=null?t:1;this.currentCamera.settings.zoomFactor=e,await this.currentCamera.applySettings(this.currentCamera.settings),this.zoomFactor=e,this.view.changeZoomButtonIcon(e);}async onCameraSwitchButtonClicked(){var r,s;let e=this.currentCamera.getCurrentState(),t=this.currentCamera.position===CameraPosition.UserFacing?CameraPosition.WorldFacing:CameraPosition.UserFacing,a=(s=(r=this.cameras.find(u=>u.position===t))!=null?r:this.cameras[0])!=null?s:Camera.pickBestGuessForPosition(t);await this.context.setFrameSource(a),await this.currentCamera.switchToDesiredState(e);let o=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(o);}};export{l as a};
1
+ import {a}from'./chunk-VLGDYIWY.js';import {TorchState,isCameraFrameSource,Camera,CameraPosition,FrameSourceState}from'@scandit/web-datacapture-core';var l=class{constructor(e,t,a,o,r){this.torchState=TorchState.Off;this.cameraSupportMap=new Map;this.zoomFactor=1;this.cameras=[];this.view=e,this.context=t,this.barcodeAr=a,this.viewSettings=o,this.cameraSettings=r;}get currentCamera(){if(isCameraFrameSource(this.context.frameSource))return this.context.frameSource;throw new Error("The current frame source is not a Camera")}isCameraMirrored(){return this.currentCamera.getMirrorImageEnabled()}async prepare(){var a$1,o,r;await this.barcodeAr.setEnabled(false),this.barcodeAr.feedback=await a.createWithOptions(true,true),this.barcodeAr.addPrivateListener(this),this.cameras=await Camera.getAll(false,isCameraFrameSource(this.context.frameSource));let e=isCameraFrameSource(this.context.frameSource)?this.context.frameSource:(r=(o=(a$1=this.cameras.find(s=>s.position===this.viewSettings.defaultCameraPosition))!=null?a$1:this.cameras.find(s=>s.position===(this.viewSettings.defaultCameraPosition===CameraPosition.WorldFacing?CameraPosition.UserFacing:CameraPosition.WorldFacing)))!=null?o:this.cameras[0])!=null?r:Camera.pickBestGuess();await this.context.setFrameSource(e),await this.currentCamera.applySettings(this.cameraSettings),await this.currentCamera.switchToDesiredState(FrameSourceState.Standby),this.zoomFactor=this.currentCamera.settings.zoomFactor,this.view.changeZoomButtonIcon(this.zoomFactor);let t=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(t);}async dispose(){var e;this.view.deleteAllViews(),await this.context.removeMode(this.barcodeAr),this.barcodeAr.removePrivateListener(this),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off));}async startSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.On)),await this.barcodeAr.setEnabled(true),await this.barcodeAr.start();}async stopSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),await this.barcodeAr.setEnabled(false),await this.barcodeAr.stop();}async pauseSearching(){var e;this.view.deletePendingViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Standby)),await this.barcodeAr.setEnabled(false),await this.barcodeAr.pause();}emitTappedFeedback(){this.barcodeAr.feedback.tapped.emit();}didUpdateSession(e,t){Object.keys(t.addedTrackedBarcodes).length>0&&this.barcodeAr.feedback.scanned.emit(),this.view.render(t);}async isTorchAvailableForCurrentCamera(){let e=this.currentCamera.label,t=this.cameraSupportMap.get(e);if(t!==void 0)return t.torch;let a=await this.currentCamera.isTorchAvailable();return this.cameraSupportMap.set(e,{torch:a}),a}async onTorchButtonClicked(){let e=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(e),e&&(await this.currentCamera.setDesiredTorchState(this.torchState===TorchState.Off?TorchState.On:TorchState.Off),this.torchState=this.torchState===TorchState.Off?TorchState.On:TorchState.Off,this.view.toggleTorchIcon(this.torchState));}async onZoomButtonClicked(){var t;if(!this.currentCamera.isZoomAvailable())return;let e=(t={1:2,2:1}[this.zoomFactor])!=null?t:1;this.currentCamera.settings.zoomFactor=e,await this.currentCamera.applySettings(this.currentCamera.settings),this.zoomFactor=e,this.view.changeZoomButtonIcon(e);}async onCameraSwitchButtonClicked(){var r,s;let e=this.currentCamera.getCurrentState(),t=this.currentCamera.position===CameraPosition.UserFacing?CameraPosition.WorldFacing:CameraPosition.UserFacing,a=(s=(r=this.cameras.find(u=>u.position===t))!=null?r:this.cameras[0])!=null?s:Camera.pickBestGuessForPosition(t);await this.context.setFrameSource(a),await this.currentCamera.switchToDesiredState(e);let o=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(o);}};export{l as a};
@@ -1 +1 @@
1
- var b=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var p=(r,d,t,s)=>{for(var a=s>1?void 0:s?i(d,t):d,e=r.length-1,c;e>=0;e--)(c=r[e])&&(a=(s?c(d,t,a):c(a))||a);return s&&a&&b(d,t,a),a};var o={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:7955615},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:7871991},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7739208},"scandit-datacapture-sdk-barcode.wasm":{bytes:7823155}};export{p as a,o as b};
1
+ var b=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var p=(r,d,t,s)=>{for(var a=s>1?void 0:s?i(d,t):d,e=r.length-1,c;e>=0;e--)(c=r[e])&&(a=(s?c(d,t,a):c(a))||a);return s&&a&&b(d,t,a),a};var o={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:7955842},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:7872164},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7739457},"scandit-datacapture-sdk-barcode.wasm":{bytes:7823444}};export{p as a,o as b};
@@ -1 +1 @@
1
- import {a}from'./chunk-CYVVGAZ4.js';import {a as a$1}from'./chunk-MVLSFC5H.js';import {ScanditHTMLElement,html,defineCustomElements,css}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var l=(e=>(e[e.Top="top-center"]="Top",e[e.Bottom="bottom-center"]="Bottom",e[e.Left="left-center"]="Left",e[e.Right="right-center"]="Right",e))(l||{}),r=class r extends ScanditHTMLElement{constructor(){super();this.isEntirePopoverTappable=false;this.annotationTrigger="highlightTap";this.onPointerUpListener=this.onPointerUp.bind(this);this.anchor=l.Bottom;let t=this.attachShadow({mode:"open"});t.innerHTML=html`<div class="container" role="group"><slot></slot></div>`,t.append(r.createStyleElement().cloneNode(true));}updatePosition(t,o,e){a(this,t,o,0);}get barcode(){return this._barcode}set barcode(t){this._barcode=t;}set direction(t){this.setAttribute("direction",t);}get direction(){var t;return (t=this.getAttribute("direction"))!=null?t:"horizontal"}static register(){defineCustomElements({[r.tag]:r});}static create(t){r.register();let o=document.createElement(r.tag);return o.barcode=t,o}static createStyleElement(){return css`:host{background-color:unset;border:none;border-radius:14px;margin:0;overflow:hidden;padding:0}:host([direction=horizontal]) .container{flex-direction:row}:host([direction=vertical]) .container{flex-direction:column}.container{backdrop-filter:blur(16px);background:#ffffffb3;box-shadow:0 6px 10px 4px #12161926;display:flex;gap:14px}`}connectedCallback(){let t=Array.from(this.querySelectorAll(a$1.tag));for(let[o,e]of Object.entries(t))e.setAttribute("data-position",o);this.addEventListener("pointerup",this.onPointerUpListener);}disconnectedCallback(){this.removeEventListener("pointerup",this.onPointerUpListener);}onPointerUp(t){var e,a,p,i,c;if(this.isEntirePopoverTappable){(a=(e=this.listener)==null?void 0:e.onPopoverTapped)==null||a.call(e,this);return}let o=(p=t.target)==null?void 0:p.closest(a$1.tag);o&&((c=(i=this.listener)==null?void 0:i.onPopoverButtonTapped)==null||c.call(i,this,o,Number(o.getAttribute("data-position"))));}};r.tag="scandit-barcode-ar-popover-annotation";var d=r;export{l as a,d as b};
1
+ import {a as a$1}from'./chunk-MVLSFC5H.js';import {a}from'./chunk-CYVVGAZ4.js';import {ScanditHTMLElement,html,defineCustomElements,css}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var l=(e=>(e[e.Top="top-center"]="Top",e[e.Bottom="bottom-center"]="Bottom",e[e.Left="left-center"]="Left",e[e.Right="right-center"]="Right",e))(l||{}),r=class r extends ScanditHTMLElement{constructor(){super();this.isEntirePopoverTappable=false;this.annotationTrigger="highlightTap";this.onPointerUpListener=this.onPointerUp.bind(this);this.anchor=l.Bottom;let t=this.attachShadow({mode:"open"});t.innerHTML=html`<div class="container" role="group"><slot></slot></div>`,t.append(r.createStyleElement().cloneNode(true));}updatePosition(t,o,e){a(this,t,o,0);}get barcode(){return this._barcode}set barcode(t){this._barcode=t;}set direction(t){this.setAttribute("direction",t);}get direction(){var t;return (t=this.getAttribute("direction"))!=null?t:"horizontal"}static register(){defineCustomElements({[r.tag]:r});}static create(t){r.register();let o=document.createElement(r.tag);return o.barcode=t,o}static createStyleElement(){return css`:host{background-color:unset;border:none;border-radius:14px;margin:0;overflow:hidden;padding:0}:host([direction=horizontal]) .container{flex-direction:row}:host([direction=vertical]) .container{flex-direction:column}.container{backdrop-filter:blur(16px);background:#ffffffb3;box-shadow:0 6px 10px 4px #12161926;display:flex;gap:14px}`}connectedCallback(){let t=Array.from(this.querySelectorAll(a$1.tag));for(let[o,e]of Object.entries(t))e.setAttribute("data-position",o);this.addEventListener("pointerup",this.onPointerUpListener);}disconnectedCallback(){this.removeEventListener("pointerup",this.onPointerUpListener);}onPointerUp(t){var e,a,p,i,c;if(this.isEntirePopoverTappable){(a=(e=this.listener)==null?void 0:e.onPopoverTapped)==null||a.call(e,this);return}let o=(p=t.target)==null?void 0:p.closest(a$1.tag);o&&((c=(i=this.listener)==null?void 0:i.onPopoverButtonTapped)==null||c.call(i,this,o,Number(o.getAttribute("data-position"))));}};r.tag="scandit-barcode-ar-popover-annotation";var d=r;export{l as a,d as b};
@@ -1 +1 @@
1
- import {d}from'./chunk-REQQ7LQL.js';import {a}from'./chunk-CYVVGAZ4.js';import {ScanditHTMLElement,Logger}from'@scandit/web-datacapture-core';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';var o=class o extends ScanditHTMLElement{constructor(){super(...arguments);this.closeUp=null;this.farAway=null;this._annotationVariation=1;}static register(){defineCustomElements({[o.tag]:o});}static create(t,a,i){let n=document.createElement(o.tag);return n._barcode=t,n.closeUp=a,n.farAway=i,a instanceof d||(Logger.warn("Only BarcodeArInfoAnnotation is supported at the moment. The close up annotation will be ignored."),n.closeUp=null),i instanceof d||(Logger.warn("Only BarcodeArInfoAnnotation is supported at the moment. The far away annotation will be ignored."),n.farAway=null),n.closeUp&&(n.closeUp.hidden=true),n.farAway&&(n.farAway.hidden=true),n}get currentAnnotation(){return this._annotationVariation===2?this.farAway:this.closeUp}get annotationTrigger(){var t,a;return (a=(t=this.currentAnnotation)==null?void 0:t.annotationTrigger)!=null?a:"highlightTapAndBarcodeScan"}set annotationTrigger(t){this.closeUp&&(this.closeUp.annotationTrigger=t),this.farAway&&(this.farAway.annotationTrigger=t);}set anchor(t){this.closeUp.anchor!==void 0&&(this.closeUp.anchor=t),this.farAway.anchor!==void 0&&(this.farAway.anchor=t);}get anchor(){var t;return (t=this.currentAnnotation.anchor)!=null?t:void 0}get barcode(){return this._barcode}updatePosition(t,a$1,i){this.updateAnnotationVisibility(),a(this,t,a$1);}get annotationVariation(){return this._annotationVariation}set annotationVariation(t){t!==this._annotationVariation&&(this._annotationVariation=t,this.updateAnnotationVisibility());}updateAnnotationVisibility(){let t=this._annotationVariation===2,a=!t;this.closeUp&&(this.closeUp.hidden=t),this.farAway&&(this.farAway.hidden=a);}static get threshold(){return o._threshold}static set threshold(t){o._threshold=t;}connectedCallback(){this.closeUp&&this.append(this.closeUp),this.farAway&&this.append(this.farAway),this.updateAnnotationVisibility();}disconnectedCallback(){this.closeUp&&this.closeUp.remove(),this.farAway&&this.farAway.remove();}};o.tag="scandit-barcode-ar-responsive-annotation",o._threshold=.1;var c=o;export{c as a};
1
+ import {d}from'./chunk-I6NAW3SE.js';import {a}from'./chunk-CYVVGAZ4.js';import {ScanditHTMLElement,Logger}from'@scandit/web-datacapture-core';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';var o=class o extends ScanditHTMLElement{constructor(){super(...arguments);this.closeUp=null;this.farAway=null;this._annotationVariation=1;}static register(){defineCustomElements({[o.tag]:o});}static create(t,a,i){let n=document.createElement(o.tag);return n._barcode=t,n.closeUp=a,n.farAway=i,a instanceof d||(Logger.warn("Only BarcodeArInfoAnnotation is supported at the moment. The close up annotation will be ignored."),n.closeUp=null),i instanceof d||(Logger.warn("Only BarcodeArInfoAnnotation is supported at the moment. The far away annotation will be ignored."),n.farAway=null),n.closeUp&&(n.closeUp.hidden=true),n.farAway&&(n.farAway.hidden=true),n}get currentAnnotation(){return this._annotationVariation===2?this.farAway:this.closeUp}get annotationTrigger(){var t,a;return (a=(t=this.currentAnnotation)==null?void 0:t.annotationTrigger)!=null?a:"highlightTapAndBarcodeScan"}set annotationTrigger(t){this.closeUp&&(this.closeUp.annotationTrigger=t),this.farAway&&(this.farAway.annotationTrigger=t);}set anchor(t){this.closeUp.anchor!==void 0&&(this.closeUp.anchor=t),this.farAway.anchor!==void 0&&(this.farAway.anchor=t);}get anchor(){var t;return (t=this.currentAnnotation.anchor)!=null?t:void 0}get barcode(){return this._barcode}updatePosition(t,a$1,i){this.updateAnnotationVisibility(),a(this,t,a$1);}get annotationVariation(){return this._annotationVariation}set annotationVariation(t){t!==this._annotationVariation&&(this._annotationVariation=t,this.updateAnnotationVisibility());}updateAnnotationVisibility(){let t=this._annotationVariation===2,a=!t;this.closeUp&&(this.closeUp.hidden=t),this.farAway&&(this.farAway.hidden=a);}static get threshold(){return o._threshold}static set threshold(t){o._threshold=t;}connectedCallback(){this.closeUp&&this.append(this.closeUp),this.farAway&&this.append(this.farAway),this.updateAnnotationVisibility();}disconnectedCallback(){this.closeUp&&this.closeUp.remove(),this.farAway&&this.farAway.remove();}};o.tag="scandit-barcode-ar-responsive-annotation",o._threshold=.1;var c=o;export{c as a};
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-SNPWBV7Y.js';import {b}from'./chunk-TCXM24SN.js';import {a}from'./chunk-2KS5VTVC.js';import {CameraSettings,convertToPublicFrameData}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var o=class n{constructor(){this.skipSerialization=true;this.type="barcodeAr";this._isEnabled=true;this._context=null;this.listeners=new Set;this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);}get context(){return this._context}static createRecommendedCameraSettings(){return new CameraSettings(b)}set context(e){this._context=e;}get allListeners(){return [...this.privateListeners,...this.listeners]}static async forContext(e,t){warnMultithreadingUnavailable();let r=new n;return r.feedback=await a.createDefaultBarcodeArFeedback(),r.settings=t,await e.setMode(r),r}isEnabled(){return this._isEnabled}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}set feedback(e){this._feedback=e;}get feedback(){return this._feedback}async setEnabled(e){var t;this._isEnabled=e,await this.workerCommand("barcodeArSetEnabled",{enabled:e}),await((t=this.context)==null?void 0:t.update([{type:"modeEnabled",newValue:e}],{updateContext:false}));}async applySettings(e){this.settings=e,await this.workerCommand("barcodeArApplySettings",{settings:e.toJSONObject()});}toJSONObject(){return {type:this.type,enabled:this._isEnabled,settings:this.settings.toJSONObject()}}async attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),await this.workerCommand("barcodeArForSettings",{settings:this.settings.toJSONObject()});}async detachedFromContext(){var e;await this.workerCommand("barcodeArModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}async start(){return this.workerCommand("barcodeArSearchStart",{})}async stop(){return this.workerCommand("barcodeArSearchStop",{})}async pause(){return this.workerCommand("barcodeArSearchPause",{})}async workerCommand(e,t){this.context!=null&&await this.context.workerCommand(e,t);}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}async onWorkerMessage(e){var t;switch(e.type){case "barcodeArDidUpdateSession":{if(!this._isEnabled||!this._context)return;for(let r of this.allListeners)(t=r.didUpdateSession)==null||t.call(r,this,a$1.fromJSON(e.payload.session),convertToPublicFrameData(e.payload.frameData,this._context));break}}}};export{o as a};
1
+ import {a as a$1}from'./chunk-SNPWBV7Y.js';import {b}from'./chunk-TCXM24SN.js';import {a}from'./chunk-VLGDYIWY.js';import {CameraSettings,convertToPublicFrameData}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var o=class n{constructor(){this.skipSerialization=true;this.type="barcodeAr";this._isEnabled=true;this._context=null;this.listeners=new Set;this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);}get context(){return this._context}static createRecommendedCameraSettings(){return new CameraSettings(b)}set context(e){this._context=e;}get allListeners(){return [...this.privateListeners,...this.listeners]}static async forContext(e,t){warnMultithreadingUnavailable();let r=new n;return r.feedback=await a.createDefaultBarcodeArFeedback(),r.settings=t,await e.setMode(r),r}isEnabled(){return this._isEnabled}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}set feedback(e){this._feedback=e;}get feedback(){return this._feedback}async setEnabled(e){var t;this._isEnabled=e,await this.workerCommand("barcodeArSetEnabled",{enabled:e}),await((t=this.context)==null?void 0:t.update([{type:"modeEnabled",newValue:e}],{updateContext:false}));}async applySettings(e){this.settings=e,await this.workerCommand("barcodeArApplySettings",{settings:e.toJSONObject()});}toJSONObject(){return {type:this.type,enabled:this._isEnabled,settings:this.settings.toJSONObject()}}async attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),await this.workerCommand("barcodeArForSettings",{settings:this.settings.toJSONObject()});}async detachedFromContext(){var e;await this.workerCommand("barcodeArModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}async start(){return this.workerCommand("barcodeArSearchStart",{})}async stop(){return this.workerCommand("barcodeArSearchStop",{})}async pause(){return this.workerCommand("barcodeArSearchPause",{})}async workerCommand(e,t){this.context!=null&&await this.context.workerCommand(e,t);}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}async onWorkerMessage(e){var t;switch(e.type){case "barcodeArDidUpdateSession":{if(!this._isEnabled||!this._context)return;for(let r of this.allListeners)(t=r.didUpdateSession)==null||t.call(r,this,a$1.fromJSON(e.payload.session),convertToPublicFrameData(e.payload.frameData,this._context));break}}}};export{o as a};
@@ -1 +1 @@
1
- import {a as a$3}from'./chunk-3MEAY6PU.js';import {a as a$4}from'./chunk-6KWMOMD7.js';import {b}from'./chunk-Z2J2FVZ3.js';import {a as a$6}from'./chunk-NZCSU4S2.js';import {h}from'./chunk-4PYZSS3H.js';import {a as a$5,c as c$1,e,f as f$1,g,h as h$1,i as i$1,j as j$1,k as k$1,b as b$1,d as d$2}from'./chunk-DVHTYKDX.js';import {d,c,f,i,j,k,l,m,n,b as b$2,e as e$1,g as g$1}from'./chunk-4JEIREAU.js';import {d as d$1}from'./chunk-YBD5JYCX.js';import {a as a$2}from'./chunk-6SI4PD2N.js';import {a as a$1}from'./chunk-AYZEMPSP.js';import {a}from'./chunk-PMTVYYAY.js';import {Logger,Point,CameraPosition,Color}from'@scandit/web-datacapture-core';import {OrientationObserver,orientationChangeEvent}from'@scandit/web-datacapture-core/build/js/private/OrientationObserver.js';import {ScanditHTMLElement,Timeout,defineCustomElements,css,clamp}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var W=class l$1 extends ScanditHTMLElement{constructor(){super(...arguments);this._targetModeButtonVisible=false;this._scanningBehaviorButtonVisible=false;this._torchControlVisible=true;this._zoomSwitchControlVisible=true;this._previewSizeControlVisible=true;this._barcodeFindButtonVisible=false;this._labelCaptureButtonVisible=false;this._cameraSwitchButtonVisible=false;this._previewCloseControlVisible=true;this._triggerButtonVisible=true;this._isTorchAvailable=true;this._isZoomAvailable=true;this._isConnected=false;this._sizingMode="constrained";this.feedbackDelegate={getFeedbackForBarcode:()=>a.success()};this.resizeObserver=null;this.onResizeHandler=this.onResize.bind(this);this.settings=new a$1;this.presenter=a$2.forView(this,this.settings);this.miniPreview=b.create();this.triggerButton=a$3.create();this.visualFeedback=a$4.create();this.miniPreviewTimeout=new Timeout(500,this.onMiniPreviewTimeoutFinished.bind(this));this.orientationObserver=new OrientationObserver;this.miniPreviewPointerUpListener=this.onMiniPreviewPointerUp.bind(this);this.miniPreviewPointerMoveListener=this.onMiniPreviewPointerMove.bind(this);this.miniPreviewButtonTapListener=this.onMiniPreviewButtonTap.bind(this);this.miniPreviewDragListener=this.onMiniPreviewDrag.bind(this);this.miniPreviewDragEndListener=this.onMiniPreviewDragEnd.bind(this);this.miniPreviewVisibilityChangeListener=this.onMiniPreviewVisibilityChange.bind(this);this.triggerButtonPointerDownListener=this.onTriggerButtonPointerDown.bind(this);this.triggerButtonTapListener=this.onTriggerButtonTap.bind(this);this.triggerButtonLongPressStartListener=this.onTriggerButtonLongPressStart.bind(this);this.triggerButtonLongPressEndListener=this.onTriggerButtonLongPressEnd.bind(this);this.triggerButtonDragListener=this.onTriggerButtonDrag.bind(this);this.toolbarButtonTapListener=this.onToolbarButtonTap.bind(this);this.clickOutsideListener=this.onClickOutside.bind(this);this.visibilityChangeListener=this.onVisibilityChange.bind(this);this.orientationChangeListener=this.onOrientationChange.bind(this);this.holdingToScan=false;this.miniPreviewListeners=[["pointerup",this.miniPreviewPointerUpListener],["pointermove",this.miniPreviewPointerMoveListener],["minipreviewbuttontap",this.miniPreviewButtonTapListener],["toolbarbuttontap",this.toolbarButtonTapListener],["drag",this.miniPreviewDragListener],["dragend",this.miniPreviewDragEndListener],[h,this.miniPreviewVisibilityChangeListener]];this.triggerButtonListeners=[["pointerdown",this.triggerButtonPointerDownListener],["tap",this.triggerButtonTapListener],["longpressstart",this.triggerButtonLongPressStartListener],["longpressend",this.triggerButtonLongPressEndListener],["drag",this.triggerButtonDragListener]];}get targetModeButtonVisible(){return this._targetModeButtonVisible}set targetModeButtonVisible(e){var i;this._targetModeButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[d]=e);}get scanningBehaviorButtonVisible(){return this._scanningBehaviorButtonVisible}set scanningBehaviorButtonVisible(e){var i;this._scanningBehaviorButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[c]=e);}get torchControlVisible(){return this._torchControlVisible}set torchControlVisible(e){this._torchControlVisible=e,this.miniPreview&&(this.miniPreview[f]=e&&this._isTorchAvailable);}get zoomSwitchControlVisible(){return this._zoomSwitchControlVisible}set zoomSwitchControlVisible(e){this._zoomSwitchControlVisible=e,this.miniPreview&&(this.miniPreview[i]=e&&this._isZoomAvailable);}get previewSizeControlVisible(){return this._previewSizeControlVisible}set previewSizeControlVisible(e){this._previewSizeControlVisible=e,this.miniPreview&&(this.miniPreview[j]=e);}get barcodeFindButtonVisible(){return this._barcodeFindButtonVisible}set barcodeFindButtonVisible(e){var i;this._barcodeFindButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[k]=e);}get labelCaptureButtonVisible(){return this._labelCaptureButtonVisible}set labelCaptureButtonVisible(e){var i;this._labelCaptureButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[l]=e);}get cameraSwitchButtonVisible(){return this._cameraSwitchButtonVisible}set cameraSwitchButtonVisible(e){var i;this._cameraSwitchButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[m]=e);}get previewCloseControlVisible(){return this._previewCloseControlVisible}set previewCloseControlVisible(e){this._previewCloseControlVisible=e,this.miniPreview&&(this.miniPreview[n]=e);}get triggerButtonVisible(){return this._triggerButtonVisible}set triggerButtonVisible(e){this._triggerButtonVisible=e,this.triggerButton&&(this.triggerButton.visible=e);}get dataCaptureContext(){return this.presenter.context}set dataCaptureContext(e){this.presenter.context!==e&&(this.presenter.context=e,this._maybeAutoPrepareScanning());}get sparkScan(){return this.presenter.sparkScan}set sparkScan(e){this.presenter.sparkScan!==e&&(this.presenter.sparkScan=e,this._maybeAutoPrepareScanning());}get _targetModeEnabledMessage(){var e;return (e=this.settings.toastSettings.targetModeEnabledMessage)!=null?e:"Aimer on"}get _targetModeDisabledMessage(){var e;return (e=this.settings.toastSettings.targetModeDisabledMessage)!=null?e:"Aimer off"}get _continuousModeEnabledMessage(){var e;return (e=this.settings.toastSettings.continuousModeEnabledMessage)!=null?e:"Continuous mode on"}get _continuousModeDisabledMessage(){var e;return (e=this.settings.toastSettings.continuousModeDisabledMessage)!=null?e:"Continuous mode off"}get _scanPausedMessage(){var e;return (e=this.settings.toastSettings.scanPausedMessage)!=null?e:"Scan paused"}get _torchEnabledMessage(){var e;return (e=this.settings.toastSettings.torchEnabledMessage)!=null?e:"Torch on"}get _torchDisabledMessage(){var e;return (e=this.settings.toastSettings.torchDisabledMessage)!=null?e:"Torch off"}get _zoomedInMessage(){var e;return (e=this.settings.toastSettings.zoomedInMessage)!=null?e:"2x zoom"}get _zoomedOutMessage(){var e;return (e=this.settings.toastSettings.zoomedOutMessage)!=null?e:"1x zoom"}set sparkScanViewSettings(e){let i=e!=null?e:new a$1;this.settings=i,this.presenter.setSparkScanViewSettings(i);}get sparkScanViewSettings(){return this.settings}static forElement(e,i,t,r){let n=l$1.create();return r&&(n.sparkScanViewSettings=r),n.dataCaptureContext=i,n.sparkScan=t,e.append(n),n}static register(){defineCustomElements({[d$1]:l$1});}static create(){return l$1.register(),document.createElement("spark-scan-view")}static createStyleElement(){return css`:root{${a$5}:#12161966;${c$1}:#12161966;${e}:#5b707f4d;${f$1}:#fff;${g}:#121619cc;${h$1}:#fbc02c;${i$1}:#fff;${j$1}:#0ff;${k$1}:#fa4446}${d$1}{position:relative}`}async prepareScanning(){await this.presenter.prepareScanning(this.miniPreview.host);}async startScanning(){await this.presenter.startScanning();}async pauseScanning(){await this.presenter.pauseScanning();}async stopScanning(){await this.presenter.stopScanning({sessionStopReason:"user"});}showToast(e){this.miniPreview.showToast("info",e,1e3);}setListener(e){this.presenter.setListener(e);}setTriggerButtonImage(e){this.triggerButton.setImage(e);}get miniPreviewSize(){return this.miniPreview.size}set miniPreviewSize(e){this.miniPreview.size=e;}setWidthAndHeightCssStyleProperties(){var t,r,n,a,o,s;let e,i;this._sizingMode==="unconstrained"?(e=(r=(t=globalThis.window.visualViewport)==null?void 0:t.width)!=null?r:globalThis.window.innerWidth,i=(a=(n=globalThis.window.visualViewport)==null?void 0:n.height)!=null?a:globalThis.window.innerHeight):(e=((o=this.parentElement)==null?void 0:o.clientWidth)||document.body.clientWidth,i=((s=this.parentElement)==null?void 0:s.clientHeight)||document.body.clientHeight),this.style.setProperty("--dvw",`${e}px`),this.style.setProperty("--dvh",`${i}px`),this.style.setProperty("--dvw-half","calc(var(--dvw) / 2)"),this.style.setProperty("--dvh-half","calc(var(--dvh) / 2)");}onResize(){this.updateSizingMode(),this.setWidthAndHeightCssStyleProperties(),this.repositionElementsIfOutOfBounds();}updateSizingMode(){var r,n,a,o;let e=(n=(r=this.parentElement)==null?void 0:r.clientWidth)!=null?n:0,t=((o=(a=this.parentElement)==null?void 0:a.clientHeight)!=null?o:0)<236||e<236?"unconstrained":"constrained";if(this._sizingMode!==t){this._sizingMode=t;let s=t==="unconstrained";this.toggleAttribute("unconstrained",s),this.miniPreview.toggleAttribute("unconstrained",s),this.triggerButton.toggleAttribute("unconstrained",s),this.miniPreview.useViewportBounds=s,this.triggerButton.useViewportBounds=s,this.repositionElementsIfOutOfBounds();}}_maybeAutoPrepareScanning(){this._isConnected&&this.presenter.context&&this.presenter.sparkScan&&this.prepareScanning().catch(e=>{Logger.warn("Auto prepareScanning failed:",e);});}connectedCallback(){var e$1;this.append(l$1.createStyleElement().cloneNode(true),this.miniPreview,this.triggerButton,this.visualFeedback),this.resizeObserver=new ResizeObserver(this.onResizeHandler),this.resizeObserver.observe(this.parentElement),this.previewCloseControlVisible=this._previewCloseControlVisible,this.previewSizeControlVisible=this._previewSizeControlVisible,this.zoomSwitchControlVisible=this._zoomSwitchControlVisible,this.torchControlVisible=this._torchControlVisible,this.miniPreview.size=this.settings.defaultMiniPreviewSize,this.targetModeButtonVisible=this._targetModeButtonVisible,this.scanningBehaviorButtonVisible=this._scanningBehaviorButtonVisible,this.barcodeFindButtonVisible=this._barcodeFindButtonVisible,this.labelCaptureButtonVisible=this._labelCaptureButtonVisible,this.cameraSwitchButtonVisible=this._cameraSwitchButtonVisible,this.triggerButtonVisible=this._triggerButtonVisible;for(let[i,t]of [[this.triggerButtonCollapsedColor,a$5],[this.triggerButtonExpandedColor,c$1],[this.triggerButtonAnimationColor,e],[this.triggerButtonTintColor,f$1],[this.toolbarBackgroundColor,g],[this.toolbarIconActiveTintColor,h$1],[this.toolbarIconInactiveTintColor,i$1]])i&&this.style.setProperty(t,`#${i.toJSON()}`);this.setTriggerButtonPressedColor("triggerButtonCollapsedColor",a$5,b$1),this.setTriggerButtonPressedColor("triggerButtonExpandedColor",c$1,d$2),this.addMiniPreviewListeners(),this.addTriggerButtonListeners(),this.orientationObserver.register(),document.addEventListener("pointerup",this.clickOutsideListener),document.addEventListener("visibilitychange",this.visibilityChangeListener),this.orientationObserver.addEventListener(orientationChangeEvent,this.orientationChangeListener),this.orientationObserver.dispatchOrientationChangeEvent(this.orientationObserver.orientation),this.updateSizingMode(),this.setWidthAndHeightCssStyleProperties(),(e$1=window.visualViewport)==null||e$1.addEventListener("resize",this.onResizeHandler),this._isConnected=true,this._maybeAutoPrepareScanning();}disconnectedCallback(){var e,i;this.miniPreviewTimeout.stop(),(e=this.resizeObserver)==null||e.disconnect(),this.orientationObserver.unregister(),this.orientationObserver.removeEventListener(orientationChangeEvent,this.orientationChangeListener),this.removeMiniPreviewListeners(),this.removeTriggerButtonListeners(),document.removeEventListener("pointerup",this.clickOutsideListener),document.removeEventListener("visibilitychange",this.visibilityChangeListener),(i=window.visualViewport)==null||i.removeEventListener("resize",this.onResizeHandler);for(let t of Array.from(this.children))t.remove();this._isConnected=false;}setTorchAvailable(e){this._isTorchAvailable=e,this.torchControlVisible=this._torchControlVisible;}setZoomAvailable(e){this._isZoomAvailable=e,this.zoomSwitchControlVisible=this._zoomSwitchControlVisible;}switchToIdleState(){this.miniPreview.darkened=false,this.miniPreview.visible=false,this.miniPreview.hideToast(),this.triggerButton.expanded=false,this.triggerButton.stopPulsating();}async switchToActiveState(e,i,t,r){this.miniPreviewTimeout.stop(),this.miniPreview.hideToast(),this.miniPreview.cancelFadeOut(),this.miniPreview.darkened=false,this.miniPreview.visible=true,this.triggerButton.expanded=true,this.triggerButton.startPulsating(),this.miniPreview.toolbar&&(this.miniPreview.toolbar[b$2]=i),e&&(t&&this.style.setProperty(j$1,`#${t.toJSON()}`),await this.visualFeedback.emitSuccessFeedback()),r===true&&this.miniPreview.showToast("warning",this._zoomedInMessage,1e3);}async switchToInactiveState(e,i,t,r){this.miniPreview.darkened=t==="persistent"||e,this.miniPreview.visible=t==="persistent"||e,this.triggerButton.expanded=true,this.triggerButton.stopPulsating(),this.miniPreview.toolbar&&(this.miniPreview.toolbar[b$2]=i),e&&(r&&this.style.setProperty(j$1,`#${r.toJSON()}`),await this.visualFeedback.emitSuccessFeedback(),t==="default"&&this.miniPreviewTimeout.start()),t==="persistent"&&this.miniPreview.showToast("warning",this._scanPausedMessage,Number.POSITIVE_INFINITY);}async switchToErrorState(e,i){e.resumeCapturingDelay>0&&(this.triggerButton.stopPulsating(),this.miniPreview.showToast("error",e.message,e.resumeCapturingDelay)),i&&(this.style.setProperty(k$1,`#${e.visualFeedbackColor.toJSON()}`),await this.visualFeedback.emitErrorFeedback());}async onMiniPreviewPointerUp(){await this.presenter.onMiniPreviewPointerUp();}onMiniPreviewPointerMove(){this.presenter.onMiniPreviewPointerMove();}async onMiniPreviewButtonTap(e){switch(e.detail.tapped){case "torchButton":{await this.presenter.onTorchButtonTap(e.detail.enabled);break}case "closeButton":{await this.presenter.onMiniPreviewCloseButtonTap();break}case "resizeButton":{this.presenter.onMiniPreviewResizeButtonTap();break}case "zoomButton":{await this.presenter.onMiniPreviewZoomButtonTap(e.detail.zoomFactor);break}}this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}async onMiniPreviewDrag(e){e instanceof a$6&&await this.presenter.onMiniPreviewDrag(e.point,this.orientationObserver.orientation.type);}async onMiniPreviewDragEnd(e){e instanceof a$6&&await this.presenter.onMiniPreviewDragEnd();}async onMiniPreviewVisibilityChange(e){await this.presenter.onMiniPreviewVisibilityChange(e.detail.visible);}async onTriggerButtonPointerDown(){await this.presenter.onTriggerButtonPointerDown();}async onTriggerButtonTap(){await this.presenter.onTriggerButtonTap();}async onTriggerButtonLongPressStart(){this.holdingToScan||(this.holdingToScan=true,await this.presenter.onTriggerButtonLongPressStart());}async onTriggerButtonLongPressEnd(){this.holdingToScan&&(this.holdingToScan=false,await this.presenter.onTriggerButtonLongPressEnd());}onTriggerButtonDrag(e){e instanceof a$6&&this.presenter.onTriggerButtonDrag(e.point,this.orientationObserver.orientation.type);}async onToolbarButtonTap(e){switch(this.miniPreview.rewindAnimation(),e.detail.tapped){case "targetModeButton":{await this.onTargetModeButtonTap(e);return}case "scanningBehaviorButton":{await this.onScanningBehaviorButtonTap(e);return}case "barcodeFindButton":{await this.onBarcodeFindButtonTap();return}case "labelCaptureButton":{await this.onLabelCaptureButtonTap();return}case "cameraSwitchButton":await this.onCameraSwitchButtonTap();}}async onClickOutside(e){e.composedPath().includes(this)||await this.presenter.onClickOutside();}async onVisibilityChange(){document.visibilityState==="hidden"&&await this.presenter.onVisibilityChange();}async onTargetModeButtonTap(e){await this.presenter.onTargetModeButtonTap(e.detail.enabled);}async onScanningBehaviorButtonTap(e){await this.presenter.onScanningBehaviorButtonTap(e.detail.enabled);}async onBarcodeFindButtonTap(){await this.presenter.onBarcodeFindButtonTap();}async onLabelCaptureButtonTap(){await this.presenter.onLabelCaptureButtonTap();}async onCameraSwitchButtonTap(){this.torchControlVisible=false,await this.presenter.onCameraSwitchButtonTap();}async onTorchButtonTap(e){await this.presenter.onTorchButtonTap(e.detail.enabled);}async onMiniPreviewTimeoutFinished(){await this.miniPreview.fadeOut();}async onOrientationChange(e){this.updateSizingMode(),this.setWidthAndHeightCssStyleProperties(),this.miniPreview.orientation=e.detail.type;let i,t,r,n;switch(e.detail.type){case "landscape-primary":case "landscape-secondary":{i=this.presenter.landscapeOrientationTriggerButtonTranslateX,t=this.presenter.landscapeOrientationTriggerButtonTranslateY,r=this.presenter.landscapeOrientationMiniPreviewTranslateX,n=this.presenter.landscapeOrientationMiniPreviewTranslateY;break}case "portrait-primary":case "portrait-secondary":{i=this.presenter.portraitOrientationTriggerButtonTranslateX,t=this.presenter.portraitOrientationTriggerButtonTranslateY,r=this.presenter.portraitOrientationMiniPreviewTranslateX,n=this.presenter.portraitOrientationMiniPreviewTranslateY;break}}this.triggerButton.translateTo(new Point(i,t)),this.miniPreview.translateTo(new Point(r,n)),await this.presenter.onOrientationChange();}targetModeButtonTapped(e,i=true){if(i){let t=e?"warning":"info",r=e?this._targetModeEnabledMessage:this._targetModeDisabledMessage;this.miniPreview.showToast(t,r,1e3);}this.miniPreview.toolbar&&(this.miniPreview.toolbar[e$1]=e),this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}scanningBehaviorButtonTapped(e,i=true){if(i){let t=e?"warning":"info",r=e?this._continuousModeEnabledMessage:this._continuousModeDisabledMessage;this.miniPreview.showToast(t,r,1e3);}this.miniPreview.toolbar&&(this.miniPreview.toolbar[b$2]=e?"continuous":"single"),this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}torchButtonTapped(e,i=true){if(i){let t=e?"warning":"info",r=e?this._torchEnabledMessage:this._torchDisabledMessage;this.miniPreview.showToast(t,r,1e3);}this.miniPreview.toolbar&&(this.miniPreview[g$1]=e),this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}cameraSwitchButtonTapped(e,i){var t;this.torchControlVisible=e,(t=this.miniPreview.toolbar)==null||t.enableCameraSwitchButton(i===CameraPosition.UserFacing);}getDefaultCssVariableValue(e){return window.getComputedStyle(this).getPropertyValue(e)}setTriggerButtonPressedColor(e,i,t){var o;let r=(o=this[e])!=null?o:Color.fromHex(this.getDefaultCssVariableValue(i)),n=clamp(r.alpha+r.alpha*.25,r.alpha,255),a=r.withAlpha(n);this.style.setProperty(t,`#${a.toJSON()}`);}addMiniPreviewListeners(){for(let[e,i]of this.miniPreviewListeners)this.miniPreview.addEventListener(e,i);}removeMiniPreviewListeners(){for(let[e,i]of this.miniPreviewListeners)this.miniPreview.removeEventListener(e,i);}addTriggerButtonListeners(){for(let[e,i]of this.triggerButtonListeners)this.triggerButton.addEventListener(e,i);}removeTriggerButtonListeners(){for(let[e,i]of this.triggerButtonListeners)this.triggerButton.removeEventListener(e,i);}repositionElementsIfOutOfBounds(){this.triggerButton.repositionIfOutOfBounds(),this.miniPreview.repositionIfOutOfBounds();}repositionMiniPreviewIfOutOfBounds(){this.miniPreview.repositionIfOutOfBounds();}repositionTriggerButtonIfOutOfBounds(){this.triggerButton.repositionIfOutOfBounds();}};export{W as a};
1
+ import {a as a$3}from'./chunk-3MEAY6PU.js';import {a as a$4}from'./chunk-6KWMOMD7.js';import {b}from'./chunk-Z2J2FVZ3.js';import {a as a$6}from'./chunk-NZCSU4S2.js';import {h}from'./chunk-4PYZSS3H.js';import {a as a$5,c as c$1,e,f as f$1,g,h as h$1,i as i$1,j as j$1,k as k$1,b as b$1,d as d$2}from'./chunk-DVHTYKDX.js';import {d,c,f,i,j,k,l,m,n,b as b$2,e as e$1,g as g$1}from'./chunk-4JEIREAU.js';import {d as d$1}from'./chunk-YBD5JYCX.js';import {a as a$2}from'./chunk-HRYJX4QW.js';import {a as a$1}from'./chunk-AYZEMPSP.js';import {a}from'./chunk-PMTVYYAY.js';import {Logger,Point,CameraPosition,Color}from'@scandit/web-datacapture-core';import {OrientationObserver,orientationChangeEvent}from'@scandit/web-datacapture-core/build/js/private/OrientationObserver.js';import {ScanditHTMLElement,Timeout,defineCustomElements,css,clamp}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var W=class l$1 extends ScanditHTMLElement{constructor(){super(...arguments);this._targetModeButtonVisible=false;this._scanningBehaviorButtonVisible=false;this._torchControlVisible=true;this._zoomSwitchControlVisible=true;this._previewSizeControlVisible=true;this._barcodeFindButtonVisible=false;this._labelCaptureButtonVisible=false;this._cameraSwitchButtonVisible=false;this._previewCloseControlVisible=true;this._triggerButtonVisible=true;this._isTorchAvailable=true;this._isZoomAvailable=true;this._isConnected=false;this._sizingMode="constrained";this.feedbackDelegate={getFeedbackForBarcode:()=>a.success()};this.resizeObserver=null;this.onResizeHandler=this.onResize.bind(this);this.settings=new a$1;this.presenter=a$2.forView(this,this.settings);this.miniPreview=b.create();this.triggerButton=a$3.create();this.visualFeedback=a$4.create();this.miniPreviewTimeout=new Timeout(500,this.onMiniPreviewTimeoutFinished.bind(this));this.orientationObserver=new OrientationObserver;this.miniPreviewPointerUpListener=this.onMiniPreviewPointerUp.bind(this);this.miniPreviewPointerMoveListener=this.onMiniPreviewPointerMove.bind(this);this.miniPreviewButtonTapListener=this.onMiniPreviewButtonTap.bind(this);this.miniPreviewDragListener=this.onMiniPreviewDrag.bind(this);this.miniPreviewDragEndListener=this.onMiniPreviewDragEnd.bind(this);this.miniPreviewVisibilityChangeListener=this.onMiniPreviewVisibilityChange.bind(this);this.triggerButtonPointerDownListener=this.onTriggerButtonPointerDown.bind(this);this.triggerButtonTapListener=this.onTriggerButtonTap.bind(this);this.triggerButtonLongPressStartListener=this.onTriggerButtonLongPressStart.bind(this);this.triggerButtonLongPressEndListener=this.onTriggerButtonLongPressEnd.bind(this);this.triggerButtonDragListener=this.onTriggerButtonDrag.bind(this);this.toolbarButtonTapListener=this.onToolbarButtonTap.bind(this);this.clickOutsideListener=this.onClickOutside.bind(this);this.visibilityChangeListener=this.onVisibilityChange.bind(this);this.orientationChangeListener=this.onOrientationChange.bind(this);this.holdingToScan=false;this.miniPreviewListeners=[["pointerup",this.miniPreviewPointerUpListener],["pointermove",this.miniPreviewPointerMoveListener],["minipreviewbuttontap",this.miniPreviewButtonTapListener],["toolbarbuttontap",this.toolbarButtonTapListener],["drag",this.miniPreviewDragListener],["dragend",this.miniPreviewDragEndListener],[h,this.miniPreviewVisibilityChangeListener]];this.triggerButtonListeners=[["pointerdown",this.triggerButtonPointerDownListener],["tap",this.triggerButtonTapListener],["longpressstart",this.triggerButtonLongPressStartListener],["longpressend",this.triggerButtonLongPressEndListener],["drag",this.triggerButtonDragListener]];}get targetModeButtonVisible(){return this._targetModeButtonVisible}set targetModeButtonVisible(e){var i;this._targetModeButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[d]=e);}get scanningBehaviorButtonVisible(){return this._scanningBehaviorButtonVisible}set scanningBehaviorButtonVisible(e){var i;this._scanningBehaviorButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[c]=e);}get torchControlVisible(){return this._torchControlVisible}set torchControlVisible(e){this._torchControlVisible=e,this.miniPreview&&(this.miniPreview[f]=e&&this._isTorchAvailable);}get zoomSwitchControlVisible(){return this._zoomSwitchControlVisible}set zoomSwitchControlVisible(e){this._zoomSwitchControlVisible=e,this.miniPreview&&(this.miniPreview[i]=e&&this._isZoomAvailable);}get previewSizeControlVisible(){return this._previewSizeControlVisible}set previewSizeControlVisible(e){this._previewSizeControlVisible=e,this.miniPreview&&(this.miniPreview[j]=e);}get barcodeFindButtonVisible(){return this._barcodeFindButtonVisible}set barcodeFindButtonVisible(e){var i;this._barcodeFindButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[k]=e);}get labelCaptureButtonVisible(){return this._labelCaptureButtonVisible}set labelCaptureButtonVisible(e){var i;this._labelCaptureButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[l]=e);}get cameraSwitchButtonVisible(){return this._cameraSwitchButtonVisible}set cameraSwitchButtonVisible(e){var i;this._cameraSwitchButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[m]=e);}get previewCloseControlVisible(){return this._previewCloseControlVisible}set previewCloseControlVisible(e){this._previewCloseControlVisible=e,this.miniPreview&&(this.miniPreview[n]=e);}get triggerButtonVisible(){return this._triggerButtonVisible}set triggerButtonVisible(e){this._triggerButtonVisible=e,this.triggerButton&&(this.triggerButton.visible=e);}get dataCaptureContext(){return this.presenter.context}set dataCaptureContext(e){this.presenter.context!==e&&(this.presenter.context=e,this._maybeAutoPrepareScanning());}get sparkScan(){return this.presenter.sparkScan}set sparkScan(e){this.presenter.sparkScan!==e&&(this.presenter.sparkScan=e,this._maybeAutoPrepareScanning());}get _targetModeEnabledMessage(){var e;return (e=this.settings.toastSettings.targetModeEnabledMessage)!=null?e:"Aimer on"}get _targetModeDisabledMessage(){var e;return (e=this.settings.toastSettings.targetModeDisabledMessage)!=null?e:"Aimer off"}get _continuousModeEnabledMessage(){var e;return (e=this.settings.toastSettings.continuousModeEnabledMessage)!=null?e:"Continuous mode on"}get _continuousModeDisabledMessage(){var e;return (e=this.settings.toastSettings.continuousModeDisabledMessage)!=null?e:"Continuous mode off"}get _scanPausedMessage(){var e;return (e=this.settings.toastSettings.scanPausedMessage)!=null?e:"Scan paused"}get _torchEnabledMessage(){var e;return (e=this.settings.toastSettings.torchEnabledMessage)!=null?e:"Torch on"}get _torchDisabledMessage(){var e;return (e=this.settings.toastSettings.torchDisabledMessage)!=null?e:"Torch off"}get _zoomedInMessage(){var e;return (e=this.settings.toastSettings.zoomedInMessage)!=null?e:"2x zoom"}get _zoomedOutMessage(){var e;return (e=this.settings.toastSettings.zoomedOutMessage)!=null?e:"1x zoom"}set sparkScanViewSettings(e){let i=e!=null?e:new a$1;this.settings=i,this.presenter.setSparkScanViewSettings(i);}get sparkScanViewSettings(){return this.settings}static forElement(e,i,t,r){let n=l$1.create();return r&&(n.sparkScanViewSettings=r),n.dataCaptureContext=i,n.sparkScan=t,e.append(n),n}static register(){defineCustomElements({[d$1]:l$1});}static create(){return l$1.register(),document.createElement("spark-scan-view")}static createStyleElement(){return css`:root{${a$5}:#12161966;${c$1}:#12161966;${e}:#5b707f4d;${f$1}:#fff;${g}:#121619cc;${h$1}:#fbc02c;${i$1}:#fff;${j$1}:#0ff;${k$1}:#fa4446}${d$1}{position:relative}`}async prepareScanning(){await this.presenter.prepareScanning(this.miniPreview.host);}async startScanning(){await this.presenter.startScanning();}async pauseScanning(){await this.presenter.pauseScanning();}async stopScanning(){await this.presenter.stopScanning({sessionStopReason:"user"});}showToast(e){this.miniPreview.showToast("info",e,1e3);}setListener(e){this.presenter.setListener(e);}setTriggerButtonImage(e){this.triggerButton.setImage(e);}get miniPreviewSize(){return this.miniPreview.size}set miniPreviewSize(e){this.miniPreview.size=e;}setWidthAndHeightCssStyleProperties(){var t,r,n,a,o,s;let e,i;this._sizingMode==="unconstrained"?(e=(r=(t=globalThis.window.visualViewport)==null?void 0:t.width)!=null?r:globalThis.window.innerWidth,i=(a=(n=globalThis.window.visualViewport)==null?void 0:n.height)!=null?a:globalThis.window.innerHeight):(e=((o=this.parentElement)==null?void 0:o.clientWidth)||document.body.clientWidth,i=((s=this.parentElement)==null?void 0:s.clientHeight)||document.body.clientHeight),this.style.setProperty("--dvw",`${e}px`),this.style.setProperty("--dvh",`${i}px`),this.style.setProperty("--dvw-half","calc(var(--dvw) / 2)"),this.style.setProperty("--dvh-half","calc(var(--dvh) / 2)");}onResize(){this.updateSizingMode(),this.setWidthAndHeightCssStyleProperties(),this.repositionElementsIfOutOfBounds();}updateSizingMode(){var r,n,a,o;let e=(n=(r=this.parentElement)==null?void 0:r.clientWidth)!=null?n:0,t=((o=(a=this.parentElement)==null?void 0:a.clientHeight)!=null?o:0)<236||e<236?"unconstrained":"constrained";if(this._sizingMode!==t){this._sizingMode=t;let s=t==="unconstrained";this.toggleAttribute("unconstrained",s),this.miniPreview.toggleAttribute("unconstrained",s),this.triggerButton.toggleAttribute("unconstrained",s),this.miniPreview.useViewportBounds=s,this.triggerButton.useViewportBounds=s,this.repositionElementsIfOutOfBounds();}}_maybeAutoPrepareScanning(){this._isConnected&&this.presenter.context&&this.presenter.sparkScan&&this.prepareScanning().catch(e=>{Logger.warn("Auto prepareScanning failed:",e);});}connectedCallback(){var e$1;this.append(l$1.createStyleElement().cloneNode(true),this.miniPreview,this.triggerButton,this.visualFeedback),this.resizeObserver=new ResizeObserver(this.onResizeHandler),this.resizeObserver.observe(this.parentElement),this.previewCloseControlVisible=this._previewCloseControlVisible,this.previewSizeControlVisible=this._previewSizeControlVisible,this.zoomSwitchControlVisible=this._zoomSwitchControlVisible,this.torchControlVisible=this._torchControlVisible,this.miniPreview.size=this.settings.defaultMiniPreviewSize,this.targetModeButtonVisible=this._targetModeButtonVisible,this.scanningBehaviorButtonVisible=this._scanningBehaviorButtonVisible,this.barcodeFindButtonVisible=this._barcodeFindButtonVisible,this.labelCaptureButtonVisible=this._labelCaptureButtonVisible,this.cameraSwitchButtonVisible=this._cameraSwitchButtonVisible,this.triggerButtonVisible=this._triggerButtonVisible;for(let[i,t]of [[this.triggerButtonCollapsedColor,a$5],[this.triggerButtonExpandedColor,c$1],[this.triggerButtonAnimationColor,e],[this.triggerButtonTintColor,f$1],[this.toolbarBackgroundColor,g],[this.toolbarIconActiveTintColor,h$1],[this.toolbarIconInactiveTintColor,i$1]])i&&this.style.setProperty(t,`#${i.toJSON()}`);this.setTriggerButtonPressedColor("triggerButtonCollapsedColor",a$5,b$1),this.setTriggerButtonPressedColor("triggerButtonExpandedColor",c$1,d$2),this.addMiniPreviewListeners(),this.addTriggerButtonListeners(),this.orientationObserver.register(),document.addEventListener("pointerup",this.clickOutsideListener),document.addEventListener("visibilitychange",this.visibilityChangeListener),this.orientationObserver.addEventListener(orientationChangeEvent,this.orientationChangeListener),this.orientationObserver.dispatchOrientationChangeEvent(this.orientationObserver.orientation),this.updateSizingMode(),this.setWidthAndHeightCssStyleProperties(),(e$1=window.visualViewport)==null||e$1.addEventListener("resize",this.onResizeHandler),this._isConnected=true,this._maybeAutoPrepareScanning();}disconnectedCallback(){var e,i;this.miniPreviewTimeout.stop(),(e=this.resizeObserver)==null||e.disconnect(),this.orientationObserver.unregister(),this.orientationObserver.removeEventListener(orientationChangeEvent,this.orientationChangeListener),this.removeMiniPreviewListeners(),this.removeTriggerButtonListeners(),document.removeEventListener("pointerup",this.clickOutsideListener),document.removeEventListener("visibilitychange",this.visibilityChangeListener),(i=window.visualViewport)==null||i.removeEventListener("resize",this.onResizeHandler);for(let t of Array.from(this.children))t.remove();this._isConnected=false;}setTorchAvailable(e){this._isTorchAvailable=e,this.torchControlVisible=this._torchControlVisible;}setZoomAvailable(e){this._isZoomAvailable=e,this.zoomSwitchControlVisible=this._zoomSwitchControlVisible;}switchToIdleState(){this.miniPreview.darkened=false,this.miniPreview.visible=false,this.miniPreview.hideToast(),this.triggerButton.expanded=false,this.triggerButton.stopPulsating();}async switchToActiveState(e,i,t,r){this.miniPreviewTimeout.stop(),this.miniPreview.hideToast(),this.miniPreview.cancelFadeOut(),this.miniPreview.darkened=false,this.miniPreview.visible=true,this.triggerButton.expanded=true,this.triggerButton.startPulsating(),this.miniPreview.toolbar&&(this.miniPreview.toolbar[b$2]=i),e&&(t&&this.style.setProperty(j$1,`#${t.toJSON()}`),await this.visualFeedback.emitSuccessFeedback()),r===true&&this.miniPreview.showToast("warning",this._zoomedInMessage,1e3);}async switchToInactiveState(e,i,t,r){this.miniPreview.darkened=t==="persistent"||e,this.miniPreview.visible=t==="persistent"||e,this.triggerButton.expanded=true,this.triggerButton.stopPulsating(),this.miniPreview.toolbar&&(this.miniPreview.toolbar[b$2]=i),e&&(r&&this.style.setProperty(j$1,`#${r.toJSON()}`),await this.visualFeedback.emitSuccessFeedback(),t==="default"&&this.miniPreviewTimeout.start()),t==="persistent"&&this.miniPreview.showToast("warning",this._scanPausedMessage,Number.POSITIVE_INFINITY);}async switchToErrorState(e,i){e.resumeCapturingDelay>0&&(this.triggerButton.stopPulsating(),this.miniPreview.showToast("error",e.message,e.resumeCapturingDelay)),i&&(this.style.setProperty(k$1,`#${e.visualFeedbackColor.toJSON()}`),await this.visualFeedback.emitErrorFeedback());}async onMiniPreviewPointerUp(){await this.presenter.onMiniPreviewPointerUp();}onMiniPreviewPointerMove(){this.presenter.onMiniPreviewPointerMove();}async onMiniPreviewButtonTap(e){switch(e.detail.tapped){case "torchButton":{await this.presenter.onTorchButtonTap(e.detail.enabled);break}case "closeButton":{await this.presenter.onMiniPreviewCloseButtonTap();break}case "resizeButton":{this.presenter.onMiniPreviewResizeButtonTap();break}case "zoomButton":{await this.presenter.onMiniPreviewZoomButtonTap(e.detail.zoomFactor);break}}this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}async onMiniPreviewDrag(e){e instanceof a$6&&await this.presenter.onMiniPreviewDrag(e.point,this.orientationObserver.orientation.type);}async onMiniPreviewDragEnd(e){e instanceof a$6&&await this.presenter.onMiniPreviewDragEnd();}async onMiniPreviewVisibilityChange(e){await this.presenter.onMiniPreviewVisibilityChange(e.detail.visible);}async onTriggerButtonPointerDown(){await this.presenter.onTriggerButtonPointerDown();}async onTriggerButtonTap(){await this.presenter.onTriggerButtonTap();}async onTriggerButtonLongPressStart(){this.holdingToScan||(this.holdingToScan=true,await this.presenter.onTriggerButtonLongPressStart());}async onTriggerButtonLongPressEnd(){this.holdingToScan&&(this.holdingToScan=false,await this.presenter.onTriggerButtonLongPressEnd());}onTriggerButtonDrag(e){e instanceof a$6&&this.presenter.onTriggerButtonDrag(e.point,this.orientationObserver.orientation.type);}async onToolbarButtonTap(e){switch(this.miniPreview.rewindAnimation(),e.detail.tapped){case "targetModeButton":{await this.onTargetModeButtonTap(e);return}case "scanningBehaviorButton":{await this.onScanningBehaviorButtonTap(e);return}case "barcodeFindButton":{await this.onBarcodeFindButtonTap();return}case "labelCaptureButton":{await this.onLabelCaptureButtonTap();return}case "cameraSwitchButton":await this.onCameraSwitchButtonTap();}}async onClickOutside(e){e.composedPath().includes(this)||await this.presenter.onClickOutside();}async onVisibilityChange(){document.visibilityState==="hidden"&&await this.presenter.onVisibilityChange();}async onTargetModeButtonTap(e){await this.presenter.onTargetModeButtonTap(e.detail.enabled);}async onScanningBehaviorButtonTap(e){await this.presenter.onScanningBehaviorButtonTap(e.detail.enabled);}async onBarcodeFindButtonTap(){await this.presenter.onBarcodeFindButtonTap();}async onLabelCaptureButtonTap(){await this.presenter.onLabelCaptureButtonTap();}async onCameraSwitchButtonTap(){this.torchControlVisible=false,await this.presenter.onCameraSwitchButtonTap();}async onTorchButtonTap(e){await this.presenter.onTorchButtonTap(e.detail.enabled);}async onMiniPreviewTimeoutFinished(){await this.miniPreview.fadeOut();}async onOrientationChange(e){this.updateSizingMode(),this.setWidthAndHeightCssStyleProperties(),this.miniPreview.orientation=e.detail.type;let i,t,r,n;switch(e.detail.type){case "landscape-primary":case "landscape-secondary":{i=this.presenter.landscapeOrientationTriggerButtonTranslateX,t=this.presenter.landscapeOrientationTriggerButtonTranslateY,r=this.presenter.landscapeOrientationMiniPreviewTranslateX,n=this.presenter.landscapeOrientationMiniPreviewTranslateY;break}case "portrait-primary":case "portrait-secondary":{i=this.presenter.portraitOrientationTriggerButtonTranslateX,t=this.presenter.portraitOrientationTriggerButtonTranslateY,r=this.presenter.portraitOrientationMiniPreviewTranslateX,n=this.presenter.portraitOrientationMiniPreviewTranslateY;break}}this.triggerButton.translateTo(new Point(i,t)),this.miniPreview.translateTo(new Point(r,n)),await this.presenter.onOrientationChange();}targetModeButtonTapped(e,i=true){if(i){let t=e?"warning":"info",r=e?this._targetModeEnabledMessage:this._targetModeDisabledMessage;this.miniPreview.showToast(t,r,1e3);}this.miniPreview.toolbar&&(this.miniPreview.toolbar[e$1]=e),this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}scanningBehaviorButtonTapped(e,i=true){if(i){let t=e?"warning":"info",r=e?this._continuousModeEnabledMessage:this._continuousModeDisabledMessage;this.miniPreview.showToast(t,r,1e3);}this.miniPreview.toolbar&&(this.miniPreview.toolbar[b$2]=e?"continuous":"single"),this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}torchButtonTapped(e,i=true){if(i){let t=e?"warning":"info",r=e?this._torchEnabledMessage:this._torchDisabledMessage;this.miniPreview.showToast(t,r,1e3);}this.miniPreview.toolbar&&(this.miniPreview[g$1]=e),this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}cameraSwitchButtonTapped(e,i){var t;this.torchControlVisible=e,(t=this.miniPreview.toolbar)==null||t.enableCameraSwitchButton(i===CameraPosition.UserFacing);}getDefaultCssVariableValue(e){return window.getComputedStyle(this).getPropertyValue(e)}setTriggerButtonPressedColor(e,i,t){var o;let r=(o=this[e])!=null?o:Color.fromHex(this.getDefaultCssVariableValue(i)),n=clamp(r.alpha+r.alpha*.25,r.alpha,255),a=r.withAlpha(n);this.style.setProperty(t,`#${a.toJSON()}`);}addMiniPreviewListeners(){for(let[e,i]of this.miniPreviewListeners)this.miniPreview.addEventListener(e,i);}removeMiniPreviewListeners(){for(let[e,i]of this.miniPreviewListeners)this.miniPreview.removeEventListener(e,i);}addTriggerButtonListeners(){for(let[e,i]of this.triggerButtonListeners)this.triggerButton.addEventListener(e,i);}removeTriggerButtonListeners(){for(let[e,i]of this.triggerButtonListeners)this.triggerButton.removeEventListener(e,i);}repositionElementsIfOutOfBounds(){this.triggerButton.repositionIfOutOfBounds(),this.miniPreview.repositionIfOutOfBounds();}repositionMiniPreviewIfOutOfBounds(){this.miniPreview.repositionIfOutOfBounds();}repositionTriggerButtonIfOutOfBounds(){this.triggerButton.repositionIfOutOfBounds();}};export{W as a};