1import{a as S,c as f,d as w}from"./chunk-2HXK3VBZ.js";import{e as p}from"./chunk-ZTDA5GMU.js";import{h as i}from"./chunk-WWX6BADO.js";var g=class extends p{stopAndHideScanner(){return i(this,null,function*(){console.log(window.OSBarcodeWebScanner),window.OSBarcodeWebScanner&&(yield window.OSBarcodeWebScanner.stop(),window.OSBarcodeWebScanner=null),document.getElementById("cap-os-barcode-scanner-container-dialog").style.display="none"})}buildScannerElement(){if(document.getElementById("cap-os-barcode-scanner-container")){document.getElementById("cap-os-barcode-scanner-container").className="scanner-container-display";return}let e=document.body.appendChild(document.createElement("div"));e.id="cap-os-barcode-scanner-container";let o=document.createElement("div");o.id="cap-os-barcode-scanner-container-dialog",o.className="scanner-dialog";let a=document.createElement("div");a.className="scanner-dialog-inner";let c=document.createElement("span");c.id="cap-os-barcode-scanner-close-button",c.className="close-button",c.innerHTML="×",a.appendChild(c);let r=document.createElement("p");r.innerHTML=" ",a.appendChild(r);let n=document.createElement("div");n.className="scanner-container-full-width",n.id="cap-os-barcode-scanner-container-scanner",a.appendChild(n),o.appendChild(a),e.appendChild(o)}scanBarcode(e){return i(this,null,function*(){return this.buildScannerElement(),document.getElementById("cap-os-barcode-scanner-container-dialog").style.display="block",new Promise((o,a)=>{var c,r;let n={facingMode:e.cameraDirection===1?"environment":"user",hasScannerButton:!1,scanButton:e.scanButton===void 0?!1:e.scanButton,showScanLine:!1,scanInstructions:e.scanInstructions?e.scanInstructions:"",orientation:e.scanOrientation?e.scanOrientation:f.PORTRAIT,showCameraSelection:!((c=e.web)===null||c===void 0)&&c.showCameraSelection?e.web.showCameraSelection:!1,typeHint:e.hint===17?void 0:e.hint,scannerFPS:!((r=e.web)===null||r===void 0)&&r.scannerFPS?e.web.scannerFPS:50},u=!1,m=document.getElementById("cap-os-barcode-scanner-close-button");m&&(m.onclick=()=>i(this,null,function*(){u||(u=!0,yield this.stopAndHideScanner(),a(new Error("Couldn\u2019t scan because the process was cancelled.")))}));let s=document.getElementById("cap-os-barcode-scanner-container-scanner");if(!s)throw new Error("Scanner Element is required for web");window.OSBarcodeWebScanner=new S(s.id,{formatsToSupport:n.typeHint!==void 0?[n.typeHint]:void 0,verbose:void 0});let h={fps:n.scannerFPS,qrbox:s.getBoundingClientRect().width*(9/16)-10,aspectRatio:16/9,videoConstraints:{focusMode:"continuous",height:{min:576,ideal:1920},deviceId:void 0,facingMode:n.facingMode}},E=(t,b)=>{var d,l;this.stopAndHideScanner(),o({ScanResult:t,format:(l=(d=b.result.format)===null||d===void 0?void 0:d.format)!==null&&l!==void 0?l:w.ALL})},B=t=>{["NotFoundException","No barcode or QR code detected","No MultiFormat Readers were able to detect the code"].find(d=>t.indexOf(d)!==-1)||(this.stopAndHideScanner(),console.error(`[Scanner Web Error] ${t}`),a(t))};window.OSBarcodeWebScanner.start({facingMode:n.facingMode},h,E,B)})})}};export{g as CapacitorBarcodeScannerWeb};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.