@sketch-hq/sketch-web-renderer 7.4.1 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/module-debug-7b1d94e8.js +1 -0
- package/dist/module-debug.wasm +0 -0
- package/dist/module-release-26b5b0ef.js +1 -0
- package/dist/module-release.wasm +0 -0
- package/dist/ts/canvas-renderer/react/CanvasRendererProvider.d.ts +2 -2
- package/dist/ts/canvas-renderer/react/CanvasRendererProvider.d.ts.map +1 -1
- package/dist/ts/canvas-renderer/react/CanvasRendererReact.d.ts +1 -1
- package/dist/ts/canvas-renderer/react/CanvasRendererReact.d.ts.map +1 -1
- package/dist/ts/prototype-renderer/PrototypeRenderer.d.ts.map +1 -1
- package/dist/ts/prototype-renderer/react/PrototypeRendererProvider.d.ts +2 -2
- package/dist/ts/prototype-renderer/react/PrototypeRendererProvider.d.ts.map +1 -1
- package/dist/ts/prototype-renderer/react/PrototypeRendererReact.d.ts +1 -1
- package/dist/ts/prototype-renderer/react/PrototypeRendererReact.d.ts.map +1 -1
- package/dist/ts/prototype-renderer/react/PrototypeTestOverlay.d.ts +2 -1
- package/dist/ts/prototype-renderer/react/PrototypeTestOverlay.d.ts.map +1 -1
- package/dist/ts/types/wasm/PrototypeScreen.d.ts +5 -7
- package/dist/ts/types/wasm/PrototypeScreen.d.ts.map +1 -1
- package/package.json +14 -22
- package/dist/module-debug-d9a78344.js +0 -1
- package/dist/module-release-47be9692.js +0 -1
- package/dist/ts/utils/EventEmitter/EventEmitter.test.d.ts +0 -2
- package/dist/ts/utils/EventEmitter/EventEmitter.test.d.ts.map +0 -1
- package/dist/ts/utils/KeyboardManager/KeyboardManager.test.d.ts +0 -2
- package/dist/ts/utils/KeyboardManager/KeyboardManager.test.d.ts.map +0 -1
- package/dist/ts/utils/ListenersCollector/ListenersCollector.test.d.ts +0 -2
- package/dist/ts/utils/ListenersCollector/ListenersCollector.test.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{createContext as t,useContext as n,useRef as o,useReducer as r,useCallback as i,useMemo as a,useEffect as s,useState as u}from"react";var c=function(e,t){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},c(e,t)};function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var d=function(){return d=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},d.apply(this,arguments)};function h(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))}function p(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function v(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function g(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))}const f=["geforce 320m","geforce 8600","geforce 8600m gt","geforce 8800 gs","geforce 8800 gt","geforce 9400","geforce 9400m g","geforce 9400m","geforce 9600m gt","geforce 9600m","geforce fx go5200","geforce gt 120","geforce gt 130","geforce gt 330m","geforce gtx 285","google swiftshader","intel g41","intel g45","intel gma 4500mhd","intel gma x3100","intel hd 3000","intel q45","legacy","mali-2","mali-3","mali-4","quadro fx 1500","quadro fx 4","quadro fx 5","radeon hd 2400","radeon hd 2600","radeon hd 4670","radeon hd 4850","radeon hd 4870","radeon hd 5670","radeon hd 5750","radeon hd 6290","radeon hd 6300","radeon hd 6310","radeon hd 6320","radeon hd 6490m","radeon hd 6630m","radeon hd 6750m","radeon hd 6770m","radeon hd 6970m","sgx 543","sgx543"];function m(e){return e.toLowerCase().replace(/.*angle ?\((.+)\)(?: on vulkan [0-9.]+)?$/i,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"").replace(/(?:vulkan|opengl) \d+\.\d+(?:\.\d+)?(?: \((.*)\))?/,"$1")}const y="undefined"==typeof window,C=(()=>{if(y)return;const{userAgent:e,platform:t,maxTouchPoints:n}=window.navigator,o=/(iphone|ipod|ipad)/i.test(e),r="iPad"===t||"MacIntel"===t&&n>0&&!window.MSStream;return{isIpad:r,isMobile:/android/i.test(e)||o||r,isSafari12:/Version\/12.+Safari/.test(e)}})();class w extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const b=[],P=[];function M(e,t){if(e===t)return 0;const n=e;e.length>t.length&&(e=t,t=n);let o=e.length,r=t.length;for(;o>0&&e.charCodeAt(~-o)===t.charCodeAt(~-r);)o--,r--;let i,a=0;for(;a<o&&e.charCodeAt(a)===t.charCodeAt(a);)a++;if(o-=a,r-=a,0===o)return r;let s,u,c=0,l=0,d=0;for(;l<o;)P[l]=e.charCodeAt(a+l),b[l]=++l;for(;d<r;)for(i=t.charCodeAt(a+d),s=d++,c=d,l=0;l<o;l++)u=i===P[l]?s:s+1,s=b[l],c=b[l]=s>c?u>c?c+1:u:u>s?s+1:u;return c}function E(e){return null!=e}const L=({mobileTiers:e=[0,15,30,60],desktopTiers:t=[0,15,30,60],override:n={},glContext:o,failIfMajorPerformanceCaveat:r=!1,benchmarksURL:i="https://unpkg.com/detect-gpu@5.0.12/dist/benchmarks"}={})=>g(void 0,void 0,void 0,(function*(){const a={};if(y)return{tier:0,type:"SSR"};const{isIpad:s=!!(null==C?void 0:C.isIpad),isMobile:u=!!(null==C?void 0:C.isMobile),screenSize:c=window.screen,loadBenchmarks:l=(e=>g(void 0,void 0,void 0,(function*(){const t=yield fetch(`${i}/${e}`).then((e=>e.json()));if(parseInt(t.shift().split(".")[0],10)<4)throw new w("Detect GPU benchmark data is out of date. Please update to version 4x");return t})))}=n;let{renderer:d}=n;const h=(e,t,n,o,r)=>({device:r,fps:o,gpu:n,isMobile:u,tier:e,type:t});let p,v="";if(d)d=m(d),p=[d];else{const e=o||function(e,t=!1){const n={alpha:!1,antialias:!1,depth:!1,failIfMajorPerformanceCaveat:t,powerPreference:"high-performance",stencil:!1};e&&delete n.powerPreference;const o=window.document.createElement("canvas"),r=o.getContext("webgl",n)||o.getContext("experimental-webgl",n);return null!=r?r:void 0}(null==C?void 0:C.isSafari12,r);if(!e)return h(0,"WEBGL_UNSUPPORTED");const t=e.getExtension("WEBGL_debug_renderer_info");if(t&&(d=e.getParameter(t.UNMASKED_RENDERER_WEBGL)),!d)return h(1,"FALLBACK");v=d,d=m(d),p=function(e,t,n){return"apple gpu"===t?function(e,t,n){if(!n)return[t];const o=function(e){const t=e.createShader(35633),n=e.createShader(35632),o=e.createProgram();if(!(n&&t&&o))return;e.shaderSource(t,"\n precision highp float;\n attribute vec3 aPosition;\n varying float vvv;\n void main() {\n vvv = 0.31622776601683794;\n gl_Position = vec4(aPosition, 1.0);\n }\n "),e.shaderSource(n,"\n precision highp float;\n varying float vvv;\n void main() {\n vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * vvv;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n gl_FragColor = enc;\n }\n "),e.compileShader(t),e.compileShader(n),e.attachShader(o,t),e.attachShader(o,n),e.linkProgram(o),e.detachShader(o,t),e.detachShader(o,n),e.deleteShader(t),e.deleteShader(n),e.useProgram(o);const r=e.createBuffer();e.bindBuffer(34962,r),e.bufferData(34962,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);const i=e.getAttribLocation(o,"aPosition");e.vertexAttribPointer(i,3,5126,!1,0,0),e.enableVertexAttribArray(i),e.clearColor(1,1,1,1),e.clear(16384),e.viewport(0,0,1,1),e.drawArrays(4,0,3);const a=new Uint8Array(4);return e.readPixels(0,0,1,1,6408,5121,a),e.deleteProgram(o),e.deleteBuffer(r),a.join("")}(e),r="801621810",i="8016218135",a="80162181161",s=(null==C?void 0:C.isIpad)?[["a7",a,12],["a8",i,15],["a8x",i,15],["a9",i,15],["a9x",i,15],["a10",i,15],["a10x",i,15],["a12",r,15],["a12x",r,15],["a12z",r,15],["a14",r,15],["m1",r,15]]:[["a7",a,12],["a8",i,12],["a9",i,15],["a10",i,15],["a11",r,15],["a12",r,15],["a13",r,15],["a14",r,15]];let u;return"80162181255"===o?u=s.filter((([,,e])=>e>=14)):(u=s.filter((([,e])=>e===o)),u.length||(u=s)),u.map((([e])=>`apple ${e} gpu`))}(e,t,n):[t]}(e,d,u)}const b=(yield Promise.all(p.map((function(e){var t;return g(this,void 0,void 0,(function*(){const n=(e=>{const t=u?["adreno","apple","mali-t","mali","nvidia","powervr","samsung"]:["intel","apple","amd","radeon","nvidia","geforce"];for(const n of t)if(e.includes(n))return n})(e);if(!n)return;const o=`${u?"m":"d"}-${n}${s?"-ipad":""}.json`,r=a[o]=null!==(t=a[o])&&void 0!==t?t:l(o);let i;try{i=yield r}catch(n){if(n instanceof w)throw n;return}const d=function(e){var t;const n=(e=e.replace(/\([^)]+\)/,"")).match(/\d+/)||e.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);return null!==(t=null==n?void 0:n.join("").replace(/\W|amd/g,""))&&void 0!==t?t:""}(e);let h=i.filter((([,e])=>e===d));h.length||(h=i.filter((([t])=>t.includes(e))));const p=h.length;if(0===p)return;const v=e.split(/[.,()\[\]/\s]/g).sort().filter(((e,t,n)=>0===t||e!==n[t-1])).join(" ");let g,[f,,,,m]=p>1?h.map((e=>[e,M(v,e[2])])).sort((([,e],[,t])=>e-t))[0][0]:h[0],y=Number.MAX_VALUE;const{devicePixelRatio:C}=window,b=c.width*C*c.height*C;for(const e of m){const[t,n]=e,o=t*n,r=Math.abs(b-o);r<y&&(y=r,g=e)}if(!g)return;const[,,P,E]=g;return[y,P,f,E]}))})))).filter(E).sort((([e=Number.MAX_VALUE,t],[n=Number.MAX_VALUE,o])=>e===n?t-o:e-n));if(!b.length){const e=f.find((e=>d.includes(e)));return e?h(0,"BLOCKLISTED",e):h(1,"FALLBACK",`${d} (${v})`)}const[,P,L,R]=b[0];if(-1===P)return h(0,"BLOCKLISTED",L,P,R);const x=u?e:t;let W=0;for(let e=0;e<x.length;e++)P>=x[e]&&(W=e);return h(W,"BENCHMARK",L,P,R)}));var R,x,W=function(e){function t(n,o,r){var i=this.constructor,a=e.call(this,"(".concat(n,") ").concat(o))||this;return a.code=n,a.cause=r,a.name=t.name,Object.setPrototypeOf(a,i.prototype),a}return l(t,e),t}(Error);function S(e){return void 0!==e}!function(e){e.debug="debug",e.release="release"}(R||(R={})),function(e){e.Fit="Fit",e.FitWidth="FitWidth",e.ActualSize="ActualSize"}(x||(x={}));var I=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){var n,o;this.listeners[e]=null!==(n=this.listeners[e])&&void 0!==n?n:new Set,null===(o=this.listeners[e])||void 0===o||o.add(t)},e.prototype.off=function(e,t){var n;null===(n=this.listeners[e])||void 0===n||n.delete(t)},e.prototype.forwardEvent=function(e,t){this.on(t,(function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];e.emit.apply(e,v([t],n,!1))}))},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var o=this.listeners[e];(null==o?void 0:o.size)&&o.forEach((function(e){Promise.resolve().then((function(){e.apply(void 0,t)}))}))},e.prototype.detachAllListeners=function(){this.listeners={}},e}(),D=function(){function e(){this.removeListenerCallbacks=[]}return e.prototype.add=function(e,t,n,o){e.addEventListener(t,n,o);var r=function(){e.removeEventListener(t,n,o)};return this.removeListenerCallbacks.push(r),r},e.prototype.dispose=function(){this.removeListenerCallbacks.forEach((function(e){return e()}))},e}(),T={delayedDraw:!0,offscreenCanvas:!1,useDirtyRectsRendering:!0,safariWebGL2:!1,pageBoundariesLimit:!1},k=function(e){return parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(e)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||!1},F=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/,U=function(e){if(void 0===e&&(e=window.navigator.userAgent),e.includes("Chrome/")||e.includes("Chromium/")||e.includes("Opera/")||e.includes("Firefox/"))return null;var t=e.match(F);if(!t)return null;var n=t[1];return"Macintosh"!==n&&"iPad"!==n&&"iPhone"!==n?null:{hardware:n,version:{major:parseInt(t[4])||0,minor:parseInt(t[5])||0,patch:parseInt(t[6])||0}}};function A(e,t){var n;function o(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];clearTimeout(n),n=setTimeout((function(){e.apply(void 0,o)}),t)}return o.cancel=function(){n&&clearTimeout(n)},o}function z(e){var t,n,o,r,i,a=null!==(n=null===(t=e.touches)||void 0===t?void 0:t[0])&&void 0!==n?n:null===(o=e.changedTouches)||void 0===o?void 0:o[0];return{x:null!==(r=null==a?void 0:a.clientX)&&void 0!==r?r:e.clientX,y:null!==(i=null==a?void 0:a.clientY)&&void 0!==i?i:e.clientY}}function B(e,t,n){return Math.max(t,Math.min(n,e))}function G(){return U()&&!T.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1}function Z(e){for(var t=e.size(),n=[],o=0;o<t;++o){var r=e.get(o);if(null==r)throw Error("Error converting embind vector to array");n.push(r)}return n}function _(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function O(e){var t=e;return Object.keys(t).forEach((function(e){void 0===t[e]&&delete t[e]})),t}function N(e){return _()?{onTouchEnd:e}:{onClick:e}}var j=function(e){function t(t){var n=e.call(this)||this;return n.listenersCollector=new D,n.state={pinchToZoomLastDistance:0,lastGestureScale:1,isCtrlPressed:!1},n.handleGestureStart=function(e){e.preventDefault(),n.state.lastGestureScale=e.scale},n.handleGestureChange=function(e){e.preventDefault();var t=e.scale/n.state.lastGestureScale;n.state.lastGestureScale=e.scale;var o=n.getCorrectPointerPosition(e);n.emitZoomEvent(t,o)},n.handleGestureEnd=function(e){e.preventDefault()},n.handleTouchStart=function(e){e.preventDefault(),n.handleTouchPinchToZoomStart(e),n.emit("pointerdown",{type:"touch",position:n.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},n.handleMouseDown=function(e){e.ctrlKey||(e.preventDefault(),n.emit("pointerdown",{type:"mouse",position:n.getCorrectPointerPosition(e),button:e.button,touchesCount:0}))},n.handleTouchMove=function(e){n.handleTouchPinchToZoomChange(e),n.emit("pointermove",{type:"touch",position:n.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},n.handleMouseMove=function(e){n.updateMousePosition(e)},n.handleGlobalTouchMove=function(e){n.emit("globalpointermove",{type:"touch",position:n.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},n.handleGlobalMouseMove=function(e){n.updateGlobalMousePosition(e)},n.handleTouchPinchToZoomStart=function(e){var t;!e.touches||(null===(t=e.touches)||void 0===t?void 0:t.length)<2||(n.state.pinchToZoomLastDistance=n.calculateDistanceBetweenTouches(e.touches[0],e.touches[1]))},n.handleTouchPinchToZoomChange=function(e){var t;if(e.touches&&!((null===(t=e.touches)||void 0===t?void 0:t.length)<2)){var o=n.calculateDistanceBetweenTouches(e.touches[0],e.touches[1]),r=n.getCorrectPointerPosition(e),i=1+.004*(o-n.state.pinchToZoomLastDistance);n.state.pinchToZoomLastDistance=o,n.emitZoomEvent(i,r)}},n.handleTouchEnd=function(e){var t=n.getCorrectPointerPosition(e);n.emit("pointerup",{position:t,type:"touch",button:0,touchesCount:e.touches.length})},n.handleMouseUp=function(e){n.emit("pointerup",{type:"mouse",position:n.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},n.handleMouseWheel=function(e){e.preventDefault();var t=e.ctrlKey&&!n.state.isCtrlPressed,o=e.metaKey||t||n.state.isCtrlPressed;if(n.updateMousePosition(e),n.updateGlobalMousePosition(e),o){var r=t?-1:1,i=n.getCorrectPointerPosition(e),a=1+.005*e.deltaY*r;n.emitZoomEvent(a,i)}else n.emit("wheel",{x:-e.deltaX,y:-e.deltaY},{type:"mouse",position:n.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},n.target=t,n.targetBounds=t.getBoundingClientRect(),n.addListeners(),n}return l(t,e),t.prototype.updateTargetBounds=function(){this.targetBounds=this.target.getBoundingClientRect()},t.prototype.addListeners=function(){this.addTouchEventListeners(),this.addMouseEventListeners(),this.addKeyboardEventListeners(),this.addSafariGesturesEventListeners()},t.prototype.addKeyboardEventListeners=function(){var e=this;this.listenersCollector.add(document,"keydown",(function(t){"Control"===t.key&&(e.state.isCtrlPressed=!0)})),this.listenersCollector.add(document,"keyup",(function(t){"Control"===t.key&&(e.state.isCtrlPressed=!1)})),this.listenersCollector.add(document,"contextmenu",(function(t){t.ctrlKey&&(e.state.isCtrlPressed=!1)}))},t.prototype.addMouseEventListeners=function(){this.listenersCollector.add(this.target,"mousedown",this.handleMouseDown),this.listenersCollector.add(this.target,"mousemove",this.handleMouseMove),this.listenersCollector.add(document,"mousemove",this.handleGlobalMouseMove),this.listenersCollector.add(document,"mouseup",this.handleMouseUp),this.listenersCollector.add(this.target,"wheel",this.handleMouseWheel)},t.prototype.addTouchEventListeners=function(){this.listenersCollector.add(this.target,"touchstart",this.handleTouchStart),this.listenersCollector.add(document,"touchmove",this.handleGlobalTouchMove,{passive:!0,capture:!0}),this.listenersCollector.add(this.target,"touchmove",this.handleTouchMove,{passive:!0,capture:!0}),this.listenersCollector.add(document,"touchcancel",this.handleTouchEnd),this.listenersCollector.add(document,"touchend",this.handleTouchEnd)},t.prototype.addSafariGesturesEventListeners=function(){_()||(this.listenersCollector.add(this.target,"gesturestart",this.handleGestureStart,{capture:!0}),this.listenersCollector.add(this.target,"gesturechange",this.handleGestureChange,{capture:!0}),this.listenersCollector.add(this.target,"gestureend",this.handleGestureEnd,{capture:!0}))},t.prototype.clampPointerToTargetBounds=function(e){return{x:e.x-this.targetBounds.x,y:e.y-this.targetBounds.y}},t.prototype.getCorrectPointerPosition=function(e){var t,n={x:0,y:0};if((null===(t=e.touches)||void 0===t?void 0:t.length)>1){var o=e,r=o.touches[0],i=o.touches[1];n={x:(r.clientX+i.clientX)/2,y:(r.clientY+i.clientY)/2}}else n=z(e);return this.clampPointerToTargetBounds(n)},t.prototype.updateMousePosition=function(e){this.emit("pointermove",{type:"mouse",position:this.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},t.prototype.updateGlobalMousePosition=function(e){this.emit("globalpointermove",{type:"mouse",position:this.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},t.prototype.calculateDistanceBetweenTouches=function(e,t){return Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)},t.prototype.emitZoomEvent=function(e,t){this.emit("pinchToZoom",e,t)},t.prototype.dispose=function(){this.listenersCollector.dispose()},t}(I),H=function(e){function t(t){var n=e.call(this)||this;return n.listenersCollector=new D,n.handleKeyUp=function(e){n.emit("keyUp",e.code)},n.target=t,n.addListeners(),n}return l(t,e),t.prototype.addListeners=function(){this.listenersCollector.add(this.target,"keyup",this.handleKeyUp)},t.prototype.dispose=function(){this.listenersCollector.dispose()},t}(I),K=function(){function e(e){this.label=e,this.startTime=performance.now(),this.startTimestamp=Date.now()}return e.prototype.measure=function(){return{duration:performance.now()-this.startTime,end:Date.now(),start:this.startTimestamp,id:this.label}},e.prototype.printMeasurement=function(){var e=this.measure().duration;if(e<1e3){var t=e.toFixed(2);return"[Performance] ".concat(this.label," -> ").concat(t," ms")}var n=(e/1e3).toFixed(2);return"[Performance] ".concat(this.label," -> ").concat(n," s")},e}();function V(e){setTimeout((function(){e()}),0)}var $=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l(t,e),t.prototype.logDebug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.emit.apply(this,v(["log","debug"],e,!1))},t.prototype.logWarning=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.emit.apply(this,v(["log","warn"],e,!1))},t.prototype.logError=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.emit.apply(this,v(["log","error"],e,!1))},t}(I)),J=function(e){function t(t){var n,o=this;return(o=e.call(this)||this).listenersCollector=new D,o.size={width:0,height:0},o.pixelRatio=1,o.maxPixelRatio=2,o.handleCanvasResizeObserver=function(e){o.resizeCanvas(e[0].contentRect)},o.resizeCanvas=function(e){var t=e.width,n=e.height;window.requestAnimationFrame((function(){o.setSize(t,n),o.emit("resize",t,n,o.getDevicePixelRatio())}))},o.getCanvasCenterPoint=function(){var e=o.getBoundingClientRect();return{x:e.width/2+e.x,y:e.height/2+e.y}},o.container=t.container,o.canvas=t.canvas,o.maxPixelRatio=null!==(n=t.maxPixelRatio)&&void 0!==n?n:o.maxPixelRatio,o.canvasResizeObserver=new ResizeObserver(o.handleCanvasResizeObserver),o.canvasResizeObserver.observe(o.container),o.listenersCollector.add(window,"orientationchange",o.handleDeviceOrientationChange),o.setSize(o.container.clientWidth,o.container.clientHeight),o}return l(t,e),t.prototype.setSize=function(e,t){this.pixelRatio=this.getDevicePixelRatio(),this.canvas.style.width="".concat(e,"px"),this.canvas.style.height="".concat(t,"px"),this.size.width=e*this.pixelRatio,this.size.height=t*this.pixelRatio,this.canvas.width=this.size.width,this.canvas.height=this.size.height},t.prototype.handleDeviceOrientationChange=function(){this.resizeCanvas({width:this.container.clientWidth,height:this.container.clientHeight})},t.prototype.getDevicePixelRatio=function(){return B(window.devicePixelRatio,1,this.maxPixelRatio)},t.prototype.getBoundingClientRect=function(){return this.canvas.getBoundingClientRect()},t.prototype.dispose=function(){this.detachAllListeners(),this.canvasResizeObserver.disconnect(),this.listenersCollector.dispose()},t}(I),Y=function(){function e(e){this.settings=e}return e.prototype.isReleaseMode=function(){return this.settings.mode===R.release},e.prototype.init=function(){return h(this,void 0,void 0,(function(){var e,t,n,o,r,i=this;return p(this,(function(a){switch(a.label){case 0:return[4,this.importModule()];case 1:e=a.sent(),t=e.default,a.label=2;case 2:return a.trys.push([2,4,,5]),n=this,[4,t({FeatureFlags:this.settings.featureFlags,currentWebGLVersion:G(),bridge:this.settings.jsBridge,locateFile:function(e){return i.settings.locateFile.replace("{file}",e)}})];case 3:return n.instance=a.sent(),[3,5];case 4:throw o=a.sent(),new W("WASM_ERROR","An error occurred while trying to create the wasm module.",o);case 5:return this.pointerTypeToWASMMap={unset:this.instance.PRUserPointerType.Unset,mouse:this.instance.PRUserPointerType.Mouse,touch:this.instance.PRUserPointerType.Touch},this.prCursorTypeToCSSCursorMap=((r={})[this.instance.PRCursorType.Auto.value]="auto",r[this.instance.PRCursorType.Default.value]="default",r[this.instance.PRCursorType.Pointer.value]="pointer",r[this.instance.PRCursorType.Grab.value]="grab",r[this.instance.PRCursorType.Grabbing.value]="grabbing",r),this.prototypeResizeModeToWASMMap={Fit:this.instance.PrototypeResizeMode.Fit,FitWidth:this.instance.PrototypeResizeMode.FitWidth,ActualSize:this.instance.PrototypeResizeMode.ActualSize},[2]}}))}))},e.prototype.makeWebGLContext=function(e,t){void 0===t&&(t={});var n=d({antialias:!1,alpha:!1,stencil:!1,depth:!1,powerPreference:"high-performance",preserveDrawingBuffer:!1,desynchronized:!0},t),o=this.instance.GL.createContext(e,n);if(!o)throw new W("WEBGL_ERROR","Unable to create WebGL context. WebGL might be unsupported, disabled, or this device is not able to run WebGL correctly.");return o},e.prototype.destroyWebGLContext=function(e){var t;$.logDebug("Destroying WebGL context");var n=null===(t=this.instance)||void 0===t?void 0:t.GL.getContext(e);if(n){this.instance.GL.deleteContext(e);var o=n.GLctx.getExtension("WEBGL_lose_context");if(o)return o.loseContext(),$.logDebug("WebGL destroyed"),!0;$.logError("WEBGL_lose_context not available. Not possible to destroy WebGL context manually.")}else $.logError("WebGL context not found while trying to destroy it")},e.prototype.importModule=function(){return this.isReleaseMode()?import("./module-release-47be9692.js"):import("./module-debug-d9a78344.js")},e.prototype.mapToCSSCursor=function(e){return this.prCursorTypeToCSSCursorMap[e.value]},e.prototype.mapToPRPointerType=function(e){var t;return null!==(t=this.pointerTypeToWASMMap[e])&&void 0!==t?t:this.instance.PRUserPointerType.Unset},e.prototype.mapPointerInfo=function(e){return d(d({},e),{type:this.mapToPRPointerType(e.type)})},e.prototype.mapResizeMode=function(e){return this.prototypeResizeModeToWASMMap[e]},e}(),X=function(e){function t(t){var n=e.call(this)||this;return n.status={type:"IDLE"},n.disposed=!1,n.handleCanvasResize=function(e,t,o){var r;null===(r=n.pageCanvasWasm)||void 0===r||r.resize(e,t,o)},n.handleWebGLContextLost=function(){n.setStatus({type:"WEBGL_CONTEXT_LOST"})},n.handlePinchToZoomEvent=function(e,t){var o;null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchPinchToZoomEvent(e,t.x,t.y)},n.handleWheelEvent=function(e,t){var o;n.wasmModule&&(null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchWheelEvent(e.x,e.y,n.wasmModule.mapPointerInfo(t)))},n.handlePointerDownEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerDownEvent(n.wasmModule.mapPointerInfo(e)))},n.handlePointerMoveEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerMoveEvent(n.wasmModule.mapPointerInfo(e)))},n.handleGlobalPointerMoveEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchGlobalPointerMoveEvent(n.wasmModule.mapPointerInfo(e)))},n.handlePointerUpEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerUpEvent(n.wasmModule.mapPointerInfo(e)))},n.settings=d(d({backgroundColor:{r:1,g:1,b:1,a:1},showTilesBorders:!1,preserveDrawingBuffer:!1,panBoundariesPadding:0},O(t)),{featureFlags:d(d({},T),t.featureFlags)}),n.gestureManager=new j(n.settings.container),n.canvasManager=new J({container:n.settings.container,canvas:n.settings.canvas}),n.wasmModule=new Y({mode:n.settings.mode,locateFile:n.settings.locateFile,jsBridge:n.createJSBridge(),featureFlags:n.settings.featureFlags}),n.fetchWorker=new Worker(n.settings.locateFile.replace("{file}","fetch-worker.js")),n.settings.manualInitialization||n.init(),n}return l(t,e),t.prototype.addListeners=function(){this.canvasManager.on("resize",this.handleCanvasResize),this.gestureManager.on("wheel",this.handleWheelEvent),this.gestureManager.on("pointerup",this.handlePointerUpEvent),this.gestureManager.on("pointermove",this.handlePointerMoveEvent),this.gestureManager.on("globalpointermove",this.handleGlobalPointerMoveEvent),this.gestureManager.on("pointerdown",this.handlePointerDownEvent),this.gestureManager.on("pinchToZoom",this.handlePinchToZoomEvent),this.settings.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost)},t.prototype.collectAndEmitDeviceInfo=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return[4,L()];case 1:return e=t.sent(),this.deviceInfo=d(d({},e),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},t.prototype.init=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.traceFirstPaint=new K("FirstPaint"),this.setStatus({type:"INITIALIZING"}),this.collectAndEmitDeviceInfo(),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,this.initWasmModule()];case 2:return t.sent(),[4,this.initCanvasRendererWasm()];case 3:return t.sent(),[4,this.setFile(this.settings.filePath)];case 4:return t.sent(),[3,6];case 5:return e=t.sent(),[2,this.fail(e instanceof W?e:new W("ERROR","Unexpected exception initializing the web renderer",e))];case 6:return this.setInitialCameraState(),this.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.setInitialCameraState=function(){var e,t,n,o=void 0!==this.settings.initialZoom,r=void 0!==this.settings.initialPan;o||r?(o&&this.setZoom(this.settings.initialZoom||1),r&&this.setPan((null===(e=this.settings.initialPan)||void 0===e?void 0:e.x)||0,(null===(t=this.settings.initialPan)||void 0===t?void 0:t.y)||0,null===(n=this.settings.initialPan)||void 0===n?void 0:n.centerPointInViewport)):this.zoomToFit()},t.prototype.startRendering=function(){var e;this.traceInitialRender=new K("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),null===(e=this.pageCanvasWasm)||void 0===e||e.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){$.logDebug("[C++] ".concat(e))},logWarning:function(e){$.logWarning("[C++] ".concat(e))},logError:function(e){$.logError("[C++] ".concat(e))},emitMetric:function(t,n,o,r){e.emit("metric",{id:t,start:n,end:o,duration:r})},resolveImageUrl:function(t){return e.settings.imagesURLFormat?e.settings.imagesURLFormat.replace(":imageId",t):e.settings.imagesURLMap&&e.settings.imagesURLMap[t]?e.settings.imagesURLMap[t]:($.logWarning("Not able to resolve the url for the image with UUID: ".concat(t)),"")},resolveFragmentUrl:function(t){return e.settings.fragmentsURLFormat?e.settings.fragmentsURLFormat.replace(":fragmentId",t):e.settings.fragmentsURLMap&&e.settings.fragmentsURLMap[t]?e.settings.fragmentsURLMap[t]:($.logWarning("Not able to resolve the url for the fragment with UUID: ".concat(t)),"")},onDrawComplete:this.handleDrawComplete.bind(this),onAllImagesReady:function(){e.emit("allImagesReady")},onCameraMoveStart:function(){e.emit("cameraMoveStart")},onCameraMoveEnd:function(){e.emit("cameraMoveEnd")},onCameraZoomStart:function(){e.emit("cameraZoomStart")},onCameraZoomEnd:function(){e.emit("cameraZoomEnd")},onCameraZoomChange:function(t){e.emit("cameraZoomChange",t)},onCameraPanChange:function(){var t=e.getPan();e.emit("cameraPanChange",(null==t?void 0:t.x)||0,(null==t?void 0:t.y)||0)},onCursorChange:function(t){var n,o=null===(n=e.wasmModule)||void 0===n?void 0:n.mapToCSSCursor(t);o&&e.emit("cursorChange",o)},fetch:this.handleJSBridgeFetch.bind(this),abortFetch:this.handleJSBridgeAbortFetch.bind(this),onPrototypeStateChange:function(){},onPrototypeUnhandledPointerUp:function(){},onPrototypeSceneChange:function(){}}},t.prototype.handleJSBridgeFetch=function(e,t){var n=this,o=t.clone(),r=function(t){var i,a,s,u;if(!n.disposed&&t.data.url===e){switch(t.data.type){case"success":o.exec(new Uint8Array(t.data.buffer),200,"");break;case"error":$.logError("Error while fetching ".concat(e),t.data.error),o.exec(new Uint8Array(0),null!==(a=null===(i=t.data.error)||void 0===i?void 0:i.statusCode)&&void 0!==a?a:500,null!==(u=null===(s=t.data.error)||void 0===s?void 0:s.statusText)&&void 0!==u?u:"Unknown error")}n.fetchWorker.removeEventListener("message",r)}};this.fetchWorker.addEventListener("message",r),this.fetchWorker.postMessage({type:"fetch",url:e})},t.prototype.handleJSBridgeAbortFetch=function(e){this.fetchWorker.postMessage({type:"abort",url:e})},t.prototype.initWasmModule=function(){var e;return h(this,void 0,void 0,(function(){var t;return p(this,(function(n){switch(n.label){case 0:return this.disposed?[2]:(t=new K("WasmModuleDownload"),[4,null===(e=this.wasmModule)||void 0===e?void 0:e.init()]);case 1:return n.sent(),$.logDebug(t.printMeasurement()),this.emit("metric",t.measure()),[2]}}))}))},t.prototype.initCanvasRendererWasm=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){if(this.disposed)return[2];try{if(!this.wasmModule)throw Error("WASM module not initialized");e=G(),$.logDebug("Using WebGL ".concat(e)),this.webglCtxHandle=this.wasmModule.makeWebGLContext(this.settings.canvas,{preserveDrawingBuffer:this.settings.preserveDrawingBuffer,majorVersion:e}),this.renderTarget=this.wasmModule.instance.RenderTarget.MakeWebGL(this.webglCtxHandle,this.canvasManager.size.width,this.canvasManager.size.height,this.canvasManager.pixelRatio),this.pageCanvasWasm=new this.wasmModule.instance.CanvasRenderer(this.renderTarget,{showTilesBorders:this.settings.showTilesBorders})}catch(e){throw new W("WASM_ERROR","An error occurred while trying to create the wasm object.",e)}return this.userEventsCollectorWasm=this.pageCanvasWasm.getUserEventsCollector(),this.pageCanvasWasm.setBackgroundColor(this.settings.backgroundColor.r,this.settings.backgroundColor.g,this.settings.backgroundColor.b,this.settings.backgroundColor.a),this.pageCanvasWasm.setZoomLevels(this.settings.minimumZoomLevel,this.settings.maximumZoomLevel),this.pageCanvasWasm.setPanBoundariesPadding(this.settings.panBoundariesPadding),[2]}))}))},t.prototype.setIsCameraLocked=function(e){var t;null===(t=this.pageCanvasWasm)||void 0===t||t.setIsCameraLocked(e)},t.prototype.setBackgroundColor=function(e){var t;e.r===this.settings.backgroundColor.r&&e.g===this.settings.backgroundColor.g&&e.b===this.settings.backgroundColor.b&&e.a===this.settings.backgroundColor.a||(null===(t=this.pageCanvasWasm)||void 0===t||t.setBackgroundColor(e.r,e.g,e.b,e.a),this.settings.backgroundColor=e)},t.prototype.generateDocumentPNG=function(){var e;return h(this,void 0,void 0,(function(){return p(this,(function(t){return[2,null===(e=this.pageCanvasWasm)||void 0===e?void 0:e.generateDocumentPNG()]}))}))},t.prototype.handleDrawComplete=function(){"DRAWING_FILE"===this.status.type&&($.logDebug(this.traceInitialRender.printMeasurement()),this.emit("metric",this.traceInitialRender.measure()),$.logDebug(this.traceFirstPaint.printMeasurement()),this.emit("metric",this.traceFirstPaint.measure()),this.setStatus({type:"READY"}))},t.prototype.looseWebGLContext=function(){var e;(null===(e=this.wasmModule)||void 0===e?void 0:e.destroyWebGLContext(this.webglCtxHandle))||$.logWarning("Failed to loose WebGL context"),this.webglCtxHandle=-1},t.prototype.zoomToFit=function(){var e;null===(e=this.pageCanvasWasm)||void 0===e||e.scaleDocumentToFit()},t.prototype.setFile=function(e){return h(this,void 0,void 0,(function(){var t=this;return p(this,(function(n){return this.disposed?[2]:(this.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,o){var r;null===(r=t.pageCanvasWasm)||void 0===r||r.setFile(e,(function(e,o,r){t.setStatus({type:"FILE_READY"});var i="".concat(e,"-v").concat("7.4.1");t.emit("fileReady",t.getDocument(),i,o,r),n()}),(function(){return o(new W("FILE_ERROR","Error encountered while fetching and parsing the file"))}))}))])}))}))},t.prototype.fail=function(e){this.setStatus({type:"FAILURE",code:e.code,message:"".concat(e.toString()).concat(e.cause?"\nWrapped Error: ".concat(e.cause.toString()):"")}),$.logError(e),e.cause&&$.logError(e.cause)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&($.logDebug("Status transition ".concat(this.status.type," => ").concat(e.type)),this.status=e,this.emit("status",e))},t.prototype.getDocument=function(){if(!this.pageCanvasWasm)return{artboards:[],bounds:{x:0,y:0,width:0,height:0}};if(!this.cachedDocumentInfo||this.cachedDocumentInfo.filePath!==this.settings.filePath){var e=this.pageCanvasWasm.getPRFile();this.cachedDocumentInfo={filePath:this.settings.filePath,document:d(d({},e),{artboards:Z(e.artboards)})}}return this.cachedDocumentInfo.document},t.prototype.getArtboardAtPosition=function(e,t){if(this.pageCanvasWasm){var n=this.getDocument();if(n){for(var o=this.pageCanvasWasm.getPan(),r=this.pageCanvasWasm.getZoom(),i=(e-o.x)/r,a=(t-o.y)/r,s=0,u=n.artboards;s<u.length;s++){var c=u[s],l=c.bounds.x+c.bounds.width,d=c.bounds.y+c.bounds.height;if(i>=c.bounds.x&&a>=c.bounds.y&&i<=l&&a<=d)return c.objectId}return null}}},t.prototype.getPanAtPosition=function(e,t){var n=this.getPan(),o=Math.max(this.getZoom(),Number.EPSILON),r=e/o,i=t/o;return{x:n.x-r,y:n.y-i}},t.prototype.getStatus=function(){return this.status},t.prototype.setZoom=function(e,t){var n,o=null!=t?t:this.canvasManager.getCanvasCenterPoint();null===(n=this.pageCanvasWasm)||void 0===n||n.setZoom(e,o.x,o.y)},t.prototype.getPan=function(){var e,t,n=this.getDocument().bounds,o=null===(e=this.pageCanvasWasm)||void 0===e?void 0:e.getPan(),r=null===(t=this.pageCanvasWasm)||void 0===t?void 0:t.getZoom();return o&&r?{x:o.x/r+n.x,y:o.y/r+n.y}:{x:0,y:0}},t.prototype.getZoom=function(){var e;return(null===(e=this.pageCanvasWasm)||void 0===e?void 0:e.getZoom())||0},t.prototype.setPan=function(e,t,n){var o;void 0===n&&(n=!1);var r=e,i=t,a=this.getDocument().bounds,s=this.getZoom();if(n){var u=Math.max(2*s*this.canvasManager.pixelRatio,Number.EPSILON);r+=this.canvasManager.size.width/u,i+=this.canvasManager.size.height/u}var c=(r-a.x)*s,l=(i-a.y)*s;null===(o=this.pageCanvasWasm)||void 0===o||o.setPan(c,l)},t.prototype.disposeFetchWorker=function(){this.fetchWorker.postMessage({type:"abort-all"}),this.fetchWorker.terminate()},t.prototype.dispose=function(){var e,t,n,o;try{this.disposed=!0,this.detachAllListeners(),null===(e=this.wasmModule)||void 0===e||e.destroyWebGLContext(this.webglCtxHandle),this.canvasManager.dispose(),this.gestureManager.dispose(),null===(t=this.pageCanvasWasm)||void 0===t||t.stopRenderLoop(),null===(n=this.pageCanvasWasm)||void 0===n||n.delete(),null===(o=this.renderTarget)||void 0===o||o.delete(),this.disposeFetchWorker(),this.fetchWorker.terminate(),this.pageCanvasWasm=void 0,this.wasmModule=void 0}catch(e){this.fail(new W("ERROR","Unexpected exception while disposing the wasm object",e))}},t}(I),q=t(void 0),Q=t(void 0),ee=t(void 0),te=t(void 0),ne=t(void 0),oe=t(void 0),re=t("auto"),ie=t(void 0),ae=function(){var e=n(ie);if(void 0===e)throw Error("useInternalContext must be used within a provider");return e},se=function(e,t){switch(t.type){case"on-status":return d(d({},e),{status:t.status});case"on-file-ready":return d(d({},e),{document:t.document});case"on-zoom":return d(d({},e),{zoom:t.zoom});case"on-pan":return d(d({},e),{pan:t.pan});case"dispose":return d(d({},e),{status:{type:"DISPOSED"},zoom:null,pan:null,cursor:"auto"});case"on-camera-zoom-start":return d(d({},e),{isCameraZooming:!0});case"on-camera-zoom-end":return d(d({},e),{isCameraZooming:!1});case"on-camera-move-start":return d(d({},e),{isCameraMoving:!0});case"on-camera-move-end":return d(d({},e),{isCameraMoving:!1});case"on-cursor-change":return d(d({},e),{cursor:t.cursor});default:return e}},ue=function(t){var n=o(null),s=o(null),u=r(se,{pan:null,zoom:null,status:{type:"IDLE"},document:null,isCameraZooming:!1,isCameraMoving:!1,cursor:"auto"}),c=u[0],l=c.status,h=c.document,p=c.zoom,v=c.pan,g=c.isCameraZooming,f=c.isCameraMoving,m=c.cursor,y=u[1],C=i((function(e){return y({type:"on-zoom",zoom:e})}),[]),w=i((function(e,t){return y({type:"on-pan",pan:{x:e,y:t}})}),[]),b=i((function(e){y({type:"on-status",status:e})}),[]),P=i((function(e){y({type:"on-file-ready",document:e})}),[]),M=i((function(){return y({type:"on-camera-zoom-start"})}),[]),E=i((function(){return y({type:"on-camera-zoom-end"})}),[]),L=i((function(){return y({type:"on-camera-move-start"})}),[]),R=i((function(){return y({type:"on-camera-move-end"})}),[]),x=i((function(e){return y({type:"on-cursor-change",cursor:e})}),[]),W=i((function(){var e=n.current;e&&($.logDebug("Provider dispose"),e.off("status",b),e.off("fileReady",P),e.off("cameraZoomChange",C),e.off("cameraPanChange",w),e.off("cameraZoomStart",M),e.off("cameraZoomEnd",E),e.off("cameraMoveStart",L),e.off("cameraMoveEnd",R),e.off("cursorChange",x),e.dispose(),n.current=null,y({type:"dispose"}))}),[b,P,w,C,M,E,L,R,x]),S=i((function(e,t,o){if(""!==e&&t&&o&&s.current){$.logDebug("Provider init");var r=new X(d(d({},s.current),{filePath:e,container:o,canvas:t,manualInitialization:!0}));r.on("status",b),r.on("fileReady",P),r.on("cameraZoomChange",C),r.on("cameraPanChange",w),r.on("cameraZoomStart",M),r.on("cameraZoomEnd",E),r.on("cameraMoveStart",L),r.on("cameraMoveEnd",R),r.on("cursorChange",x),n.current=r,r.init()}}),[b,P,C,w,M,E,L,R,x]),I=i((function(e){var t;$.logDebug("Provider setSettings",e),e.backgroundColor&&(null===(t=n.current)||void 0===t||t.setBackgroundColor(e.backgroundColor)),s.current=e}),[]),D=i((function(){return n.current}),[]),T=a((function(){return{dispose:W,init:S,setSettings:I,getInstance:D,dispatch:y}}),[W,S,I,D]);return e.createElement(ie.Provider,{value:T},e.createElement(q.Provider,{value:l},e.createElement(Q.Provider,{value:h},e.createElement(ee.Provider,{value:p},e.createElement(oe.Provider,{value:v},e.createElement(te.Provider,{value:g},e.createElement(ne.Provider,{value:f},e.createElement(re.Provider,{value:m},t.children))))))))},ce=function(){var e=n(q);if(void 0===e)throw Error("useStatus must be used within a provider");return e},le=function(){var e=n(Q);if(void 0===e)throw Error("useDocument must be used within a provider");return e},de=function(){var e=n(ee);if(void 0===e)throw Error("useZoom must be used within a provider");return e},he=function(){var e=n(oe);if(void 0===e)throw Error("usePan must be used within a provider");return e},pe=function(){var e=n(re);if(void 0===e)throw Error("useCursor must be used within a provider");return e},ve=function(){var e=n(te);if(void 0===status)throw Error("useIsCameraZooming must be used within a provider");return e},ge=function(){var e=n(ne);if(void 0===status)throw Error("useIsCameraMoving must be used within a provider");return e},fe=function(){var e=(0,ae().getInstance)();return i((function(t){null==e||e.setZoom(t)}),[e])},me=function(){var e=fe(),t=de();return i((function(){var n;"number"==typeof t&&(n=t>=1?Math.round(2*t):t>.5?1:2*t,e(n))}),[e,t])},ye=function(){var e=fe(),t=de();return i((function(){"number"==typeof t&&e(t/2)}),[e,t])},Ce=function(){var e=(0,ae().getInstance)();return i((function(t){var n=t.x,o=t.y,r=t.centerPointInViewport;null==e||e.setPan(n,o,r)}),[e])},we=function(){var e=(0,ae().getInstance)();return i((function(){null==e||e.zoomToFit()}),[e])},be=function(){var e=(0,ae().getInstance)();return i((function(){null==e||e.looseWebGLContext()}),[e])},Pe=function(){var e=(0,ae().getInstance)();return i((function(){return h(void 0,void 0,void 0,(function(){return p(this,(function(t){switch(t.label){case 0:return[4,null==e?void 0:e.generateDocumentPNG()];case 1:return[2,t.sent()]}}))}))}),[e])},Me=function(){var e=(0,ae().getInstance)();return i((function(t,n){return h(void 0,void 0,void 0,(function(){return p(this,(function(o){switch(o.label){case 0:return[4,null==e?void 0:e.getArtboardAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},Ee=function(){var e=(0,ae().getInstance)();return i((function(t,n){return h(void 0,void 0,void 0,(function(){return p(this,(function(o){switch(o.label){case 0:return[4,null==e?void 0:e.getPanAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},Le=function(){var e=(0,ae().getInstance)();return i((function(t){null==e||e.setIsCameraLocked(t)}),[e])},Re=function(e,t){var n=(0,ae().getInstance)();s((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])};function xe(e){var t=o(e);t.current=e;var n=i((function(e){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];t.current.apply(t,v([e],n,!1))}),[]);s((function(){return $.on("log",n),function(){$.off("log",n)}}),[n])}var We={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},Se={position:"absolute",top:0,left:0},Ie=function(t){var n=t.filePath,r=t.locateFile,c=t.imagesURLFormat,l=t.imagesURLMap,h=t.fragmentsURLFormat,p=t.fragmentsURLMap,v=t.backgroundColor,g=t.mode,f=t.showTilesBorders,m=t.minimumZoomLevel,y=t.maximumZoomLevel,C=t.preserveDrawingBuffer,w=t.panBoundariesPadding,b=t.initialPan,P=t.initialZoom,M=t.children,E=t.containerProps,L=void 0===E?{}:E,R=t.canvasProps,x=void 0===R?{}:R,W=t.featureFlags,S=void 0===W?{}:W,I=o(null),D=o(null),T=u(!1),k=T[0],F=T[1],U=i((function(){return F(!0)}),[]),A=ae(),z=A.dispose,B=A.init,G=A.setSettings,Z=pe(),_=ce();Re("allImagesReady",U),s((function(){return $.logDebug("WebRenderer mounted"),function(){return $.logDebug("WebRenderer unmounted")}}),[]),s((function(){G({locateFile:r,imagesURLFormat:c,imagesURLMap:l,fragmentsURLFormat:h,fragmentsURLMap:p,backgroundColor:v,mode:g,showTilesBorders:f,minimumZoomLevel:m,maximumZoomLevel:y,preserveDrawingBuffer:C,panBoundariesPadding:w,initialPan:b,initialZoom:P,featureFlags:S})}),[G,r,c,l,h,p,v,g,f,m,y,C,w,b,P,S]),s((function(){if(n)return B(n,I.current,D.current),function(){z()}}),[z,B,n]);var O=a((function(){var e;return null!==(e=t.cursor)&&void 0!==e?e:Z}),[t.cursor,Z]),N=a((function(){return d(d({},We),{cursor:O})}),[O]);return e.createElement("div",d({},L,{ref:D,style:N}),n&&e.createElement("canvas",d({},x,{key:n,ref:I,"data-sketchweb-all-images-ready":k,"data-testid":"sketchweb-canvas","data-sketchweb-status":"sketchweb-status-".concat((null==_?void 0:_.type.toLowerCase())||"null"),style:Se})),"READY"===(null==_?void 0:_.type)&&M)},De=function(e){function t(t){var n=e.call(this)||this;return n.status={type:"IDLE"},n.disposed=!1,n.handleCanvasResize=function(e,t,o){var r;null===(r=n.playerWasm)||void 0===r||r.resize(e,t,o)},n.handleWebGLContextLost=function(){n.setStatus({type:"WEBGL_CONTEXT_LOST"})},n.handlePinchToZoomEvent=function(e,t){var o;null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchPinchToZoomEvent(e,t.x,t.y)},n.handleWheelEvent=function(e,t){var o;n.wasmModule&&n.userEventsCollectorWasm.dispatchWheelEvent(e.x,e.y,null===(o=n.wasmModule)||void 0===o?void 0:o.mapPointerInfo(t))},n.handlePointerDownEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchPointerDownEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.handlePointerMoveEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchPointerMoveEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.handleGlobalPointerMoveEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchGlobalPointerMoveEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.handlePointerUpEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchPointerUpEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.restartPrototype=function(e){var t;null===(t=n.playerWasm)||void 0===t||t.restartPrototype(e)},n.goBack=function(){var e;null===(e=n.playerWasm)||void 0===e||e.goBack()},n.goForwards=function(){var e;null===(e=n.playerWasm)||void 0===e||e.goForwards()},n.setResizeMode=function(e){var t;if(n.wasmModule){var o=n.wasmModule.mapResizeMode(e);null===(t=n.playerWasm)||void 0===t||t.setResizeMode(o)}},n.getScreen=function(){var e,t=null===(e=n.playerWasm)||void 0===e?void 0:e.getJSScreen();return t?d(d({},t),{hotspots:Z(t.hotspots)}):{bounds:{x:0,y:0,width:0,height:0},name:"",id:"",hotspots:[]}},n.settings=d(d({backgroundColor:{r:1,g:1,b:1,a:1},showTilesBorders:!1,preserveDrawingBuffer:!1},O(t)),{featureFlags:d(d({},T),t.featureFlags)}),n.gestureManager=new j(n.settings.container),n.canvasManager=new J({container:n.settings.container,canvas:n.settings.canvas,maxPixelRatio:3}),n.wasmModule=new Y({mode:n.settings.mode,locateFile:n.settings.locateFile,jsBridge:n.createJSBridge(),featureFlags:n.settings.featureFlags}),n.fetchWorker=new Worker(n.settings.locateFile.replace("{file}","fetch-worker.js")),n.settings.manualInitialization||n.init(),n}return l(t,e),t.prototype.addListeners=function(){this.canvasManager.on("resize",this.handleCanvasResize),this.gestureManager.on("wheel",this.handleWheelEvent),this.gestureManager.on("pointerup",this.handlePointerUpEvent),this.gestureManager.on("pointermove",this.handlePointerMoveEvent),this.gestureManager.on("globalpointermove",this.handleGlobalPointerMoveEvent),this.gestureManager.on("pointerdown",this.handlePointerDownEvent),this.gestureManager.on("pinchToZoom",this.handlePinchToZoomEvent),this.settings.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost)},t.prototype.collectAndEmitDeviceInfo=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return[4,L()];case 1:return e=t.sent(),this.deviceInfo=d(d({},e),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},t.prototype.init=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.traceFirstPaint=new K("FirstPaint"),this.setStatus({type:"INITIALIZING"}),this.collectAndEmitDeviceInfo(),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,this.initWasmModule()];case 2:return t.sent(),[4,this.initPlayerWasm()];case 3:return t.sent(),[4,this.startDownload()];case 4:return t.sent(),[3,6];case 5:return e=t.sent(),[2,this.fail(e instanceof W?e:new W("ERROR","Unexpected exception initializing the web renderer",e))];case 6:return this.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.initWasmModule=function(){var e;return h(this,void 0,void 0,(function(){var t;return p(this,(function(n){switch(n.label){case 0:return t=new K("WasmModuleDownload"),[4,null===(e=this.wasmModule)||void 0===e?void 0:e.init()];case 1:return n.sent(),t.printMeasurement(),this.emit("metric",t.measure()),[2]}}))}))},t.prototype.startDownload=function(){var e=this;return this.setStatus({type:"LOADING_FILE"}),new Promise((function(t){var n;null===(n=e.playerWasm)||void 0===n||n.startDownload((function(){t()}),(function(){console.error("Error loading file")}))}))},t.prototype.startRendering=function(){var e;this.traceInitialRender=new K("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),null===(e=this.playerWasm)||void 0===e||e.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){$.logDebug("[C++] ".concat(e))},logWarning:function(e){$.logWarning("[C++] ".concat(e))},logError:function(e){$.logError("[C++] ".concat(e))},emitMetric:function(t,n,o,r){e.emit("metric",{id:t,start:n,end:o,duration:r})},resolveImageUrl:function(t){return e.settings.imagesURLFormat?e.settings.imagesURLFormat.replace(":imageId",t):e.settings.imagesURLMap&&e.settings.imagesURLMap[t]?e.settings.imagesURLMap[t]:($.logWarning("Not able to resolve the url for the image with UUID: ".concat(t)),"")},resolveFragmentUrl:function(t){return e.settings.fragmentsURLFormat?e.settings.fragmentsURLFormat.replace(":fragmentId",t):e.settings.fragmentsURLMap&&e.settings.fragmentsURLMap[t]?e.settings.fragmentsURLMap[t]:($.logWarning("Not able to resolve the url for the fragment with UUID: ".concat(t)),"")},onDrawComplete:this.handleDrawComplete.bind(this),onAllImagesReady:function(){e.emit("allImagesReady")},onCameraMoveStart:function(){e.emit("cameraMoveStart")},onCameraMoveEnd:function(){e.emit("cameraMoveEnd")},onCameraZoomStart:function(){e.emit("cameraZoomStart")},onCameraZoomEnd:function(){e.emit("cameraZoomEnd")},onCameraZoomChange:function(t){e.emit("cameraZoomChange",t)},onCameraPanChange:function(t,n){e.emit("cameraPanChange",t,n)},onCursorChange:function(t){var n,o=null===(n=e.wasmModule)||void 0===n?void 0:n.mapToCSSCursor(t);o&&e.emit("cursorChange",o)},onPrototypeStateChange:function(t,n,o){e.emit("prototypeStateChange",{currentArtboardId:t,canGoBack:n,canGoForwards:o})},fetch:this.handleJSBridgeFetch.bind(this),abortFetch:this.handleJSBridgeAbortFetch.bind(this),onPrototypeUnhandledPointerUp:function(){e.emit("prototypeUnhandledPointerUp")},onPrototypeSceneChange:function(){e.emit("prototypeSceneChange")}}},t.prototype.handleJSBridgeFetch=function(e,t){var n=this,o=t.clone(),r=function(t){var i,a,s,u;if(!n.disposed&&t.data.url===e){switch(t.data.type){case"success":o.exec(new Uint8Array(t.data.buffer),200,"");break;case"error":$.logError("Error while fetching ".concat(e),t.data.error),o.exec(new Uint8Array(0),null!==(a=null===(i=t.data.error)||void 0===i?void 0:i.statusCode)&&void 0!==a?a:500,null!==(u=null===(s=t.data.error)||void 0===s?void 0:s.statusText)&&void 0!==u?u:"Unknown error")}n.fetchWorker.removeEventListener("message",r)}};this.fetchWorker.addEventListener("message",r),this.fetchWorker.postMessage({type:"fetch",url:e})},t.prototype.handleJSBridgeAbortFetch=function(e){this.fetchWorker.postMessage({type:"abort",url:e})},t.prototype.initPlayerWasm=function(){var e,t;return h(this,void 0,void 0,(function(){var n,o,r,i,a,s,u,c,l,h,v,g,f,m,y,C,w,b;return p(this,(function(p){try{if(!this.wasmModule)throw Error("WASM module not initialized");for(this.webglCtxHandle=this.wasmModule.makeWebGLContext(this.settings.canvas,{preserveDrawingBuffer:this.settings.preserveDrawingBuffer,majorVersion:G()}),n=this.wasmModule.instance,o=n.RenderTarget,r=n.PrototypeRenderer,i=n.PrototypeStructureArtboardVector,a=n.PrototypeStructureFlowVector,s=n.PrototypeStructureAssetVector,this.renderTarget=o.MakeWebGL(this.webglCtxHandle,this.canvasManager.size.width,this.canvasManager.size.height,this.canvasManager.pixelRatio),u={artboards:new i},c=0,l=this.settings.prototypeStructure.artboards;c<l.length;c++){for(h=l[c],v=new a,g=0,f=null!==(e=h.flows)&&void 0!==e?e:[];g<f.length;g++)m=f[g],v.push_back(m);for(y=new s,C=0,w=null!==(t=h.assets)&&void 0!==t?t:[];C<w.length;C++)b=w[C],y.push_back(b);u.artboards.push_back(d(d({},h),{flows:v,assets:y}))}this.playerWasm=new r(this.renderTarget,{showTilesBorders:this.settings.showTilesBorders},this.settings.startArtboardUUID,u,this.settings.highlightHotspots)}catch(e){throw new W("WASM_ERROR","An error occurred while trying to create the PrototypeRenderer WASM object.",e)}return this.userEventsCollectorWasm=this.playerWasm.getUserEventsCollector(),this.playerWasm.setBackgroundColor(this.settings.backgroundColor.r,this.settings.backgroundColor.g,this.settings.backgroundColor.b,this.settings.backgroundColor.a),this.playerWasm.setZoomLevels(this.settings.minimumZoomLevel,this.settings.maximumZoomLevel),this.setResizeMode(this.settings.resizeMode),[2]}))}))},t.prototype.setIsCameraLocked=function(e){var t;null===(t=this.playerWasm)||void 0===t||t.setIsCameraLocked(e)},t.prototype.setBackgroundColor=function(e){var t;e.r===this.settings.backgroundColor.r&&e.g===this.settings.backgroundColor.g&&e.b===this.settings.backgroundColor.b&&e.a===this.settings.backgroundColor.a||(null===(t=this.playerWasm)||void 0===t||t.setBackgroundColor(e.r,e.g,e.b,e.a),this.settings.backgroundColor=e)},t.prototype.handleDrawComplete=function(){"DRAWING_FILE"===this.status.type&&(this.traceInitialRender.printMeasurement(),this.emit("metric",this.traceInitialRender.measure()),this.traceFirstPaint.printMeasurement(),this.emit("metric",this.traceFirstPaint.measure()),this.setStatus({type:"READY"}))},t.prototype.looseWebGLContext=function(){var e;null===(e=this.wasmModule)||void 0===e||e.destroyWebGLContext(this.webglCtxHandle),this.webglCtxHandle=-1},t.prototype.fail=function(e){this.setStatus({type:"FAILURE",code:e.code,message:"".concat(e.toString()).concat(e.cause?"\nWrapped Error: ".concat(e.cause.toString()):"")}),$.logError(e),e.cause&&$.logError(e.cause)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&($.logDebug("Status transition ".concat(this.status.type," => ").concat(e.type)),this.status=e,this.emit("status",e))},t.prototype.getStatus=function(){return this.status},t.prototype.dispose=function(){var e,t,n;try{this.detachAllListeners(),null===(e=this.wasmModule)||void 0===e||e.destroyWebGLContext(this.webglCtxHandle),this.canvasManager.dispose(),this.gestureManager.dispose(),null===(t=this.playerWasm)||void 0===t||t.stopRenderLoop(),null===(n=this.playerWasm)||void 0===n||n.delete(),this.renderTarget.delete(),this.playerWasm=void 0,this.wasmModule=void 0,this.disposed=!0}catch(e){this.fail(new W("ERROR","Unexpected exception while disposing the WebRendererWasm object",e))}},t}(I),Te=t(void 0),ke=t("auto"),Fe=t(void 0),Ue=t(void 0),Ae=t(void 0),ze=t(void 0),Be=function(){var e=n(ze);if(void 0===e)throw Error("useInternalContext must be used within a provider");return e},Ge=function(e,t){switch(t.type){case"on-status":return d(d({},e),{status:t.status});case"dispose":return d(d({},e),{status:{type:"DISPOSED"},cursor:"auto"});case"on-cursor-change":return d(d({},e),{cursor:t.cursor});case"on-prototype-state-change":return d(d({},e),{prototypeState:d(d({},e.prototypeState),t.prototypeState)});case"on-zoom":return d(d({},e),{zoom:t.zoom});case"on-pan":return d(d({},e),{pan:{x:t.pan.x,y:t.pan.y}});default:return e}},Ze=function(t){var n=o(null),s=o(null),u=r(Ge,{status:{type:"IDLE"},cursor:"auto",prototypeState:{currentArtboardId:"",canGoBack:!1,canGoForwards:!1},zoom:1,pan:{x:0,y:0}}),c=u[0],l=c.status,h=c.cursor,p=c.prototypeState,v=c.zoom,g=c.pan,f=u[1],m=i((function(e){f({type:"on-status",status:e})}),[]),y=i((function(e){return f({type:"on-zoom",zoom:e})}),[]),C=i((function(e,t){return f({type:"on-pan",pan:{x:e,y:t}})}),[]),w=i((function(e){return f({type:"on-cursor-change",cursor:e})}),[]),b=i((function(e){return f({type:"on-prototype-state-change",prototypeState:e})}),[]),P=i((function(){var e=n.current;e&&($.logDebug("Provider dispose"),e.off("status",m),e.off("cursorChange",w),e.off("prototypeStateChange",b),e.off("cameraZoomChange",y),e.off("cameraPanChange",C),e.dispose(),n.current=null,f({type:"dispose"}))}),[m,w,b,C,y]),M=i((function(e,t){if(e&&t&&s.current){$.logDebug("Provider init");var o=new De(d(d({},s.current),{container:t,canvas:e,manualInitialization:!0}));o.on("status",m),o.on("cursorChange",w),o.on("prototypeStateChange",b),o.on("cameraZoomChange",y),o.on("cameraPanChange",C),n.current=o,o.init()}}),[m,w,b,C,y]),E=i((function(e){var t,o,r,i;$.logDebug("Provider setSettings",e),e.backgroundColor&&e.backgroundColor!=(null===(t=s.current)||void 0===t?void 0:t.backgroundColor)&&(null===(o=n.current)||void 0===o||o.setBackgroundColor(e.backgroundColor)),(null===(r=s.current)||void 0===r?void 0:r.resizeMode)!=e.resizeMode&&(null===(i=n.current)||void 0===i||i.setResizeMode(e.resizeMode)),s.current=e}),[]),L=i((function(){return n.current}),[]),R=a((function(){return{dispose:P,init:M,setSettings:E,getInstance:L,dispatch:f}}),[P,M,E,L]);return e.createElement(ze.Provider,{value:R},e.createElement(Te.Provider,{value:l},e.createElement(ke.Provider,{value:h},e.createElement(Fe.Provider,{value:p},e.createElement(Ue.Provider,{value:v},e.createElement(Ae.Provider,{value:g},t.children))))))},_e=function(){var e=(0,Be().getInstance)();return i((function(t){null==e||e.restartPrototype(t)}),[e])},Oe=function(){var e=(0,Be().getInstance)();return i((function(){null==e||e.goBack()}),[e])},Ne=function(){var e=(0,Be().getInstance)();return i((function(){null==e||e.goForwards()}),[e])},je=function(){var e=n(Te);if(void 0===e)throw Error("usePrototypeStatus must be used within a provider");return e},He=function(){var e=n(ke);if(void 0===e)throw Error("usePrototypeCursor must be used within a provider");return e},Ke=function(){var e=n(Fe);if(void 0===e)throw Error("usePrototypeState must be used within a provider");return e},Ve=function(){var e=n(Ue);if(void 0===e)throw Error("usePrototypeZoom must be used within a provider");return e},$e=function(){var e=n(Ae);if(void 0===e)throw Error("usePrototypePan must be used within a provider");return e},Je=function(e,t){var n=(0,Be().getInstance)();s((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])};function Ye(){var e=(0,Be().getInstance)();return i((function(){return null==e?void 0:e.getScreen()}),[e])}var Xe={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},qe={position:"absolute",top:0,left:0},Qe=function(t){var n=t.locateFile,r=t.imagesURLFormat,i=t.imagesURLMap,u=t.backgroundColor,c=t.mode,l=t.showTilesBorders,h=t.minimumZoomLevel,p=t.maximumZoomLevel,v=t.preserveDrawingBuffer,g=t.children,f=t.containerProps,m=void 0===f?{}:f,y=t.canvasProps,C=void 0===y?{}:y,w=t.featureFlags,b=void 0===w?{}:w,P=t.startArtboardUUID,M=t.prototypeStructure,E=t.fragmentsURLFormat,L=t.fragmentsURLMap,R=t.highlightHotspots,x=t.resizeMode,W=o(null),S=o(null),I=Be(),D=I.dispose,T=I.init,k=I.setSettings,F=He(),U=je();s((function(){k({locateFile:n,imagesURLFormat:r,imagesURLMap:i,backgroundColor:u,mode:c,showTilesBorders:l,minimumZoomLevel:h,maximumZoomLevel:p,preserveDrawingBuffer:v,featureFlags:b,startArtboardUUID:P,prototypeStructure:M,fragmentsURLFormat:E,fragmentsURLMap:L,highlightHotspots:R,resizeMode:x})}),[k,n,r,i,u,c,l,h,p,v,b,P,R,x,E,L,M]),s((function(){return T(W.current,S.current),function(){D()}}),[D,T]);var A=a((function(){return d(d({},Xe),{cursor:F})}),[F]);return e.createElement("div",d({},m,{ref:S,style:A}),e.createElement("canvas",d({},C,{ref:W,"data-testid":"prototype-canvas","data-prototype-status":"prototype-status-".concat((null==U?void 0:U.type.toLowerCase())||"null"),style:qe})),"READY"===(null==U?void 0:U.type)&&g)},et={position:"absolute",inset:0,pointerEvents:"none"};function tt(t){var n=t.visualize,o=void 0!==n&&n,r=u(null),s=r[0],c=r[1],l=Ye(),h=i((function(){c(l()||null)}),[l]);Je("prototypeSceneChange",h);var p=a((function(){return d(d({},et),{opacity:o?1:0})}),[o]);return s?e.createElement("div",{style:p},e.createElement(nt,d({},s,{type:"screen"})),s.hotspots.map((function(t,n){return e.createElement(nt,d({key:"".concat(s.id,"/").concat(n,"/").concat(t.id),type:"hotspot"},t))}))):null}function nt(t){var n=t.bounds,o=t.name,r=t.id,i=t.type,s=Ve(),u=$e()||{x:0,y:0},c=u.x,l=u.y,h=a((function(){return d({position:"absolute",left:c/window.devicePixelRatio+n.x*s,top:l/window.devicePixelRatio+n.y*s,width:n.width*s,height:n.height*s,backgroundColor:"rgba(0, 255, 255, 0.2)",border:"2px dotted white"},"hotspot"===i?{cursor:"pointer",pointerEvents:"auto"}:{})}),[n.x,n.y,n.width,n.height,c,l,s,i]);return e.createElement("div",{style:h,"data-testid":"prototype-".concat(i,"-entity"),"data-entity-name":o,"data-entity-id":r})}export{ne as CameraMoveContext,te as CameraZoomingContext,X as CanvasRenderer,ue as CanvasRendererProvider,Ie as CanvasRendererReact,re as CursorContext,T as DefaultFeatureFlags,Q as DocumentContext,I as EventEmitter,j as GestureManager,H as KeyboardManager,D as ListenersCollector,oe as PanContext,K as Performance,De as PrototypeRenderer,Ze as PrototypeRendererProvider,Qe as PrototypeRendererReact,x as PrototypeResizeMode,tt as PrototypeTestOverlay,q as StatusContext,W as WebRendererError,R as WebRendererMode,ee as ZoomContext,B as clamp,Z as convertEmbindVectorToArray,A as debounce,z as extractPointer,G as getSupportedWebGLVersion,k as getiOSVersion,S as isDefinedPresentationManifestArtboard,_ as isTouchDevice,$ as logger,V as nextTick,U as parseSafariUserAgent,se as reducer,O as removeUndefinedKeys,N as touchableClick,pe as useCursor,ye as useDecrementZoom,le as useDocument,Re as useEvent,Pe as useGenerateDocumentPNG,Me as useGetArtboardAtPosititon,Ee as useGetPanAtPosition,Ye as useGetScreen,Oe as useGoBack,Ne as useGoForwards,me as useIncrementZoom,ge as useIsCameraMoving,ve as useIsCameraZooming,Le as useLockCamera,xe as useLogEvent,be as useLooseWebGLContext,he as usePan,He as usePrototypeCursor,Je as usePrototypeEvent,$e as usePrototypePan,Ke as usePrototypeState,je as usePrototypeStatus,Ve as usePrototypeZoom,_e as useRestartPrototype,Ce as useSetPan,fe as useSetZoom,ce as useStatus,de as useZoom,we as useZoomToFit};
|
|
1
|
+
import e,{createContext as t,useContext as n,useRef as o,useReducer as r,useCallback as i,useMemo as a,useEffect as s,useState as u}from"react";var c=function(e,t){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},c(e,t)};function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var d=function(){return d=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},d.apply(this,arguments)};function h(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))}function p(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function v(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function g(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))}const f=["geforce 320m","geforce 8600","geforce 8600m gt","geforce 8800 gs","geforce 8800 gt","geforce 9400","geforce 9400m g","geforce 9400m","geforce 9600m gt","geforce 9600m","geforce fx go5200","geforce gt 120","geforce gt 130","geforce gt 330m","geforce gtx 285","google swiftshader","intel g41","intel g45","intel gma 4500mhd","intel gma x3100","intel hd 3000","intel q45","legacy","mali-2","mali-3","mali-4","quadro fx 1500","quadro fx 4","quadro fx 5","radeon hd 2400","radeon hd 2600","radeon hd 4670","radeon hd 4850","radeon hd 4870","radeon hd 5670","radeon hd 5750","radeon hd 6290","radeon hd 6300","radeon hd 6310","radeon hd 6320","radeon hd 6490m","radeon hd 6630m","radeon hd 6750m","radeon hd 6770m","radeon hd 6970m","sgx 543","sgx543"];function m(e){return e.toLowerCase().replace(/.*angle ?\((.+)\)(?: on vulkan [0-9.]+)?$/i,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"").replace(/(?:vulkan|opengl) \d+\.\d+(?:\.\d+)?(?: \((.*)\))?/,"$1")}const y="undefined"==typeof window,C=(()=>{if(y)return;const{userAgent:e,platform:t,maxTouchPoints:n}=window.navigator,o=/(iphone|ipod|ipad)/i.test(e),r="iPad"===t||"MacIntel"===t&&n>0&&!window.MSStream;return{isIpad:r,isMobile:/android/i.test(e)||o||r,isSafari12:/Version\/12.+Safari/.test(e)}})();class w extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const b=[],P=[];function M(e,t){if(e===t)return 0;const n=e;e.length>t.length&&(e=t,t=n);let o=e.length,r=t.length;for(;o>0&&e.charCodeAt(~-o)===t.charCodeAt(~-r);)o--,r--;let i,a=0;for(;a<o&&e.charCodeAt(a)===t.charCodeAt(a);)a++;if(o-=a,r-=a,0===o)return r;let s,u,c=0,l=0,d=0;for(;l<o;)P[l]=e.charCodeAt(a+l),b[l]=++l;for(;d<r;)for(i=t.charCodeAt(a+d),s=d++,c=d,l=0;l<o;l++)u=i===P[l]?s:s+1,s=b[l],c=b[l]=s>c?u>c?c+1:u:u>s?s+1:u;return c}function E(e){return null!=e}const L=({mobileTiers:e=[0,15,30,60],desktopTiers:t=[0,15,30,60],override:n={},glContext:o,failIfMajorPerformanceCaveat:r=!1,benchmarksURL:i="https://unpkg.com/detect-gpu@5.0.25/dist/benchmarks"}={})=>g(void 0,void 0,void 0,(function*(){const a={};if(y)return{tier:0,type:"SSR"};const{isIpad:s=!!(null==C?void 0:C.isIpad),isMobile:u=!!(null==C?void 0:C.isMobile),screenSize:c=window.screen,loadBenchmarks:l=(e=>g(void 0,void 0,void 0,(function*(){const t=yield fetch(`${i}/${e}`).then((e=>e.json()));if(parseInt(t.shift().split(".")[0],10)<4)throw new w("Detect GPU benchmark data is out of date. Please update to version 4x");return t})))}=n;let{renderer:d}=n;const h=(e,t,n,o,r)=>({device:r,fps:o,gpu:n,isMobile:u,tier:e,type:t});let p,v="";if(d)d=m(d),p=[d];else{const e=o||function(e,t=!1){const n={alpha:!1,antialias:!1,depth:!1,failIfMajorPerformanceCaveat:t,powerPreference:"high-performance",stencil:!1};e&&delete n.powerPreference;const o=window.document.createElement("canvas"),r=o.getContext("webgl",n)||o.getContext("experimental-webgl",n);return null!=r?r:void 0}(null==C?void 0:C.isSafari12,r);if(!e)return h(0,"WEBGL_UNSUPPORTED");const t=e.getExtension("WEBGL_debug_renderer_info");if(t&&(d=e.getParameter(t.UNMASKED_RENDERER_WEBGL)),!d)return h(1,"FALLBACK");v=d,d=m(d),p=function(e,t,n){return"apple gpu"===t?function(e,t,n){if(!n)return[t];const o=function(e){const t=e.createShader(35633),n=e.createShader(35632),o=e.createProgram();if(!(n&&t&&o))return;e.shaderSource(t,"\n precision highp float;\n attribute vec3 aPosition;\n varying float vvv;\n void main() {\n vvv = 0.31622776601683794;\n gl_Position = vec4(aPosition, 1.0);\n }\n "),e.shaderSource(n,"\n precision highp float;\n varying float vvv;\n void main() {\n vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * vvv;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n gl_FragColor = enc;\n }\n "),e.compileShader(t),e.compileShader(n),e.attachShader(o,t),e.attachShader(o,n),e.linkProgram(o),e.detachShader(o,t),e.detachShader(o,n),e.deleteShader(t),e.deleteShader(n),e.useProgram(o);const r=e.createBuffer();e.bindBuffer(34962,r),e.bufferData(34962,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);const i=e.getAttribLocation(o,"aPosition");e.vertexAttribPointer(i,3,5126,!1,0,0),e.enableVertexAttribArray(i),e.clearColor(1,1,1,1),e.clear(16384),e.viewport(0,0,1,1),e.drawArrays(4,0,3);const a=new Uint8Array(4);return e.readPixels(0,0,1,1,6408,5121,a),e.deleteProgram(o),e.deleteBuffer(r),a.join("")}(e),r="801621810",i="8016218135",a="80162181161",s=(null==C?void 0:C.isIpad)?[["a7",a,12],["a8",i,15],["a8x",i,15],["a9",i,15],["a9x",i,15],["a10",i,15],["a10x",i,15],["a12",r,15],["a12x",r,15],["a12z",r,15],["a14",r,15],["m1",r,15]]:[["a7",a,12],["a8",i,12],["a9",i,15],["a10",i,15],["a11",r,15],["a12",r,15],["a13",r,15],["a14",r,15]];let u;return"80162181255"===o?u=s.filter((([,,e])=>e>=14)):(u=s.filter((([,e])=>e===o)),u.length||(u=s)),u.map((([e])=>`apple ${e} gpu`))}(e,t,n):[t]}(e,d,u)}const b=(yield Promise.all(p.map((function(e){var t;return g(this,void 0,void 0,(function*(){const n=(e=>{const t=u?["adreno","apple","mali-t","mali","nvidia","powervr","samsung"]:["intel","apple","amd","radeon","nvidia","geforce"];for(const n of t)if(e.includes(n))return n})(e);if(!n)return;const o=`${u?"m":"d"}-${n}${s?"-ipad":""}.json`,r=a[o]=null!==(t=a[o])&&void 0!==t?t:l(o);let i;try{i=yield r}catch(n){if(n instanceof w)throw n;return}const d=function(e){var t;const n=(e=e.replace(/\([^)]+\)/,"")).match(/\d+/)||e.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);return null!==(t=null==n?void 0:n.join("").replace(/\W|amd/g,""))&&void 0!==t?t:""}(e);let h=i.filter((([,e])=>e===d));h.length||(h=i.filter((([t])=>t.includes(e))));const p=h.length;if(0===p)return;const v=e.split(/[.,()\[\]/\s]/g).sort().filter(((e,t,n)=>0===t||e!==n[t-1])).join(" ");let g,[f,,,,m]=p>1?h.map((e=>[e,M(v,e[2])])).sort((([,e],[,t])=>e-t))[0][0]:h[0],y=Number.MAX_VALUE;const{devicePixelRatio:C}=window,b=c.width*C*c.height*C;for(const e of m){const[t,n]=e,o=t*n,r=Math.abs(b-o);r<y&&(y=r,g=e)}if(!g)return;const[,,P,E]=g;return[y,P,f,E]}))})))).filter(E).sort((([e=Number.MAX_VALUE,t],[n=Number.MAX_VALUE,o])=>e===n?t-o:e-n));if(!b.length){const e=f.find((e=>d.includes(e)));return e?h(0,"BLOCKLISTED",e):h(1,"FALLBACK",`${d} (${v})`)}const[,P,L,R]=b[0];if(-1===P)return h(0,"BLOCKLISTED",L,P,R);const x=u?e:t;let W=0;for(let e=0;e<x.length;e++)P>=x[e]&&(W=e);return h(W,"BENCHMARK",L,P,R)}));var R,x,W=function(e){function t(n,o,r){var i=this.constructor,a=e.call(this,"(".concat(n,") ").concat(o))||this;return a.code=n,a.cause=r,a.name=t.name,Object.setPrototypeOf(a,i.prototype),a}return l(t,e),t}(Error);function S(e){return void 0!==e}!function(e){e.debug="debug",e.release="release"}(R||(R={})),function(e){e.Fit="Fit",e.FitWidth="FitWidth",e.ActualSize="ActualSize"}(x||(x={}));var I=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){var n,o;this.listeners[e]=null!==(n=this.listeners[e])&&void 0!==n?n:new Set,null===(o=this.listeners[e])||void 0===o||o.add(t)},e.prototype.off=function(e,t){var n;null===(n=this.listeners[e])||void 0===n||n.delete(t)},e.prototype.forwardEvent=function(e,t){this.on(t,(function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];e.emit.apply(e,v([t],n,!1))}))},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var o=this.listeners[e];(null==o?void 0:o.size)&&o.forEach((function(e){Promise.resolve().then((function(){e.apply(void 0,t)}))}))},e.prototype.detachAllListeners=function(){this.listeners={}},e}(),D=function(){function e(){this.removeListenerCallbacks=[]}return e.prototype.add=function(e,t,n,o){e.addEventListener(t,n,o);var r=function(){e.removeEventListener(t,n,o)};return this.removeListenerCallbacks.push(r),r},e.prototype.dispose=function(){this.removeListenerCallbacks.forEach((function(e){return e()}))},e}(),T={delayedDraw:!0,offscreenCanvas:!1,useDirtyRectsRendering:!0,safariWebGL2:!1,pageBoundariesLimit:!1},k=function(e){return parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(e)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||!1},F=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/,U=function(e){if(void 0===e&&(e=window.navigator.userAgent),e.includes("Chrome/")||e.includes("Chromium/")||e.includes("Opera/")||e.includes("Firefox/"))return null;var t=e.match(F);if(!t)return null;var n=t[1];return"Macintosh"!==n&&"iPad"!==n&&"iPhone"!==n?null:{hardware:n,version:{major:parseInt(t[4])||0,minor:parseInt(t[5])||0,patch:parseInt(t[6])||0}}};function A(e,t){var n;function o(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];clearTimeout(n),n=setTimeout((function(){e.apply(void 0,o)}),t)}return o.cancel=function(){n&&clearTimeout(n)},o}function z(e){var t,n,o,r,i,a=null!==(n=null===(t=e.touches)||void 0===t?void 0:t[0])&&void 0!==n?n:null===(o=e.changedTouches)||void 0===o?void 0:o[0];return{x:null!==(r=null==a?void 0:a.clientX)&&void 0!==r?r:e.clientX,y:null!==(i=null==a?void 0:a.clientY)&&void 0!==i?i:e.clientY}}function B(e,t,n){return Math.max(t,Math.min(n,e))}function G(){return U()&&!T.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1}function Z(e){for(var t=e.size(),n=[],o=0;o<t;++o){var r=e.get(o);if(null==r)throw Error("Error converting embind vector to array");n.push(r)}return n}function _(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function O(e){var t=e;return Object.keys(t).forEach((function(e){void 0===t[e]&&delete t[e]})),t}function j(e){return _()?{onTouchEnd:e}:{onClick:e}}var N=function(e){function t(t){var n=e.call(this)||this;return n.listenersCollector=new D,n.state={pinchToZoomLastDistance:0,lastGestureScale:1,isCtrlPressed:!1},n.handleGestureStart=function(e){e.preventDefault(),n.state.lastGestureScale=e.scale},n.handleGestureChange=function(e){e.preventDefault();var t=e.scale/n.state.lastGestureScale;n.state.lastGestureScale=e.scale;var o=n.getCorrectPointerPosition(e);n.emitZoomEvent(t,o)},n.handleGestureEnd=function(e){e.preventDefault()},n.handleTouchStart=function(e){e.preventDefault(),n.handleTouchPinchToZoomStart(e),n.emit("pointerdown",{type:"touch",position:n.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},n.handleMouseDown=function(e){e.ctrlKey||(e.preventDefault(),n.emit("pointerdown",{type:"mouse",position:n.getCorrectPointerPosition(e),button:e.button,touchesCount:0}))},n.handleTouchMove=function(e){n.handleTouchPinchToZoomChange(e),n.emit("pointermove",{type:"touch",position:n.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},n.handleMouseMove=function(e){n.updateMousePosition(e)},n.handleGlobalTouchMove=function(e){n.emit("globalpointermove",{type:"touch",position:n.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},n.handleGlobalMouseMove=function(e){n.updateGlobalMousePosition(e)},n.handleTouchPinchToZoomStart=function(e){var t;!e.touches||(null===(t=e.touches)||void 0===t?void 0:t.length)<2||(n.state.pinchToZoomLastDistance=n.calculateDistanceBetweenTouches(e.touches[0],e.touches[1]))},n.handleTouchPinchToZoomChange=function(e){var t;if(e.touches&&!((null===(t=e.touches)||void 0===t?void 0:t.length)<2)){var o=n.calculateDistanceBetweenTouches(e.touches[0],e.touches[1]),r=n.getCorrectPointerPosition(e),i=1+.004*(o-n.state.pinchToZoomLastDistance);n.state.pinchToZoomLastDistance=o,n.emitZoomEvent(i,r)}},n.handleTouchEnd=function(e){var t=n.getCorrectPointerPosition(e);n.emit("pointerup",{position:t,type:"touch",button:0,touchesCount:e.touches.length})},n.handleMouseUp=function(e){n.emit("pointerup",{type:"mouse",position:n.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},n.handleMouseWheel=function(e){e.preventDefault();var t=e.ctrlKey&&!n.state.isCtrlPressed,o=e.metaKey||t||n.state.isCtrlPressed;if(n.updateMousePosition(e),n.updateGlobalMousePosition(e),o){var r=t?-1:1,i=n.getCorrectPointerPosition(e),a=1+.005*e.deltaY*r;n.emitZoomEvent(a,i)}else n.emit("wheel",{x:-e.deltaX,y:-e.deltaY},{type:"mouse",position:n.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},n.target=t,n.targetBounds=t.getBoundingClientRect(),n.addListeners(),n}return l(t,e),t.prototype.updateTargetBounds=function(){this.targetBounds=this.target.getBoundingClientRect()},t.prototype.addListeners=function(){this.addTouchEventListeners(),this.addMouseEventListeners(),this.addKeyboardEventListeners(),this.addSafariGesturesEventListeners()},t.prototype.addKeyboardEventListeners=function(){var e=this;this.listenersCollector.add(document,"keydown",(function(t){"Control"===t.key&&(e.state.isCtrlPressed=!0)})),this.listenersCollector.add(document,"keyup",(function(t){"Control"===t.key&&(e.state.isCtrlPressed=!1)})),this.listenersCollector.add(document,"contextmenu",(function(t){t.ctrlKey&&(e.state.isCtrlPressed=!1)}))},t.prototype.addMouseEventListeners=function(){this.listenersCollector.add(this.target,"mousedown",this.handleMouseDown),this.listenersCollector.add(this.target,"mousemove",this.handleMouseMove),this.listenersCollector.add(document,"mousemove",this.handleGlobalMouseMove),this.listenersCollector.add(document,"mouseup",this.handleMouseUp),this.listenersCollector.add(this.target,"wheel",this.handleMouseWheel)},t.prototype.addTouchEventListeners=function(){this.listenersCollector.add(this.target,"touchstart",this.handleTouchStart),this.listenersCollector.add(document,"touchmove",this.handleGlobalTouchMove,{passive:!0,capture:!0}),this.listenersCollector.add(this.target,"touchmove",this.handleTouchMove,{passive:!0,capture:!0}),this.listenersCollector.add(document,"touchcancel",this.handleTouchEnd),this.listenersCollector.add(document,"touchend",this.handleTouchEnd)},t.prototype.addSafariGesturesEventListeners=function(){_()||(this.listenersCollector.add(this.target,"gesturestart",this.handleGestureStart,{capture:!0}),this.listenersCollector.add(this.target,"gesturechange",this.handleGestureChange,{capture:!0}),this.listenersCollector.add(this.target,"gestureend",this.handleGestureEnd,{capture:!0}))},t.prototype.clampPointerToTargetBounds=function(e){return{x:e.x-this.targetBounds.x,y:e.y-this.targetBounds.y}},t.prototype.getCorrectPointerPosition=function(e){var t,n={x:0,y:0};if((null===(t=e.touches)||void 0===t?void 0:t.length)>1){var o=e,r=o.touches[0],i=o.touches[1];n={x:(r.clientX+i.clientX)/2,y:(r.clientY+i.clientY)/2}}else n=z(e);return this.clampPointerToTargetBounds(n)},t.prototype.updateMousePosition=function(e){this.emit("pointermove",{type:"mouse",position:this.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},t.prototype.updateGlobalMousePosition=function(e){this.emit("globalpointermove",{type:"mouse",position:this.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},t.prototype.calculateDistanceBetweenTouches=function(e,t){return Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)},t.prototype.emitZoomEvent=function(e,t){this.emit("pinchToZoom",e,t)},t.prototype.dispose=function(){this.listenersCollector.dispose()},t}(I),H=function(e){function t(t){var n=e.call(this)||this;return n.listenersCollector=new D,n.handleKeyUp=function(e){n.emit("keyUp",e.code)},n.target=t,n.addListeners(),n}return l(t,e),t.prototype.addListeners=function(){this.listenersCollector.add(this.target,"keyup",this.handleKeyUp)},t.prototype.dispose=function(){this.listenersCollector.dispose()},t}(I),K=function(){function e(e){this.label=e,this.startTime=performance.now(),this.startTimestamp=Date.now()}return e.prototype.measure=function(){return{duration:performance.now()-this.startTime,end:Date.now(),start:this.startTimestamp,id:this.label}},e.prototype.printMeasurement=function(){var e=this.measure().duration;if(e<1e3){var t=e.toFixed(2);return"[Performance] ".concat(this.label," -> ").concat(t," ms")}var n=(e/1e3).toFixed(2);return"[Performance] ".concat(this.label," -> ").concat(n," s")},e}();function V(e){setTimeout((function(){e()}),0)}var $=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return l(t,e),t.prototype.logDebug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.emit.apply(this,v(["log","debug"],e,!1))},t.prototype.logWarning=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.emit.apply(this,v(["log","warn"],e,!1))},t.prototype.logError=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.emit.apply(this,v(["log","error"],e,!1))},t}(I)),J=function(e){function t(t){var n,o=this;return(o=e.call(this)||this).listenersCollector=new D,o.size={width:0,height:0},o.pixelRatio=1,o.maxPixelRatio=2,o.handleCanvasResizeObserver=function(e){o.resizeCanvas(e[0].contentRect)},o.resizeCanvas=function(e){var t=e.width,n=e.height;window.requestAnimationFrame((function(){o.setSize(t,n),o.emit("resize",t,n,o.getDevicePixelRatio())}))},o.getCanvasCenterPoint=function(){var e=o.getBoundingClientRect();return{x:e.width/2+e.x,y:e.height/2+e.y}},o.container=t.container,o.canvas=t.canvas,o.maxPixelRatio=null!==(n=t.maxPixelRatio)&&void 0!==n?n:o.maxPixelRatio,o.canvasResizeObserver=new ResizeObserver(o.handleCanvasResizeObserver),o.canvasResizeObserver.observe(o.container),o.listenersCollector.add(window,"orientationchange",o.handleDeviceOrientationChange),o.setSize(o.container.clientWidth,o.container.clientHeight),o}return l(t,e),t.prototype.setSize=function(e,t){this.pixelRatio=this.getDevicePixelRatio(),this.canvas.style.width="".concat(e,"px"),this.canvas.style.height="".concat(t,"px"),this.size.width=e*this.pixelRatio,this.size.height=t*this.pixelRatio,this.canvas.width=this.size.width,this.canvas.height=this.size.height},t.prototype.handleDeviceOrientationChange=function(){this.resizeCanvas({width:this.container.clientWidth,height:this.container.clientHeight})},t.prototype.getDevicePixelRatio=function(){return B(window.devicePixelRatio,1,this.maxPixelRatio)},t.prototype.getBoundingClientRect=function(){return this.canvas.getBoundingClientRect()},t.prototype.dispose=function(){this.detachAllListeners(),this.canvasResizeObserver.disconnect(),this.listenersCollector.dispose()},t}(I),Y=function(){function e(e){this.settings=e}return e.prototype.isReleaseMode=function(){return this.settings.mode===R.release},e.prototype.init=function(){return h(this,void 0,void 0,(function(){var e,t,n,o,r,i=this;return p(this,(function(a){switch(a.label){case 0:return[4,this.importModule()];case 1:e=a.sent(),t=e.default,a.label=2;case 2:return a.trys.push([2,4,,5]),n=this,[4,t({FeatureFlags:this.settings.featureFlags,currentWebGLVersion:G(),bridge:this.settings.jsBridge,locateFile:function(e){return i.settings.locateFile.replace("{file}",e)}})];case 3:return n.instance=a.sent(),[3,5];case 4:throw o=a.sent(),new W("WASM_ERROR","An error occurred while trying to create the wasm module.",o);case 5:return this.pointerTypeToWASMMap={unset:this.instance.PRUserPointerType.Unset,mouse:this.instance.PRUserPointerType.Mouse,touch:this.instance.PRUserPointerType.Touch},this.prCursorTypeToCSSCursorMap=((r={})[this.instance.PRCursorType.Auto.value]="auto",r[this.instance.PRCursorType.Default.value]="default",r[this.instance.PRCursorType.Pointer.value]="pointer",r[this.instance.PRCursorType.Grab.value]="grab",r[this.instance.PRCursorType.Grabbing.value]="grabbing",r),this.prototypeResizeModeToWASMMap={Fit:this.instance.PrototypeResizeMode.Fit,FitWidth:this.instance.PrototypeResizeMode.FitWidth,ActualSize:this.instance.PrototypeResizeMode.ActualSize},[2]}}))}))},e.prototype.makeWebGLContext=function(e,t){void 0===t&&(t={});var n=d({antialias:!1,alpha:!1,stencil:!1,depth:!1,powerPreference:"high-performance",preserveDrawingBuffer:!1,desynchronized:!0},t),o=this.instance.GL.createContext(e,n);if(!o)throw new W("WEBGL_ERROR","Unable to create WebGL context. WebGL might be unsupported, disabled, or this device is not able to run WebGL correctly.");return o},e.prototype.destroyWebGLContext=function(e){var t;$.logDebug("Destroying WebGL context");var n=null===(t=this.instance)||void 0===t?void 0:t.GL.getContext(e);if(n){this.instance.GL.deleteContext(e);var o=n.GLctx.getExtension("WEBGL_lose_context");if(o)return o.loseContext(),$.logDebug("WebGL destroyed"),!0;$.logError("WEBGL_lose_context not available. Not possible to destroy WebGL context manually.")}else $.logError("WebGL context not found while trying to destroy it")},e.prototype.importModule=function(){return this.isReleaseMode()?import("./module-release-26b5b0ef.js"):import("./module-debug-7b1d94e8.js")},e.prototype.mapToCSSCursor=function(e){return this.prCursorTypeToCSSCursorMap[e.value]},e.prototype.mapToPRPointerType=function(e){var t;return null!==(t=this.pointerTypeToWASMMap[e])&&void 0!==t?t:this.instance.PRUserPointerType.Unset},e.prototype.mapPointerInfo=function(e){return d(d({},e),{type:this.mapToPRPointerType(e.type)})},e.prototype.mapResizeMode=function(e){return this.prototypeResizeModeToWASMMap[e]},e}(),X=function(e){function t(t){var n=e.call(this)||this;return n.status={type:"IDLE"},n.disposed=!1,n.handleCanvasResize=function(e,t,o){var r;null===(r=n.pageCanvasWasm)||void 0===r||r.resize(e,t,o)},n.handleWebGLContextLost=function(){n.setStatus({type:"WEBGL_CONTEXT_LOST"})},n.handlePinchToZoomEvent=function(e,t){var o;null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchPinchToZoomEvent(e,t.x,t.y)},n.handleWheelEvent=function(e,t){var o;n.wasmModule&&(null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchWheelEvent(e.x,e.y,n.wasmModule.mapPointerInfo(t)))},n.handlePointerDownEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerDownEvent(n.wasmModule.mapPointerInfo(e)))},n.handlePointerMoveEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerMoveEvent(n.wasmModule.mapPointerInfo(e)))},n.handleGlobalPointerMoveEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchGlobalPointerMoveEvent(n.wasmModule.mapPointerInfo(e)))},n.handlePointerUpEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerUpEvent(n.wasmModule.mapPointerInfo(e)))},n.settings=d(d({backgroundColor:{r:1,g:1,b:1,a:1},showTilesBorders:!1,preserveDrawingBuffer:!1,panBoundariesPadding:0},O(t)),{featureFlags:d(d({},T),t.featureFlags)}),n.gestureManager=new N(n.settings.container),n.canvasManager=new J({container:n.settings.container,canvas:n.settings.canvas}),n.wasmModule=new Y({mode:n.settings.mode,locateFile:n.settings.locateFile,jsBridge:n.createJSBridge(),featureFlags:n.settings.featureFlags}),n.fetchWorker=new Worker(n.settings.locateFile.replace("{file}","fetch-worker.js")),n.settings.manualInitialization||n.init(),n}return l(t,e),t.prototype.addListeners=function(){this.canvasManager.on("resize",this.handleCanvasResize),this.gestureManager.on("wheel",this.handleWheelEvent),this.gestureManager.on("pointerup",this.handlePointerUpEvent),this.gestureManager.on("pointermove",this.handlePointerMoveEvent),this.gestureManager.on("globalpointermove",this.handleGlobalPointerMoveEvent),this.gestureManager.on("pointerdown",this.handlePointerDownEvent),this.gestureManager.on("pinchToZoom",this.handlePinchToZoomEvent),this.settings.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost)},t.prototype.collectAndEmitDeviceInfo=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return[4,L()];case 1:return e=t.sent(),this.deviceInfo=d(d({},e),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},t.prototype.init=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.traceFirstPaint=new K("FirstPaint"),this.setStatus({type:"INITIALIZING"}),this.collectAndEmitDeviceInfo(),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,this.initWasmModule()];case 2:return t.sent(),[4,this.initCanvasRendererWasm()];case 3:return t.sent(),[4,this.setFile(this.settings.filePath)];case 4:return t.sent(),[3,6];case 5:return e=t.sent(),[2,this.fail(e instanceof W?e:new W("ERROR","Unexpected exception initializing the web renderer",e))];case 6:return this.setInitialCameraState(),this.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.setInitialCameraState=function(){var e,t,n,o=void 0!==this.settings.initialZoom,r=void 0!==this.settings.initialPan;o||r?(o&&this.setZoom(this.settings.initialZoom||1),r&&this.setPan((null===(e=this.settings.initialPan)||void 0===e?void 0:e.x)||0,(null===(t=this.settings.initialPan)||void 0===t?void 0:t.y)||0,null===(n=this.settings.initialPan)||void 0===n?void 0:n.centerPointInViewport)):this.zoomToFit()},t.prototype.startRendering=function(){var e;this.traceInitialRender=new K("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),null===(e=this.pageCanvasWasm)||void 0===e||e.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){$.logDebug("[C++] ".concat(e))},logWarning:function(e){$.logWarning("[C++] ".concat(e))},logError:function(e){$.logError("[C++] ".concat(e))},emitMetric:function(t,n,o,r){e.emit("metric",{id:t,start:n,end:o,duration:r})},resolveImageUrl:function(t){return e.settings.imagesURLFormat?e.settings.imagesURLFormat.replace(":imageId",t):e.settings.imagesURLMap&&e.settings.imagesURLMap[t]?e.settings.imagesURLMap[t]:($.logWarning("Not able to resolve the url for the image with UUID: ".concat(t)),"")},resolveFragmentUrl:function(t){return e.settings.fragmentsURLFormat?e.settings.fragmentsURLFormat.replace(":fragmentId",t):e.settings.fragmentsURLMap&&e.settings.fragmentsURLMap[t]?e.settings.fragmentsURLMap[t]:($.logWarning("Not able to resolve the url for the fragment with UUID: ".concat(t)),"")},onDrawComplete:this.handleDrawComplete.bind(this),onAllImagesReady:function(){e.emit("allImagesReady")},onCameraMoveStart:function(){e.emit("cameraMoveStart")},onCameraMoveEnd:function(){e.emit("cameraMoveEnd")},onCameraZoomStart:function(){e.emit("cameraZoomStart")},onCameraZoomEnd:function(){e.emit("cameraZoomEnd")},onCameraZoomChange:function(t){e.emit("cameraZoomChange",t)},onCameraPanChange:function(){var t=e.getPan();e.emit("cameraPanChange",(null==t?void 0:t.x)||0,(null==t?void 0:t.y)||0)},onCursorChange:function(t){var n,o=null===(n=e.wasmModule)||void 0===n?void 0:n.mapToCSSCursor(t);o&&e.emit("cursorChange",o)},fetch:this.handleJSBridgeFetch.bind(this),abortFetch:this.handleJSBridgeAbortFetch.bind(this),onPrototypeStateChange:function(){},onPrototypeUnhandledPointerUp:function(){},onPrototypeSceneChange:function(){}}},t.prototype.handleJSBridgeFetch=function(e,t){var n=this,o=t.clone(),r=function(t){var i,a,s,u;if(!n.disposed&&t.data.url===e){switch(t.data.type){case"success":o.exec(new Uint8Array(t.data.buffer),200,"");break;case"error":$.logError("Error while fetching ".concat(e),t.data.error),o.exec(new Uint8Array(0),null!==(a=null===(i=t.data.error)||void 0===i?void 0:i.statusCode)&&void 0!==a?a:500,null!==(u=null===(s=t.data.error)||void 0===s?void 0:s.statusText)&&void 0!==u?u:"Unknown error")}n.fetchWorker.removeEventListener("message",r)}};this.fetchWorker.addEventListener("message",r),this.fetchWorker.postMessage({type:"fetch",url:e})},t.prototype.handleJSBridgeAbortFetch=function(e){this.fetchWorker.postMessage({type:"abort",url:e})},t.prototype.initWasmModule=function(){var e;return h(this,void 0,void 0,(function(){var t;return p(this,(function(n){switch(n.label){case 0:return this.disposed?[2]:(t=new K("WasmModuleDownload"),[4,null===(e=this.wasmModule)||void 0===e?void 0:e.init()]);case 1:return n.sent(),$.logDebug(t.printMeasurement()),this.emit("metric",t.measure()),[2]}}))}))},t.prototype.initCanvasRendererWasm=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){if(this.disposed)return[2];try{if(!this.wasmModule)throw Error("WASM module not initialized");e=G(),$.logDebug("Using WebGL ".concat(e)),this.webglCtxHandle=this.wasmModule.makeWebGLContext(this.settings.canvas,{preserveDrawingBuffer:this.settings.preserveDrawingBuffer,majorVersion:e}),this.renderTarget=this.wasmModule.instance.RenderTarget.MakeWebGL(this.webglCtxHandle,this.canvasManager.size.width,this.canvasManager.size.height,this.canvasManager.pixelRatio),this.pageCanvasWasm=new this.wasmModule.instance.CanvasRenderer(this.renderTarget,{showTilesBorders:this.settings.showTilesBorders})}catch(e){throw new W("WASM_ERROR","An error occurred while trying to create the wasm object.",e)}return this.userEventsCollectorWasm=this.pageCanvasWasm.getUserEventsCollector(),this.pageCanvasWasm.setBackgroundColor(this.settings.backgroundColor.r,this.settings.backgroundColor.g,this.settings.backgroundColor.b,this.settings.backgroundColor.a),this.pageCanvasWasm.setZoomLevels(this.settings.minimumZoomLevel,this.settings.maximumZoomLevel),this.pageCanvasWasm.setPanBoundariesPadding(this.settings.panBoundariesPadding),[2]}))}))},t.prototype.setIsCameraLocked=function(e){var t;null===(t=this.pageCanvasWasm)||void 0===t||t.setIsCameraLocked(e)},t.prototype.setBackgroundColor=function(e){var t;e.r===this.settings.backgroundColor.r&&e.g===this.settings.backgroundColor.g&&e.b===this.settings.backgroundColor.b&&e.a===this.settings.backgroundColor.a||(null===(t=this.pageCanvasWasm)||void 0===t||t.setBackgroundColor(e.r,e.g,e.b,e.a),this.settings.backgroundColor=e)},t.prototype.generateDocumentPNG=function(){var e;return h(this,void 0,void 0,(function(){return p(this,(function(t){return[2,null===(e=this.pageCanvasWasm)||void 0===e?void 0:e.generateDocumentPNG()]}))}))},t.prototype.handleDrawComplete=function(){"DRAWING_FILE"===this.status.type&&($.logDebug(this.traceInitialRender.printMeasurement()),this.emit("metric",this.traceInitialRender.measure()),$.logDebug(this.traceFirstPaint.printMeasurement()),this.emit("metric",this.traceFirstPaint.measure()),this.setStatus({type:"READY"}))},t.prototype.looseWebGLContext=function(){var e;(null===(e=this.wasmModule)||void 0===e?void 0:e.destroyWebGLContext(this.webglCtxHandle))||$.logWarning("Failed to loose WebGL context"),this.webglCtxHandle=-1},t.prototype.zoomToFit=function(){var e;null===(e=this.pageCanvasWasm)||void 0===e||e.scaleDocumentToFit()},t.prototype.setFile=function(e){return h(this,void 0,void 0,(function(){var t=this;return p(this,(function(n){return this.disposed?[2]:(this.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,o){var r;null===(r=t.pageCanvasWasm)||void 0===r||r.setFile(e,(function(e,o,r){t.setStatus({type:"FILE_READY"});var i="".concat(e,"-v").concat("7.5.0");t.emit("fileReady",t.getDocument(),i,o,r),n()}),(function(){return o(new W("FILE_ERROR","Error encountered while fetching and parsing the file"))}))}))])}))}))},t.prototype.fail=function(e){this.setStatus({type:"FAILURE",code:e.code,message:"".concat(e.toString()).concat(e.cause?"\nWrapped Error: ".concat(e.cause.toString()):"")}),$.logError(e),e.cause&&$.logError(e.cause)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&($.logDebug("Status transition ".concat(this.status.type," => ").concat(e.type)),this.status=e,this.emit("status",e))},t.prototype.getDocument=function(){if(!this.pageCanvasWasm)return{artboards:[],bounds:{x:0,y:0,width:0,height:0}};if(!this.cachedDocumentInfo||this.cachedDocumentInfo.filePath!==this.settings.filePath){var e=this.pageCanvasWasm.getPRFile();this.cachedDocumentInfo={filePath:this.settings.filePath,document:d(d({},e),{artboards:Z(e.artboards)})}}return this.cachedDocumentInfo.document},t.prototype.getArtboardAtPosition=function(e,t){if(this.pageCanvasWasm){var n=this.getDocument();if(n){for(var o=this.pageCanvasWasm.getPan(),r=this.pageCanvasWasm.getZoom(),i=(e-o.x)/r,a=(t-o.y)/r,s=0,u=n.artboards;s<u.length;s++){var c=u[s],l=c.bounds.x+c.bounds.width,d=c.bounds.y+c.bounds.height;if(i>=c.bounds.x&&a>=c.bounds.y&&i<=l&&a<=d)return c.objectId}return null}}},t.prototype.getPanAtPosition=function(e,t){var n=this.getPan(),o=Math.max(this.getZoom(),Number.EPSILON),r=e/o,i=t/o;return{x:n.x-r,y:n.y-i}},t.prototype.getStatus=function(){return this.status},t.prototype.setZoom=function(e,t){var n,o=null!=t?t:this.canvasManager.getCanvasCenterPoint();null===(n=this.pageCanvasWasm)||void 0===n||n.setZoom(e,o.x,o.y)},t.prototype.getPan=function(){var e,t,n=this.getDocument().bounds,o=null===(e=this.pageCanvasWasm)||void 0===e?void 0:e.getPan(),r=null===(t=this.pageCanvasWasm)||void 0===t?void 0:t.getZoom();return o&&r?{x:o.x/r+n.x,y:o.y/r+n.y}:{x:0,y:0}},t.prototype.getZoom=function(){var e;return(null===(e=this.pageCanvasWasm)||void 0===e?void 0:e.getZoom())||0},t.prototype.setPan=function(e,t,n){var o;void 0===n&&(n=!1);var r=e,i=t,a=this.getDocument().bounds,s=this.getZoom();if(n){var u=Math.max(2*s*this.canvasManager.pixelRatio,Number.EPSILON);r+=this.canvasManager.size.width/u,i+=this.canvasManager.size.height/u}var c=(r-a.x)*s,l=(i-a.y)*s;null===(o=this.pageCanvasWasm)||void 0===o||o.setPan(c,l)},t.prototype.disposeFetchWorker=function(){this.fetchWorker.postMessage({type:"abort-all"}),this.fetchWorker.terminate()},t.prototype.dispose=function(){var e,t,n,o;try{this.disposed=!0,this.detachAllListeners(),null===(e=this.wasmModule)||void 0===e||e.destroyWebGLContext(this.webglCtxHandle),this.canvasManager.dispose(),this.gestureManager.dispose(),null===(t=this.pageCanvasWasm)||void 0===t||t.stopRenderLoop(),null===(n=this.pageCanvasWasm)||void 0===n||n.delete(),null===(o=this.renderTarget)||void 0===o||o.delete(),this.disposeFetchWorker(),this.fetchWorker.terminate(),this.pageCanvasWasm=void 0,this.wasmModule=void 0}catch(e){this.fail(new W("ERROR","Unexpected exception while disposing the wasm object",e))}},t}(I),q=t(void 0),Q=t(void 0),ee=t(void 0),te=t(void 0),ne=t(void 0),oe=t(void 0),re=t("auto"),ie=t(void 0),ae=function(){var e=n(ie);if(void 0===e)throw Error("useInternalContext must be used within a provider");return e},se=function(e,t){switch(t.type){case"on-status":return d(d({},e),{status:t.status});case"on-file-ready":return d(d({},e),{document:t.document});case"on-zoom":return d(d({},e),{zoom:t.zoom});case"on-pan":return d(d({},e),{pan:t.pan});case"dispose":return d(d({},e),{status:{type:"DISPOSED"},zoom:null,pan:null,cursor:"auto"});case"on-camera-zoom-start":return d(d({},e),{isCameraZooming:!0});case"on-camera-zoom-end":return d(d({},e),{isCameraZooming:!1});case"on-camera-move-start":return d(d({},e),{isCameraMoving:!0});case"on-camera-move-end":return d(d({},e),{isCameraMoving:!1});case"on-cursor-change":return d(d({},e),{cursor:t.cursor});default:return e}},ue=function(t){var n=o(null),s=o(null),u=r(se,{pan:null,zoom:null,status:{type:"IDLE"},document:null,isCameraZooming:!1,isCameraMoving:!1,cursor:"auto"}),c=u[0],l=c.status,h=c.document,p=c.zoom,v=c.pan,g=c.isCameraZooming,f=c.isCameraMoving,m=c.cursor,y=u[1],C=i((function(e){return y({type:"on-zoom",zoom:e})}),[]),w=i((function(e,t){return y({type:"on-pan",pan:{x:e,y:t}})}),[]),b=i((function(e){y({type:"on-status",status:e})}),[]),P=i((function(e){y({type:"on-file-ready",document:e})}),[]),M=i((function(){return y({type:"on-camera-zoom-start"})}),[]),E=i((function(){return y({type:"on-camera-zoom-end"})}),[]),L=i((function(){return y({type:"on-camera-move-start"})}),[]),R=i((function(){return y({type:"on-camera-move-end"})}),[]),x=i((function(e){return y({type:"on-cursor-change",cursor:e})}),[]),W=i((function(){var e=n.current;e&&($.logDebug("Provider dispose"),e.off("status",b),e.off("fileReady",P),e.off("cameraZoomChange",C),e.off("cameraPanChange",w),e.off("cameraZoomStart",M),e.off("cameraZoomEnd",E),e.off("cameraMoveStart",L),e.off("cameraMoveEnd",R),e.off("cursorChange",x),e.dispose(),n.current=null,y({type:"dispose"}))}),[b,P,w,C,M,E,L,R,x]),S=i((function(e,t,o){if(""!==e&&t&&o&&s.current){$.logDebug("Provider init");var r=new X(d(d({},s.current),{filePath:e,container:o,canvas:t,manualInitialization:!0}));r.on("status",b),r.on("fileReady",P),r.on("cameraZoomChange",C),r.on("cameraPanChange",w),r.on("cameraZoomStart",M),r.on("cameraZoomEnd",E),r.on("cameraMoveStart",L),r.on("cameraMoveEnd",R),r.on("cursorChange",x),n.current=r,r.init()}}),[b,P,C,w,M,E,L,R,x]),I=i((function(e){var t;$.logDebug("Provider setSettings",e),e.backgroundColor&&(null===(t=n.current)||void 0===t||t.setBackgroundColor(e.backgroundColor)),s.current=e}),[]),D=i((function(){return n.current}),[]),T=a((function(){return{dispose:W,init:S,setSettings:I,getInstance:D,dispatch:y}}),[W,S,I,D]);return e.createElement(ie.Provider,{value:T},e.createElement(q.Provider,{value:l},e.createElement(Q.Provider,{value:h},e.createElement(ee.Provider,{value:p},e.createElement(oe.Provider,{value:v},e.createElement(te.Provider,{value:g},e.createElement(ne.Provider,{value:f},e.createElement(re.Provider,{value:m},t.children))))))))},ce=function(){var e=n(q);if(void 0===e)throw Error("useStatus must be used within a provider");return e},le=function(){var e=n(Q);if(void 0===e)throw Error("useDocument must be used within a provider");return e},de=function(){var e=n(ee);if(void 0===e)throw Error("useZoom must be used within a provider");return e},he=function(){var e=n(oe);if(void 0===e)throw Error("usePan must be used within a provider");return e},pe=function(){var e=n(re);if(void 0===e)throw Error("useCursor must be used within a provider");return e},ve=function(){var e=n(te);if(void 0===status)throw Error("useIsCameraZooming must be used within a provider");return e},ge=function(){var e=n(ne);if(void 0===status)throw Error("useIsCameraMoving must be used within a provider");return e},fe=function(){var e=(0,ae().getInstance)();return i((function(t){null==e||e.setZoom(t)}),[e])},me=function(){var e=fe(),t=de();return i((function(){var n;"number"==typeof t&&(n=t>=1?Math.round(2*t):t>.5?1:2*t,e(n))}),[e,t])},ye=function(){var e=fe(),t=de();return i((function(){"number"==typeof t&&e(t/2)}),[e,t])},Ce=function(){var e=(0,ae().getInstance)();return i((function(t){var n=t.x,o=t.y,r=t.centerPointInViewport;null==e||e.setPan(n,o,r)}),[e])},we=function(){var e=(0,ae().getInstance)();return i((function(){null==e||e.zoomToFit()}),[e])},be=function(){var e=(0,ae().getInstance)();return i((function(){null==e||e.looseWebGLContext()}),[e])},Pe=function(){var e=(0,ae().getInstance)();return i((function(){return h(void 0,void 0,void 0,(function(){return p(this,(function(t){switch(t.label){case 0:return[4,null==e?void 0:e.generateDocumentPNG()];case 1:return[2,t.sent()]}}))}))}),[e])},Me=function(){var e=(0,ae().getInstance)();return i((function(t,n){return h(void 0,void 0,void 0,(function(){return p(this,(function(o){switch(o.label){case 0:return[4,null==e?void 0:e.getArtboardAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},Ee=function(){var e=(0,ae().getInstance)();return i((function(t,n){return h(void 0,void 0,void 0,(function(){return p(this,(function(o){switch(o.label){case 0:return[4,null==e?void 0:e.getPanAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},Le=function(){var e=(0,ae().getInstance)();return i((function(t){null==e||e.setIsCameraLocked(t)}),[e])},Re=function(e,t){var n=(0,ae().getInstance)();s((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])};function xe(e){var t=o(e);t.current=e;var n=i((function(e){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];t.current.apply(t,v([e],n,!1))}),[]);s((function(){return $.on("log",n),function(){$.off("log",n)}}),[n])}var We={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},Se={position:"absolute",top:0,left:0},Ie=function(t){var n=t.filePath,r=t.locateFile,c=t.imagesURLFormat,l=t.imagesURLMap,h=t.fragmentsURLFormat,p=t.fragmentsURLMap,v=t.backgroundColor,g=t.mode,f=t.showTilesBorders,m=t.minimumZoomLevel,y=t.maximumZoomLevel,C=t.preserveDrawingBuffer,w=t.panBoundariesPadding,b=t.initialPan,P=t.initialZoom,M=t.children,E=t.containerProps,L=void 0===E?{}:E,R=t.canvasProps,x=void 0===R?{}:R,W=t.featureFlags,S=void 0===W?{}:W,I=o(null),D=o(null),T=u(!1),k=T[0],F=T[1],U=i((function(){return F(!0)}),[]),A=ae(),z=A.dispose,B=A.init,G=A.setSettings,Z=pe(),_=ce();Re("allImagesReady",U),s((function(){return $.logDebug("WebRenderer mounted"),function(){return $.logDebug("WebRenderer unmounted")}}),[]),s((function(){G({locateFile:r,imagesURLFormat:c,imagesURLMap:l,fragmentsURLFormat:h,fragmentsURLMap:p,backgroundColor:v,mode:g,showTilesBorders:f,minimumZoomLevel:m,maximumZoomLevel:y,preserveDrawingBuffer:C,panBoundariesPadding:w,initialPan:b,initialZoom:P,featureFlags:S})}),[G,r,c,l,h,p,v,g,f,m,y,C,w,b,P,S]),s((function(){if(n)return B(n,I.current,D.current),function(){z()}}),[z,B,n]);var O=a((function(){var e;return null!==(e=t.cursor)&&void 0!==e?e:Z}),[t.cursor,Z]),j=a((function(){return d(d({},We),{cursor:O})}),[O]);return e.createElement("div",d({},L,{ref:D,style:j}),n&&e.createElement("canvas",d({},x,{key:n,ref:I,"data-sketchweb-all-images-ready":k,"data-testid":"sketchweb-canvas","data-sketchweb-status":"sketchweb-status-".concat((null==_?void 0:_.type.toLowerCase())||"null"),style:Se})),"READY"===(null==_?void 0:_.type)&&M)},De=function(e){function t(t){var n=e.call(this)||this;return n.status={type:"IDLE"},n.disposed=!1,n.handleCanvasResize=function(e,t,o){var r;null===(r=n.playerWasm)||void 0===r||r.resize(e,t,o)},n.handleWebGLContextLost=function(){n.setStatus({type:"WEBGL_CONTEXT_LOST"})},n.handlePinchToZoomEvent=function(e,t){var o;null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchPinchToZoomEvent(e,t.x,t.y)},n.handleWheelEvent=function(e,t){var o;n.wasmModule&&n.userEventsCollectorWasm.dispatchWheelEvent(e.x,e.y,null===(o=n.wasmModule)||void 0===o?void 0:o.mapPointerInfo(t))},n.handlePointerDownEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchPointerDownEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.handlePointerMoveEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchPointerMoveEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.handleGlobalPointerMoveEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchGlobalPointerMoveEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.handlePointerUpEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchPointerUpEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.restartPrototype=function(e){var t;null===(t=n.playerWasm)||void 0===t||t.restartPrototype(e)},n.goBack=function(){var e;null===(e=n.playerWasm)||void 0===e||e.goBack()},n.goForwards=function(){var e;null===(e=n.playerWasm)||void 0===e||e.goForwards()},n.setResizeMode=function(e){var t;if(n.wasmModule){var o=n.wasmModule.mapResizeMode(e);null===(t=n.playerWasm)||void 0===t||t.setResizeMode(o)}},n.getScreen=function(){var e,t=null===(e=n.playerWasm)||void 0===e?void 0:e.getJSScreen();return t?{layers:Z(t.layers)}:{layers:[]}},n.settings=d(d({backgroundColor:{r:1,g:1,b:1,a:1},showTilesBorders:!1,preserveDrawingBuffer:!1},O(t)),{featureFlags:d(d({},T),t.featureFlags)}),n.gestureManager=new N(n.settings.container),n.canvasManager=new J({container:n.settings.container,canvas:n.settings.canvas,maxPixelRatio:3}),n.wasmModule=new Y({mode:n.settings.mode,locateFile:n.settings.locateFile,jsBridge:n.createJSBridge(),featureFlags:n.settings.featureFlags}),n.fetchWorker=new Worker(n.settings.locateFile.replace("{file}","fetch-worker.js")),n.settings.manualInitialization||n.init(),n}return l(t,e),t.prototype.addListeners=function(){this.canvasManager.on("resize",this.handleCanvasResize),this.gestureManager.on("wheel",this.handleWheelEvent),this.gestureManager.on("pointerup",this.handlePointerUpEvent),this.gestureManager.on("pointermove",this.handlePointerMoveEvent),this.gestureManager.on("globalpointermove",this.handleGlobalPointerMoveEvent),this.gestureManager.on("pointerdown",this.handlePointerDownEvent),this.gestureManager.on("pinchToZoom",this.handlePinchToZoomEvent),this.settings.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost)},t.prototype.collectAndEmitDeviceInfo=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return[4,L()];case 1:return e=t.sent(),this.deviceInfo=d(d({},e),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},t.prototype.init=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.traceFirstPaint=new K("FirstPaint"),this.setStatus({type:"INITIALIZING"}),this.collectAndEmitDeviceInfo(),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,this.initWasmModule()];case 2:return t.sent(),[4,this.initPlayerWasm()];case 3:return t.sent(),[4,this.startDownload()];case 4:return t.sent(),[3,6];case 5:return e=t.sent(),[2,this.fail(e instanceof W?e:new W("ERROR","Unexpected exception initializing the web renderer",e))];case 6:return this.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.initWasmModule=function(){var e;return h(this,void 0,void 0,(function(){var t;return p(this,(function(n){switch(n.label){case 0:return t=new K("WasmModuleDownload"),[4,null===(e=this.wasmModule)||void 0===e?void 0:e.init()];case 1:return n.sent(),t.printMeasurement(),this.emit("metric",t.measure()),[2]}}))}))},t.prototype.startDownload=function(){var e=this;return this.setStatus({type:"LOADING_FILE"}),new Promise((function(t){var n;null===(n=e.playerWasm)||void 0===n||n.startDownload((function(){t()}),(function(){console.error("Error loading file")}))}))},t.prototype.startRendering=function(){var e;this.traceInitialRender=new K("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),null===(e=this.playerWasm)||void 0===e||e.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){$.logDebug("[C++] ".concat(e))},logWarning:function(e){$.logWarning("[C++] ".concat(e))},logError:function(e){$.logError("[C++] ".concat(e))},emitMetric:function(t,n,o,r){e.emit("metric",{id:t,start:n,end:o,duration:r})},resolveImageUrl:function(t){return e.settings.imagesURLFormat?e.settings.imagesURLFormat.replace(":imageId",t):e.settings.imagesURLMap&&e.settings.imagesURLMap[t]?e.settings.imagesURLMap[t]:($.logWarning("Not able to resolve the url for the image with UUID: ".concat(t)),"")},resolveFragmentUrl:function(t){return e.settings.fragmentsURLFormat?e.settings.fragmentsURLFormat.replace(":fragmentId",t):e.settings.fragmentsURLMap&&e.settings.fragmentsURLMap[t]?e.settings.fragmentsURLMap[t]:($.logWarning("Not able to resolve the url for the fragment with UUID: ".concat(t)),"")},onDrawComplete:this.handleDrawComplete.bind(this),onAllImagesReady:function(){e.emit("allImagesReady")},onCameraMoveStart:function(){e.emit("cameraMoveStart")},onCameraMoveEnd:function(){e.emit("cameraMoveEnd")},onCameraZoomStart:function(){e.emit("cameraZoomStart")},onCameraZoomEnd:function(){e.emit("cameraZoomEnd")},onCameraZoomChange:function(t){e.emit("cameraZoomChange",t)},onCameraPanChange:function(t,n){e.emit("cameraPanChange",t,n)},onCursorChange:function(t){var n,o=null===(n=e.wasmModule)||void 0===n?void 0:n.mapToCSSCursor(t);o&&e.emit("cursorChange",o)},onPrototypeStateChange:function(t,n,o){e.emit("prototypeStateChange",{currentArtboardId:t,canGoBack:n,canGoForwards:o})},fetch:this.handleJSBridgeFetch.bind(this),abortFetch:this.handleJSBridgeAbortFetch.bind(this),onPrototypeUnhandledPointerUp:function(){e.emit("prototypeUnhandledPointerUp")},onPrototypeSceneChange:function(){e.emit("prototypeSceneChange")}}},t.prototype.handleJSBridgeFetch=function(e,t){var n=this,o=t.clone(),r=function(t){var i,a,s,u;if(!n.disposed&&t.data.url===e){switch(t.data.type){case"success":o.exec(new Uint8Array(t.data.buffer),200,"");break;case"error":$.logError("Error while fetching ".concat(e),t.data.error),o.exec(new Uint8Array(0),null!==(a=null===(i=t.data.error)||void 0===i?void 0:i.statusCode)&&void 0!==a?a:500,null!==(u=null===(s=t.data.error)||void 0===s?void 0:s.statusText)&&void 0!==u?u:"Unknown error")}n.fetchWorker.removeEventListener("message",r)}};this.fetchWorker.addEventListener("message",r),this.fetchWorker.postMessage({type:"fetch",url:e})},t.prototype.handleJSBridgeAbortFetch=function(e){this.fetchWorker.postMessage({type:"abort",url:e})},t.prototype.initPlayerWasm=function(){var e,t;return h(this,void 0,void 0,(function(){var n,o,r,i,a,s,u,c,l,h,v,g,f,m,y,C,w,b;return p(this,(function(p){try{if(!this.wasmModule)throw Error("WASM module not initialized");for(this.webglCtxHandle=this.wasmModule.makeWebGLContext(this.settings.canvas,{preserveDrawingBuffer:this.settings.preserveDrawingBuffer,majorVersion:G()}),n=this.wasmModule.instance,o=n.RenderTarget,r=n.PrototypeRenderer,i=n.PrototypeStructureArtboardVector,a=n.PrototypeStructureFlowVector,s=n.PrototypeStructureAssetVector,this.renderTarget=o.MakeWebGL(this.webglCtxHandle,this.canvasManager.size.width,this.canvasManager.size.height,this.canvasManager.pixelRatio),u={artboards:new i},c=0,l=this.settings.prototypeStructure.artboards;c<l.length;c++){for(h=l[c],v=new a,g=0,f=null!==(e=h.flows)&&void 0!==e?e:[];g<f.length;g++)m=f[g],v.push_back(m);for(y=new s,C=0,w=null!==(t=h.assets)&&void 0!==t?t:[];C<w.length;C++)b=w[C],y.push_back(b);u.artboards.push_back(d(d({},h),{flows:v,assets:y}))}this.playerWasm=new r(this.renderTarget,{showTilesBorders:this.settings.showTilesBorders},this.settings.startArtboardUUID,u,this.settings.highlightHotspots)}catch(e){throw new W("WASM_ERROR","An error occurred while trying to create the PrototypeRenderer WASM object.",e)}return this.userEventsCollectorWasm=this.playerWasm.getUserEventsCollector(),this.playerWasm.setBackgroundColor(this.settings.backgroundColor.r,this.settings.backgroundColor.g,this.settings.backgroundColor.b,this.settings.backgroundColor.a),this.playerWasm.setZoomLevels(this.settings.minimumZoomLevel,this.settings.maximumZoomLevel),this.setResizeMode(this.settings.resizeMode),[2]}))}))},t.prototype.setIsCameraLocked=function(e){var t;null===(t=this.playerWasm)||void 0===t||t.setIsCameraLocked(e)},t.prototype.setBackgroundColor=function(e){var t;e.r===this.settings.backgroundColor.r&&e.g===this.settings.backgroundColor.g&&e.b===this.settings.backgroundColor.b&&e.a===this.settings.backgroundColor.a||(null===(t=this.playerWasm)||void 0===t||t.setBackgroundColor(e.r,e.g,e.b,e.a),this.settings.backgroundColor=e)},t.prototype.handleDrawComplete=function(){"DRAWING_FILE"===this.status.type&&(this.traceInitialRender.printMeasurement(),this.emit("metric",this.traceInitialRender.measure()),this.traceFirstPaint.printMeasurement(),this.emit("metric",this.traceFirstPaint.measure()),this.setStatus({type:"READY"}))},t.prototype.looseWebGLContext=function(){var e;null===(e=this.wasmModule)||void 0===e||e.destroyWebGLContext(this.webglCtxHandle),this.webglCtxHandle=-1},t.prototype.fail=function(e){this.setStatus({type:"FAILURE",code:e.code,message:"".concat(e.toString()).concat(e.cause?"\nWrapped Error: ".concat(e.cause.toString()):"")}),$.logError(e),e.cause&&$.logError(e.cause)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&($.logDebug("Status transition ".concat(this.status.type," => ").concat(e.type)),this.status=e,this.emit("status",e))},t.prototype.getStatus=function(){return this.status},t.prototype.dispose=function(){var e,t,n;try{this.detachAllListeners(),null===(e=this.wasmModule)||void 0===e||e.destroyWebGLContext(this.webglCtxHandle),this.canvasManager.dispose(),this.gestureManager.dispose(),null===(t=this.playerWasm)||void 0===t||t.stopRenderLoop(),null===(n=this.playerWasm)||void 0===n||n.delete(),this.renderTarget.delete(),this.playerWasm=void 0,this.wasmModule=void 0,this.disposed=!0}catch(e){this.fail(new W("ERROR","Unexpected exception while disposing the WebRendererWasm object",e))}},t}(I),Te=t(void 0),ke=t("auto"),Fe=t(void 0),Ue=t(void 0),Ae=t(void 0),ze=t(void 0),Be=function(){var e=n(ze);if(void 0===e)throw Error("useInternalContext must be used within a provider");return e},Ge=function(e,t){switch(t.type){case"on-status":return d(d({},e),{status:t.status});case"dispose":return d(d({},e),{status:{type:"DISPOSED"},cursor:"auto"});case"on-cursor-change":return d(d({},e),{cursor:t.cursor});case"on-prototype-state-change":return d(d({},e),{prototypeState:d(d({},e.prototypeState),t.prototypeState)});case"on-zoom":return d(d({},e),{zoom:t.zoom});case"on-pan":return d(d({},e),{pan:{x:t.pan.x,y:t.pan.y}});default:return e}},Ze=function(t){var n=o(null),s=o(null),u=r(Ge,{status:{type:"IDLE"},cursor:"auto",prototypeState:{currentArtboardId:"",canGoBack:!1,canGoForwards:!1},zoom:1,pan:{x:0,y:0}}),c=u[0],l=c.status,h=c.cursor,p=c.prototypeState,v=c.zoom,g=c.pan,f=u[1],m=i((function(e){f({type:"on-status",status:e})}),[]),y=i((function(e){return f({type:"on-zoom",zoom:e})}),[]),C=i((function(e,t){return f({type:"on-pan",pan:{x:e,y:t}})}),[]),w=i((function(e){return f({type:"on-cursor-change",cursor:e})}),[]),b=i((function(e){return f({type:"on-prototype-state-change",prototypeState:e})}),[]),P=i((function(){var e=n.current;e&&($.logDebug("Provider dispose"),e.off("status",m),e.off("cursorChange",w),e.off("prototypeStateChange",b),e.off("cameraZoomChange",y),e.off("cameraPanChange",C),e.dispose(),n.current=null,f({type:"dispose"}))}),[m,w,b,C,y]),M=i((function(e,t){if(e&&t&&s.current){$.logDebug("Provider init");var o=new De(d(d({},s.current),{container:t,canvas:e,manualInitialization:!0}));o.on("status",m),o.on("cursorChange",w),o.on("prototypeStateChange",b),o.on("cameraZoomChange",y),o.on("cameraPanChange",C),n.current=o,o.init()}}),[m,w,b,C,y]),E=i((function(e){var t,o,r,i;$.logDebug("Provider setSettings",e),e.backgroundColor&&e.backgroundColor!=(null===(t=s.current)||void 0===t?void 0:t.backgroundColor)&&(null===(o=n.current)||void 0===o||o.setBackgroundColor(e.backgroundColor)),(null===(r=s.current)||void 0===r?void 0:r.resizeMode)!=e.resizeMode&&(null===(i=n.current)||void 0===i||i.setResizeMode(e.resizeMode)),s.current=e}),[]),L=i((function(){return n.current}),[]),R=a((function(){return{dispose:P,init:M,setSettings:E,getInstance:L,dispatch:f}}),[P,M,E,L]);return e.createElement(ze.Provider,{value:R},e.createElement(Te.Provider,{value:l},e.createElement(ke.Provider,{value:h},e.createElement(Fe.Provider,{value:p},e.createElement(Ue.Provider,{value:v},e.createElement(Ae.Provider,{value:g},t.children))))))},_e=function(){var e=(0,Be().getInstance)();return i((function(t){null==e||e.restartPrototype(t)}),[e])},Oe=function(){var e=(0,Be().getInstance)();return i((function(){null==e||e.goBack()}),[e])},je=function(){var e=(0,Be().getInstance)();return i((function(){null==e||e.goForwards()}),[e])},Ne=function(){var e=n(Te);if(void 0===e)throw Error("usePrototypeStatus must be used within a provider");return e},He=function(){var e=n(ke);if(void 0===e)throw Error("usePrototypeCursor must be used within a provider");return e},Ke=function(){var e=n(Fe);if(void 0===e)throw Error("usePrototypeState must be used within a provider");return e},Ve=function(){var e=n(Ue);if(void 0===e)throw Error("usePrototypeZoom must be used within a provider");return e},$e=function(){var e=n(Ae);if(void 0===e)throw Error("usePrototypePan must be used within a provider");return e},Je=function(e,t){var n=(0,Be().getInstance)();s((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])};function Ye(){var e=(0,Be().getInstance)();return i((function(){return null==e?void 0:e.getScreen()}),[e])}var Xe={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},qe={position:"absolute",top:0,left:0},Qe=function(t){var n=t.locateFile,r=t.imagesURLFormat,i=t.imagesURLMap,u=t.backgroundColor,c=t.mode,l=t.showTilesBorders,h=t.minimumZoomLevel,p=t.maximumZoomLevel,v=t.preserveDrawingBuffer,g=t.children,f=t.containerProps,m=void 0===f?{}:f,y=t.canvasProps,C=void 0===y?{}:y,w=t.featureFlags,b=void 0===w?{}:w,P=t.startArtboardUUID,M=t.prototypeStructure,E=t.fragmentsURLFormat,L=t.fragmentsURLMap,R=t.highlightHotspots,x=t.resizeMode,W=o(null),S=o(null),I=Be(),D=I.dispose,T=I.init,k=I.setSettings,F=He(),U=Ne();s((function(){k({locateFile:n,imagesURLFormat:r,imagesURLMap:i,backgroundColor:u,mode:c,showTilesBorders:l,minimumZoomLevel:h,maximumZoomLevel:p,preserveDrawingBuffer:v,featureFlags:b,startArtboardUUID:P,prototypeStructure:M,fragmentsURLFormat:E,fragmentsURLMap:L,highlightHotspots:R,resizeMode:x})}),[k,n,r,i,u,c,l,h,p,v,b,P,R,x,E,L,M]),s((function(){return T(W.current,S.current),function(){D()}}),[D,T]);var A=a((function(){return d(d({},Xe),{cursor:F})}),[F]);return e.createElement("div",d({},m,{ref:S,style:A}),e.createElement("canvas",d({},C,{ref:W,"data-testid":"prototype-canvas","data-prototype-status":"prototype-status-".concat((null==U?void 0:U.type.toLowerCase())||"null"),style:qe})),"READY"===(null==U?void 0:U.type)&&g)},et={position:"absolute",inset:0,pointerEvents:"none"};function tt(t){var n=t.visualize,o=void 0!==n&&n,r=u(null),s=r[0],c=r[1],l=Ye(),h=i((function(){c(l()||null)}),[l]);Je("prototypeSceneChange",h);var p=a((function(){return d(d({},et),{opacity:o?1:0})}),[o]);return s?e.createElement("div",{style:p},s.layers.map((function(t,n){return e.createElement(nt,d({key:"".concat(n,"/").concat(t.id)},t))}))):null}function nt(t){var n=t.bounds,o=t.name,r=t.id,i=t.type,s=Ve(),u=$e()||{x:0,y:0},c=u.x,l=u.y,h=a((function(){return d({position:"absolute",left:c/window.devicePixelRatio+n.x*s,top:l/window.devicePixelRatio+n.y*s,width:n.width*s,height:n.height*s,backgroundColor:"rgba(0, 255, 255, 0.2)",border:"2px dotted white"},"hotspot"===i?{cursor:"pointer",pointerEvents:"auto"}:{})}),[n.x,n.y,n.width,n.height,c,l,s,i]);return e.createElement("div",{style:h,"data-testid":"".concat(i,"-").concat(ot(o),"-").concat(r),"data-entity-name":o,"data-entity-id":r,"data-entity-bounds-x":n.x,"data-entity-bounds-y":n.x,"data-entity-bounds-width":n.width,"data-entity-bounds-height":n.height})}function ot(e){var t,n;return null!==(n=null===(t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))||void 0===t?void 0:t.join("-").toLowerCase())&&void 0!==n?n:""}export{ne as CameraMoveContext,te as CameraZoomingContext,X as CanvasRenderer,ue as CanvasRendererProvider,Ie as CanvasRendererReact,re as CursorContext,T as DefaultFeatureFlags,Q as DocumentContext,I as EventEmitter,N as GestureManager,H as KeyboardManager,D as ListenersCollector,oe as PanContext,K as Performance,De as PrototypeRenderer,Ze as PrototypeRendererProvider,Qe as PrototypeRendererReact,x as PrototypeResizeMode,tt as PrototypeTestOverlay,q as StatusContext,W as WebRendererError,R as WebRendererMode,ee as ZoomContext,B as clamp,Z as convertEmbindVectorToArray,A as debounce,z as extractPointer,G as getSupportedWebGLVersion,k as getiOSVersion,S as isDefinedPresentationManifestArtboard,_ as isTouchDevice,$ as logger,V as nextTick,U as parseSafariUserAgent,se as reducer,O as removeUndefinedKeys,j as touchableClick,pe as useCursor,ye as useDecrementZoom,le as useDocument,Re as useEvent,Pe as useGenerateDocumentPNG,Me as useGetArtboardAtPosititon,Ee as useGetPanAtPosition,Ye as useGetScreen,Oe as useGoBack,je as useGoForwards,me as useIncrementZoom,ge as useIsCameraMoving,ve as useIsCameraZooming,Le as useLockCamera,xe as useLogEvent,be as useLooseWebGLContext,he as usePan,He as usePrototypeCursor,Je as usePrototypeEvent,$e as usePrototypePan,Ke as usePrototypeState,Ne as usePrototypeStatus,Ve as usePrototypeZoom,_e as useRestartPrototype,Ce as useSetPan,fe as useSetZoom,ce as useStatus,de as useZoom,we as useZoomToFit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e,t=(e="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t){var r,n,i=void 0!==(t=t||{})?t:{};i.ready=new Promise((function(e,t){r=e,n=t})),Object.getOwnPropertyDescriptor(i.ready,"_malloc")||(Object.defineProperty(i.ready,"_malloc",{configurable:!0,get:function(){se("You are getting _malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_malloc",{configurable:!0,set:function(){se("You are setting _malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_free")||(Object.defineProperty(i.ready,"_free",{configurable:!0,get:function(){se("You are getting _free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_free",{configurable:!0,set:function(){se("You are setting _free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"___getTypeName")||(Object.defineProperty(i.ready,"___getTypeName",{configurable:!0,get:function(){se("You are getting ___getTypeName on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"___getTypeName",{configurable:!0,set:function(){se("You are setting ___getTypeName on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"___embind_register_native_and_builtin_types")||(Object.defineProperty(i.ready,"___embind_register_native_and_builtin_types",{configurable:!0,get:function(){se("You are getting ___embind_register_native_and_builtin_types on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"___embind_register_native_and_builtin_types",{configurable:!0,set:function(){se("You are setting ___embind_register_native_and_builtin_types on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"___stdio_exit")||(Object.defineProperty(i.ready,"___stdio_exit",{configurable:!0,get:function(){se("You are getting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"___stdio_exit",{configurable:!0,set:function(){se("You are setting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"onRuntimeInitialized")||(Object.defineProperty(i.ready,"onRuntimeInitialized",{configurable:!0,get:function(){se("You are getting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"onRuntimeInitialized",{configurable:!0,set:function(){se("You are setting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}));var a=Object.assign({},i),o="./this.program",s=!0;if(i.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");var c,u="";if("undefined"!=typeof document&&document.currentScript&&(u=document.currentScript.src),e&&(u=e),u=0!==u.indexOf("blob:")?u.substr(0,u.replace(/[?#].*/,"").lastIndexOf("/")+1):"","object"!=typeof window&&"function"!=typeof importScripts)throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");var l,f=i.print||console.log.bind(console),d=i.printErr||console.warn.bind(console);function m(e){m.shown||(m.shown={}),m.shown[e]||(m.shown[e]=1,d(e))}function g(e,t){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get:function(){se("Module."+e+" has been replaced with plain "+t+" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}})}function p(e,t){var r="'"+e+"' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)";return t&&(r+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),r}function v(e,t){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get:function(){se(p(e,t))}})}function h(e,t){Object.getOwnPropertyDescriptor(i,e)||(i[e]=()=>se(p(e,t)))}Object.assign(i,a),a=null,l="fetchSettings",Object.getOwnPropertyDescriptor(i,l)&&se("`Module."+l+"` was supplied but `"+l+"` not included in INCOMING_MODULE_JS_API"),i.arguments&&i.arguments,g("arguments","arguments_"),i.thisProgram&&(o=i.thisProgram),g("thisProgram","thisProgram"),i.quit&&i.quit,g("quit","quit_"),T(void 0===i.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),T(void 0===i.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),T(void 0===i.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),T(void 0===i.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),T(void 0===i.read,"Module.read option was removed (modify read_ in JS)"),T(void 0===i.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),T(void 0===i.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),T(void 0===i.setWindowTitle,"Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),T(void 0===i.TOTAL_MEMORY,"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),g("read","read_"),g("readAsync","readAsync"),g("readBinary","readBinary"),g("setWindowTitle","setWindowTitle"),T(!0,"worker environment detected but not enabled at build time. Add 'worker' to `-sENVIRONMENT` to enable."),T(!0,"node environment detected but not enabled at build time. Add 'node' to `-sENVIRONMENT` to enable."),T(!0,"shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.");var _,y,b=0;i.wasmBinary&&(_=i.wasmBinary),g("wasmBinary","wasmBinary"),i.noExitRuntime,g("noExitRuntime","noExitRuntime"),"object"!=typeof WebAssembly&&se("no native wasm support detected");var w=!1;function T(e,t){e||se("Assertion failed"+(t?": "+t:""))}var P="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function x(e,t,r){for(var n=t+r,i=t;e[i]&&!(i>=n);)++i;if(i-t>16&&e.buffer&&P)return P.decode(e.subarray(t,i));for(var a="";t<i;){var o=e[t++];if(128&o){var s=63&e[t++];if(192!=(224&o)){var c=63&e[t++];if(224==(240&o)?o=(15&o)<<12|s<<6|c:(240!=(248&o)&&m("Invalid UTF-8 leading byte 0x"+o.toString(16)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),o=(7&o)<<18|s<<12|c<<6|63&e[t++]),o<65536)a+=String.fromCharCode(o);else{var u=o-65536;a+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else a+=String.fromCharCode((31&o)<<6|s)}else a+=String.fromCharCode(o)}return a}function E(e,t){return e?x(k,e,t):""}function S(e,t,r,n){if(!(n>0))return 0;for(var i=r,a=r+n-1,o=0;o<e.length;++o){var s=e.charCodeAt(o);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o)),s<=127){if(r>=a)break;t[r++]=s}else if(s<=2047){if(r+1>=a)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=a)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=a)break;s>1114111&&m("Invalid Unicode code point 0x"+s.toString(16)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}}return t[r]=0,r-i}function C(e,t,r){return T("number"==typeof r,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),S(e,k,t,r)}function A(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&e.charCodeAt(++r)),n<=127?++t:t+=n<=2047?2:n<=65535?3:4}return t}var I,F,k,D,O,L,M,U,R,B,W,$="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function N(e,t){T(e%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var r=e,n=r>>1,i=n+t/2;!(n>=i)&&O[n];)++n;if((r=n<<1)-e>32&&$)return $.decode(k.subarray(e,r));for(var a="",o=0;!(o>=t/2);++o){var s=D[e+2*o>>1];if(0==s)break;a+=String.fromCharCode(s)}return a}function j(e,t,r){if(T(t%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),T("number"==typeof r,"stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),void 0===r&&(r=2147483647),r<2)return 0;for(var n=t,i=(r-=2)<2*e.length?r/2:e.length,a=0;a<i;++a){var o=e.charCodeAt(a);D[t>>1]=o,t+=2}return D[t>>1]=0,t-n}function G(e){return 2*e.length}function V(e,t){T(e%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");for(var r=0,n="";!(r>=t/4);){var i=L[e+4*r>>2];if(0==i)break;if(++r,i>=65536){var a=i-65536;n+=String.fromCharCode(55296|a>>10,56320|1023&a)}else n+=String.fromCharCode(i)}return n}function H(e,t,r){if(T(t%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!"),T("number"==typeof r,"stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),void 0===r&&(r=2147483647),r<4)return 0;for(var n=t,i=n+r-4,a=0;a<e.length;++a){var o=e.charCodeAt(a);if(o>=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),L[t>>2]=o,(t+=4)+4>i)break}return L[t>>2]=0,t-n}function Y(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t}function z(e){I=e,i.HEAP8=F=new Int8Array(e),i.HEAP16=D=new Int16Array(e),i.HEAP32=L=new Int32Array(e),i.HEAPU8=k=new Uint8Array(e),i.HEAPU16=O=new Uint16Array(e),i.HEAPU32=M=new Uint32Array(e),i.HEAPF32=U=new Float32Array(e),i.HEAPF64=W=new Float64Array(e),i.HEAP64=R=new BigInt64Array(e),i.HEAPU64=B=new BigUint64Array(e)}var J=5242880;i.TOTAL_STACK&&T(J===i.TOTAL_STACK,"the stack size can no longer be determined at runtime");var q,Z=i.INITIAL_MEMORY||134217728;function K(){var e=Pr();T(0==(3&e)),L[e>>2]=34821223,L[e+4>>2]=2310721022,M[0]=1668509029}function Q(){if(!w){var e=Pr(),t=M[e>>2],r=M[e+4>>2];34821223==t&&2310721022==r||se("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x"+r.toString(16)+" 0x"+t.toString(16)),1668509029!==M[0]&&se("Runtime error: The application has corrupted its heap memory area (address zero)!")}}g("INITIAL_MEMORY","INITIAL_MEMORY"),T(Z>=J,"INITIAL_MEMORY should be larger than TOTAL_STACK, was "+Z+"! (TOTAL_STACK="+J+")"),T("undefined"!=typeof Int32Array&&"undefined"!=typeof Float64Array&&null!=Int32Array.prototype.subarray&&null!=Int32Array.prototype.set,"JS engine does not provide full typed array support"),T(!i.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),T(134217728==Z,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically"),function(){var e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,115!==t[0]||99!==t[1])throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"}();var X=[],ee=[],te=[],re=!1;T(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),T(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),T(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),T(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var ne=0,ie=null,ae=null,oe={};function se(e){i.onAbort&&i.onAbort(e),d(e="Aborted("+e+")"),w=!0;var t=new WebAssembly.RuntimeError(e);throw n(t),t}var ce={error:function(){se("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM")},init:function(){ce.error()},createDataFile:function(){ce.error()},createPreloadedFile:function(){ce.error()},createLazyFile:function(){ce.error()},open:function(){ce.error()},mkdev:function(){ce.error()},registerDevice:function(){ce.error()},analyzePath:function(){ce.error()},loadFilesFromDB:function(){ce.error()},ErrnoError:function(){ce.error()}};i.FS_createDataFile=ce.createDataFile,i.FS_createPreloadedFile=ce.createPreloadedFile;var ue,le,fe="data:application/octet-stream;base64,";function de(e){return e.startsWith(fe)}function me(e,t){return function(){var r=e,n=t;return t||(n=i.asm),T(re,"native function `"+r+"` called before runtime initialization"),n[e]||T(n[e],"exported native function `"+r+"` not found"),n[e].apply(null,arguments)}}function ge(e){try{if(e==ue&&_)return new Uint8Array(_);if(!c)throw"both async and sync fetching of the wasm failed"}catch(e){se(e)}}function pe(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?he(r)():he(r)(t.arg):r(void 0===t.arg?null:t.arg)}else t(i)}}de(ue="module-debug.wasm")||(le=ue,ue=i.locateFile?i.locateFile(le,u):u+le);var ve=[];function he(e){var t=ve[e];return t||(e>=ve.length&&(ve.length=e+1),ve[e]=t=q.get(e)),T(q.get(e)==t,"JavaScript-side Wasm function table mirror is out of date!"),t}var _e={};function ye(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function be(e){return this.fromWireType(M[e>>2])}var we={},Te={},Pe={},xe=48,Ee=57;function Se(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=xe&&t<=Ee?"_"+e:e}function Ce(e,t){return e=Se(e),new Function("body","return function "+e+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(t)}function Ae(e,t){var r=Ce(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},r}var Ie=void 0;function Fe(e){throw new Ie(e)}function ke(e,t,r){function n(t){var n=r(t);n.length!==e.length&&Fe("Mismatched type converter count");for(var i=0;i<e.length;++i)Re(e[i],n[i])}e.forEach((function(e){Pe[e]=t}));var i=new Array(t.length),a=[],o=0;t.forEach(((e,t)=>{Te.hasOwnProperty(e)?i[t]=Te[e]:(a.push(e),we.hasOwnProperty(e)||(we[e]=[]),we[e].push((()=>{i[t]=Te[e],++o===a.length&&n(i)})))})),0===a.length&&n(i)}function De(e){if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e}var Oe=void 0;function Le(e){for(var t="",r=e;k[r];)t+=Oe[k[r++]];return t}var Me=void 0;function Ue(e){throw new Me(e)}function Re(e,t,r={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=t.name;if(e||Ue('type "'+n+'" must have a positive integer typeid pointer'),Te.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;Ue("Cannot register type '"+n+"' twice")}if(Te[e]=t,delete Pe[e],we.hasOwnProperty(e)){var i=we[e];delete we[e],i.forEach((e=>e()))}}function Be(e,t,r){switch(t){case 0:return r?function(e){return F[e]}:function(e){return k[e]};case 1:return r?function(e){return D[e>>1]}:function(e){return O[e>>1]};case 2:return r?function(e){return L[e>>2]}:function(e){return M[e>>2]};case 3:return r?function(e){return R[e>>3]}:function(e){return B[e>>3]};default:throw new TypeError("Unknown integer type: "+e)}}function We(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}function $e(e){if(!(this instanceof ct))return!1;if(!(e instanceof ct))return!1;for(var t=this.$$.ptrType.registeredClass,r=this.$$.ptr,n=e.$$.ptrType.registeredClass,i=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)i=n.upcast(i),n=n.baseClass;return t===n&&r===i}function Ne(e){Ue(e.$$.ptrType.registeredClass.name+" instance already deleted")}var je=!1;function Ge(e){}function Ve(e){e.count.value-=1,0===e.count.value&&function(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}(e)}function He(e,t,r){if(t===r)return e;if(void 0===r.baseClass)return null;var n=He(e,t,r.baseClass);return null===n?null:r.downcast(n)}var Ye={};function ze(){return Object.keys(Xe).length}function Je(){var e=[];for(var t in Xe)Xe.hasOwnProperty(t)&&e.push(Xe[t]);return e}var qe=[];function Ze(){for(;qe.length;){var e=qe.pop();e.$$.deleteScheduled=!1,e.delete()}}var Ke=void 0;function Qe(e){Ke=e,qe.length&&Ke&&Ke(Ze)}var Xe={};function et(e,t){return t=function(e,t){for(void 0===t&&Ue("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}(e,t),Xe[t]}function tt(e,t){return t.ptrType&&t.ptr||Fe("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&Fe("Both smartPtrType and smartPtr must be specified"),t.count={value:1},nt(Object.create(e,{$$:{value:t}}))}function rt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=et(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function i(){return this.isSmartPointer?tt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):tt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a,o=this.registeredClass.getActualType(t),s=Ye[o];if(!s)return i.call(this);a=this.isConst?s.constPointerType:s.pointerType;var c=He(t,this.registeredClass,a.registeredClass);return null===c?i.call(this):this.isSmartPointer?tt(a.registeredClass.instancePrototype,{ptrType:a,ptr:c,smartPtrType:this,smartPtr:e}):tt(a.registeredClass.instancePrototype,{ptrType:a,ptr:c})}function nt(e){return"undefined"==typeof FinalizationRegistry?(nt=e=>e,e):(je=new FinalizationRegistry((e=>{console.warn(e.leakWarning.stack.replace(/^Error: /,"")),Ve(e.$$)})),nt=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t},n=t.ptrType.registeredClass;r.leakWarning=new Error("Embind found a leaked C++ instance "+n.name+" <0x"+t.ptr.toString(16)+">.\nWe'll free it automatically in this case, but this functionality is not reliable across various environments.\nMake sure to invoke .delete() manually once you're done with the instance instead.\nOriginally allocated"),"captureStackTrace"in Error&&Error.captureStackTrace(r.leakWarning,rt),je.register(e,r,e)}return e},Ge=e=>je.unregister(e),nt(e))}function it(){if(this.$$.ptr||Ne(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=nt(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}function at(){this.$$.ptr||Ne(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ue("Object already scheduled for deletion"),Ge(this),Ve(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function ot(){return!this.$$.ptr}function st(){return this.$$.ptr||Ne(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ue("Object already scheduled for deletion"),qe.push(this),1===qe.length&&Ke&&Ke(Ze),this.$$.deleteScheduled=!0,this}function ct(){}function ut(e,t,r){if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||Ue("Function '"+r+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}}function lt(e,t,r){i.hasOwnProperty(e)?((void 0===r||void 0!==i[e].overloadTable&&void 0!==i[e].overloadTable[r])&&Ue("Cannot register public name '"+e+"' twice"),ut(i,e,e),i.hasOwnProperty(r)&&Ue("Cannot register multiple overloads of a function with the same number of arguments ("+r+")!"),i[e].overloadTable[r]=t):(i[e]=t,void 0!==r&&(i[e].numArguments=r))}function ft(e,t,r,n,i,a,o,s){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=i,this.getActualType=a,this.upcast=o,this.downcast=s,this.pureVirtualFunctions=[]}function dt(e,t,r){for(;t!==r;)t.upcast||Ue("Expected null or instance of "+r.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function mt(e,t){if(null===t)return this.isReference&&Ue("null is not a valid "+this.name),0;t.$$||Ue('Cannot pass "'+De(t)+'" as a '+this.name),t.$$.ptr||Ue("Cannot pass deleted object as a pointer of type "+this.name);var r=t.$$.ptrType.registeredClass;return dt(t.$$.ptr,r,this.registeredClass)}function gt(e,t){var r;if(null===t)return this.isReference&&Ue("null is not a valid "+this.name),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||Ue('Cannot pass "'+De(t)+'" as a '+this.name),t.$$.ptr||Ue("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&Ue("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var n=t.$$.ptrType.registeredClass;if(r=dt(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&Ue("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:Ue("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var i=t.clone();r=this.rawShare(r,Dt.toHandle((function(){i.delete()}))),null!==e&&e.push(this.rawDestructor,r)}break;default:Ue("Unsupporting sharing policy")}return r}function pt(e,t){if(null===t)return this.isReference&&Ue("null is not a valid "+this.name),0;t.$$||Ue('Cannot pass "'+De(t)+'" as a '+this.name),t.$$.ptr||Ue("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&Ue("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var r=t.$$.ptrType.registeredClass;return dt(t.$$.ptr,r,this.registeredClass)}function vt(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function ht(e){this.rawDestructor&&this.rawDestructor(e)}function _t(e){null!==e&&e.delete()}function yt(e,t,r,n,i,a,o,s,c,u,l){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=i,this.pointeeType=a,this.sharingPolicy=o,this.rawGetPointee=s,this.rawConstructor=c,this.rawShare=u,this.rawDestructor=l,i||void 0!==t.baseClass?this.toWireType=gt:n?(this.toWireType=mt,this.destructorFunction=null):(this.toWireType=pt,this.destructorFunction=null)}function bt(e,t){e=Le(e);var r=he(t);return"function"!=typeof r&&Ue("unknown function pointer with signature "+e+": "+t),r}var wt=void 0;function Tt(e){var t=yr(e),r=Le(t);return _r(t),r}function Pt(e,t){var r=[],n={};throw t.forEach((function e(t){n[t]||Te[t]||(Pe[t]?Pe[t].forEach(e):(r.push(t),n[t]=!0))})),new wt(e+": "+r.map(Tt).join([", "]))}function xt(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var r=Ce(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var n=new r,i=e.apply(n,t);return i instanceof Object?i:n}function Et(e,t,r,n,i){var a=t.length;a<2&&Ue("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,s=!1,c=1;c<t.length;++c)if(null!==t[c]&&void 0===t[c].destructorFunction){s=!0;break}var u="void"!==t[0].name,l="",f="";for(c=0;c<a-2;++c)l+=(0!==c?", ":"")+"arg"+c,f+=(0!==c?", ":"")+"arg"+c+"Wired";var d="return function "+Se(e)+"("+l+") {\nif (arguments.length !== "+(a-2)+") {\nthrowBindingError('function "+e+" called with ' + arguments.length + ' arguments, expected "+(a-2)+" args!');\n}\n";s&&(d+="var destructors = [];\n");var m=s?"destructors":"null",g=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],p=[Ue,n,i,ye,t[0],t[1]];for(o&&(d+="var thisWired = classParam.toWireType("+m+", this);\n"),c=0;c<a-2;++c)d+="var arg"+c+"Wired = argType"+c+".toWireType("+m+", arg"+c+"); // "+t[c+2].name+"\n",g.push("argType"+c),p.push(t[c+2]);if(o&&(f="thisWired"+(f.length>0?", ":"")+f),d+=(u?"var rv = ":"")+"invoker(fn"+(f.length>0?", ":"")+f+");\n",s)d+="runDestructors(destructors);\n";else for(c=o?1:2;c<t.length;++c){var v=1===c?"thisWired":"arg"+(c-2)+"Wired";null!==t[c].destructorFunction&&(d+=v+"_dtor("+v+"); // "+t[c].name+"\n",g.push(v+"_dtor"),p.push(t[c].destructorFunction))}return u&&(d+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),d+="}\n",g.push(d),xt(Function,g).apply(null,p)}function St(e,t){for(var r=[],n=0;n<e;n++)r.push(L[(t>>2)+n]);return r}var Ct=[],At=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function It(e){e>4&&0==--At[e].refcount&&(At[e]=void 0,Ct.push(e))}function Ft(){for(var e=0,t=5;t<At.length;++t)void 0!==At[t]&&++e;return e}function kt(){for(var e=5;e<At.length;++e)if(void 0!==At[e])return At[e];return null}var Dt={toValue:e=>(e||Ue("Cannot use deleted val. handle = "+e),At[e].value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var t=Ct.length?Ct.pop():At.length;return At[t]={refcount:1,value:e},t}}};function Ot(e,t,r){switch(t){case 0:return function(e){var t=r?F:k;return this.fromWireType(t[e])};case 1:return function(e){var t=r?D:O;return this.fromWireType(t[e>>1])};case 2:return function(e){var t=r?L:M;return this.fromWireType(t[e>>2])};default:throw new TypeError("Unknown integer type: "+e)}}function Lt(e,t){var r=Te[e];return void 0===r&&Ue(t+" has unknown type "+Tt(e)),r}function Mt(e,t){switch(t){case 2:return function(e){return this.fromWireType(U[e>>2])};case 3:return function(e){return this.fromWireType(W[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Ut(e,t){for(var r=new Array(e),n=0;n<e;++n)r[n]=Lt(L[(t>>2)+n],"parameter "+n);return r}var Rt={};function Bt(e){var t=Rt[e];return void 0===t?Le(e):t}var Wt=[];function $t(){return"object"==typeof globalThis?globalThis:Function("return this")()}var Nt,jt=[];Nt=()=>performance.now();var Gt={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],samplers:[],transformFeedbacks:[],syncs:[],stringCache:{},stringiCache:{},unpackAlignment:4,recordError:function(e){Gt.lastError||(Gt.lastError=e)},getNewId:function(e){for(var t=Gt.counter++,r=e.length;r<t;r++)e[r]=null;return t},getSource:function(e,t,r,n){for(var i="",a=0;a<t;++a){var o=n?L[n+4*a>>2]:-1;i+=E(L[r+4*a>>2],o<0?void 0:o)}return i},createContext:function(e,t){e.getContextSafariWebGL2Fixed||(e.getContextSafariWebGL2Fixed=e.getContext,e.getContext=function(t,r){var n=e.getContextSafariWebGL2Fixed(t,r);return"webgl"==t==n instanceof WebGLRenderingContext?n:null});var r=t.majorVersion>1?e.getContext("webgl2",t):e.getContext("webgl",t);return r?Gt.registerContext(r,t):0},registerContext:function(e,t){var r=Gt.getNewId(Gt.contexts),n={handle:r,attributes:t,version:t.majorVersion,GLctx:e};return e.canvas&&(e.canvas.GLctxObject=n),Gt.contexts[r]=n,(void 0===t.enableExtensionsByDefault||t.enableExtensionsByDefault)&&Gt.initExtensions(n),r},makeContextCurrent:function(e){return Gt.currentContext=Gt.contexts[e],i.ctx=ur=Gt.currentContext&&Gt.currentContext.GLctx,!(e&&!ur)},getContext:function(e){return Gt.contexts[e]},deleteContext:function(e){Gt.currentContext===Gt.contexts[e]&&(Gt.currentContext=null),"object"==typeof JSEvents&&JSEvents.removeAllHandlersOnTarget(Gt.contexts[e].GLctx.canvas),Gt.contexts[e]&&Gt.contexts[e].GLctx.canvas&&(Gt.contexts[e].GLctx.canvas.GLctxObject=void 0),Gt.contexts[e]=null},initExtensions:function(e){if(e||(e=Gt.currentContext),!e.initExtensionsDone){e.initExtensionsDone=!0;var t,r=e.GLctx;!function(e){var t=e.getExtension("ANGLE_instanced_arrays");t&&(e.vertexAttribDivisor=function(e,r){t.vertexAttribDivisorANGLE(e,r)},e.drawArraysInstanced=function(e,r,n,i){t.drawArraysInstancedANGLE(e,r,n,i)},e.drawElementsInstanced=function(e,r,n,i,a){t.drawElementsInstancedANGLE(e,r,n,i,a)})}(r),function(e){var t=e.getExtension("OES_vertex_array_object");t&&(e.createVertexArray=function(){return t.createVertexArrayOES()},e.deleteVertexArray=function(e){t.deleteVertexArrayOES(e)},e.bindVertexArray=function(e){t.bindVertexArrayOES(e)},e.isVertexArray=function(e){return t.isVertexArrayOES(e)})}(r),function(e){var t=e.getExtension("WEBGL_draw_buffers");t&&(e.drawBuffers=function(e,r){t.drawBuffersWEBGL(e,r)})}(r),(t=r).dibvbi=t.getExtension("WEBGL_draw_instanced_base_vertex_base_instance"),function(e){e.mdibvbi=e.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance")}(r),e.version>=2&&(r.disjointTimerQueryExt=r.getExtension("EXT_disjoint_timer_query_webgl2")),(e.version<2||!r.disjointTimerQueryExt)&&(r.disjointTimerQueryExt=r.getExtension("EXT_disjoint_timer_query")),function(e){e.multiDrawWebgl=e.getExtension("WEBGL_multi_draw")}(r),(r.getSupportedExtensions()||[]).forEach((function(e){e.includes("lose_context")||e.includes("debug")||r.getExtension(e)}))}}};function Vt(e,t){return T(t===(0|t)),(e>>>0)+4294967296*t}var Ht=[];function Yt(e,t,r,n){for(var i=0;i<e;i++){var a=ur[r](),o=a&&Gt.getNewId(n);a?(a.name=o,n[o]=a):Gt.recordError(1282),L[t+4*i>>2]=o}}function zt(e,t){M[e>>2]=t,M[e+4>>2]=(t-M[e>>2])/4294967296;var r=t>=0?function(e){return M[e>>2]+4294967296*M[e+4>>2]}(e):function(e){return M[e>>2]+4294967296*L[e+4>>2]}(e);r!=t&&m("writeI53ToI64() out of range: serialized JS Number "+t+" to Wasm heap as bytes lo=0x"+M[e>>2].toString(16)+", hi=0x"+M[e+4>>2].toString(16)+", which deserializes back to "+r+" instead!")}function Jt(e,t,r){if(t){var n=void 0;switch(e){case 36346:n=1;break;case 36344:return void(0!=r&&1!=r&&Gt.recordError(1280));case 34814:case 36345:n=0;break;case 34466:var i=ur.getParameter(34467);n=i?i.length:0;break;case 33309:if(Gt.currentContext.version<2)return void Gt.recordError(1282);n=2*(ur.getSupportedExtensions()||[]).length;break;case 33307:case 33308:if(Gt.currentContext.version<2)return void Gt.recordError(1280);n=33307==e?3:0}if(void 0===n){var a=ur.getParameter(e);switch(typeof a){case"number":n=a;break;case"boolean":n=a?1:0;break;case"string":return void Gt.recordError(1280);case"object":if(null===a)switch(e){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:n=0;break;default:return void Gt.recordError(1280)}else{if(a instanceof Float32Array||a instanceof Uint32Array||a instanceof Int32Array||a instanceof Array){for(var o=0;o<a.length;++o)switch(r){case 0:L[t+4*o>>2]=a[o];break;case 2:U[t+4*o>>2]=a[o];break;case 4:F[t+o>>0]=a[o]?1:0}return}try{n=0|a.name}catch(t){return Gt.recordError(1280),void d("GL_INVALID_ENUM in glGet"+r+"v: Unknown object returned from WebGL getParameter("+e+")! (error: "+t+")")}}break;default:return Gt.recordError(1280),void d("GL_INVALID_ENUM in glGet"+r+"v: Native code calling glGet"+r+"v("+e+") and it returns "+a+" of type "+typeof a+"!")}}switch(r){case 1:zt(t,n);break;case 0:L[t>>2]=n;break;case 2:U[t>>2]=n;break;case 4:F[t>>0]=n?1:0}}else Gt.recordError(1281)}function qt(e){var t=A(e)+1,r=hr(t);return C(e,r,t),r}function Zt(e){return"]"==e.slice(-1)&&e.lastIndexOf("[")}function Kt(e){return 0==(e-=5120)?F:1==e?k:2==e?D:4==e?L:6==e?U:5==e||28922==e||28520==e||30779==e||30782==e?M:O}function Qt(e){return 31-Math.clz32(e.BYTES_PER_ELEMENT)}function Xt(e,t,r,n,i,a){var o=Kt(e),s=Qt(o),c=1<<s,u=function(e){return{5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[e-6402]||1}(t)*c,l=function(e,t,r,n){var i;return t*(e*r+(i=n)-1&-i)}(r,n,u,Gt.unpackAlignment);return o.subarray(i>>s,i+l>>s)}function er(e){var t=ur.currentProgram;if(t){var r=t.uniformLocsById[e];return"number"==typeof r&&(t.uniformLocsById[e]=r=ur.getUniformLocation(t,t.uniformArrayNamesById[e]+(r>0?"["+r+"]":""))),r}Gt.recordError(1282)}var tr=[],rr=[];function nr(e){try{return y.grow(e-I.byteLength+65535>>>16),z(y.buffer),1}catch(t){d("emscripten_realloc_buffer: Attempted to grow heap from "+I.byteLength+" bytes to "+e+" bytes, but got error: "+t)}}var ir={};function ar(){if(!ar.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:o||"./this.program"};for(var t in ir)void 0===ir[t]?delete e[t]:e[t]=ir[t];var r=[];for(var t in e)r.push(t+"="+e[t]);ar.strings=r}return ar.strings}var or=[null,[],[]];function sr(e,t){var r=or[e];T(r),0===t||10===t?((1===e?f:d)(x(r,0)),r.length=0):r.push(t)}function cr(e){return e%4==0&&(e%100!=0||e%400==0)}var ur,lr=[31,29,31,30,31,30,31,31,30,31,30,31],fr=[31,28,31,30,31,30,31,31,30,31,30,31];function dr(e,t,r,n){var i=L[n+40>>2],a={tm_sec:L[n>>2],tm_min:L[n+4>>2],tm_hour:L[n+8>>2],tm_mday:L[n+12>>2],tm_mon:L[n+16>>2],tm_year:L[n+20>>2],tm_wday:L[n+24>>2],tm_yday:L[n+28>>2],tm_isdst:L[n+32>>2],tm_gmtoff:L[n+36>>2],tm_zone:i?E(i):""},o=E(r),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var c in s)o=o.replace(new RegExp(c,"g"),s[c]);var u=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=["January","February","March","April","May","June","July","August","September","October","November","December"];function f(e,t,r){for(var n="number"==typeof e?e.toString():e||"";n.length<t;)n=r[0]+n;return n}function d(e,t){return f(e,t,"0")}function m(e,t){function r(e){return e<0?-1:e>0?1:0}var n;return 0===(n=r(e.getFullYear()-t.getFullYear()))&&0===(n=r(e.getMonth()-t.getMonth()))&&(n=r(e.getDate()-t.getDate())),n}function g(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function p(e){var t=function(e,t){for(var r=new Date(e.getTime());t>0;){var n=cr(r.getFullYear()),i=r.getMonth(),a=(n?lr:fr)[i];if(!(t>a-r.getDate()))return r.setDate(r.getDate()+t),r;t-=a-r.getDate()+1,r.setDate(1),i<11?r.setMonth(i+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1))}return r}(new Date(e.tm_year+1900,0,1),e.tm_yday),r=new Date(t.getFullYear(),0,4),n=new Date(t.getFullYear()+1,0,4),i=g(r),a=g(n);return m(i,t)<=0?m(a,t)<=0?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var v={"%a":function(e){return u[e.tm_wday].substring(0,3)},"%A":function(e){return u[e.tm_wday]},"%b":function(e){return l[e.tm_mon].substring(0,3)},"%B":function(e){return l[e.tm_mon]},"%C":function(e){return d((e.tm_year+1900)/100|0,2)},"%d":function(e){return d(e.tm_mday,2)},"%e":function(e){return f(e.tm_mday,2," ")},"%g":function(e){return p(e).toString().substring(2)},"%G":function(e){return p(e)},"%H":function(e){return d(e.tm_hour,2)},"%I":function(e){var t=e.tm_hour;return 0==t?t=12:t>12&&(t-=12),d(t,2)},"%j":function(e){return d(e.tm_mday+function(e,t){for(var r=0,n=0;n<=t;r+=e[n++]);return r}(cr(e.tm_year+1900)?lr:fr,e.tm_mon-1),3)},"%m":function(e){return d(e.tm_mon+1,2)},"%M":function(e){return d(e.tm_min,2)},"%n":function(){return"\n"},"%p":function(e){return e.tm_hour>=0&&e.tm_hour<12?"AM":"PM"},"%S":function(e){return d(e.tm_sec,2)},"%t":function(){return"\t"},"%u":function(e){return e.tm_wday||7},"%U":function(e){var t=e.tm_yday+7-e.tm_wday;return d(Math.floor(t/7),2)},"%V":function(e){var t=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&t++,t){if(53==t){var r=(e.tm_wday+371-e.tm_yday)%7;4==r||3==r&&cr(e.tm_year)||(t=1)}}else{t=52;var n=(e.tm_wday+7-e.tm_yday-1)%7;(4==n||5==n&&cr(e.tm_year%400-1))&&t++}return d(t,2)},"%w":function(e){return e.tm_wday},"%W":function(e){var t=e.tm_yday+7-(e.tm_wday+6)%7;return d(Math.floor(t/7),2)},"%y":function(e){return(e.tm_year+1900).toString().substring(2)},"%Y":function(e){return e.tm_year+1900},"%z":function(e){var t=e.tm_gmtoff,r=t>=0;return t=(t=Math.abs(t)/60)/60*100+t%60,(r?"+":"-")+String("0000"+t).slice(-4)},"%Z":function(e){return e.tm_zone},"%%":function(){return"%"}};for(var c in o=o.replace(/%%/g,"\0\0"),v)o.includes(c)&&(o=o.replace(new RegExp(c,"g"),v[c](a)));var h,_,y,b,w,P,x=(h=o=o.replace(/\0\0/g,"%"),_=!1,b=y>0?y:A(h)+1,w=new Array(b),P=S(h,w,0,w.length),_&&(w.length=P),w);return x.length>t?0:(function(e,t){T(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),F.set(e,t)}(x,e),x.length-1)}Ie=i.InternalError=Ae(Error,"InternalError"),function(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Oe=e}(),Me=i.BindingError=Ae(Error,"BindingError"),ct.prototype.isAliasOf=$e,ct.prototype.clone=it,ct.prototype.delete=at,ct.prototype.isDeleted=ot,ct.prototype.deleteLater=st,i.getInheritedInstanceCount=ze,i.getLiveInheritedInstances=Je,i.flushPendingDeletes=Ze,i.setDelayFunction=Qe,yt.prototype.getPointee=vt,yt.prototype.destructor=ht,yt.prototype.argPackAdvance=8,yt.prototype.readValueFromPointer=be,yt.prototype.deleteObject=_t,yt.prototype.fromWireType=rt,wt=i.UnboundTypeError=Ae(Error,"UnboundTypeError"),i.count_emval_handles=Ft,i.get_first_emval=kt;for(var mr=0;mr<32;++mr)Ht.push(new Array(mr));var gr=new Float32Array(288);for(mr=0;mr<288;++mr)tr[mr]=gr.subarray(0,mr+1);var pr=new Int32Array(288);for(mr=0;mr<288;++mr)rr[mr]=pr.subarray(0,mr+1);var vr={__assert_fail:function(e,t,r,n){se("Assertion failed: "+E(e)+", at: "+[t?E(t):"unknown filename",r,n?E(n):"unknown function"])},_embind_finalize_value_object:function(e){var t=_e[e];delete _e[e];var r=t.rawConstructor,n=t.rawDestructor,i=t.fields;ke([e],i.map((e=>e.getterReturnType)).concat(i.map((e=>e.setterArgumentType))),(e=>{var a={};return i.forEach(((t,r)=>{var n=t.fieldName,o=e[r],s=t.getter,c=t.getterContext,u=e[r+i.length],l=t.setter,f=t.setterContext;a[n]={read:e=>o.fromWireType(s(c,e)),write:(e,t)=>{var r=[];l(f,e,u.toWireType(r,t)),ye(r)}}})),[{name:t.name,fromWireType:function(e){var t={};for(var r in a)t[r]=a[r].read(e);return n(e),t},toWireType:function(e,t){for(var i in a)if(!(i in t))throw new TypeError('Missing field: "'+i+'"');var o=r();for(i in a)a[i].write(o,t[i]);return null!==e&&e.push(n,o),o},argPackAdvance:8,readValueFromPointer:be,destructorFunction:n}]}))},_embind_register_bigint:function(e,t,r,n,i){t=Le(t);var a=We(r),o=-1!=t.indexOf("u");o&&(i=(BigInt(1)<<BigInt(64))-BigInt(1)),Re(e,{name:t,fromWireType:function(e){return e},toWireType:function(e,r){if("bigint"!=typeof r)throw new TypeError('Cannot convert "'+De(r)+'" to '+this.name);if(r<n||r>i)throw new TypeError('Passing a number "'+De(r)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+n+", "+i+"]!");return r},argPackAdvance:8,readValueFromPointer:Be(t,a,!o),destructorFunction:null})},_embind_register_bool:function(e,t,r,n,i){var a=We(r);Re(e,{name:t=Le(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?n:i},argPackAdvance:8,readValueFromPointer:function(e){var n;if(1===r)n=F;else if(2===r)n=D;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+t);n=L}return this.fromWireType(n[e>>a])},destructorFunction:null})},_embind_register_class:function(e,t,r,n,a,o,s,c,u,l,f,d,m){f=Le(f),o=bt(a,o),c&&(c=bt(s,c)),l&&(l=bt(u,l)),m=bt(d,m);var g=Se(f);lt(g,(function(){Pt("Cannot construct "+f+" due to unbound types",[n])})),ke([e,t,r],n?[n]:[],(function(t){var r,a;t=t[0],a=n?(r=t.registeredClass).instancePrototype:ct.prototype;var s=Ce(g,(function(){if(Object.getPrototypeOf(this)!==u)throw new Me("Use 'new' to construct "+f);if(void 0===d.constructor_body)throw new Me(f+" has no accessible constructor");var e=d.constructor_body[arguments.length];if(void 0===e)throw new Me("Tried to invoke ctor of "+f+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(d.constructor_body).toString()+") parameters instead!");return e.apply(this,arguments)})),u=Object.create(a,{constructor:{value:s}});s.prototype=u;var d=new ft(f,s,u,m,r,o,c,l),p=new yt(f,d,!0,!1,!1),v=new yt(f+"*",d,!1,!1,!1),h=new yt(f+" const*",d,!1,!0,!1);return Ye[e]={pointerType:v,constPointerType:h},function(e,t,r){i.hasOwnProperty(e)||Fe("Replacing nonexistant public symbol"),void 0!==i[e].overloadTable&&void 0!==r?i[e].overloadTable[r]=t:(i[e]=t,i[e].argCount=r)}(g,s),[p,v,h]}))},_embind_register_class_class_function:function(e,t,r,n,i,a,o){var s=St(r,n);t=Le(t),a=bt(i,a),ke([],[e],(function(e){var n=(e=e[0]).name+"."+t;function i(){Pt("Cannot call "+n+" due to unbound types",s)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]);var c=e.registeredClass.constructor;return void 0===c[t]?(i.argCount=r-1,c[t]=i):(ut(c,t,n),c[t].overloadTable[r-1]=i),ke([],s,(function(e){var i=[e[0],null].concat(e.slice(1)),s=Et(n,i,null,a,o);return void 0===c[t].overloadTable?(s.argCount=r-1,c[t]=s):c[t].overloadTable[r-1]=s,[]})),[]}))},_embind_register_class_constructor:function(e,t,r,n,i,a){T(t>0);var o=St(t,r);i=bt(n,i),ke([],[e],(function(e){var r="constructor "+(e=e[0]).name;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Me("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+e.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return e.registeredClass.constructor_body[t-1]=()=>{Pt("Cannot construct "+e.name+" due to unbound types",o)},ke([],o,(function(n){return n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Et(r,n,null,i,a),[]})),[]}))},_embind_register_class_function:function(e,t,r,n,i,a,o,s){var c=St(r,n);t=Le(t),a=bt(i,a),ke([],[e],(function(e){var n=(e=e[0]).name+"."+t;function i(){Pt("Cannot call "+n+" due to unbound types",c)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(t);var u=e.registeredClass.instancePrototype,l=u[t];return void 0===l||void 0===l.overloadTable&&l.className!==e.name&&l.argCount===r-2?(i.argCount=r-2,i.className=e.name,u[t]=i):(ut(u,t,n),u[t].overloadTable[r-2]=i),ke([],c,(function(i){var s=Et(n,i,e,a,o);return void 0===u[t].overloadTable?(s.argCount=r-2,u[t]=s):u[t].overloadTable[r-2]=s,[]})),[]}))},_embind_register_emval:function(e,t){Re(e,{name:t=Le(t),fromWireType:function(e){var t=Dt.toValue(e);return It(e),t},toWireType:function(e,t){return Dt.toHandle(t)},argPackAdvance:8,readValueFromPointer:be,destructorFunction:null})},_embind_register_enum:function(e,t,r,n){var i=We(r);function a(){}t=Le(t),a.values={},Re(e,{name:t,constructor:a,fromWireType:function(e){return this.constructor.values[e]},toWireType:function(e,t){return t.value},argPackAdvance:8,readValueFromPointer:Ot(t,i,n),destructorFunction:null}),lt(t,a)},_embind_register_enum_value:function(e,t,r){var n=Lt(e,"enum");t=Le(t);var i=n.constructor,a=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:Ce(n.name+"_"+t,(function(){}))}});i.values[r]=a,i[t]=a},_embind_register_float:function(e,t,r){var n=We(r);Re(e,{name:t=Le(t),fromWireType:function(e){return e},toWireType:function(e,t){if("number"!=typeof t&&"boolean"!=typeof t)throw new TypeError('Cannot convert "'+De(t)+'" to '+this.name);return t},argPackAdvance:8,readValueFromPointer:Mt(t,n),destructorFunction:null})},_embind_register_integer:function(e,t,r,n,i){t=Le(t),-1===i&&(i=4294967295);var a=We(r),o=e=>e;if(0===n){var s=32-8*r;o=e=>e<<s>>>s}var c=t.includes("unsigned"),u=(e,r)=>{if("number"!=typeof e&&"boolean"!=typeof e)throw new TypeError('Cannot convert "'+De(e)+'" to '+r);if(e<n||e>i)throw new TypeError('Passing a number "'+De(e)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+n+", "+i+"]!")};Re(e,{name:t,fromWireType:o,toWireType:c?function(e,t){return u(t,this.name),t>>>0}:function(e,t){return u(t,this.name),t},argPackAdvance:8,readValueFromPointer:Be(t,a,0!==n),destructorFunction:null})},_embind_register_memory_view:function(e,t,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][t];function i(e){var t=M,r=t[e>>=2],i=t[e+1];return new n(I,i,r)}Re(e,{name:r=Le(r),fromWireType:i,argPackAdvance:8,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},_embind_register_std_string:function(e,t){var r="std::string"===(t=Le(t));Re(e,{name:t,fromWireType:function(e){var t,n=M[e>>2];if(r)for(var i=e+4,a=0;a<=n;++a){var o=e+4+a;if(a==n||0==k[o]){var s=E(i,o-i);void 0===t?t=s:(t+=String.fromCharCode(0),t+=s),i=o+1}}else{var c=new Array(n);for(a=0;a<n;++a)c[a]=String.fromCharCode(k[e+4+a]);t=c.join("")}return _r(e),t},toWireType:function(e,t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var n="string"==typeof t;n||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||Ue("Cannot pass non-string to std::string");var i=(r&&n?()=>A(t):()=>t.length)(),a=hr(4+i+1);if(M[a>>2]=i,r&&n)C(t,a+4,i+1);else if(n)for(var o=0;o<i;++o){var s=t.charCodeAt(o);s>255&&(_r(a),Ue("String has UTF-16 code units that do not fit in 8 bits")),k[a+4+o]=s}else for(o=0;o<i;++o)k[a+4+o]=t[o];return null!==e&&e.push(_r,a),a},argPackAdvance:8,readValueFromPointer:be,destructorFunction:function(e){_r(e)}})},_embind_register_std_wstring:function(e,t,r){var n,i,a,o,s;r=Le(r),2===t?(n=N,i=j,o=G,a=()=>O,s=1):4===t&&(n=V,i=H,o=Y,a=()=>M,s=2),Re(e,{name:r,fromWireType:function(e){for(var r,i=M[e>>2],o=a(),c=e+4,u=0;u<=i;++u){var l=e+4+u*t;if(u==i||0==o[l>>s]){var f=n(c,l-c);void 0===r?r=f:(r+=String.fromCharCode(0),r+=f),c=l+t}}return _r(e),r},toWireType:function(e,n){"string"!=typeof n&&Ue("Cannot pass non-string to C++ string type "+r);var a=o(n),c=hr(4+a+t);return M[c>>2]=a>>s,i(n,c+4,a+t),null!==e&&e.push(_r,c),c},argPackAdvance:8,readValueFromPointer:be,destructorFunction:function(e){_r(e)}})},_embind_register_value_object:function(e,t,r,n,i,a){_e[e]={name:Le(t),rawConstructor:bt(r,n),rawDestructor:bt(i,a),fields:[]}},_embind_register_value_object_field:function(e,t,r,n,i,a,o,s,c,u){_e[e].fields.push({fieldName:Le(t),getterReturnType:r,getter:bt(n,i),getterContext:a,setterArgumentType:o,setter:bt(s,c),setterContext:u})},_embind_register_void:function(e,t){Re(e,{isVoid:!0,name:t=Le(t),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})},_emscripten_date_now:function(){return Date.now()},_emscripten_get_now_is_monotonic:function(){return!0},_emscripten_throw_longjmp:function(){throw 1/0},_emval_as:function(e,t,r){e=Dt.toValue(e),t=Lt(t,"emval::as");var n=[],i=Dt.toHandle(n);return L[r>>2]=i,t.toWireType(n,e)},_emval_call:function(e,t,r,n){e=Dt.toValue(e);for(var i=Ut(t,r),a=new Array(t),o=0;o<t;++o){var s=i[o];a[o]=s.readValueFromPointer(n),n+=s.argPackAdvance}var c=e.apply(void 0,a);return Dt.toHandle(c)},_emval_call_method:function(e,t,r,n,i){return(e=Wt[e])(t=Dt.toValue(t),r=Bt(r),function(e){var t=[];return L[e>>2]=Dt.toHandle(t),t}(n),i)},_emval_call_void_method:function(e,t,r,n){(e=Wt[e])(t=Dt.toValue(t),r=Bt(r),null,n)},_emval_decref:It,_emval_get_global:function(e){return 0===e?Dt.toHandle($t()):(e=Bt(e),Dt.toHandle($t()[e]))},_emval_get_method_caller:function(e,t){var r=Ut(e,t),n=r[0],i=n.name+"_$"+r.slice(1).map((function(e){return e.name})).join("_")+"$",a=jt[i];if(void 0!==a)return a;for(var o=["retType"],s=[n],c="",u=0;u<e-1;++u)c+=(0!==u?", ":"")+"arg"+u,o.push("argType"+u),s.push(r[1+u]);var l="return function "+Se("methodCaller_"+i)+"(handle, name, destructors, args) {\n",f=0;for(u=0;u<e-1;++u)l+=" var arg"+u+" = argType"+u+".readValueFromPointer(args"+(f?"+"+f:"")+");\n",f+=r[u+1].argPackAdvance;for(l+=" var rv = handle[name]("+c+");\n",u=0;u<e-1;++u)r[u+1].deleteObject&&(l+=" argType"+u+".deleteObject(arg"+u+");\n");n.isVoid||(l+=" return retType.toWireType(destructors, rv);\n"),l+="};\n",o.push(l);var d,m,g=xt(Function,o).apply(null,s);return d=g,m=Wt.length,Wt.push(d),a=m,jt[i]=a,a},_emval_get_module_property:function(e){return e=Bt(e),Dt.toHandle(i[e])},_emval_get_property:function(e,t){return e=Dt.toValue(e),t=Dt.toValue(t),Dt.toHandle(e[t])},_emval_incref:function(e){e>4&&(At[e].refcount+=1)},_emval_new_array:function(){return Dt.toHandle([])},_emval_new_cstring:function(e){return Dt.toHandle(Bt(e))},_emval_run_destructors:function(e){ye(Dt.toValue(e)),It(e)},_emval_take_value:function(e,t){var r=(e=Lt(e,"_emval_take_value")).readValueFromPointer(t);return Dt.toHandle(r)},abort:function(){se("native code called abort()")},emscripten_cancel_animation_frame:function(e){cancelAnimationFrame(e)},emscripten_get_now:Nt,emscripten_glActiveTexture:function(e){ur.activeTexture(e)},emscripten_glAttachShader:function(e,t){ur.attachShader(Gt.programs[e],Gt.shaders[t])},emscripten_glBindAttribLocation:function(e,t,r){ur.bindAttribLocation(Gt.programs[e],t,E(r))},emscripten_glBindBuffer:function(e,t){35051==e?ur.currentPixelPackBufferBinding=t:35052==e&&(ur.currentPixelUnpackBufferBinding=t),ur.bindBuffer(e,Gt.buffers[t])},emscripten_glBindFramebuffer:function(e,t){ur.bindFramebuffer(e,Gt.framebuffers[t])},emscripten_glBindRenderbuffer:function(e,t){ur.bindRenderbuffer(e,Gt.renderbuffers[t])},emscripten_glBindSampler:function(e,t){ur.bindSampler(e,Gt.samplers[t])},emscripten_glBindTexture:function(e,t){ur.bindTexture(e,Gt.textures[t])},emscripten_glBindVertexArray:function(e){ur.bindVertexArray(Gt.vaos[e])},emscripten_glBindVertexArrayOES:function(e){ur.bindVertexArray(Gt.vaos[e])},emscripten_glBlendColor:function(e,t,r,n){ur.blendColor(e,t,r,n)},emscripten_glBlendEquation:function(e){ur.blendEquation(e)},emscripten_glBlendFunc:function(e,t){ur.blendFunc(e,t)},emscripten_glBlitFramebuffer:function(e,t,r,n,i,a,o,s,c,u){ur.blitFramebuffer(e,t,r,n,i,a,o,s,c,u)},emscripten_glBufferData:function(e,t,r,n){Gt.currentContext.version>=2?r&&t?ur.bufferData(e,k,n,r,t):ur.bufferData(e,t,n):ur.bufferData(e,r?k.subarray(r,r+t):t,n)},emscripten_glBufferSubData:function(e,t,r,n){Gt.currentContext.version>=2?r&&ur.bufferSubData(e,t,k,n,r):ur.bufferSubData(e,t,k.subarray(n,n+r))},emscripten_glCheckFramebufferStatus:function(e){return ur.checkFramebufferStatus(e)},emscripten_glClear:function(e){ur.clear(e)},emscripten_glClearColor:function(e,t,r,n){ur.clearColor(e,t,r,n)},emscripten_glClearStencil:function(e){ur.clearStencil(e)},emscripten_glClientWaitSync:function(e,t,r,n){return ur.clientWaitSync(Gt.syncs[e],t,Vt(r,n))},emscripten_glColorMask:function(e,t,r,n){ur.colorMask(!!e,!!t,!!r,!!n)},emscripten_glCompileShader:function(e){ur.compileShader(Gt.shaders[e])},emscripten_glCompressedTexImage2D:function(e,t,r,n,i,a,o,s){Gt.currentContext.version>=2?ur.currentPixelUnpackBufferBinding||!o?ur.compressedTexImage2D(e,t,r,n,i,a,o,s):ur.compressedTexImage2D(e,t,r,n,i,a,k,s,o):ur.compressedTexImage2D(e,t,r,n,i,a,s?k.subarray(s,s+o):null)},emscripten_glCompressedTexSubImage2D:function(e,t,r,n,i,a,o,s,c){Gt.currentContext.version>=2?ur.currentPixelUnpackBufferBinding||!s?ur.compressedTexSubImage2D(e,t,r,n,i,a,o,s,c):ur.compressedTexSubImage2D(e,t,r,n,i,a,o,k,c,s):ur.compressedTexSubImage2D(e,t,r,n,i,a,o,c?k.subarray(c,c+s):null)},emscripten_glCopyBufferSubData:function(e,t,r,n,i){ur.copyBufferSubData(e,t,r,n,i)},emscripten_glCopyTexSubImage2D:function(e,t,r,n,i,a,o,s){ur.copyTexSubImage2D(e,t,r,n,i,a,o,s)},emscripten_glCreateProgram:function(){var e=Gt.getNewId(Gt.programs),t=ur.createProgram();return t.name=e,t.maxUniformLength=t.maxAttributeLength=t.maxUniformBlockNameLength=0,t.uniformIdCounter=1,Gt.programs[e]=t,e},emscripten_glCreateShader:function(e){var t=Gt.getNewId(Gt.shaders);return Gt.shaders[t]=ur.createShader(e),t},emscripten_glCullFace:function(e){ur.cullFace(e)},emscripten_glDeleteBuffers:function(e,t){for(var r=0;r<e;r++){var n=L[t+4*r>>2],i=Gt.buffers[n];i&&(ur.deleteBuffer(i),i.name=0,Gt.buffers[n]=null,n==ur.currentPixelPackBufferBinding&&(ur.currentPixelPackBufferBinding=0),n==ur.currentPixelUnpackBufferBinding&&(ur.currentPixelUnpackBufferBinding=0))}},emscripten_glDeleteFramebuffers:function(e,t){for(var r=0;r<e;++r){var n=L[t+4*r>>2],i=Gt.framebuffers[n];i&&(ur.deleteFramebuffer(i),i.name=0,Gt.framebuffers[n]=null)}},emscripten_glDeleteProgram:function(e){if(e){var t=Gt.programs[e];t?(ur.deleteProgram(t),t.name=0,Gt.programs[e]=null):Gt.recordError(1281)}},emscripten_glDeleteRenderbuffers:function(e,t){for(var r=0;r<e;r++){var n=L[t+4*r>>2],i=Gt.renderbuffers[n];i&&(ur.deleteRenderbuffer(i),i.name=0,Gt.renderbuffers[n]=null)}},emscripten_glDeleteSamplers:function(e,t){for(var r=0;r<e;r++){var n=L[t+4*r>>2],i=Gt.samplers[n];i&&(ur.deleteSampler(i),i.name=0,Gt.samplers[n]=null)}},emscripten_glDeleteShader:function(e){if(e){var t=Gt.shaders[e];t?(ur.deleteShader(t),Gt.shaders[e]=null):Gt.recordError(1281)}},emscripten_glDeleteSync:function(e){if(e){var t=Gt.syncs[e];t?(ur.deleteSync(t),t.name=0,Gt.syncs[e]=null):Gt.recordError(1281)}},emscripten_glDeleteTextures:function(e,t){for(var r=0;r<e;r++){var n=L[t+4*r>>2],i=Gt.textures[n];i&&(ur.deleteTexture(i),i.name=0,Gt.textures[n]=null)}},emscripten_glDeleteVertexArrays:function(e,t){for(var r=0;r<e;r++){var n=L[t+4*r>>2];ur.deleteVertexArray(Gt.vaos[n]),Gt.vaos[n]=null}},emscripten_glDeleteVertexArraysOES:function(e,t){for(var r=0;r<e;r++){var n=L[t+4*r>>2];ur.deleteVertexArray(Gt.vaos[n]),Gt.vaos[n]=null}},emscripten_glDepthMask:function(e){ur.depthMask(!!e)},emscripten_glDisable:function(e){ur.disable(e)},emscripten_glDisableVertexAttribArray:function(e){ur.disableVertexAttribArray(e)},emscripten_glDrawArrays:function(e,t,r){ur.drawArrays(e,t,r)},emscripten_glDrawArraysInstanced:function(e,t,r,n){ur.drawArraysInstanced(e,t,r,n)},emscripten_glDrawArraysInstancedBaseInstanceWEBGL:function(e,t,r,n,i){ur.dibvbi.drawArraysInstancedBaseInstanceWEBGL(e,t,r,n,i)},emscripten_glDrawBuffers:function(e,t){for(var r=Ht[e],n=0;n<e;n++)r[n]=L[t+4*n>>2];ur.drawBuffers(r)},emscripten_glDrawElements:function(e,t,r,n){ur.drawElements(e,t,r,n)},emscripten_glDrawElementsInstanced:function(e,t,r,n,i){ur.drawElementsInstanced(e,t,r,n,i)},emscripten_glDrawElementsInstancedBaseVertexBaseInstanceWEBGL:function(e,t,r,n,i,a,o){ur.dibvbi.drawElementsInstancedBaseVertexBaseInstanceWEBGL(e,t,r,n,i,a,o)},emscripten_glDrawRangeElements:function(e,t,r,n,i,a){!function(e,t,r,n){ur.drawElements(e,t,r,n)}(e,n,i,a)},emscripten_glEnable:function(e){ur.enable(e)},emscripten_glEnableVertexAttribArray:function(e){ur.enableVertexAttribArray(e)},emscripten_glFenceSync:function(e,t){var r=ur.fenceSync(e,t);if(r){var n=Gt.getNewId(Gt.syncs);return r.name=n,Gt.syncs[n]=r,n}return 0},emscripten_glFinish:function(){ur.finish()},emscripten_glFlush:function(){ur.flush()},emscripten_glFramebufferRenderbuffer:function(e,t,r,n){ur.framebufferRenderbuffer(e,t,r,Gt.renderbuffers[n])},emscripten_glFramebufferTexture2D:function(e,t,r,n,i){ur.framebufferTexture2D(e,t,r,Gt.textures[n],i)},emscripten_glFrontFace:function(e){ur.frontFace(e)},emscripten_glGenBuffers:function(e,t){Yt(e,t,"createBuffer",Gt.buffers)},emscripten_glGenFramebuffers:function(e,t){Yt(e,t,"createFramebuffer",Gt.framebuffers)},emscripten_glGenRenderbuffers:function(e,t){Yt(e,t,"createRenderbuffer",Gt.renderbuffers)},emscripten_glGenSamplers:function(e,t){Yt(e,t,"createSampler",Gt.samplers)},emscripten_glGenTextures:function(e,t){Yt(e,t,"createTexture",Gt.textures)},emscripten_glGenVertexArrays:function(e,t){Yt(e,t,"createVertexArray",Gt.vaos)},emscripten_glGenVertexArraysOES:function(e,t){Yt(e,t,"createVertexArray",Gt.vaos)},emscripten_glGenerateMipmap:function(e){ur.generateMipmap(e)},emscripten_glGetBufferParameteriv:function(e,t,r){r?L[r>>2]=ur.getBufferParameter(e,t):Gt.recordError(1281)},emscripten_glGetError:function(){var e=ur.getError()||Gt.lastError;return Gt.lastError=0,e},emscripten_glGetFloatv:function(e,t){Jt(e,t,2)},emscripten_glGetFramebufferAttachmentParameteriv:function(e,t,r,n){var i=ur.getFramebufferAttachmentParameter(e,t,r);(i instanceof WebGLRenderbuffer||i instanceof WebGLTexture)&&(i=0|i.name),L[n>>2]=i},emscripten_glGetIntegerv:function(e,t){Jt(e,t,0)},emscripten_glGetProgramInfoLog:function(e,t,r,n){var i=ur.getProgramInfoLog(Gt.programs[e]);null===i&&(i="(unknown error)");var a=t>0&&n?C(i,n,t):0;r&&(L[r>>2]=a)},emscripten_glGetProgramiv:function(e,t,r){if(r)if(e>=Gt.counter)Gt.recordError(1281);else if(e=Gt.programs[e],35716==t){var n=ur.getProgramInfoLog(e);null===n&&(n="(unknown error)"),L[r>>2]=n.length+1}else if(35719==t){if(!e.maxUniformLength)for(var i=0;i<ur.getProgramParameter(e,35718);++i)e.maxUniformLength=Math.max(e.maxUniformLength,ur.getActiveUniform(e,i).name.length+1);L[r>>2]=e.maxUniformLength}else if(35722==t){if(!e.maxAttributeLength)for(i=0;i<ur.getProgramParameter(e,35721);++i)e.maxAttributeLength=Math.max(e.maxAttributeLength,ur.getActiveAttrib(e,i).name.length+1);L[r>>2]=e.maxAttributeLength}else if(35381==t){if(!e.maxUniformBlockNameLength)for(i=0;i<ur.getProgramParameter(e,35382);++i)e.maxUniformBlockNameLength=Math.max(e.maxUniformBlockNameLength,ur.getActiveUniformBlockName(e,i).length+1);L[r>>2]=e.maxUniformBlockNameLength}else L[r>>2]=ur.getProgramParameter(e,t);else Gt.recordError(1281)},emscripten_glGetRenderbufferParameteriv:function(e,t,r){r?L[r>>2]=ur.getRenderbufferParameter(e,t):Gt.recordError(1281)},emscripten_glGetShaderInfoLog:function(e,t,r,n){var i=ur.getShaderInfoLog(Gt.shaders[e]);null===i&&(i="(unknown error)");var a=t>0&&n?C(i,n,t):0;r&&(L[r>>2]=a)},emscripten_glGetShaderPrecisionFormat:function(e,t,r,n){var i=ur.getShaderPrecisionFormat(e,t);L[r>>2]=i.rangeMin,L[r+4>>2]=i.rangeMax,L[n>>2]=i.precision},emscripten_glGetShaderiv:function(e,t,r){if(r)if(35716==t){var n=ur.getShaderInfoLog(Gt.shaders[e]);null===n&&(n="(unknown error)");var i=n?n.length+1:0;L[r>>2]=i}else if(35720==t){var a=ur.getShaderSource(Gt.shaders[e]),o=a?a.length+1:0;L[r>>2]=o}else L[r>>2]=ur.getShaderParameter(Gt.shaders[e],t);else Gt.recordError(1281)},emscripten_glGetString:function(e){var t=Gt.stringCache[e];if(!t){switch(e){case 7939:var r=ur.getSupportedExtensions()||[];t=qt((r=r.concat(r.map((function(e){return"GL_"+e})))).join(" "));break;case 7936:case 7937:case 37445:case 37446:var n=ur.getParameter(e);n||Gt.recordError(1280),t=n&&qt(n);break;case 7938:var i=ur.getParameter(7938);t=qt(i=Gt.currentContext.version>=2?"OpenGL ES 3.0 ("+i+")":"OpenGL ES 2.0 ("+i+")");break;case 35724:var a=ur.getParameter(35724),o=a.match(/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/);null!==o&&(3==o[1].length&&(o[1]=o[1]+"0"),a="OpenGL ES GLSL ES "+o[1]+" ("+a+")"),t=qt(a);break;default:Gt.recordError(1280)}Gt.stringCache[e]=t}return t},emscripten_glGetStringi:function(e,t){if(Gt.currentContext.version<2)return Gt.recordError(1282),0;var r=Gt.stringiCache[e];if(r)return t<0||t>=r.length?(Gt.recordError(1281),0):r[t];if(7939===e){var n=ur.getSupportedExtensions()||[];return n=(n=n.concat(n.map((function(e){return"GL_"+e})))).map((function(e){return qt(e)})),r=Gt.stringiCache[e]=n,t<0||t>=r.length?(Gt.recordError(1281),0):r[t]}return Gt.recordError(1280),0},emscripten_glGetUniformLocation:function(e,t){if(t=E(t),e=Gt.programs[e]){!function(e){var t,r,n=e.uniformLocsById,i=e.uniformSizeAndIdsByName;if(!n)for(e.uniformLocsById=n={},e.uniformArrayNamesById={},t=0;t<ur.getProgramParameter(e,35718);++t){var a=ur.getActiveUniform(e,t),o=a.name,s=a.size,c=Zt(o),u=c>0?o.slice(0,c):o,l=e.uniformIdCounter;for(e.uniformIdCounter+=s,i[u]=[s,l],r=0;r<s;++r)n[l]=r,e.uniformArrayNamesById[l++]=u}}(e);var r=e.uniformLocsById,n=0,i=t,a=Zt(t);a>0&&(s=t.slice(a+1),n=parseInt(s)>>>0,i=t.slice(0,a));var o=e.uniformSizeAndIdsByName[i];if(o&&n<o[0]&&(r[n+=o[1]]=r[n]||ur.getUniformLocation(e,t)))return n}else Gt.recordError(1281);var s;return-1},emscripten_glInvalidateFramebuffer:function(e,t,r){for(var n=Ht[t],i=0;i<t;i++)n[i]=L[r+4*i>>2];ur.invalidateFramebuffer(e,n)},emscripten_glInvalidateSubFramebuffer:function(e,t,r,n,i,a,o){for(var s=Ht[t],c=0;c<t;c++)s[c]=L[r+4*c>>2];ur.invalidateSubFramebuffer(e,s,n,i,a,o)},emscripten_glIsSync:function(e){return ur.isSync(Gt.syncs[e])},emscripten_glIsTexture:function(e){var t=Gt.textures[e];return t?ur.isTexture(t):0},emscripten_glLineWidth:function(e){ur.lineWidth(e)},emscripten_glLinkProgram:function(e){e=Gt.programs[e],ur.linkProgram(e),e.uniformLocsById=0,e.uniformSizeAndIdsByName={}},emscripten_glMultiDrawArraysInstancedBaseInstanceWEBGL:function(e,t,r,n,i,a){ur.mdibvbi.multiDrawArraysInstancedBaseInstanceWEBGL(e,L,t>>2,L,r>>2,L,n>>2,M,i>>2,a)},emscripten_glMultiDrawElementsInstancedBaseVertexBaseInstanceWEBGL:function(e,t,r,n,i,a,o,s){ur.mdibvbi.multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL(e,L,t>>2,r,L,n>>2,L,i>>2,L,a>>2,M,o>>2,s)},emscripten_glPixelStorei:function(e,t){3317==e&&(Gt.unpackAlignment=t),ur.pixelStorei(e,t)},emscripten_glReadBuffer:function(e){ur.readBuffer(e)},emscripten_glReadPixels:function(e,t,r,n,i,a,o){if(Gt.currentContext.version>=2)if(ur.currentPixelPackBufferBinding)ur.readPixels(e,t,r,n,i,a,o);else{var s=Kt(a);ur.readPixels(e,t,r,n,i,a,s,o>>Qt(s))}else{var c=Xt(a,i,r,n,o);c?ur.readPixels(e,t,r,n,i,a,c):Gt.recordError(1280)}},emscripten_glRenderbufferStorage:function(e,t,r,n){ur.renderbufferStorage(e,t,r,n)},emscripten_glRenderbufferStorageMultisample:function(e,t,r,n,i){ur.renderbufferStorageMultisample(e,t,r,n,i)},emscripten_glSamplerParameterf:function(e,t,r){ur.samplerParameterf(Gt.samplers[e],t,r)},emscripten_glSamplerParameteri:function(e,t,r){ur.samplerParameteri(Gt.samplers[e],t,r)},emscripten_glSamplerParameteriv:function(e,t,r){var n=L[r>>2];ur.samplerParameteri(Gt.samplers[e],t,n)},emscripten_glScissor:function(e,t,r,n){ur.scissor(e,t,r,n)},emscripten_glShaderSource:function(e,t,r,n){var i=Gt.getSource(e,t,r,n);ur.shaderSource(Gt.shaders[e],i)},emscripten_glStencilFunc:function(e,t,r){ur.stencilFunc(e,t,r)},emscripten_glStencilFuncSeparate:function(e,t,r,n){ur.stencilFuncSeparate(e,t,r,n)},emscripten_glStencilMask:function(e){ur.stencilMask(e)},emscripten_glStencilMaskSeparate:function(e,t){ur.stencilMaskSeparate(e,t)},emscripten_glStencilOp:function(e,t,r){ur.stencilOp(e,t,r)},emscripten_glStencilOpSeparate:function(e,t,r,n){ur.stencilOpSeparate(e,t,r,n)},emscripten_glTexImage2D:function(e,t,r,n,i,a,o,s,c){if(Gt.currentContext.version>=2)if(ur.currentPixelUnpackBufferBinding)ur.texImage2D(e,t,r,n,i,a,o,s,c);else if(c){var u=Kt(s);ur.texImage2D(e,t,r,n,i,a,o,s,u,c>>Qt(u))}else ur.texImage2D(e,t,r,n,i,a,o,s,null);else ur.texImage2D(e,t,r,n,i,a,o,s,c?Xt(s,o,n,i,c):null)},emscripten_glTexParameterf:function(e,t,r){ur.texParameterf(e,t,r)},emscripten_glTexParameterfv:function(e,t,r){var n=U[r>>2];ur.texParameterf(e,t,n)},emscripten_glTexParameteri:function(e,t,r){ur.texParameteri(e,t,r)},emscripten_glTexParameteriv:function(e,t,r){var n=L[r>>2];ur.texParameteri(e,t,n)},emscripten_glTexStorage2D:function(e,t,r,n,i){ur.texStorage2D(e,t,r,n,i)},emscripten_glTexSubImage2D:function(e,t,r,n,i,a,o,s,c){if(Gt.currentContext.version>=2)if(ur.currentPixelUnpackBufferBinding)ur.texSubImage2D(e,t,r,n,i,a,o,s,c);else if(c){var u=Kt(s);ur.texSubImage2D(e,t,r,n,i,a,o,s,u,c>>Qt(u))}else ur.texSubImage2D(e,t,r,n,i,a,o,s,null);else{var l=null;c&&(l=Xt(s,o,i,a,c)),ur.texSubImage2D(e,t,r,n,i,a,o,s,l)}},emscripten_glUniform1f:function(e,t){ur.uniform1f(er(e),t)},emscripten_glUniform1fv:function(e,t,r){if(Gt.currentContext.version>=2)t&&ur.uniform1fv(er(e),U,r>>2,t);else{if(t<=288)for(var n=tr[t-1],i=0;i<t;++i)n[i]=U[r+4*i>>2];else n=U.subarray(r>>2,r+4*t>>2);ur.uniform1fv(er(e),n)}},emscripten_glUniform1i:function(e,t){ur.uniform1i(er(e),t)},emscripten_glUniform1iv:function(e,t,r){if(Gt.currentContext.version>=2)t&&ur.uniform1iv(er(e),L,r>>2,t);else{if(t<=288)for(var n=rr[t-1],i=0;i<t;++i)n[i]=L[r+4*i>>2];else n=L.subarray(r>>2,r+4*t>>2);ur.uniform1iv(er(e),n)}},emscripten_glUniform2f:function(e,t,r){ur.uniform2f(er(e),t,r)},emscripten_glUniform2fv:function(e,t,r){if(Gt.currentContext.version>=2)t&&ur.uniform2fv(er(e),U,r>>2,2*t);else{if(t<=144)for(var n=tr[2*t-1],i=0;i<2*t;i+=2)n[i]=U[r+4*i>>2],n[i+1]=U[r+(4*i+4)>>2];else n=U.subarray(r>>2,r+8*t>>2);ur.uniform2fv(er(e),n)}},emscripten_glUniform2i:function(e,t,r){ur.uniform2i(er(e),t,r)},emscripten_glUniform2iv:function(e,t,r){if(Gt.currentContext.version>=2)t&&ur.uniform2iv(er(e),L,r>>2,2*t);else{if(t<=144)for(var n=rr[2*t-1],i=0;i<2*t;i+=2)n[i]=L[r+4*i>>2],n[i+1]=L[r+(4*i+4)>>2];else n=L.subarray(r>>2,r+8*t>>2);ur.uniform2iv(er(e),n)}},emscripten_glUniform3f:function(e,t,r,n){ur.uniform3f(er(e),t,r,n)},emscripten_glUniform3fv:function(e,t,r){if(Gt.currentContext.version>=2)t&&ur.uniform3fv(er(e),U,r>>2,3*t);else{if(t<=96)for(var n=tr[3*t-1],i=0;i<3*t;i+=3)n[i]=U[r+4*i>>2],n[i+1]=U[r+(4*i+4)>>2],n[i+2]=U[r+(4*i+8)>>2];else n=U.subarray(r>>2,r+12*t>>2);ur.uniform3fv(er(e),n)}},emscripten_glUniform3i:function(e,t,r,n){ur.uniform3i(er(e),t,r,n)},emscripten_glUniform3iv:function(e,t,r){if(Gt.currentContext.version>=2)t&&ur.uniform3iv(er(e),L,r>>2,3*t);else{if(t<=96)for(var n=rr[3*t-1],i=0;i<3*t;i+=3)n[i]=L[r+4*i>>2],n[i+1]=L[r+(4*i+4)>>2],n[i+2]=L[r+(4*i+8)>>2];else n=L.subarray(r>>2,r+12*t>>2);ur.uniform3iv(er(e),n)}},emscripten_glUniform4f:function(e,t,r,n,i){ur.uniform4f(er(e),t,r,n,i)},emscripten_glUniform4fv:function(e,t,r){if(Gt.currentContext.version>=2)t&&ur.uniform4fv(er(e),U,r>>2,4*t);else{if(t<=72){var n=tr[4*t-1],i=U;r>>=2;for(var a=0;a<4*t;a+=4){var o=r+a;n[a]=i[o],n[a+1]=i[o+1],n[a+2]=i[o+2],n[a+3]=i[o+3]}}else n=U.subarray(r>>2,r+16*t>>2);ur.uniform4fv(er(e),n)}},emscripten_glUniform4i:function(e,t,r,n,i){ur.uniform4i(er(e),t,r,n,i)},emscripten_glUniform4iv:function(e,t,r){if(Gt.currentContext.version>=2)t&&ur.uniform4iv(er(e),L,r>>2,4*t);else{if(t<=72)for(var n=rr[4*t-1],i=0;i<4*t;i+=4)n[i]=L[r+4*i>>2],n[i+1]=L[r+(4*i+4)>>2],n[i+2]=L[r+(4*i+8)>>2],n[i+3]=L[r+(4*i+12)>>2];else n=L.subarray(r>>2,r+16*t>>2);ur.uniform4iv(er(e),n)}},emscripten_glUniformMatrix2fv:function(e,t,r,n){if(Gt.currentContext.version>=2)t&&ur.uniformMatrix2fv(er(e),!!r,U,n>>2,4*t);else{if(t<=72)for(var i=tr[4*t-1],a=0;a<4*t;a+=4)i[a]=U[n+4*a>>2],i[a+1]=U[n+(4*a+4)>>2],i[a+2]=U[n+(4*a+8)>>2],i[a+3]=U[n+(4*a+12)>>2];else i=U.subarray(n>>2,n+16*t>>2);ur.uniformMatrix2fv(er(e),!!r,i)}},emscripten_glUniformMatrix3fv:function(e,t,r,n){if(Gt.currentContext.version>=2)t&&ur.uniformMatrix3fv(er(e),!!r,U,n>>2,9*t);else{if(t<=32)for(var i=tr[9*t-1],a=0;a<9*t;a+=9)i[a]=U[n+4*a>>2],i[a+1]=U[n+(4*a+4)>>2],i[a+2]=U[n+(4*a+8)>>2],i[a+3]=U[n+(4*a+12)>>2],i[a+4]=U[n+(4*a+16)>>2],i[a+5]=U[n+(4*a+20)>>2],i[a+6]=U[n+(4*a+24)>>2],i[a+7]=U[n+(4*a+28)>>2],i[a+8]=U[n+(4*a+32)>>2];else i=U.subarray(n>>2,n+36*t>>2);ur.uniformMatrix3fv(er(e),!!r,i)}},emscripten_glUniformMatrix4fv:function(e,t,r,n){if(Gt.currentContext.version>=2)t&&ur.uniformMatrix4fv(er(e),!!r,U,n>>2,16*t);else{if(t<=18){var i=tr[16*t-1],a=U;n>>=2;for(var o=0;o<16*t;o+=16){var s=n+o;i[o]=a[s],i[o+1]=a[s+1],i[o+2]=a[s+2],i[o+3]=a[s+3],i[o+4]=a[s+4],i[o+5]=a[s+5],i[o+6]=a[s+6],i[o+7]=a[s+7],i[o+8]=a[s+8],i[o+9]=a[s+9],i[o+10]=a[s+10],i[o+11]=a[s+11],i[o+12]=a[s+12],i[o+13]=a[s+13],i[o+14]=a[s+14],i[o+15]=a[s+15]}}else i=U.subarray(n>>2,n+64*t>>2);ur.uniformMatrix4fv(er(e),!!r,i)}},emscripten_glUseProgram:function(e){e=Gt.programs[e],ur.useProgram(e),ur.currentProgram=e},emscripten_glVertexAttrib1f:function(e,t){ur.vertexAttrib1f(e,t)},emscripten_glVertexAttrib2fv:function(e,t){ur.vertexAttrib2f(e,U[t>>2],U[t+4>>2])},emscripten_glVertexAttrib3fv:function(e,t){ur.vertexAttrib3f(e,U[t>>2],U[t+4>>2],U[t+8>>2])},emscripten_glVertexAttrib4fv:function(e,t){ur.vertexAttrib4f(e,U[t>>2],U[t+4>>2],U[t+8>>2],U[t+12>>2])},emscripten_glVertexAttribDivisor:function(e,t){ur.vertexAttribDivisor(e,t)},emscripten_glVertexAttribIPointer:function(e,t,r,n,i){ur.vertexAttribIPointer(e,t,r,n,i)},emscripten_glVertexAttribPointer:function(e,t,r,n,i,a){ur.vertexAttribPointer(e,t,r,!!n,i,a)},emscripten_glViewport:function(e,t,r,n){ur.viewport(e,t,r,n)},emscripten_glWaitSync:function(e,t,r,n){ur.waitSync(Gt.syncs[e],t,Vt(r,n))},emscripten_memcpy_big:function(e,t,r){k.copyWithin(e,t,t+r)},emscripten_request_animation_frame:function(e,t){return requestAnimationFrame((function(r){he(e)(r,t)}))},emscripten_resize_heap:function(e){var t=k.length;T((e>>>=0)>t);var r,n,i=2147483648;if(e>i)return d("Cannot enlarge memory, asked to go up to "+e+" bytes, but the limit is "+i+" bytes!"),!1;for(var a=1;a<=4;a*=2){var o=t*(1+.2/a);o=Math.min(o,e+100663296);var s=Math.min(i,(r=Math.max(e,o))+((n=65536)-r%n)%n);if(nr(s))return!0}return d("Failed to grow the heap from "+t+" bytes to "+s+" bytes, not enough memory!"),!1},emscripten_webgl_make_context_current:function(e){return Gt.makeContextCurrent(e)?0:-5},environ_get:function(e,t){var r=0;return ar().forEach((function(n,i){var a=t+r;L[e+4*i>>2]=a,function(e,t,r){for(var n=0;n<e.length;++n)T(e.charCodeAt(n)===(255&e.charCodeAt(n))),F[t++>>0]=e.charCodeAt(n);r||(F[t>>0]=0)}(n,a),r+=n.length+1})),0},environ_sizes_get:function(e,t){var r=ar();L[e>>2]=r.length;var n=0;return r.forEach((function(e){n+=e.length+1})),L[t>>2]=n,0},fd_close:function(e){se("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM")},fd_seek:function(e,t,r,n){return 70},fd_write:function(e,t,r,n){for(var i=0,a=0;a<r;a++){var o=M[t>>2],s=M[t+4>>2];t+=8;for(var c=0;c<s;c++)sr(e,k[o+c]);i+=s}return L[n>>2]=i,0},getTempRet0:function(){return b},glBindFramebuffer:function(e,t){ur.bindFramebuffer(e,Gt.framebuffers[t])},glClear:function(e){ur.clear(e)},glClearColor:function(e,t,r,n){ur.clearColor(e,t,r,n)},glClearStencil:function(e){ur.clearStencil(e)},glGetIntegerv:function(e,t){Jt(e,t,0)},invoke_ii:function(e,t){var r=xr();try{return he(e)(t)}catch(e){if(Er(r),e!==e+0)throw e;br(1,0)}},invoke_iii:function(e,t,r){var n=xr();try{return he(e)(t,r)}catch(e){if(Er(n),e!==e+0)throw e;br(1,0)}},invoke_iiii:function(e,t,r,n){var i=xr();try{return he(e)(t,r,n)}catch(e){if(Er(i),e!==e+0)throw e;br(1,0)}},invoke_iiiii:function(e,t,r,n,i){var a=xr();try{return he(e)(t,r,n,i)}catch(e){if(Er(a),e!==e+0)throw e;br(1,0)}},invoke_v:function(e){var t=xr();try{he(e)()}catch(e){if(Er(t),e!==e+0)throw e;br(1,0)}},invoke_vi:function(e,t){var r=xr();try{he(e)(t)}catch(e){if(Er(r),e!==e+0)throw e;br(1,0)}},invoke_vii:function(e,t,r){var n=xr();try{he(e)(t,r)}catch(e){if(Er(n),e!==e+0)throw e;br(1,0)}},invoke_viii:function(e,t,r,n){var i=xr();try{he(e)(t,r,n)}catch(e){if(Er(i),e!==e+0)throw e;br(1,0)}},invoke_viiii:function(e,t,r,n,i){var a=xr();try{he(e)(t,r,n,i)}catch(e){if(Er(a),e!==e+0)throw e;br(1,0)}},invoke_viiiii:function(e,t,r,n,i,a){var o=xr();try{he(e)(t,r,n,i,a)}catch(e){if(Er(o),e!==e+0)throw e;br(1,0)}},invoke_viiiiii:function(e,t,r,n,i,a,o){var s=xr();try{he(e)(t,r,n,i,a,o)}catch(e){if(Er(s),e!==e+0)throw e;br(1,0)}},invoke_viiiiiiiii:function(e,t,r,n,i,a,o,s,c,u){var l=xr();try{he(e)(t,r,n,i,a,o,s,c,u)}catch(e){if(Er(l),e!==e+0)throw e;br(1,0)}},setTempRet0:function(e){b=e},strftime_l:function(e,t,r,n){return dr(e,t,r,n)}};!function(){var e,t={env:vr,wasi_snapshot_preview1:vr};function r(e,t){var r,n=e.exports;i.asm=n,T(y=i.asm.memory,"memory not found in wasm exports"),z(y.buffer),T(q=i.asm.__indirect_function_table,"table not found in wasm exports"),r=i.asm.__wasm_call_ctors,ee.unshift(r),function(e){if(ne--,i.monitorRunDependencies&&i.monitorRunDependencies(ne),e?(T(oe[e]),delete oe[e]):d("warning: run dependency removed without ID"),0==ne&&(null!==ie&&(clearInterval(ie),ie=null),ae)){var t=ae;ae=null,t()}}("wasm-instantiate")}e="wasm-instantiate",ne++,i.monitorRunDependencies&&i.monitorRunDependencies(ne),e?(T(!oe[e]),oe[e]=1,null===ie&&"undefined"!=typeof setInterval&&(ie=setInterval((function(){if(w)return clearInterval(ie),void(ie=null);var e=!1;for(var t in oe)e||(e=!0,d("still waiting on run dependencies:")),d("dependency: "+t);e&&d("(end of list)")}),1e4))):d("warning: run dependency added without ID");var a=i;function o(e){T(i===a,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),a=null,r(e.instance)}function c(e){return(!_&&s&&"function"==typeof fetch?fetch(ue,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+ue+"'";return e.arrayBuffer()})).catch((function(){return ge(ue)})):Promise.resolve().then((function(){return ge(ue)}))).then((function(e){return WebAssembly.instantiate(e,t)})).then((function(e){return e})).then(e,(function(e){d("failed to asynchronously prepare wasm: "+e),ue.startsWith("file://")&&d("warning: Loading from a file URI ("+ue+") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing"),se(e)}))}if(i.instantiateWasm)try{return i.instantiateWasm(t,r)}catch(e){return d("Module.instantiateWasm callback failed with error: "+e),!1}(_||"function"!=typeof WebAssembly.instantiateStreaming||de(ue)||"function"!=typeof fetch?c(o):fetch(ue,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,t).then(o,(function(e){return d("wasm streaming compile failed: "+e),d("falling back to ArrayBuffer instantiation"),c(o)}))}))).catch(n)}(),i.___wasm_call_ctors=me("__wasm_call_ctors");var hr=i._malloc=me("malloc"),_r=i._free=me("free");i.___errno_location=me("__errno_location"),i._saveSetjmp=me("saveSetjmp");var yr=i.___getTypeName=me("__getTypeName");i.___embind_register_native_and_builtin_types=me("__embind_register_native_and_builtin_types"),i.___stdio_exit=me("__stdio_exit"),i.___dl_seterr=me("__dl_seterr");var br=i._setThrew=me("setThrew"),wr=i._emscripten_stack_init=function(){return(wr=i._emscripten_stack_init=i.asm.emscripten_stack_init).apply(null,arguments)};i._emscripten_stack_get_free=function(){return(i._emscripten_stack_get_free=i.asm.emscripten_stack_get_free).apply(null,arguments)},i._emscripten_stack_get_base=function(){return(i._emscripten_stack_get_base=i.asm.emscripten_stack_get_base).apply(null,arguments)};var Tr,Pr=i._emscripten_stack_get_end=function(){return(Pr=i._emscripten_stack_get_end=i.asm.emscripten_stack_get_end).apply(null,arguments)},xr=i.stackSave=me("stackSave"),Er=i.stackRestore=me("stackRestore");function Sr(e){function t(){Tr||(Tr=!0,i.calledRun=!0,w||(Q(),T(!re),re=!0,pe(ee),r(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),T(!i._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),function(){if(Q(),i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;)e=i.postRun.shift(),te.unshift(e);var e;pe(te)}()))}ne>0||(wr(),K(),function(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)e=i.preRun.shift(),X.unshift(e);var e;pe(X)}(),ne>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),t()}),1)):t(),Q()))}if(i.stackAlloc=me("stackAlloc"),h("ccall",!1),h("cwrap",!1),h("setValue",!1),h("getValue",!1),h("allocate",!1),h("UTF8ArrayToString",!1),h("UTF8ToString",!1),h("stringToUTF8Array",!1),h("stringToUTF8",!1),h("lengthBytesUTF8",!1),h("addOnPreRun",!1),h("addOnInit",!1),h("addOnPreMain",!1),h("addOnExit",!1),h("addOnPostRun",!1),h("addRunDependency",!0),h("removeRunDependency",!0),h("FS_createFolder",!1),h("FS_createPath",!0),h("FS_createDataFile",!0),h("FS_createPreloadedFile",!0),h("FS_createLazyFile",!0),h("FS_createLink",!1),h("FS_createDevice",!0),h("FS_unlink",!0),h("getLEB",!1),h("getFunctionTables",!1),h("alignFunctionTables",!1),h("registerFunctions",!1),h("addFunction",!1),h("removeFunction",!1),h("prettyPrint",!1),h("getCompilerSetting",!1),h("print",!1),h("printErr",!1),h("getTempRet0",!1),h("setTempRet0",!1),h("callMain",!1),h("abort",!1),h("keepRuntimeAlive",!1),h("wasmMemory",!1),h("warnOnce",!1),h("stackSave",!1),h("stackRestore",!1),h("stackAlloc",!1),h("AsciiToString",!1),h("stringToAscii",!1),h("UTF16ToString",!1),h("stringToUTF16",!1),h("lengthBytesUTF16",!1),h("UTF32ToString",!1),h("stringToUTF32",!1),h("lengthBytesUTF32",!1),h("allocateUTF8",!1),h("allocateUTF8OnStack",!1),h("ExitStatus",!1),h("intArrayFromString",!1),h("intArrayToString",!1),h("writeStringToMemory",!1),h("writeArrayToMemory",!1),h("writeAsciiToMemory",!1),i.writeStackCookie=K,i.checkStackCookie=Q,h("ptrToString",!1),h("zeroMemory",!1),h("stringToNewUTF8",!1),h("emscripten_realloc_buffer",!1),h("ENV",!1),h("ERRNO_CODES",!1),h("ERRNO_MESSAGES",!1),h("setErrNo",!1),h("inetPton4",!1),h("inetNtop4",!1),h("inetPton6",!1),h("inetNtop6",!1),h("readSockaddr",!1),h("writeSockaddr",!1),h("DNS",!1),h("getHostByName",!1),h("Protocols",!1),h("Sockets",!1),h("getRandomDevice",!1),h("traverseStack",!1),h("UNWIND_CACHE",!1),h("convertPCtoSourceLocation",!1),h("readAsmConstArgsArray",!1),h("readAsmConstArgs",!1),h("mainThreadEM_ASM",!1),h("jstoi_q",!1),h("jstoi_s",!1),h("getExecutableName",!1),h("listenOnce",!1),h("autoResumeAudioContext",!1),h("dynCall",!1),h("handleException",!1),h("runtimeKeepalivePush",!1),h("runtimeKeepalivePop",!1),h("callUserCallback",!1),h("maybeExit",!1),h("safeSetTimeout",!1),h("asmjsMangle",!1),h("asyncLoad",!1),h("alignMemory",!1),h("mmapAlloc",!1),h("reallyNegative",!1),h("unSign",!1),h("reSign",!1),h("formatString",!1),h("PATH",!1),h("PATH_FS",!1),h("SYSCALLS",!1),h("getSocketFromFD",!1),h("getSocketAddress",!1),h("JSEvents",!1),h("registerKeyEventCallback",!1),h("specialHTMLTargets",!1),h("maybeCStringToJsString",!1),h("findEventTarget",!1),h("findCanvasEventTarget",!1),h("getBoundingClientRect",!1),h("fillMouseEventData",!1),h("registerMouseEventCallback",!1),h("registerWheelEventCallback",!1),h("registerUiEventCallback",!1),h("registerFocusEventCallback",!1),h("fillDeviceOrientationEventData",!1),h("registerDeviceOrientationEventCallback",!1),h("fillDeviceMotionEventData",!1),h("registerDeviceMotionEventCallback",!1),h("screenOrientation",!1),h("fillOrientationChangeEventData",!1),h("registerOrientationChangeEventCallback",!1),h("fillFullscreenChangeEventData",!1),h("registerFullscreenChangeEventCallback",!1),h("registerRestoreOldStyle",!1),h("hideEverythingExceptGivenElement",!1),h("restoreHiddenElements",!1),h("setLetterbox",!1),h("currentFullscreenStrategy",!1),h("restoreOldWindowedStyle",!1),h("softFullscreenResizeWebGLRenderTarget",!1),h("doRequestFullscreen",!1),h("fillPointerlockChangeEventData",!1),h("registerPointerlockChangeEventCallback",!1),h("registerPointerlockErrorEventCallback",!1),h("requestPointerLock",!1),h("fillVisibilityChangeEventData",!1),h("registerVisibilityChangeEventCallback",!1),h("registerTouchEventCallback",!1),h("fillGamepadEventData",!1),h("registerGamepadEventCallback",!1),h("registerBeforeUnloadEventCallback",!1),h("fillBatteryEventData",!1),h("battery",!1),h("registerBatteryEventCallback",!1),h("setCanvasElementSize",!1),h("getCanvasElementSize",!1),h("demangle",!1),h("demangleAll",!1),h("jsStackTrace",!1),h("stackTrace",!1),h("getEnvStrings",!1),h("checkWasiClock",!1),h("flush_NO_FILESYSTEM",!1),h("writeI53ToI64",!1),h("writeI53ToI64Clamped",!1),h("writeI53ToI64Signaling",!1),h("writeI53ToU64Clamped",!1),h("writeI53ToU64Signaling",!1),h("readI53FromI64",!1),h("readI53FromU64",!1),h("convertI32PairToI53",!1),h("convertU32PairToI53",!1),h("setImmediateWrapped",!1),h("clearImmediateWrapped",!1),h("polyfillSetImmediate",!1),h("Browser",!1),h("setMainLoop",!1),h("wget",!1),h("tempFixedLengthArray",!1),h("miniTempWebGLFloatBuffers",!1),h("heapObjectForWebGLType",!1),h("heapAccessShiftForWebGLHeap",!1),i.GL=Gt,h("emscriptenWebGLGet",!1),h("computeUnpackAlignedImageSize",!1),h("emscriptenWebGLGetTexPixelData",!1),h("emscriptenWebGLGetUniform",!1),h("webglGetUniformLocation",!1),h("webglPrepareUniformLocationsBeforeFirstUse",!1),h("webglGetLeftBracePos",!1),h("emscriptenWebGLGetVertexAttrib",!1),h("emscriptenWebGLGetIndexed",!1),h("Fetch",!1),h("fetchDeleteCachedData",!1),h("fetchLoadCachedData",!1),h("fetchCacheData",!1),h("fetchXHR",!1),h("InternalError",!1),h("BindingError",!1),h("UnboundTypeError",!1),h("PureVirtualError",!1),h("init_embind",!1),h("throwInternalError",!1),h("throwBindingError",!1),h("throwUnboundTypeError",!1),h("ensureOverloadTable",!1),h("exposePublicSymbol",!1),h("replacePublicSymbol",!1),h("extendError",!1),h("createNamedFunction",!1),h("registeredInstances",!1),h("getBasestPointer",!1),h("registerInheritedInstance",!1),h("unregisterInheritedInstance",!1),h("getInheritedInstance",!1),h("getInheritedInstanceCount",!1),h("getLiveInheritedInstances",!1),h("registeredTypes",!1),h("awaitingDependencies",!1),h("typeDependencies",!1),h("registeredPointers",!1),h("registerType",!1),h("whenDependentTypesAreResolved",!1),h("embind_charCodes",!1),h("embind_init_charCodes",!1),h("readLatin1String",!1),h("getTypeName",!1),h("heap32VectorToArray",!1),h("requireRegisteredType",!1),h("getShiftFromSize",!1),h("integerReadValueFromPointer",!1),h("enumReadValueFromPointer",!1),h("floatReadValueFromPointer",!1),h("simpleReadValueFromPointer",!1),h("runDestructors",!1),h("new_",!1),h("craftInvokerFunction",!1),h("embind__requireFunction",!1),h("tupleRegistrations",!1),h("structRegistrations",!1),h("genericPointerToWireType",!1),h("constNoSmartPtrRawPointerToWireType",!1),h("nonConstNoSmartPtrRawPointerToWireType",!1),h("init_RegisteredPointer",!1),h("RegisteredPointer",!1),h("RegisteredPointer_getPointee",!1),h("RegisteredPointer_destructor",!1),h("RegisteredPointer_deleteObject",!1),h("RegisteredPointer_fromWireType",!1),h("runDestructor",!1),h("releaseClassHandle",!1),h("finalizationRegistry",!1),h("detachFinalizer_deps",!1),h("detachFinalizer",!1),h("attachFinalizer",!1),h("makeClassHandle",!1),h("init_ClassHandle",!1),h("ClassHandle",!1),h("ClassHandle_isAliasOf",!1),h("throwInstanceAlreadyDeleted",!1),h("ClassHandle_clone",!1),h("ClassHandle_delete",!1),h("deletionQueue",!1),h("ClassHandle_isDeleted",!1),h("ClassHandle_deleteLater",!1),h("flushPendingDeletes",!1),h("delayFunction",!1),h("setDelayFunction",!1),h("RegisteredClass",!1),h("shallowCopyInternalPointer",!1),h("downcastPointer",!1),h("upcastPointer",!1),h("validateThis",!1),h("char_0",!1),h("char_9",!1),h("makeLegalFunctionName",!1),h("emval_handle_array",!1),h("emval_free_list",!1),h("emval_symbols",!1),h("init_emval",!1),h("count_emval_handles",!1),h("get_first_emval",!1),h("getStringOrSymbol",!1),h("Emval",!1),h("emval_newers",!1),h("craftEmvalAllocator",!1),h("emval_get_global",!1),h("emval_methodCallers",!1),h("emval_registeredMethods",!1),h("writeGLArray",!1),v("ALLOC_NORMAL",!1),v("ALLOC_STACK",!1),ae=function e(){Tr||Sr(),Tr||(ae=e)},i.run=Sr,i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return Sr(),t.ready});"object"==typeof exports&&"object"==typeof module?module.exports=t:"function"==typeof define&&define.amd?define([],(function(){return t})):"object"==typeof exports&&(exports.WebRendererWasmFactory=t);
|
package/dist/module-debug.wasm
CHANGED
|
Binary file
|