@zappar/zappar-cv 3.0.1-beta.8 → 3.1.0-beta.2

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 (41) hide show
  1. package/README.md +2 -2
  2. package/lib/additional.d.ts +1 -0
  3. package/lib/android-bridge-message-handler.d.ts +11 -0
  4. package/lib/android-bridge-message-handler.js +167 -0
  5. package/lib/array-from-string.d.ts +2 -0
  6. package/lib/array-from-string.js +48 -0
  7. package/lib/bridged-camera-source.d.ts +39 -0
  8. package/lib/bridged-camera-source.js +383 -0
  9. package/lib/bridged-message-parser.d.ts +12 -0
  10. package/lib/bridged-message-parser.js +56 -0
  11. package/lib/bridged-message.d.ts +64 -0
  12. package/lib/bridged-message.js +1 -0
  13. package/lib/bridged-world-tracker.d.ts +20 -0
  14. package/lib/bridged-world-tracker.js +426 -0
  15. package/lib/camera-source-map.d.ts +2 -1
  16. package/lib/camera-source-map.js +4 -1
  17. package/lib/drawmesh.d.ts +14 -0
  18. package/lib/drawmesh.js +123 -0
  19. package/lib/gen/zappar-client.js +12 -0
  20. package/lib/gen/zappar.d.ts +16 -0
  21. package/lib/index-standalone.js +1 -1
  22. package/lib/native.js +61 -15
  23. package/lib/options.d.ts +1 -0
  24. package/lib/permission.js +6 -0
  25. package/lib/pipeline.js +2 -1
  26. package/lib/profile.js +2 -1
  27. package/lib/source.d.ts +1 -0
  28. package/lib/version.d.ts +1 -1
  29. package/lib/version.js +1 -1
  30. package/lib/yuv-conversion-gl.d.ts +44 -0
  31. package/lib/yuv-conversion-gl.js +416 -0
  32. package/lib/zappar-cv.js +1 -1
  33. package/lib/zappar-cv.wasm +0 -0
  34. package/package.json +6 -16
  35. package/umd/287.zappar-cv.js +1 -0
  36. package/umd/{7fd693559466ec5f412e.wasm → 641e1456d6d56783d581.wasm} +0 -0
  37. package/umd/867.zappar-cv.js +1 -1
  38. package/umd/zappar-cv-ceres.worker.js +1 -0
  39. package/umd/zappar-cv.js +1 -1
  40. package/umd/zappar-cv.worker.js +1 -1
  41. package/umd/751.zappar-cv.js +0 -1
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zappar/zappar-cv",
3
- "version": "3.0.1-beta.8",
3
+ "version": "3.1.0-beta.2",
4
4
  "description": "Zappar's core computer vision library, supporting image, face and world tracking.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -9,14 +9,14 @@
9
9
  "build-standalone-debug": "webpack --config=webpack.config.standalone.js --mode=development",
10
10
  "build-module": "tsc",
11
11
  "tsc-watch": "tsc --watch",
12
- "test-module": "jest puppeteer/module",
13
- "test-standalone": "jest puppeteer/standalone",
12
+ "test-module": "npx playwright test --config playwright.config.module.ts",
13
+ "test-standalone": "npx playwright test --config playwright.config.standalone.ts",
14
+ "test-cdn": "npx playwright test --config playwright.config.cdn.ts",
15
+ "test-cdn-live": "npx playwright test --config playwright.config.cdn-live.ts",
14
16
  "tests": "webpack --config=webpack.tests.config.js --mode=development && webpack serve --mode=development --config=webpack.tests.config.js",
15
17
  "tests-with-tracing": "webpack --config=webpack.testswithtracing.config.js --mode=development && webpack serve --mode=development --config=webpack.testswithtracing.config.js",
16
18
  "tests-with-tracing-prod": "webpack --config=webpack.testswithtracing.config.js --mode=production && webpack serve --mode=production --config=webpack.testswithtracing.config.js",
17
19
  "webpack-puppeteer": "webpack --config=webpack.config.puppeteer.js --mode=development && webpack serve --config=webpack.config.puppeteer.js",
18
- "standalone-test-serve": "concurrently 'zapworks serve --port 7010 umd' 'zapworks serve --port 7011 puppeteer-standalone-dist' || true",
19
- "standalone-test-serve2": "zapworks serve --port 7011 puppeteer-standalone-dist",
20
20
  "audit": "better-npm-audit audit --production"
21
21
  },
22
22
  "author": "Zappar Limited",
@@ -29,30 +29,20 @@
29
29
  "upkg": "umd/zappar-cv.js",
30
30
  "license": "Proprietary",
31
31
  "devDependencies": {
32
+ "@playwright/test": "^1.48.2",
32
33
  "@types/dom-mediacapture-transform": "0.1.1",
33
34
  "@types/dom-webcodecs": "0.1.2",
34
- "@types/expect-puppeteer": "4.4.5",
35
- "@types/jest-environment-puppeteer": "4.4.1",
36
35
  "@types/node": "14.14.7",
37
36
  "@types/offscreencanvas": "2019.6.4",
38
- "@types/pixelmatch": "5.2.2",
39
37
  "@types/pngjs": "6.0.0",
40
- "@types/puppeteer": "5.4.3",
41
38
  "@types/ua-parser-js": "0.7.33",
42
39
  "@zappar/zapworks-cli": "2.0.6",
43
40
  "better-npm-audit": "^3.7.3",
44
- "concurrently": "5.3.0",
45
41
  "dat.gui": "0.7.7",
46
42
  "html-webpack-plugin": "5.5.0",
47
- "jest": "26.6.3",
48
- "jest-puppeteer": "6.0.2",
49
43
  "jsdoc": "3.6.7",
50
- "pixelmatch": "5.2.1",
51
44
  "pngjs": "6.0.0",
52
- "puppeteer": "7.1.0",
53
- "ts-jest": "26.5.1",
54
45
  "ts-loader": "9.2.6",
55
- "ts-node": "9.1.1",
56
46
  "typescript": "4.0.5",
57
47
  "webpack": "5.89.0",
58
48
  "webpack-cli": "4.9.2",
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ZCV=t():e.ZCV=t()}(self,(()=>(()=>{"use strict";var e,t,r={287:(e,t,r)=>{var a=r(581);class _{constructor(e){this._messageSender=e,this._freeBufferPool=[],this._buffer=new ArrayBuffer(16),this._i32View=new Int32Array(this._buffer),this._f32View=new Float32Array(this._buffer),this._f64View=new Float64Array(this._buffer),this._u8View=new Uint8Array(this._buffer),this._u8cView=new Uint8ClampedArray(this._buffer),this._u16View=new Uint16Array(this._buffer),this._u32View=new Uint32Array(this._buffer),this._offset=1,this._startOffset=-1,this._timeoutSet=!1,this._appender={int:e=>this.int(e),bool:e=>this.int(e?1:0),float:e=>this.float(e),string:e=>this.string(e),dataWithLength:e=>this.arrayBuffer(e),type:e=>this.int(e),matrix4x4:e=>this.float32ArrayBuffer(e),matrix3x3:e=>this.float32ArrayBuffer(e),floatArray:e=>this.float32ArrayBuffer(e),ucharArray:e=>this.uint8ArrayBuffer(e),identityCoefficients:e=>this.float32ArrayBuffer(e),expressionCoefficients:e=>this.float32ArrayBuffer(e),cameraModel:e=>this.float32ArrayBuffer(e),timestamp:e=>this.double(e),barcodeFormat:e=>this.int(e),faceLandmarkName:e=>this.int(e),instantTrackerTransformOrientation:e=>this.int(e),transformOrientation:e=>this.int(e),planeOrientation:e=>this.int(e),anchorStatus:e=>this.int(e),logLevel:e=>this.int(e)},this._freeBufferPool.push(new ArrayBuffer(16)),this._freeBufferPool.push(new ArrayBuffer(16))}bufferReturn(e){this._freeBufferPool.push(e)}_ensureArrayBuffer(e){let t,r=4*(this._offset+e+8);if(this._buffer&&this._buffer.byteLength>=r)return;if(!t){let e=r;e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,t=new ArrayBuffer(e)}let a=this._buffer?this._i32View:void 0;this._buffer=t,this._i32View=new Int32Array(this._buffer),this._f32View=new Float32Array(this._buffer),this._f64View=new Float64Array(this._buffer),this._u8View=new Uint8Array(this._buffer),this._u8cView=new Uint8ClampedArray(this._buffer),this._u16View=new Uint16Array(this._buffer),this._u32View=new Uint32Array(this._buffer),a&&this._i32View.set(a.subarray(0,this._offset))}sendMessage(e,t){this._ensureArrayBuffer(4),this._startOffset=this._offset,this._i32View[this._offset+1]=e,this._offset+=2,t(this._appender),this._i32View[this._startOffset]=this._offset-this._startOffset,this._startOffset=-1,this._sendOneTime()}_sendOneTime(){!1===this._timeoutSet&&(this._timeoutSet=!0,setTimeout((()=>{this._timeoutSet=!1,this._send()}),0))}_send(){0!==this._freeBufferPool.length?(this._i32View[0]=this._offset,this._messageSender(this._buffer),this._buffer=void 0,this._buffer=this._freeBufferPool.pop(),this._i32View=new Int32Array(this._buffer),this._f32View=new Float32Array(this._buffer),this._f64View=new Float64Array(this._buffer),this._u8View=new Uint8Array(this._buffer),this._u8cView=new Uint8ClampedArray(this._buffer),this._u16View=new Uint16Array(this._buffer),this._u32View=new Uint32Array(this._buffer),this._offset=1,this._startOffset=-1):this._sendOneTime()}int(e){this._ensureArrayBuffer(1),this._i32View[this._offset]=e,this._offset++}double(e){this._ensureArrayBuffer(2),this._offset%2==1&&this._offset++,this._f64View[this._offset/2]=e,this._offset+=2}float(e){this._ensureArrayBuffer(1),this._f32View[this._offset]=e,this._offset++}int32Array(e){this._ensureArrayBuffer(e.length);for(let t=0;t<e.length;++t)this._i32View[this._offset+t]=e[t];this._offset+=e.length}float32Array(e){this._ensureArrayBuffer(e.length);for(let t=0;t<e.length;++t)this._f32View[this._offset+t]=e[t];this._offset+=e.length}booleanArray(e){this._ensureArrayBuffer(e.length);for(let t=0;t<e.length;++t)this._i32View[this._offset+t]=e[t]?1:0;this._offset+=e.length}uint8ArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.byteLength,this._offset++,this._u8View.set(e,4*this._offset),this._offset+=e.byteLength>>2,0!=(3&e.byteLength)&&this._offset++}arrayBuffer(e){let t=new Uint8Array(e);this.uint8ArrayBuffer(t)}uint8ClampedArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.byteLength,this._offset++,this._u8cView.set(e,4*this._offset),this._offset+=e.byteLength>>2,0!=(3&e.byteLength)&&this._offset++}float32ArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.length,this._offset++,this._f32View.set(e,this._offset),this._offset+=e.length}uint16ArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.length,this._offset++;let t=2*this._offset;this._u16View.set(e,t),this._offset+=e.length>>1,0!=(1&e.length)&&this._offset++}int32ArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.length,this._offset++,this._i32View.set(e,this._offset),this._offset+=e.length}uint32ArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.length,this._offset++,this._u32View.set(e,this._offset),this._offset+=e.length}string(e){let t=(new TextEncoder).encode(e);this._ensureArrayBuffer(t.byteLength/4),this._i32View[this._offset]=t.byteLength,this._offset++,this._u8View.set(t,4*this._offset),this._offset+=t.byteLength>>2,0!=(3&t.byteLength)&&this._offset++}}class i{constructor(){this._buffer=new ArrayBuffer(0),this._i32View=new Int32Array(this._buffer),this._f32View=new Float32Array(this._buffer),this._f64View=new Float64Array(this._buffer),this._u8View=new Uint8Array(this._buffer),this._u16View=new Uint16Array(this._buffer),this._u32View=new Uint32Array(this._buffer),this._offset=0,this._length=0,this._startOffset=-1,this._processor={int:()=>this._i32View[this._startOffset++],bool:()=>1===this._i32View[this._startOffset++],type:()=>this._i32View[this._startOffset++],float:()=>this._f32View[this._startOffset++],timestamp:()=>{this._startOffset%2==1&&this._startOffset++;let e=this._f64View[this._startOffset/2];return this._startOffset+=2,e},string:()=>{let e=this._i32View[this._startOffset++],t=(new TextDecoder).decode(new Uint8Array(this._buffer,4*this._startOffset,e));return this._startOffset+=e>>2,0!=(3&e)&&this._startOffset++,t},dataWithLength:()=>{let e=this._i32View[this._startOffset++],t=new Uint8Array(e);return t.set(this._u8View.subarray(4*this._startOffset,4*this._startOffset+e)),this._startOffset+=t.byteLength>>2,0!=(3&t.byteLength)&&this._startOffset++,t.buffer},ucharArray:()=>{let e=this._i32View[this._startOffset++],t=new Uint8Array(e);return t.set(this._u8View.subarray(4*this._startOffset,4*this._startOffset+e)),this._startOffset+=t.byteLength>>2,0!=(3&t.byteLength)&&this._startOffset++,t},floatArray:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+e)),this._startOffset+=e,t},matrix4x4:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+16)),this._startOffset+=e,t},matrix3x3:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+9)),this._startOffset+=e,t},identityCoefficients:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+50)),this._startOffset+=e,t},expressionCoefficients:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+29)),this._startOffset+=e,t},cameraModel:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+6)),this._startOffset+=e,t},barcodeFormat:()=>this._i32View[this._startOffset++],faceLandmarkName:()=>this._i32View[this._startOffset++],instantTrackerTransformOrientation:()=>this._i32View[this._startOffset++],transformOrientation:()=>this._i32View[this._startOffset++],planeOrientation:()=>this._i32View[this._startOffset++],anchorStatus:()=>this._i32View[this._startOffset++],logLevel:()=>this._i32View[this._startOffset++]}}setData(e){this._buffer=e,this._i32View=new Int32Array(this._buffer),this._f32View=new Float32Array(this._buffer),this._f64View=new Float64Array(this._buffer),this._u8View=new Uint8Array(this._buffer),this._u16View=new Uint16Array(this._buffer),this._u32View=new Uint32Array(this._buffer),this._offset=0,this._length=0,e.byteLength>=4&&(this._offset=1,this._length=this._i32View[0]),this._startOffset=-1}hasMessage(){return this._offset+1<this._length}forMessages(e){for(;this.hasMessage();){let t=this._i32View[this._offset],r=this._i32View[this._offset+1];this._startOffset=this._offset+2,this._offset+=t,e(r,this._processor)}}}class n{constructor(e,t){this._impl=e,this._sender=t,this._deserializer=new i,this.serializersByPipelineId=new Map,this._pipeline_id_by_pipeline_id=new Map,this._pipeline_by_instance=new Map,this._pipeline_id_by_camera_source_id=new Map,this._camera_source_by_instance=new Map,this._pipeline_id_by_sequence_source_id=new Map,this._sequence_source_by_instance=new Map,this._pipeline_id_by_image_tracker_id=new Map,this._image_tracker_by_instance=new Map,this._pipeline_id_by_face_tracker_id=new Map,this._face_tracker_by_instance=new Map,this._pipeline_id_by_face_mesh_id=new Map,this._face_mesh_by_instance=new Map,this._pipeline_id_by_face_landmark_id=new Map,this._face_landmark_by_instance=new Map,this._pipeline_id_by_barcode_finder_id=new Map,this._barcode_finder_by_instance=new Map,this._pipeline_id_by_instant_world_tracker_id=new Map,this._instant_world_tracker_by_instance=new Map,this._pipeline_id_by_zapcode_tracker_id=new Map,this._zapcode_tracker_by_instance=new Map,this._pipeline_id_by_world_tracker_id=new Map,this._world_tracker_by_instance=new Map,this._pipeline_id_by_custom_anchor_id=new Map,this._custom_anchor_by_instance=new Map}processBuffer(e){this._deserializer.setData(e),this._deserializer.forMessages(((e,t)=>{switch(e){case 38:this._impl.log_level_set(t.logLevel());break;case 35:this._impl.analytics_project_id_set(t.string(),t.string());break;case 31:{let e=t.type(),r=this._impl.pipeline_create();this._pipeline_by_instance.set(e,r),this._pipeline_id_by_pipeline_id.set(e,e),this.serializersByPipelineId.set(e,new _((t=>{this._sender(e,t)})));break}case 32:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_destroy(r),this._pipeline_by_instance.delete(e);break}case 9:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_frame_update(r);break}case 8:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_camera_frame_submit(r,t.dataWithLength(),t.int(),t.int(),t.int(),t.matrix4x4(),t.cameraModel(),t.bool(),t.float());break}case 10:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_accelerometer_submit(r,t.timestamp(),t.float(),t.float(),t.float());break}case 12:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_accelerometer_with_gravity_submit_int(r,t.timestamp(),t.timestamp(),t.float(),t.float(),t.float());break}case 11:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_accelerometer_without_gravity_submit_int(r,t.timestamp(),t.timestamp(),t.float(),t.float(),t.float());break}case 15:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_rotation_rate_submit(r,t.timestamp(),t.float(),t.float(),t.float());break}case 13:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_rotation_rate_submit_int(r,t.timestamp(),t.timestamp(),t.float(),t.float(),t.float());break}case 16:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_attitude_submit(r,t.timestamp(),t.float(),t.float(),t.float());break}case 14:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_attitude_submit_int(r,t.timestamp(),t.timestamp(),t.float(),t.float(),t.float());break}case 17:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_attitude_matrix_submit(r,t.matrix4x4());break}case 33:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),_=t.string(),i=this._impl.camera_source_create(a,_);this._camera_source_by_instance.set(e,i),this._pipeline_id_by_camera_source_id.set(e,r);break}case 34:{let e=t.type(),r=this._camera_source_by_instance.get(e);if(void 0===r)return;this._impl.camera_source_destroy(r),this._camera_source_by_instance.delete(e);break}case 39:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),_=this._impl.sequence_source_create(a);this._sequence_source_by_instance.set(e,_),this._pipeline_id_by_sequence_source_id.set(e,r);break}case 40:{let e=t.type(),r=this._sequence_source_by_instance.get(e);if(void 0===r)return;this._impl.sequence_source_destroy(r),this._sequence_source_by_instance.delete(e);break}case 2:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),_=this._impl.image_tracker_create(a);this._image_tracker_by_instance.set(e,_),this._pipeline_id_by_image_tracker_id.set(e,r);break}case 18:{let e=t.type(),r=this._image_tracker_by_instance.get(e);if(void 0===r)return;this._impl.image_tracker_destroy(r),this._image_tracker_by_instance.delete(e);break}case 4:{let e=t.type(),r=this._image_tracker_by_instance.get(e);if(void 0===r)return;this._impl.image_tracker_target_load_from_memory(r,t.dataWithLength());break}case 3:{let e=t.type(),r=this._image_tracker_by_instance.get(e);if(void 0===r)return;this._impl.image_tracker_enabled_set(r,t.bool());break}case 24:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),_=this._impl.face_tracker_create(a);this._face_tracker_by_instance.set(e,_),this._pipeline_id_by_face_tracker_id.set(e,r);break}case 25:{let e=t.type(),r=this._face_tracker_by_instance.get(e);if(void 0===r)return;this._impl.face_tracker_destroy(r),this._face_tracker_by_instance.delete(e);break}case 26:{let e=t.type(),r=this._face_tracker_by_instance.get(e);if(void 0===r)return;this._impl.face_tracker_model_load_from_memory(r,t.dataWithLength());break}case 27:{let e=t.type(),r=this._face_tracker_by_instance.get(e);if(void 0===r)return;this._impl.face_tracker_enabled_set(r,t.bool());break}case 28:{let e=t.type(),r=this._face_tracker_by_instance.get(e);if(void 0===r)return;this._impl.face_tracker_max_faces_set(r,t.int());break}case 29:{let e=t.type(),r=this._impl.face_mesh_create();this._face_mesh_by_instance.set(e,r);break}case 30:{let e=t.type(),r=this._face_mesh_by_instance.get(e);if(void 0===r)return;this._impl.face_mesh_destroy(r),this._face_mesh_by_instance.delete(e);break}case 36:{let e=t.type(),r=t.faceLandmarkName(),a=this._impl.face_landmark_create(r);this._face_landmark_by_instance.set(e,a);break}case 37:{let e=t.type(),r=this._face_landmark_by_instance.get(e);if(void 0===r)return;this._impl.face_landmark_destroy(r),this._face_landmark_by_instance.delete(e);break}case 20:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),_=this._impl.barcode_finder_create(a);this._barcode_finder_by_instance.set(e,_),this._pipeline_id_by_barcode_finder_id.set(e,r);break}case 21:{let e=t.type(),r=this._barcode_finder_by_instance.get(e);if(void 0===r)return;this._impl.barcode_finder_destroy(r),this._barcode_finder_by_instance.delete(e);break}case 22:{let e=t.type(),r=this._barcode_finder_by_instance.get(e);if(void 0===r)return;this._impl.barcode_finder_enabled_set(r,t.bool());break}case 23:{let e=t.type(),r=this._barcode_finder_by_instance.get(e);if(void 0===r)return;this._impl.barcode_finder_formats_set(r,t.barcodeFormat());break}case 5:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),_=this._impl.instant_world_tracker_create(a);this._instant_world_tracker_by_instance.set(e,_),this._pipeline_id_by_instant_world_tracker_id.set(e,r);break}case 19:{let e=t.type(),r=this._instant_world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.instant_world_tracker_destroy(r),this._instant_world_tracker_by_instance.delete(e);break}case 6:{let e=t.type(),r=this._instant_world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.instant_world_tracker_enabled_set(r,t.bool());break}case 7:{let e=t.type(),r=this._instant_world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.instant_world_tracker_anchor_pose_set_from_camera_offset_raw(r,t.float(),t.float(),t.float(),t.instantTrackerTransformOrientation());break}case 41:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),_=this._impl.zapcode_tracker_create(a);this._zapcode_tracker_by_instance.set(e,_),this._pipeline_id_by_zapcode_tracker_id.set(e,r);break}case 44:{let e=t.type(),r=this._zapcode_tracker_by_instance.get(e);if(void 0===r)return;this._impl.zapcode_tracker_destroy(r),this._zapcode_tracker_by_instance.delete(e);break}case 43:{let e=t.type(),r=this._zapcode_tracker_by_instance.get(e);if(void 0===r)return;this._impl.zapcode_tracker_target_load_from_memory(r,t.dataWithLength());break}case 42:{let e=t.type(),r=this._zapcode_tracker_by_instance.get(e);if(void 0===r)return;this._impl.zapcode_tracker_enabled_set(r,t.bool());break}case 45:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),_=this._impl.world_tracker_create(a);this._world_tracker_by_instance.set(e,_),this._pipeline_id_by_world_tracker_id.set(e,r);break}case 46:{let e=t.type(),r=this._world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.world_tracker_destroy(r),this._world_tracker_by_instance.delete(e);break}case 47:{let e=t.type(),r=this._world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.world_tracker_enabled_set(r,t.bool());break}case 48:{let e=t.type(),r=this._world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.world_tracker_horizontal_plane_detection_enabled_set(r,t.bool());break}case 49:{let e=t.type(),r=this._world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.world_tracker_vertical_plane_detection_enabled_set(r,t.bool());break}case 50:{let e=t.type(),r=this._world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.world_tracker_reset(r);break}case 51:{let e=t.type(),r=this._world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.world_tracker_tracks_data_enabled_set(r,t.bool());break}case 52:{let e=t.type(),r=this._world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.world_tracker_projections_data_enabled_set(r,t.bool());break}case 53:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),_=t.type(),i=this._world_tracker_by_instance.get(_),n=t.string(),s=this._impl.custom_anchor_create(a,i,n);this._custom_anchor_by_instance.set(e,s),this._pipeline_id_by_custom_anchor_id.set(e,r);break}case 54:{let e=t.type(),r=this._custom_anchor_by_instance.get(e);if(void 0===r)return;this._impl.custom_anchor_destroy(r),this._custom_anchor_by_instance.delete(e);break}case 55:{let e=t.type(),r=this._custom_anchor_by_instance.get(e);if(void 0===r)return;this._impl.custom_anchor_pose_set_from_camera_offset_raw(r,t.float(),t.float(),t.float(),t.transformOrientation());break}case 56:{let e=t.type(),r=this._custom_anchor_by_instance.get(e);if(void 0===r)return;this._impl.custom_anchor_pose_set_from_anchor_offset(r,t.string(),t.float(),t.float(),t.float(),t.transformOrientation());break}case 57:{let e=t.type(),r=this._custom_anchor_by_instance.get(e);if(void 0===r)return;this._impl.custom_anchor_pose_set(r,t.matrix4x4());break}case 58:{let e=t.type(),r=this._custom_anchor_by_instance.get(e);if(void 0===r)return;this._impl.custom_anchor_pose_set_with_parent(r,t.matrix4x4(),t.string());break}}}))}exploreState(){for(let[e,t]of this._pipeline_by_instance){let r=this._pipeline_id_by_pipeline_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);a&&(a.sendMessage(9,(r=>{r.type(e),r.int(this._impl.pipeline_frame_number(t))})),a.sendMessage(6,(r=>{r.type(e),r.cameraModel(this._impl.pipeline_camera_model(t))})),a.sendMessage(7,(r=>{r.type(e),r.int(this._impl.pipeline_camera_data_width(t))})),a.sendMessage(8,(r=>{r.type(e),r.int(this._impl.pipeline_camera_data_height(t))})),a.sendMessage(5,(r=>{r.type(e),r.int(this._impl.pipeline_camera_frame_user_data(t))})),a.sendMessage(13,(r=>{r.type(e),r.matrix4x4(this._impl.pipeline_camera_frame_camera_attitude(t))})),a.sendMessage(14,(r=>{r.type(e),r.matrix4x4(this._impl.pipeline_camera_frame_device_attitude(t))})))}for(let[e,t]of this._camera_source_by_instance){let t=this._pipeline_id_by_camera_source_id.get(e);t&&this.serializersByPipelineId.get(t)}for(let[e,t]of this._sequence_source_by_instance){let t=this._pipeline_id_by_sequence_source_id.get(e);t&&this.serializersByPipelineId.get(t)}for(let[e,t]of this._image_tracker_by_instance){let r=this._pipeline_id_by_image_tracker_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);if(a){a.sendMessage(21,(r=>{r.type(e),r.int(this._impl.image_tracker_target_loaded_version(t))})),a.sendMessage(1,(r=>{r.type(e),r.int(this._impl.image_tracker_anchor_count(t))}));for(let r=0;r<this._impl.image_tracker_anchor_count(t);r++)a.sendMessage(2,(a=>{a.type(e),a.int(r),a.string(this._impl.image_tracker_anchor_id(t,r))}));for(let r=0;r<this._impl.image_tracker_anchor_count(t);r++)a.sendMessage(3,(a=>{a.type(e),a.int(r),a.matrix4x4(this._impl.image_tracker_anchor_pose_raw(t,r))}))}}for(let[e,t]of this._face_tracker_by_instance){let r=this._pipeline_id_by_face_tracker_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);if(a){a.sendMessage(20,(r=>{r.type(e),r.int(this._impl.face_tracker_model_loaded_version(t))})),a.sendMessage(15,(r=>{r.type(e),r.int(this._impl.face_tracker_anchor_count(t))}));for(let r=0;r<this._impl.face_tracker_anchor_count(t);r++)a.sendMessage(16,(a=>{a.type(e),a.int(r),a.string(this._impl.face_tracker_anchor_id(t,r))}));for(let r=0;r<this._impl.face_tracker_anchor_count(t);r++)a.sendMessage(17,(a=>{a.type(e),a.int(r),a.matrix4x4(this._impl.face_tracker_anchor_pose_raw(t,r))}));for(let r=0;r<this._impl.face_tracker_anchor_count(t);r++)a.sendMessage(18,(a=>{a.type(e),a.int(r),a.identityCoefficients(this._impl.face_tracker_anchor_identity_coefficients(t,r))}));for(let r=0;r<this._impl.face_tracker_anchor_count(t);r++)a.sendMessage(19,(a=>{a.type(e),a.int(r),a.expressionCoefficients(this._impl.face_tracker_anchor_expression_coefficients(t,r))}))}}for(let[e,t]of this._face_mesh_by_instance){let t=this._pipeline_id_by_face_mesh_id.get(e);t&&this.serializersByPipelineId.get(t)}for(let[e,t]of this._face_landmark_by_instance){let t=this._pipeline_id_by_face_landmark_id.get(e);t&&this.serializersByPipelineId.get(t)}for(let[e,t]of this._barcode_finder_by_instance){let r=this._pipeline_id_by_barcode_finder_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);if(a){a.sendMessage(10,(r=>{r.type(e),r.int(this._impl.barcode_finder_found_number(t))}));for(let r=0;r<this._impl.barcode_finder_found_number(t);r++)a.sendMessage(11,(a=>{a.type(e),a.int(r),a.string(this._impl.barcode_finder_found_text(t,r))}));for(let r=0;r<this._impl.barcode_finder_found_number(t);r++)a.sendMessage(12,(a=>{a.type(e),a.int(r),a.barcodeFormat(this._impl.barcode_finder_found_format(t,r))}))}}for(let[e,t]of this._instant_world_tracker_by_instance){let r=this._pipeline_id_by_instant_world_tracker_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);a&&a.sendMessage(4,(r=>{r.type(e),r.matrix4x4(this._impl.instant_world_tracker_anchor_pose_raw(t))}))}for(let[e,t]of this._zapcode_tracker_by_instance){let r=this._pipeline_id_by_zapcode_tracker_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);if(a){a.sendMessage(26,(r=>{r.type(e),r.int(this._impl.zapcode_tracker_target_loaded_version(t))})),a.sendMessage(23,(r=>{r.type(e),r.int(this._impl.zapcode_tracker_anchor_count(t))}));for(let r=0;r<this._impl.zapcode_tracker_anchor_count(t);r++)a.sendMessage(24,(a=>{a.type(e),a.int(r),a.string(this._impl.zapcode_tracker_anchor_id(t,r))}));for(let r=0;r<this._impl.zapcode_tracker_anchor_count(t);r++)a.sendMessage(25,(a=>{a.type(e),a.int(r),a.matrix4x4(this._impl.zapcode_tracker_anchor_pose_raw(t,r))}))}}for(let[e,t]of this._world_tracker_by_instance){let r=this._pipeline_id_by_world_tracker_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);if(a){a.sendMessage(42,(r=>{r.type(e),r.int(this._impl.world_tracker_quality(t))})),a.sendMessage(27,(r=>{r.type(e),r.int(this._impl.world_tracker_plane_anchor_count(t))}));for(let r=0;r<this._impl.world_tracker_plane_anchor_count(t);r++)a.sendMessage(35,(a=>{a.type(e),a.int(r),a.string(this._impl.world_tracker_plane_anchor_id(t,r))}));for(let r=0;r<this._impl.world_tracker_plane_anchor_count(t);r++)a.sendMessage(28,(a=>{a.type(e),a.int(r),a.matrix4x4(this._impl.world_tracker_plane_anchor_pose_raw(t,r))}));for(let r=0;r<this._impl.world_tracker_plane_anchor_count(t);r++)a.sendMessage(30,(a=>{a.type(e),a.int(r),a.anchorStatus(this._impl.world_tracker_plane_anchor_status(t,r))}));for(let r=0;r<this._impl.world_tracker_plane_anchor_count(t);r++)a.sendMessage(31,(a=>{a.type(e),a.int(r),a.int(this._impl.world_tracker_plane_anchor_polygon_data_size(t,r))}));for(let r=0;r<this._impl.world_tracker_plane_anchor_count(t);r++)a.sendMessage(32,(a=>{a.type(e),a.int(r),a.floatArray(this._impl.world_tracker_plane_anchor_polygon_data(t,r))}));for(let r=0;r<this._impl.world_tracker_plane_anchor_count(t);r++)a.sendMessage(33,(a=>{a.type(e),a.int(r),a.int(this._impl.world_tracker_plane_anchor_polygon_version(t,r))}));for(let r=0;r<this._impl.world_tracker_plane_anchor_count(t);r++)a.sendMessage(34,(a=>{a.type(e),a.int(r),a.planeOrientation(this._impl.world_tracker_plane_anchor_orientation(t,r))}));a.sendMessage(38,(r=>{r.type(e),r.anchorStatus(this._impl.world_tracker_world_anchor_status(t))})),a.sendMessage(37,(r=>{r.type(e),r.string(this._impl.world_tracker_world_anchor_id(t))})),a.sendMessage(36,(r=>{r.type(e),r.matrix4x4(this._impl.world_tracker_world_anchor_pose_raw(t))})),a.sendMessage(40,(r=>{r.type(e),r.string(this._impl.world_tracker_ground_anchor_id(t))})),a.sendMessage(41,(r=>{r.type(e),r.anchorStatus(this._impl.world_tracker_ground_anchor_status(t))})),a.sendMessage(39,(r=>{r.type(e),r.matrix4x4(this._impl.world_tracker_ground_anchor_pose_raw(t))})),a.sendMessage(45,(r=>{r.type(e),r.int(this._impl.world_tracker_tracks_data_size(t))})),a.sendMessage(44,(r=>{r.type(e),r.floatArray(this._impl.world_tracker_tracks_data(t))})),a.sendMessage(47,(r=>{r.type(e),r.int(this._impl.world_tracker_tracks_type_data_size(t))})),a.sendMessage(46,(r=>{r.type(e),r.ucharArray(this._impl.world_tracker_tracks_type_data(t))})),a.sendMessage(50,(r=>{r.type(e),r.int(this._impl.world_tracker_projections_data_size(t))})),a.sendMessage(49,(r=>{r.type(e),r.floatArray(this._impl.world_tracker_projections_data(t))}))}}for(let[e,t]of this._custom_anchor_by_instance){let r=this._pipeline_id_by_custom_anchor_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);a&&(a.sendMessage(52,(r=>{r.type(e),r.anchorStatus(this._impl.custom_anchor_status(t))})),a.sendMessage(53,(r=>{r.type(e),r.int(this._impl.custom_anchor_pose_version(t))})),a.sendMessage(51,(r=>{r.type(e),r.matrix4x4(this._impl.custom_anchor_pose_raw(t))})))}}}class s{constructor(){this._funcs=[]}bind(e){this._funcs.push(e)}unbind(e){let t=this._funcs.indexOf(e);t>-1&&this._funcs.splice(t,1)}emit(){for(var e=0,t=this._funcs.length;e<t;e++)this._funcs[e]()}}class o{constructor(){this._funcs=[]}bind(e){this._funcs.push(e)}unbind(e){let t=this._funcs.indexOf(e);t>-1&&this._funcs.splice(t,1)}emit(e){for(var t=0,r=this._funcs.length;t<r;t++)this._funcs[t](e)}}var c,l,p,u,f,d,h,m,b,w,y,g=r(975);!function(e){e[e.UNKNOWN=131072]="UNKNOWN",e[e.AZTEC=1]="AZTEC",e[e.CODABAR=2]="CODABAR",e[e.CODE_39=4]="CODE_39",e[e.CODE_93=8]="CODE_93",e[e.CODE_128=16]="CODE_128",e[e.DATA_MATRIX=32]="DATA_MATRIX",e[e.EAN_8=64]="EAN_8",e[e.EAN_13=128]="EAN_13",e[e.ITF=256]="ITF",e[e.MAXICODE=512]="MAXICODE",e[e.PDF_417=1024]="PDF_417",e[e.QR_CODE=2048]="QR_CODE",e[e.RSS_14=4096]="RSS_14",e[e.RSS_EXPANDED=8192]="RSS_EXPANDED",e[e.UPC_A=16384]="UPC_A",e[e.UPC_E=32768]="UPC_E",e[e.UPC_EAN_EXTENSION=65536]="UPC_EAN_EXTENSION",e[e.ALL=131071]="ALL"}(c||(c={})),function(e){e[e.EYE_LEFT=0]="EYE_LEFT",e[e.EYE_RIGHT=1]="EYE_RIGHT",e[e.EAR_LEFT=2]="EAR_LEFT",e[e.EAR_RIGHT=3]="EAR_RIGHT",e[e.NOSE_BRIDGE=4]="NOSE_BRIDGE",e[e.NOSE_TIP=5]="NOSE_TIP",e[e.NOSE_BASE=6]="NOSE_BASE",e[e.LIP_TOP=7]="LIP_TOP",e[e.LIP_BOTTOM=8]="LIP_BOTTOM",e[e.MOUTH_CENTER=9]="MOUTH_CENTER",e[e.CHIN=10]="CHIN",e[e.EYEBROW_LEFT=11]="EYEBROW_LEFT",e[e.EYEBROW_RIGHT=12]="EYEBROW_RIGHT"}(l||(l={})),function(e){e[e.WORLD=3]="WORLD",e[e.MINUS_Z_AWAY_FROM_USER=4]="MINUS_Z_AWAY_FROM_USER",e[e.MINUS_Z_HEADING=5]="MINUS_Z_HEADING",e[e.UNCHANGED=6]="UNCHANGED"}(p||(p={})),function(e){e[e.UNCHANGED=0]="UNCHANGED",e[e.WORLD=1]="WORLD",e[e.PARENT=2]="PARENT",e[e.Z_TOWARDS_CAMERA=3]="Z_TOWARDS_CAMERA"}(u||(u={})),function(e){e[e.LOG_LEVEL_NONE=0]="LOG_LEVEL_NONE",e[e.LOG_LEVEL_ERROR=1]="LOG_LEVEL_ERROR",e[e.LOG_LEVEL_WARNING=2]="LOG_LEVEL_WARNING",e[e.LOG_LEVEL_VERBOSE=3]="LOG_LEVEL_VERBOSE"}(f||(f={})),function(e){e[e.FRAME_PIXEL_FORMAT_I420=0]="FRAME_PIXEL_FORMAT_I420",e[e.FRAME_PIXEL_FORMAT_I420A=1]="FRAME_PIXEL_FORMAT_I420A",e[e.FRAME_PIXEL_FORMAT_I422=2]="FRAME_PIXEL_FORMAT_I422",e[e.FRAME_PIXEL_FORMAT_I444=3]="FRAME_PIXEL_FORMAT_I444",e[e.FRAME_PIXEL_FORMAT_NV12=4]="FRAME_PIXEL_FORMAT_NV12",e[e.FRAME_PIXEL_FORMAT_RGBA=5]="FRAME_PIXEL_FORMAT_RGBA",e[e.FRAME_PIXEL_FORMAT_BGRA=6]="FRAME_PIXEL_FORMAT_BGRA",e[e.FRAME_PIXEL_FORMAT_Y=7]="FRAME_PIXEL_FORMAT_Y"}(d||(d={})),function(e){e[e.IMAGE_TRACKER_TYPE_PLANAR=0]="IMAGE_TRACKER_TYPE_PLANAR",e[e.IMAGE_TRACKER_TYPE_CYLINDRICAL=1]="IMAGE_TRACKER_TYPE_CYLINDRICAL",e[e.IMAGE_TRACKER_TYPE_CONICAL=2]="IMAGE_TRACKER_TYPE_CONICAL"}(h||(h={})),function(e){e[e.WORLD_TRACKER_QUALITY_INITIALIZING=0]="WORLD_TRACKER_QUALITY_INITIALIZING",e[e.WORLD_TRACKER_QUALITY_GOOD=1]="WORLD_TRACKER_QUALITY_GOOD",e[e.WORLD_TRACKER_QUALITY_LIMITED=2]="WORLD_TRACKER_QUALITY_LIMITED"}(m||(m={})),function(e){e[e.ANCHOR_STATUS_INITIALIZING=0]="ANCHOR_STATUS_INITIALIZING",e[e.ANCHOR_STATUS_TRACKING=1]="ANCHOR_STATUS_TRACKING",e[e.ANCHOR_STATUS_PAUSED=2]="ANCHOR_STATUS_PAUSED",e[e.ANCHOR_STATUS_STOPPED=3]="ANCHOR_STATUS_STOPPED"}(b||(b={})),function(e){e[e.PLANE_ORIENTATION_HORIZONTAL=0]="PLANE_ORIENTATION_HORIZONTAL",e[e.PLANE_ORIENTATION_VERTICAL=1]="PLANE_ORIENTATION_VERTICAL"}(w||(w={})),function(e){e[e.DEFAULT=0]="DEFAULT",e[e.HIGH=1]="HIGH"}(y||(y={}));const A=new Map;class E{constructor(e){this._gl=e,this._viewports=[],this._underlyingViewport=this._gl.viewport,this._viewports.push(this._gl.getParameter(this._gl.VIEWPORT)),this._gl.viewport=(e,t,r,a)=>{this._viewports[this._viewports.length-1]=[e,t,r,a],this._underlyingViewport.call(this._gl,e,t,r,a)}}static get(e){let t=A.get(e);return t||(t=new E(e),A.set(e,t)),t}push(){this._viewports.push(this._viewports[this._viewports.length-1])}pop(){const e=this._viewports.pop(),t=this._viewports[this._viewports.length-1];e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]||this._underlyingViewport.call(this._gl,t[0],t[1],t[2],t[3])}}var T=r(238);new TextDecoder;const k=new Uint8Array([90,80,82,77]),R=new Uint16Array(k.buffer),v=new Uint32Array(k.buffer)[0],x=new Uint32Array(1),L=new Uint16Array(x.buffer);const I=/^zprreply:(\d{1,12}):(?:0:|(1):(?:(\d{1,12}):|$))/;var O;!function(e){e[e.OBJECT_URL=0]="OBJECT_URL",e[e.SRC_OBJECT=1]="SRC_OBJECT"}(O||(O={}));let F={deviceMotionMutliplier:-1,blacklisted:!1,showGyroPermissionsWarningIfNecessary:!1,showSafariPermissionsResetIfNecessary:!1,requestHighFrameRate:!1,videoWidth:640,videoHeight:480,getDataSize:e=>e===y.HIGH?[640,480]:[320,240],videoElementInDOM:!1,preferMediaStreamTrackProcessorCamera:!class{constructor(){this._messageId=0,this._replyResolvers=new Map,this._processMessage=e=>{"string"!=typeof e.data?"object"==typeof e.data&&e.data instanceof ArrayBuffer&&this._processArrayBufferMessage(e.data):this._processStringMessage(e.data)}}static IsSupported(){return!!globalThis.zprCameraBridge}postMessage(e){return t=this,r=void 0,_=function*(){if(!this._nativePort){let e=this._initPort();yield e}let t=`zpr:${this._messageId}:${e}`,r=new Promise(((e,t)=>{this._replyResolvers.set(this._messageId,{resolve:e,reject:t})}));return this._nativePort.postMessage(t),this._messageId++,r},new((a=void 0)||(a=Promise))((function(e,i){function n(e){try{o(_.next(e))}catch(e){i(e)}}function s(e){try{o(_.throw(e))}catch(e){i(e)}}function o(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a((function(e){e(r)}))).then(n,s)}o((_=_.apply(t,r||[])).next())}));var t,r,a,_}_processStringMessage(e){if(!((t=e).length<16)&&t.charCodeAt(0)===R[0]&&t.charCodeAt(1)===R[1]){let t=function(e){return e.length<16?4294967295:(L[0]=e.charCodeAt(2),L[1]=e.charCodeAt(3),x[0])}(e),r=this._replyResolvers.get(t);if(!r)return;return this._replyResolvers.delete(t),void r.resolve(e)}var t;let r=e.match(I);if(!r)return;let a=r[0].length,_=Number.parseInt(r[1]),i=this._replyResolvers.get(_);if(!i)return;if(this._replyResolvers.delete(_),"1"!==r[2])return void i.reject(new Error(e.substring(a)));if(void 0===r[3])return void i.resolve();let n=a+Number.parseInt(r[3]);if(n==e.length)return void i.resolve(e.substring(a));let s=e.substring(a,n),o=new ArrayBuffer(2*e.length);!function(e,t){!function(e,t){const r=Math.min(t.length,e.length);let a=0;for(a=0;a+31<r;a+=32)e[a]=t.charCodeAt(a),e[a+1]=t.charCodeAt(a+1),e[a+2]=t.charCodeAt(a+2),e[a+3]=t.charCodeAt(a+3),e[a+4]=t.charCodeAt(a+4),e[a+5]=t.charCodeAt(a+5),e[a+6]=t.charCodeAt(a+6),e[a+7]=t.charCodeAt(a+7),e[a+8]=t.charCodeAt(a+8),e[a+9]=t.charCodeAt(a+9),e[a+10]=t.charCodeAt(a+10),e[a+11]=t.charCodeAt(a+11),e[a+12]=t.charCodeAt(a+12),e[a+13]=t.charCodeAt(a+13),e[a+14]=t.charCodeAt(a+14),e[a+15]=t.charCodeAt(a+15),e[a+16]=t.charCodeAt(a+16),e[a+17]=t.charCodeAt(a+17),e[a+18]=t.charCodeAt(a+18),e[a+19]=t.charCodeAt(a+19),e[a+20]=t.charCodeAt(a+20),e[a+21]=t.charCodeAt(a+21),e[a+22]=t.charCodeAt(a+22),e[a+23]=t.charCodeAt(a+23),e[a+24]=t.charCodeAt(a+24),e[a+25]=t.charCodeAt(a+25),e[a+26]=t.charCodeAt(a+26),e[a+27]=t.charCodeAt(a+27),e[a+28]=t.charCodeAt(a+28),e[a+29]=t.charCodeAt(a+29),e[a+30]=t.charCodeAt(a+30),e[a+31]=t.charCodeAt(a+31);for(;a<r;a++)e[a]=t.charCodeAt(a)}(new Uint16Array(e),t)}(o,e);let c=2*n;c=c+15>>4<<4;let l={stringData:s,arrayBuffer:o,byteDataOffset:c};i.resolve(l)}_processArrayBufferMessage(e){if(e.byteLength<32)return;let t=new Uint32Array(e,0,2);if(t[0]!==v)return;let r=t[1],a=this._replyResolvers.get(r);a&&(this._replyResolvers.delete(r),a.resolve(e))}_initPort(){return new Promise((e=>{let t=r=>{"zprCameraBridgePort"===r.data&&r.ports.length>0&&(this._nativePort=r.ports[0],window.removeEventListener("message",t),window.addEventListener("message",this._processMessage),e())};window.addEventListener("message",t);let r=window.origin||document.location.origin;window.zprCameraBridge.requestMessageChannel(r)}))}}.IsSupported(),preferImageBitmapCamera:!1,ios164CameraSelection:!1,relyOnConstraintsForCameraSelection:!1,forceWindowOrientation:!1,intervalMultiplier:1,trustSensorIntervals:!1};"undefined"!=typeof window&&(window.zeeProfile=F,window.location.href.indexOf("_mstppipeline")>=0&&(console.log("Configuring for MSTP camera pipeline (if supported)"),F.preferMediaStreamTrackProcessorCamera=!0),window.location.href.indexOf("_imagebitmappipeline")>=0&&(console.log("Configuring for ImageBitmap camera pipeline (if supported)"),F.preferImageBitmapCamera=!0));let M=new T.UAParser,C=(M.getOS().name||"unknown").toLowerCase(),z=(M.getEngine().name||"unknown").toLowerCase();function P(e){F.forceWindowOrientation=!0,F.preferMediaStreamTrackProcessorCamera=!1,F.intervalMultiplier=1e3,F.trustSensorIntervals=!0;let t=e.split(".");if(t.length>=2){const e=parseInt(t[0]),r=parseInt(t[1]);(e<11||11===e&&r<3)&&(F.blacklisted=!0),(e<12||12===e&&r<2)&&(F.videoElementInDOM=!0),(12===e&&r>=2||e>=13)&&(F.showGyroPermissionsWarningIfNecessary=!0),e>=13&&(F.showSafariPermissionsResetIfNecessary=!0),(e>=12&&r>1||e>=13)&&navigator.mediaDevices&&navigator.mediaDevices.getSupportedConstraints&&navigator.mediaDevices.getSupportedConstraints().frameRate&&(F.requestHighFrameRate=!0,e<14&&(F.videoHeight=360,F.getDataSize=e=>e===y.HIGH?[640,360]:[320,180])),16===e&&r>=4&&(F.ios164CameraSelection=!0),e>=17&&(F.relyOnConstraintsForCameraSelection=!0)}}function B(e,t,r){let a=e.createShader(t);if(!a)throw new Error("Unable to create shader");e.shaderSource(a,r),e.compileShader(a);let _=e.getShaderInfoLog(a);if(_&&_.trim().length>0)throw new Error("Shader compile error: "+_);return a}"webkit"===z&&"ios"!==C&&(F.deviceMotionMutliplier=1,"undefined"!=typeof window&&void 0!==window.orientation&&P("15.0")),"webkit"===z&&"ios"===C&&(F.deviceMotionMutliplier=1,P(M.getOS().version||"15.0"));class U{constructor(e){this._gl=e,this._isPaused=!0,this._hadFrames=!1,this._isUserFacing=!1,this._cameraToScreenRotation=0,this._isUploadFrame=!0,this._computedTransformRotation=-1,this._computedFrontCameraRotation=!1,this._cameraUvTransform=g.Ue(),this._framebufferWidth=0,this._framebufferHeight=0,this._framebufferId=null,this._renderTexture=null,this._isWebGL2=!1,this._isWebGL2=e.getParameter(e.VERSION).indexOf("WebGL 2")>=0,this._isWebGL2||(this._instancedArraysExtension=this._gl.getExtension("ANGLE_instanced_arrays"))}resetGLContext(){this._framebufferId=null,this._renderTexture=null,this._vertexBuffer=void 0,this._indexBuffer=void 0,this._greyscaleShader=void 0}destroy(){this.resetGLContext()}uploadFrame(e,t,r,a,_){let i=this._gl;const n=E.get(i);n.push();const s=i.isEnabled(i.SCISSOR_TEST),o=i.isEnabled(i.DEPTH_TEST),c=i.isEnabled(i.BLEND),l=i.isEnabled(i.CULL_FACE),p=i.isEnabled(i.STENCIL_TEST),u=i.getParameter(i.ACTIVE_TEXTURE),f=i.getParameter(i.UNPACK_FLIP_Y_WEBGL),d=i.getParameter(i.CURRENT_PROGRAM);i.activeTexture(i.TEXTURE0);const h=i.getParameter(i.TEXTURE_BINDING_2D),m=i.getParameter(i.FRAMEBUFFER_BINDING),b=i.getParameter(i.ARRAY_BUFFER_BINDING),w=i.getParameter(i.ELEMENT_ARRAY_BUFFER_BINDING);i.disable(i.SCISSOR_TEST),i.disable(i.DEPTH_TEST),i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.STENCIL_TEST),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.bindTexture(i.TEXTURE_2D,e);const y=i.RGBA,g=i.RGBA,A=i.UNSIGNED_BYTE;i.texImage2D(i.TEXTURE_2D,0,y,g,A,t);let T=0,k=0;"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement?(T=t.videoWidth,k=t.videoHeight):(T=t.width,k=t.height),k>T&&(k=[T,T=k][0]),this._updateTransforms(r,a);const[R,v]=F.getDataSize(_);let x=this._getFramebuffer(i,R/4,v),L=this._getVertexBuffer(i),I=this._getIndexBuffer(i),O=this._getGreyscaleShader(i);const M=i.getVertexAttrib(O.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_SIZE),C=i.getVertexAttrib(O.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_TYPE),z=i.getVertexAttrib(O.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_NORMALIZED),P=i.getVertexAttrib(O.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_STRIDE),B=i.getVertexAttribOffset(O.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_POINTER),U=i.getVertexAttrib(O.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_ENABLED),V=i.getVertexAttrib(O.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING),S=i.getVertexAttrib(O.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_SIZE),N=i.getVertexAttrib(O.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_TYPE),D=i.getVertexAttrib(O.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_NORMALIZED),G=i.getVertexAttrib(O.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_STRIDE),H=i.getVertexAttribOffset(O.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_POINTER),X=i.getVertexAttrib(O.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING),W=i.getVertexAttrib(O.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_ENABLED);let Y=0,j=0;this._isWebGL2?(Y=i.getVertexAttrib(O.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_DIVISOR),j=i.getVertexAttrib(O.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_DIVISOR),i.vertexAttribDivisor(O.aVertexPositionLoc,0),i.vertexAttribDivisor(O.aTextureCoordLoc,0)):this._instancedArraysExtension&&(Y=i.getVertexAttrib(O.aVertexPositionLoc,this._instancedArraysExtension.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE),j=i.getVertexAttrib(O.aTextureCoordLoc,this._instancedArraysExtension.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE),this._instancedArraysExtension.vertexAttribDivisorANGLE(O.aVertexPositionLoc,0),this._instancedArraysExtension.vertexAttribDivisorANGLE(O.aTextureCoordLoc,0)),i.bindFramebuffer(i.FRAMEBUFFER,x),i.viewport(0,0,this._framebufferWidth,this._framebufferHeight),i.clear(i.COLOR_BUFFER_BIT),i.bindBuffer(i.ARRAY_BUFFER,L),i.vertexAttribPointer(O.aVertexPositionLoc,2,i.FLOAT,!1,16,0),i.enableVertexAttribArray(O.aVertexPositionLoc),i.vertexAttribPointer(O.aTextureCoordLoc,2,i.FLOAT,!1,16,8),i.enableVertexAttribArray(O.aTextureCoordLoc),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,I),i.useProgram(O.program),i.uniform1f(O.uTexWidthLoc,R),i.uniformMatrix4fv(O.uUvTransformLoc,!1,this._cameraUvTransform),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,e),i.uniform1i(O.uSamplerLoc,0),i.drawElements(i.TRIANGLES,6,i.UNSIGNED_SHORT,0),i.bindBuffer(i.ARRAY_BUFFER,V),i.vertexAttribPointer(O.aVertexPositionLoc,M,C,z,P,B),i.bindBuffer(i.ARRAY_BUFFER,X),i.vertexAttribPointer(O.aTextureCoordLoc,S,N,D,G,H),i.bindBuffer(i.ARRAY_BUFFER,b),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,w),U||i.disableVertexAttribArray(O.aVertexPositionLoc),W||i.disableVertexAttribArray(O.aTextureCoordLoc),this._isWebGL2?(i.vertexAttribDivisor(O.aVertexPositionLoc,Y),i.vertexAttribDivisor(O.aTextureCoordLoc,j)):this._instancedArraysExtension&&(this._instancedArraysExtension.vertexAttribDivisorANGLE(O.aVertexPositionLoc,Y),this._instancedArraysExtension.vertexAttribDivisorANGLE(O.aTextureCoordLoc,j)),i.bindFramebuffer(i.FRAMEBUFFER,m),i.useProgram(d),i.bindTexture(i.TEXTURE_2D,h),i.activeTexture(u),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,f),n.pop(),c&&i.enable(i.BLEND),l&&i.enable(i.CULL_FACE),o&&i.enable(i.DEPTH_TEST),s&&i.enable(i.SCISSOR_TEST),p&&i.enable(i.STENCIL_TEST)}readFrame(e,t,r){let a=this._gl,_=new Uint8Array(t);const i=a.getParameter(a.FRAMEBUFFER_BINDING),[n,s]=F.getDataSize(r);let o=this._getFramebuffer(a,n/4,s);return a.bindFramebuffer(a.FRAMEBUFFER,o),a.readPixels(0,0,this._framebufferWidth,this._framebufferHeight,a.RGBA,a.UNSIGNED_BYTE,_),a.bindFramebuffer(a.FRAMEBUFFER,i),{uvTransform:this._cameraUvTransform,data:t,texture:e,dataWidth:n,dataHeight:s,userFacing:this._computedFrontCameraRotation}}_updateTransforms(e,t){e==this._computedTransformRotation&&t==this._computedFrontCameraRotation||(this._computedTransformRotation=e,this._computedFrontCameraRotation=t,this._cameraUvTransform=this._getCameraUvTransform())}_getCameraUvTransform(){switch(this._computedTransformRotation){case 270:return new Float32Array([0,1,0,0,-1,0,0,0,0,0,1,0,1,0,0,1]);case 180:return new Float32Array([-1,0,0,0,0,-1,0,0,0,0,1,0,1,1,0,1]);case 90:return new Float32Array([0,-1,0,0,1,0,0,0,0,0,1,0,0,1,0,1])}return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}_getFramebuffer(e,t,r){if(this._framebufferWidth===t&&this._framebufferHeight===r&&this._framebufferId)return this._framebufferId;if(this._framebufferId&&(e.deleteFramebuffer(this._framebufferId),this._framebufferId=null),this._renderTexture&&(e.deleteTexture(this._renderTexture),this._renderTexture=null),this._framebufferId=e.createFramebuffer(),!this._framebufferId)throw new Error("Unable to create framebuffer");if(e.bindFramebuffer(e.FRAMEBUFFER,this._framebufferId),this._renderTexture=e.createTexture(),!this._renderTexture)throw new Error("Unable to create render texture");e.activeTexture(e.TEXTURE0);const a=e.getParameter(e.TEXTURE_BINDING_2D);e.bindTexture(e.TEXTURE_2D,this._renderTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,r,0,e.RGBA,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameterf(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this._renderTexture,0);let _=e.checkFramebufferStatus(e.FRAMEBUFFER);if(_!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer not complete: "+_.toString());return this._framebufferWidth=t,this._framebufferHeight=r,e.bindTexture(e.TEXTURE_2D,a),e.bindFramebuffer(e.FRAMEBUFFER,null),this._framebufferId}_getVertexBuffer(e){if(this._vertexBuffer)return this._vertexBuffer;if(this._vertexBuffer=e.createBuffer(),!this._vertexBuffer)throw new Error("Unable to create vertex buffer");e.bindBuffer(e.ARRAY_BUFFER,this._vertexBuffer);let t=new Float32Array([-1,-1,0,0,-1,1,0,1,1,1,1,1,1,-1,1,0]);return e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW),this._vertexBuffer}_getIndexBuffer(e){if(this._indexBuffer)return this._indexBuffer;if(this._indexBuffer=e.createBuffer(),!this._indexBuffer)throw new Error("Unable to create index buffer");e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this._indexBuffer);let t=new Uint16Array([0,1,2,0,2,3]);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW),this._indexBuffer}_getGreyscaleShader(e){if(this._greyscaleShader)return this._greyscaleShader;let t=e.createProgram();if(!t)throw new Error("Unable to create program");let r=B(e,e.VERTEX_SHADER,G),a=B(e,e.FRAGMENT_SHADER,H);e.attachShader(t,r),e.attachShader(t,a),function(e,t){e.linkProgram(t);let r=e.getProgramInfoLog(t);if(r&&r.trim().length>0)throw new Error("Unable to link: "+r)}(e,t);let _=e.getUniformLocation(t,"uTexWidth");if(!_)throw new Error("Unable to get uniform location uTexWidth");let i=e.getUniformLocation(t,"uUvTransform");if(!i)throw new Error("Unable to get uniform location uUvTransform");let n=e.getUniformLocation(t,"uSampler");if(!n)throw new Error("Unable to get uniform location uSampler");return this._greyscaleShader={program:t,aVertexPositionLoc:e.getAttribLocation(t,"aVertexPosition"),aTextureCoordLoc:e.getAttribLocation(t,"aTextureCoord"),uTexWidthLoc:_,uUvTransformLoc:i,uSamplerLoc:n},this._greyscaleShader}}let V,S,N,D,G="\n attribute vec4 aVertexPosition;\n attribute vec2 aTextureCoord;\n\n varying highp vec2 vTextureCoord1;\n varying highp vec2 vTextureCoord2;\n varying highp vec2 vTextureCoord3;\n varying highp vec2 vTextureCoord4;\n\n uniform float uTexWidth;\n\tuniform mat4 uUvTransform;\n\n void main(void) {\n highp vec2 offset1 = vec2(1.5 / uTexWidth, 0);\n highp vec2 offset2 = vec2(0.5 / uTexWidth, 0);\n\n gl_Position = aVertexPosition;\n vTextureCoord1 = (uUvTransform * vec4(aTextureCoord - offset1, 0, 1)).xy;\n vTextureCoord2 = (uUvTransform * vec4(aTextureCoord - offset2, 0, 1)).xy;\n vTextureCoord3 = (uUvTransform * vec4(aTextureCoord + offset2, 0, 1)).xy;\n vTextureCoord4 = (uUvTransform * vec4(aTextureCoord + offset1, 0, 1)).xy;\n }\n",H="\n varying highp vec2 vTextureCoord1;\n varying highp vec2 vTextureCoord2;\n varying highp vec2 vTextureCoord3;\n varying highp vec2 vTextureCoord4;\n\n uniform sampler2D uSampler;\n\n const lowp vec3 colorWeights = vec3(77.0 / 256.0, 150.0 / 256.0, 29.0 / 256.0);\n\n void main(void) {\n lowp vec4 outpx;\n\n outpx.r = dot(colorWeights, texture2D(uSampler, vTextureCoord1).xyz);\n outpx.g = dot(colorWeights, texture2D(uSampler, vTextureCoord2).xyz);\n outpx.b = dot(colorWeights, texture2D(uSampler, vTextureCoord3).xyz);\n outpx.a = dot(colorWeights, texture2D(uSampler, vTextureCoord4).xyz);\n\n gl_FragColor = outpx;\n }\n";var X=r(604),W=function(e,t,r,a){return new(r||(r=Promise))((function(_,i){function n(e){try{o(a.next(e))}catch(e){i(e)}}function s(e){try{o(a.throw(e))}catch(e){i(e)}}function o(e){var t;e.done?_(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(n,s)}o((a=a.apply(e,t||[])).next())}))};let Y,j=new class{constructor(){this.onOutgoingMessage=new s,this.onIncomingMessage=new o,this._outgoingMessages=[]}postIncomingMessage(e){this.onIncomingMessage.emit(e)}postOutgoingMessage(e,t){this._outgoingMessages.push({msg:e,transferables:t}),this.onOutgoingMessage.emit()}getOutgoingMessages(){let e=this._outgoingMessages;return this._outgoingMessages=[],e}},Z=0,q=!1;const K=new Map,Q=new Map;function $(e,t,r){return W(this,void 0,void 0,(function*(){let _=a.Z({locateFile:(t,r)=>t.endsWith("zappar-cv.wasm")?e:r+t,instantiateWasm:(e,r)=>{const a=new WebAssembly.Instance(t,e);return r(a),a.exports},onRuntimeInitialized:()=>{let e=function(e){let t=e.cwrap("zappar_log_level","number",[]),r=e.cwrap("zappar_log_level_set",null,["number"]),a=e.cwrap("zappar_analytics_project_id_set",null,["string","string"]),_=e.cwrap("zappar_pipeline_create","number",[]),i=e.cwrap("zappar_pipeline_destroy",null,["number"]),n=e.cwrap("zappar_pipeline_camera_frame_data_raw","number",["number"]),s=e.cwrap("zappar_pipeline_camera_frame_data_raw_size","number",["number"]),o=e.cwrap("zappar_pipeline_frame_update",null,["number"]),c=e.cwrap("zappar_pipeline_frame_number","number",["number"]),l=e.cwrap("zappar_pipeline_camera_model","number",["number"]),p=e.cwrap("zappar_pipeline_camera_data_width","number",["number"]),u=e.cwrap("zappar_pipeline_camera_data_height","number",["number"]),f=e.cwrap("zappar_pipeline_camera_frame_user_data","number",["number"]),d=e.cwrap("zappar_pipeline_camera_frame_submit",null,["number","number","number","number","number","number","number","number","number","number"]),h=e.cwrap("zappar_pipeline_camera_frame_submit_raw_pointer",null,["number","number","number","number","number","number","number","number","number","number","number","number","number"]),m=e.cwrap("zappar_pipeline_camera_frame_camera_attitude","number",["number"]),b=e.cwrap("zappar_pipeline_camera_frame_device_attitude","number",["number"]),w=e.cwrap("zappar_pipeline_motion_accelerometer_submit",null,["number","number","number","number","number"]),y=e.cwrap("zappar_pipeline_motion_accelerometer_with_gravity_submit_int",null,["number","number","number","number","number","number"]),g=e.cwrap("zappar_pipeline_motion_accelerometer_without_gravity_submit_int",null,["number","number","number","number","number","number"]),A=e.cwrap("zappar_pipeline_motion_rotation_rate_submit",null,["number","number","number","number","number"]),E=e.cwrap("zappar_pipeline_motion_rotation_rate_submit_int",null,["number","number","number","number","number","number"]),T=e.cwrap("zappar_pipeline_motion_attitude_submit",null,["number","number","number","number","number"]),k=e.cwrap("zappar_pipeline_motion_attitude_submit_int",null,["number","number","number","number","number","number"]),R=e.cwrap("zappar_pipeline_motion_attitude_matrix_submit",null,["number","number"]),v=e.cwrap("zappar_camera_source_create","number",["number","string"]),x=e.cwrap("zappar_camera_source_destroy",null,["number"]),L=e.cwrap("zappar_sequence_source_create","number",["number"]),I=e.cwrap("zappar_sequence_source_destroy",null,["number"]),O=e.cwrap("zappar_image_tracker_create","number",["number"]),F=e.cwrap("zappar_image_tracker_destroy",null,["number"]),M=e.cwrap("zappar_image_tracker_target_load_from_memory",null,["number","number","number"]),C=e.cwrap("zappar_image_tracker_target_loaded_version","number",["number"]),z=e.cwrap("zappar_image_tracker_enabled","number",["number"]),P=e.cwrap("zappar_image_tracker_enabled_set",null,["number","number"]),B=e.cwrap("zappar_image_tracker_anchor_count","number",["number"]),U=e.cwrap("zappar_image_tracker_anchor_id","string",["number","number"]),V=e.cwrap("zappar_image_tracker_anchor_pose_raw","number",["number","number"]),S=e.cwrap("zappar_face_tracker_create","number",["number"]),N=e.cwrap("zappar_face_tracker_destroy",null,["number"]),D=e.cwrap("zappar_face_tracker_model_load_from_memory",null,["number","number","number"]),G=e.cwrap("zappar_face_tracker_model_loaded_version","number",["number"]),H=e.cwrap("zappar_face_tracker_enabled_set",null,["number","number"]),X=e.cwrap("zappar_face_tracker_enabled","number",["number"]),W=e.cwrap("zappar_face_tracker_max_faces_set",null,["number","number"]),Y=e.cwrap("zappar_face_tracker_max_faces","number",["number"]),j=e.cwrap("zappar_face_tracker_anchor_count","number",["number"]),Z=e.cwrap("zappar_face_tracker_anchor_id","string",["number","number"]),q=e.cwrap("zappar_face_tracker_anchor_pose_raw","number",["number","number"]),K=e.cwrap("zappar_face_tracker_anchor_identity_coefficients","number",["number","number"]),Q=e.cwrap("zappar_face_tracker_anchor_expression_coefficients","number",["number","number"]),$=e.cwrap("zappar_face_mesh_create","number",[]),J=e.cwrap("zappar_face_mesh_destroy",null,["number"]),ee=e.cwrap("zappar_face_landmark_create","number",["number"]),te=e.cwrap("zappar_face_landmark_destroy",null,["number"]),re=e.cwrap("zappar_barcode_finder_create","number",["number"]),ae=e.cwrap("zappar_barcode_finder_destroy",null,["number"]),_e=e.cwrap("zappar_barcode_finder_enabled_set",null,["number","number"]),ie=e.cwrap("zappar_barcode_finder_enabled","number",["number"]),ne=e.cwrap("zappar_barcode_finder_found_number","number",["number"]),se=e.cwrap("zappar_barcode_finder_found_text","string",["number","number"]),oe=e.cwrap("zappar_barcode_finder_found_format","number",["number","number"]),ce=e.cwrap("zappar_barcode_finder_formats","number",["number"]),le=e.cwrap("zappar_barcode_finder_formats_set",null,["number","number"]),pe=e.cwrap("zappar_instant_world_tracker_create","number",["number"]),ue=e.cwrap("zappar_instant_world_tracker_destroy",null,["number"]),fe=e.cwrap("zappar_instant_world_tracker_enabled_set",null,["number","number"]),de=e.cwrap("zappar_instant_world_tracker_enabled","number",["number"]),he=e.cwrap("zappar_instant_world_tracker_anchor_pose_raw","number",["number"]),me=e.cwrap("zappar_instant_world_tracker_anchor_pose_set_from_camera_offset_raw",null,["number","number","number","number","number"]),be=e.cwrap("zappar_zapcode_tracker_create","number",["number"]),we=e.cwrap("zappar_zapcode_tracker_destroy",null,["number"]),ye=e.cwrap("zappar_zapcode_tracker_target_load_from_memory",null,["number","number","number"]),ge=e.cwrap("zappar_zapcode_tracker_target_loaded_version","number",["number"]),Ae=e.cwrap("zappar_zapcode_tracker_enabled","number",["number"]),Ee=e.cwrap("zappar_zapcode_tracker_enabled_set",null,["number","number"]),Te=e.cwrap("zappar_zapcode_tracker_anchor_count","number",["number"]),ke=e.cwrap("zappar_zapcode_tracker_anchor_id","string",["number","number"]),Re=e.cwrap("zappar_zapcode_tracker_anchor_pose_raw","number",["number","number"]),ve=e.cwrap("zappar_world_tracker_create","number",["number"]),xe=e.cwrap("zappar_world_tracker_destroy",null,["number"]),Le=e.cwrap("zappar_world_tracker_enabled","number",["number"]),Ie=e.cwrap("zappar_world_tracker_enabled_set",null,["number","number"]),Oe=e.cwrap("zappar_world_tracker_quality","number",["number"]),Fe=e.cwrap("zappar_world_tracker_horizontal_plane_detection_enabled","number",["number"]),Me=e.cwrap("zappar_world_tracker_horizontal_plane_detection_enabled_set",null,["number","number"]),Ce=e.cwrap("zappar_world_tracker_vertical_plane_detection_enabled","number",["number"]),ze=e.cwrap("zappar_world_tracker_vertical_plane_detection_enabled_set",null,["number","number"]),Pe=e.cwrap("zappar_world_tracker_plane_anchor_count","number",["number"]),Be=e.cwrap("zappar_world_tracker_plane_anchor_id","string",["number","number"]),Ue=e.cwrap("zappar_world_tracker_plane_anchor_pose_raw","number",["number","number"]),Ve=e.cwrap("zappar_world_tracker_plane_anchor_status","number",["number","number"]),Se=e.cwrap("zappar_world_tracker_plane_anchor_polygon_data_size","number",["number","number"]),Ne=e.cwrap("zappar_world_tracker_plane_anchor_polygon_data","number",["number","number"]),De=e.cwrap("zappar_world_tracker_plane_anchor_polygon_version","number",["number","number"]),Ge=e.cwrap("zappar_world_tracker_plane_anchor_orientation","number",["number","number"]),He=e.cwrap("zappar_world_tracker_world_anchor_status","number",["number"]),Xe=e.cwrap("zappar_world_tracker_world_anchor_id","string",["number"]),We=e.cwrap("zappar_world_tracker_world_anchor_pose_raw","number",["number"]),Ye=e.cwrap("zappar_world_tracker_ground_anchor_id","string",["number"]),je=e.cwrap("zappar_world_tracker_ground_anchor_status","number",["number"]),Ze=e.cwrap("zappar_world_tracker_ground_anchor_pose_raw","number",["number"]),qe=e.cwrap("zappar_world_tracker_reset",null,["number"]),Ke=e.cwrap("zappar_world_tracker_tracks_data_enabled","number",["number"]),Qe=e.cwrap("zappar_world_tracker_tracks_data_enabled_set",null,["number","number"]),$e=e.cwrap("zappar_world_tracker_tracks_data_size","number",["number"]),Je=e.cwrap("zappar_world_tracker_tracks_data","number",["number"]),et=e.cwrap("zappar_world_tracker_tracks_type_data_size","number",["number"]),tt=e.cwrap("zappar_world_tracker_tracks_type_data","number",["number"]),rt=e.cwrap("zappar_world_tracker_projections_data_enabled","number",["number"]),at=e.cwrap("zappar_world_tracker_projections_data_enabled_set",null,["number","number"]),_t=e.cwrap("zappar_world_tracker_projections_data_size","number",["number"]),it=e.cwrap("zappar_world_tracker_projections_data","number",["number"]),nt=e.cwrap("zappar_custom_anchor_create","number",["number","number","string"]),st=e.cwrap("zappar_custom_anchor_destroy",null,["number"]),ot=e.cwrap("zappar_custom_anchor_status","number",["number"]),ct=e.cwrap("zappar_custom_anchor_pose_version","number",["number"]),lt=e.cwrap("zappar_custom_anchor_pose_raw","number",["number"]),pt=e.cwrap("zappar_custom_anchor_pose_set_from_camera_offset_raw",null,["number","number","number","number","number"]),ut=e.cwrap("zappar_custom_anchor_pose_set_from_anchor_offset",null,["number","string","number","number","number","number"]),ft=e.cwrap("zappar_custom_anchor_pose_set",null,["number","number"]),dt=e.cwrap("zappar_custom_anchor_pose_set_with_parent",null,["number","number","string"]),ht=32,mt=e._malloc(ht),bt=(e._malloc(64),new Map),wt=(t,r)=>{let a=bt.get(t);return(!a||a[0]<r)&&(a&&e._free(a[1]),a=[r,e._malloc(r)],bt.set(t,a)),a[1]};return{log_level:()=>t(),log_level_set:e=>r(e),analytics_project_id_set:(e,t)=>a(e,t),pipeline_create:()=>_(),pipeline_destroy:()=>{i()},pipeline_camera_frame_data_raw:e=>n(e),pipeline_camera_frame_data_raw_size:e=>s(e),pipeline_frame_update:e=>o(e),pipeline_frame_number:e=>c(e),pipeline_camera_model:t=>{let r=l(t),a=new Float32Array(6);return a.set(e.HEAPF32.subarray(r/4,6+r/4)),r=a,r},pipeline_camera_data_width:e=>p(e),pipeline_camera_data_height:e=>u(e),pipeline_camera_frame_user_data:e=>f(e),pipeline_camera_frame_submit:(t,r,a,_,i,n,s,o,c)=>{ht<r.byteLength&&(e._free(mt),ht=r.byteLength,mt=e._malloc(ht));let l=mt,p=r.byteLength;e.HEAPU8.set(new Uint8Array(r),mt);let u=a,f=_,h=i,m=wt(4,n.byteLength);e.HEAPF32.set(n,m/4);let b=wt(5,s.byteLength);return e.HEAPF32.set(s,b/4),d(t,l,p,u,f,h,m,b,o?1:0,c)},pipeline_camera_frame_submit_raw_pointer:(t,r,a,_,i,n,s,o,c,l,p,u,f)=>{let d=r,m=a,b=_,w=i,y=n,g=s,A=wt(6,o.byteLength);e.HEAPF32.set(o,A/4);let E=c,T=wt(8,l.byteLength);return e.HEAPF32.set(l,T/4),h(t,d,m,b,w,y,g,A,E,T,p?1:0,u,f?1:0)},pipeline_camera_frame_camera_attitude:t=>{let r=m(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},pipeline_camera_frame_device_attitude:t=>{let r=b(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},pipeline_motion_accelerometer_submit:(e,t,r,a,_)=>w(e,t,r,a,_),pipeline_motion_accelerometer_with_gravity_submit_int:(e,t,r,a,_,i)=>y(e,t,r,a,_,i),pipeline_motion_accelerometer_without_gravity_submit_int:(e,t,r,a,_,i)=>g(e,t,r,a,_,i),pipeline_motion_rotation_rate_submit:(e,t,r,a,_)=>A(e,t,r,a,_),pipeline_motion_rotation_rate_submit_int:(e,t,r,a,_,i)=>E(e,t,r,a,_,i),pipeline_motion_attitude_submit:(e,t,r,a,_)=>T(e,t,r,a,_),pipeline_motion_attitude_submit_int:(e,t,r,a,_,i)=>k(e,t,r,a,_,i),pipeline_motion_attitude_matrix_submit:(t,r)=>{let a=wt(0,r.byteLength);return e.HEAPF32.set(r,a/4),R(t,a)},camera_source_create:(e,t)=>v(e,t),camera_source_destroy:()=>{x()},sequence_source_create:e=>L(e),sequence_source_destroy:()=>{I()},image_tracker_create:e=>O(e),image_tracker_destroy:()=>{F()},image_tracker_target_load_from_memory:(t,r)=>{ht<r.byteLength&&(e._free(mt),ht=r.byteLength,mt=e._malloc(ht));let a=mt,_=r.byteLength;return e.HEAPU8.set(new Uint8Array(r),mt),M(t,a,_)},image_tracker_target_loaded_version:e=>C(e),image_tracker_enabled:e=>{let t=z(e);return t=1===t,t},image_tracker_enabled_set:(e,t)=>P(e,t?1:0),image_tracker_anchor_count:e=>B(e),image_tracker_anchor_id:(e,t)=>U(e,t),image_tracker_anchor_pose_raw:(t,r)=>{let a=V(t,r),_=new Float32Array(16);return _.set(e.HEAPF32.subarray(a/4,16+a/4)),a=_,a},face_tracker_create:e=>S(e),face_tracker_destroy:()=>{N()},face_tracker_model_load_from_memory:(t,r)=>{ht<r.byteLength&&(e._free(mt),ht=r.byteLength,mt=e._malloc(ht));let a=mt,_=r.byteLength;return e.HEAPU8.set(new Uint8Array(r),mt),D(t,a,_)},face_tracker_model_loaded_version:e=>G(e),face_tracker_enabled_set:(e,t)=>H(e,t?1:0),face_tracker_enabled:e=>{let t=X(e);return t=1===t,t},face_tracker_max_faces_set:(e,t)=>W(e,t),face_tracker_max_faces:e=>Y(e),face_tracker_anchor_count:e=>j(e),face_tracker_anchor_id:(e,t)=>Z(e,t),face_tracker_anchor_pose_raw:(t,r)=>{let a=q(t,r),_=new Float32Array(16);return _.set(e.HEAPF32.subarray(a/4,16+a/4)),a=_,a},face_tracker_anchor_identity_coefficients:(t,r)=>{let a=K(t,r),_=new Float32Array(50);return _.set(e.HEAPF32.subarray(a/4,50+a/4)),a=_,a},face_tracker_anchor_expression_coefficients:(t,r)=>{let a=Q(t,r),_=new Float32Array(29);return _.set(e.HEAPF32.subarray(a/4,29+a/4)),a=_,a},face_mesh_create:()=>$(),face_mesh_destroy:()=>{J()},face_landmark_create:e=>ee(e),face_landmark_destroy:()=>{te()},barcode_finder_create:e=>re(e),barcode_finder_destroy:()=>{ae()},barcode_finder_enabled_set:(e,t)=>_e(e,t?1:0),barcode_finder_enabled:e=>{let t=ie(e);return t=1===t,t},barcode_finder_found_number:e=>ne(e),barcode_finder_found_text:(e,t)=>se(e,t),barcode_finder_found_format:(e,t)=>oe(e,t),barcode_finder_formats:e=>ce(e),barcode_finder_formats_set:(e,t)=>le(e,t),instant_world_tracker_create:e=>pe(e),instant_world_tracker_destroy:()=>{ue()},instant_world_tracker_enabled_set:(e,t)=>fe(e,t?1:0),instant_world_tracker_enabled:e=>{let t=de(e);return t=1===t,t},instant_world_tracker_anchor_pose_raw:t=>{let r=he(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},instant_world_tracker_anchor_pose_set_from_camera_offset_raw:(e,t,r,a,_)=>me(e,t,r,a,_),zapcode_tracker_create:e=>be(e),zapcode_tracker_destroy:()=>{we()},zapcode_tracker_target_load_from_memory:(t,r)=>{ht<r.byteLength&&(e._free(mt),ht=r.byteLength,mt=e._malloc(ht));let a=mt,_=r.byteLength;return e.HEAPU8.set(new Uint8Array(r),mt),ye(t,a,_)},zapcode_tracker_target_loaded_version:e=>ge(e),zapcode_tracker_enabled:e=>{let t=Ae(e);return t=1===t,t},zapcode_tracker_enabled_set:(e,t)=>Ee(e,t?1:0),zapcode_tracker_anchor_count:e=>Te(e),zapcode_tracker_anchor_id:(e,t)=>ke(e,t),zapcode_tracker_anchor_pose_raw:(t,r)=>{let a=Re(t,r),_=new Float32Array(16);return _.set(e.HEAPF32.subarray(a/4,16+a/4)),a=_,a},world_tracker_create:e=>ve(e),world_tracker_destroy:()=>{xe()},world_tracker_enabled:e=>{let t=Le(e);return t=1===t,t},world_tracker_enabled_set:(e,t)=>Ie(e,t?1:0),world_tracker_quality:e=>Oe(e),world_tracker_horizontal_plane_detection_enabled:e=>{let t=Fe(e);return t=1===t,t},world_tracker_horizontal_plane_detection_enabled_set:(e,t)=>Me(e,t?1:0),world_tracker_vertical_plane_detection_enabled:e=>{let t=Ce(e);return t=1===t,t},world_tracker_vertical_plane_detection_enabled_set:(e,t)=>ze(e,t?1:0),world_tracker_plane_anchor_count:e=>Pe(e),world_tracker_plane_anchor_id:(e,t)=>Be(e,t),world_tracker_plane_anchor_pose_raw:(t,r)=>{let a=Ue(t,r),_=new Float32Array(16);return _.set(e.HEAPF32.subarray(a/4,16+a/4)),a=_,a},world_tracker_plane_anchor_status:(e,t)=>Ve(e,t),world_tracker_plane_anchor_polygon_data_size:(e,t)=>Se(e,t),world_tracker_plane_anchor_polygon_data:(t,r)=>{let a=Ne(t,r),_=Se(t,r),i=new Float32Array(_);return i.set(e.HEAPF32.subarray(a/4,_+a/4)),a=i,a},world_tracker_plane_anchor_polygon_version:(e,t)=>De(e,t),world_tracker_plane_anchor_orientation:(e,t)=>Ge(e,t),world_tracker_world_anchor_status:e=>He(e),world_tracker_world_anchor_id:e=>Xe(e),world_tracker_world_anchor_pose_raw:t=>{let r=We(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},world_tracker_ground_anchor_id:e=>Ye(e),world_tracker_ground_anchor_status:e=>je(e),world_tracker_ground_anchor_pose_raw:t=>{let r=Ze(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},world_tracker_reset:e=>qe(e),world_tracker_tracks_data_enabled:e=>{let t=Ke(e);return t=1===t,t},world_tracker_tracks_data_enabled_set:(e,t)=>Qe(e,t?1:0),world_tracker_tracks_data_size:e=>$e(e),world_tracker_tracks_data:t=>{let r=Je(t),a=$e(t),_=new Float32Array(a);return _.set(e.HEAPF32.subarray(r/4,a+r/4)),r=_,r},world_tracker_tracks_type_data_size:e=>et(e),world_tracker_tracks_type_data:t=>{let r=tt(t),a=et(t),_=new Uint8Array(a);return _.set(e.HEAPU8.subarray(r,a+r)),r=_,r},world_tracker_projections_data_enabled:e=>{let t=rt(e);return t=1===t,t},world_tracker_projections_data_enabled_set:(e,t)=>at(e,t?1:0),world_tracker_projections_data_size:e=>_t(e),world_tracker_projections_data:t=>{let r=it(t),a=_t(t),_=new Float32Array(a);return _.set(e.HEAPF32.subarray(r/4,a+r/4)),r=_,r},custom_anchor_create:(e,t,r)=>nt(e,t,r),custom_anchor_destroy:()=>{st()},custom_anchor_status:e=>ot(e),custom_anchor_pose_version:e=>ct(e),custom_anchor_pose_raw:t=>{let r=lt(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},custom_anchor_pose_set_from_camera_offset_raw:(e,t,r,a,_)=>pt(e,t,r,a,_),custom_anchor_pose_set_from_anchor_offset:(e,t,r,a,_,i)=>ut(e,t,r,a,_,i),custom_anchor_pose_set:(t,r)=>{let a=wt(0,r.byteLength);return e.HEAPF32.set(r,a/4),ft(t,a)},custom_anchor_pose_set_with_parent:(t,r,a)=>{let _=wt(0,r.byteLength);return e.HEAPF32.set(r,_/4),dt(t,_,a)}}}(_);const t=(0,X.g)(_),a=r>0?function(e){return{data_download_clear:e.cwrap("data_download_clear",null,[]),data_download_size:e.cwrap("data_download_size","number",[]),data_download:e.cwrap("data_download","number",[]),data_should_record_set:e.cwrap("data_should_record_set",null,["number"])}}(_):void 0;null==a||a.data_should_record_set(r);let i=new n(e,((e,t)=>{j.postOutgoingMessage({p:e,t:"zappar",d:t},[t])}));j.postOutgoingMessage("loaded",[]),j.onIncomingMessage.bind((r=>{var n,s,o;switch(r.t){case"zappar":i.processBuffer(r.d),j.postOutgoingMessage({t:"buf",d:r.d},[r.d]);break;case"buf":null===(n=i.serializersByPipelineId.get(r.p))||void 0===n||n.bufferReturn(r.d);break;case"cameraFrameC2S":{let n,s=r,o=i._pipeline_by_instance.get(s.p);o&&(e.pipeline_camera_frame_submit(o,s.d,s.width,s.height,s.token,s.c2d,s.cm,s.userFacing,s.captureTime),e.pipeline_frame_update(o),n=e.pipeline_camera_frame_device_attitude(o),i.exploreState(),oe(_,t),a&&ce(_,a));let c={token:s.token,d:s.d,p:s.p,t:"cameraFrameRecycleS2C",att:n};j.postOutgoingMessage(c,[s.d]);break}case"rawenabled":q=r.v;break;case"rawrequest":{const e=r,t=K.get(e.p),a={t:"raw",token:e.token,p:e.p,data:t&&null!==(o=null===(s=t.ready.find((t=>t.token===e.token)))||void 0===s?void 0:s.data)&&void 0!==o?o:null};j.postOutgoingMessage(a,[]);break}case"cameraProfileC2S":{let e=r;Q.set(e.source,e.p);break}case"streamC2S":{let n=r;(function(e,t,r,a,_,i,n,s,o){return W(this,void 0,void 0,(function*(){for(;;){let c;try{c=yield r.getReader()}catch(e){yield ne(1e3);continue}try{return void(yield ie(e,t,c,a,_,i,n,s,o))}catch(e){}return void(yield ne(1e3))}}))})(_,e,n.s,n.p,n.userFacing,i,n.source,t,a).then((()=>{let e={t:"streamEndedS2C",p:n.p,source:n.source};j.postOutgoingMessage(e,[])})).catch((e=>{}));break}case"cameraToScreenC2S":Z=r.r;break;case"imageBitmapC2S":!function(e,t,r,a){const[_,i]=function(){if(!N||!D){const e=new OffscreenCanvas(1,1);if(D=e.getContext("webgl"),!D)throw new Error("Unable to get offscreen GL context");N=new U(D)}return[N,D]}();if(S||(S=i.createTexture(),i.bindTexture(i.TEXTURE_2D,S),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR)),!S)return;const[n,s]=F.getDataSize(e.cp);(!V||V.byteLength<n*s)&&(V=new ArrayBuffer(n*s)),_.uploadFrame(S,e.i,e.r,e.userFacing,e.cp);let o=_.readFrame(S,V,e.cp),c={t:"imageBitmapS2C",dataWidth:o.dataWidth,dataHeight:o.dataHeight,frame:e.i,userFacing:o.userFacing,uvTransform:o.uvTransform||g.Ue(),tokenId:e.tokenId,p:e.p};a.postOutgoingMessage(c,[e.i]);let l=r._pipeline_by_instance.get(e.p);l&&(t.pipeline_camera_frame_submit(l,V,o.dataWidth,o.dataHeight,e.tokenId,e.cameraToDevice,e.cameraModel,o.userFacing,performance.now()),t.pipeline_frame_update(l),r.exploreState())}(r,e,i,j);break;case"sensorDataC2S":{const t=r,a=i._pipeline_by_instance.get(t.p);if(!a)break;switch(t.sensor){case"accel":e.pipeline_motion_accelerometer_submit(a,t.timestamp,t.x,t.y,t.z);break;case"accel_w_gravity_int":e.pipeline_motion_accelerometer_with_gravity_submit_int(a,t.timestamp,t.interval,t.x,t.y,t.z);break;case"accel_wo_gravity_int":e.pipeline_motion_accelerometer_without_gravity_submit_int(a,t.timestamp,t.interval,t.x,t.y,t.z);break;case"attitude_int":e.pipeline_motion_attitude_submit_int(a,t.timestamp,t.interval,t.x,t.y,t.z);break;case"attitude":e.pipeline_motion_attitude_submit(a,t.timestamp,t.x,t.y,t.z);break;case"rotation_rate_int":e.pipeline_motion_rotation_rate_submit_int(a,t.timestamp,t.interval,t.x,t.y,t.z);break;case"rotation_rate":e.pipeline_motion_rotation_rate_submit(a,t.timestamp,t.x,t.y,t.z)}break}case"attitudeMatrixC2S":{const t=r,a=i._pipeline_by_instance.get(t.p);if(!a)break;e.pipeline_motion_attitude_matrix_submit(a,t.m);break}}}))}})}))}let J=0,ee=0,te=1;function re(e){return new Promise(((t,r)=>{const a=setTimeout((()=>{r("Frame timeout")}),2e3);e.read().then((e=>{clearTimeout(a),t(e)}))}))}const ae=g.Ue(),_e=new Float32Array([300,300,160,120,0,0]);function ie(e,t,r,a,_,i,n,s,o){var c,l;return W(this,void 0,void 0,(function*(){for(;;){let p=yield re(r);if(p.done)return void(null===(c=p.value)||void 0===c||c.close());let u=p.value,f=u.allocationSize();f>ee&&(J>0&&e._free(J),J=e._malloc(f),ee=f),yield u.copyTo(e.HEAPU8.subarray(J,J+ee));let d=te;te++;const h=u.visibleRect.width,m=u.visibleRect.height;let b,w=h,A=m;switch(Z){case 270:b=new Float32Array([0,1,0,0,-1,0,0,0,0,0,1,0,1,0,0,1]),w=m,A=h;break;case 180:b=new Float32Array([-1,0,0,0,0,-1,0,0,0,0,1,0,1,1,0,1]);break;case 90:b=new Float32Array([0,-1,0,0,1,0,0,0,0,0,1,0,0,1,0,1]),w=m,A=h;break;default:b=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}let E=!1;Q.get(n)!==y.HIGH&&(w/=2,A/=2,E=!0);let T=u.clone();_?g.xJ(ae,[-1,1,-1]):g.yR(ae);let k=(_?300:240)*w/320;_e[0]=k,_e[1]=k,_e[2]=.5*w,_e[3]=.5*A;const R={token:d,d:T,p:a,t:"videoFrameS2C",userFacing:_,uvTransform:b,w,h:A,cameraToDevice:ae,cameraModel:_e,source:n};j.postOutgoingMessage(R,[R.d,R.uvTransform.buffer]);const v=i._pipeline_by_instance.get(a);if(v){try{t.pipeline_camera_frame_submit_raw_pointer(v,J,f,se(u.format),h,m,d,ae,Z,_e,_,1e-6*(null!==(l=u.timestamp)&&void 0!==l?l:-1),E),oe(e,s),o&&ce(e,o)}catch(e){console.log("Exception during camera processing",e)}if(t.pipeline_frame_update(v),q){let r=K.get(a);if(r||(r={available:[],ready:[]},K.set(a,r)),r.ready.length>4){const e=r.ready.splice(0,1);for(const t of e)r.available.push(new Uint8Array(t.data.data))}const _=t.pipeline_camera_frame_data_raw_size(v);let i;for(;!i||i.byteLength<_;)r.available.length<1&&r.available.push(new Uint8Array(_)),i=r.available.pop();const n=t.pipeline_camera_frame_data_raw(v);i.set(e.HEAPU8.subarray(n,n+_)),r.ready.push({token:d,data:{data:i,width:t.pipeline_camera_data_width(a),height:t.pipeline_camera_data_height(a)}})}i.exploreState()}u.close()}}))}function ne(e){return new Promise((t=>{setTimeout(t,e)}))}function se(e){switch(e){case"I420":return d.FRAME_PIXEL_FORMAT_I420;case"I420A":return d.FRAME_PIXEL_FORMAT_I420A;case"I422":return d.FRAME_PIXEL_FORMAT_I422;case"I444":return d.FRAME_PIXEL_FORMAT_I444;case"NV12":return d.FRAME_PIXEL_FORMAT_NV12;case"RGBA":case"RGBX":return d.FRAME_PIXEL_FORMAT_RGBA;case"BGRA":case"BGRX":return d.FRAME_PIXEL_FORMAT_BGRA}return d.FRAME_PIXEL_FORMAT_Y}function oe(e,t){const r=t.worker_message_send_count();if(0!==r){Y||(Y=new MessageChannel,Y.port1.start(),Y.port1.addEventListener("message",(r=>{if("msgrec"!==r.data.t)return;const a=r.data.data,_=e._malloc(a.byteLength);e.HEAPU8.set(a,_),t.worker_message_receive(r.data.reference,a.byteLength,_),e._free(_)})),j.postOutgoingMessage({t:"setupCeresWorker",port:Y.port2},[Y.port2]));for(let a=0;a<r;a++){const r=t.worker_message_send_reference(a),_=t.worker_message_send_data_size(a),i=t.worker_message_send_data(a),n=e.HEAPU8.slice(i,i+_);Y.port1.postMessage({t:"msgsend",data:n,reference:r},[n.buffer])}t.worker_message_send_clear()}}function ce(e,t){const r=t.data_download_size();if(0===r)return;const a=t.data_download(),_=e.HEAPU8.slice(a,a+r);j.postOutgoingMessage({t:"_z_datadownload",data:_},[_.buffer]),t.data_download_clear()}const le=self;j.onOutgoingMessage.bind((()=>{let e=j.getOutgoingMessages();for(let t of e)le.postMessage(t.msg,t.transferables)}));let pe=e=>{var t;e&&e.data&&"wasm"===e.data.t&&($(location.href.startsWith("blob")?e.data.url:new URL(r(751),r.b).toString(),e.data.module,null!==(t=e.data.shouldRecordData)&&void 0!==t?t:0),le.removeEventListener("message",pe))};le.addEventListener("message",pe),le.addEventListener("message",(e=>{j.postIncomingMessage(e.data)}))}},a={};function _(e){var t=a[e];if(void 0!==t)return t.exports;var i=a[e]={exports:{}};return r[e].call(i.exports,i,i.exports,_),i.exports}return _.m=r,_.x=()=>{var e=_.O(void 0,[169,867],(()=>_(287)));return _.O(e)},_.amdO={},e=[],_.O=(t,r,a,i)=>{if(!r){var n=1/0;for(l=0;l<e.length;l++){for(var[r,a,i]=e[l],s=!0,o=0;o<r.length;o++)(!1&i||n>=i)&&Object.keys(_.O).every((e=>_.O[e](r[o])))?r.splice(o--,1):(s=!1,i<n&&(n=i));if(s){e.splice(l--,1);var c=a();void 0!==c&&(t=c)}}return t}i=i||0;for(var l=e.length;l>0&&e[l-1][2]>i;l--)e[l]=e[l-1];e[l]=[r,a,i]},_.d=(e,t)=>{for(var r in t)_.o(t,r)&&!_.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},_.f={},_.e=e=>Promise.all(Object.keys(_.f).reduce(((t,r)=>(_.f[r](e,t),t)),[])),_.u=e=>e+".zappar-cv.js",_.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),_.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;_.g.importScripts&&(e=_.g.location+"");var t=_.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var a=r.length-1;a>-1&&!e;)e=r[a--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),_.p=e})(),(()=>{_.b=self.location+"";var e={287:1};_.f.i=(t,r)=>{e[t]||importScripts(_.p+_.u(t))};var t=self.webpackChunkZCV=self.webpackChunkZCV||[],r=t.push.bind(t);t.push=t=>{var[a,i,n]=t;for(var s in i)_.o(i,s)&&(_.m[s]=i[s]);for(n&&n(_);a.length;)e[a.pop()]=1;r(t)}})(),t=_.x,_.x=()=>Promise.all([_.e(169),_.e(867)]).then(t),_.x()})()));