@sketch-hq/sketch-web-renderer 4.0.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/module-debug.wasm +0 -0
  3. package/dist/{module-release-890717f2.js → module-release-0b378fd1.js} +1 -1
  4. package/dist/module-release.wasm +0 -0
  5. package/dist/ts/canvas-renderer/CanvasRenderer.d.ts +12 -12
  6. package/dist/ts/canvas-renderer/CanvasRenderer.d.ts.map +1 -1
  7. package/dist/ts/canvas-renderer/react/CanvasRendererProvider.d.ts.map +1 -1
  8. package/dist/ts/canvas-renderer/react/index.d.ts +0 -2
  9. package/dist/ts/canvas-renderer/react/index.d.ts.map +1 -1
  10. package/dist/ts/canvas-renderer/react/reducer.d.ts.map +1 -1
  11. package/dist/ts/canvas-renderer/react/types.d.ts +0 -8
  12. package/dist/ts/canvas-renderer/react/types.d.ts.map +1 -1
  13. package/dist/ts/canvas-renderer/react/utils.d.ts +1 -16
  14. package/dist/ts/canvas-renderer/react/utils.d.ts.map +1 -1
  15. package/dist/ts/index.d.ts +2 -0
  16. package/dist/ts/index.d.ts.map +1 -1
  17. package/dist/ts/prototype-renderer/PrototypeRenderer.d.ts +18 -6
  18. package/dist/ts/prototype-renderer/PrototypeRenderer.d.ts.map +1 -1
  19. package/dist/ts/prototype-renderer/index.d.ts +1 -0
  20. package/dist/ts/prototype-renderer/index.d.ts.map +1 -1
  21. package/dist/ts/prototype-renderer/react/PrototypeRendererProvider.d.ts +23 -0
  22. package/dist/ts/prototype-renderer/react/PrototypeRendererProvider.d.ts.map +1 -0
  23. package/dist/ts/prototype-renderer/react/PrototypeRendererReact.d.ts +10 -0
  24. package/dist/ts/prototype-renderer/react/PrototypeRendererReact.d.ts.map +1 -0
  25. package/dist/ts/prototype-renderer/react/contexts.d.ts +15 -0
  26. package/dist/ts/prototype-renderer/react/contexts.d.ts.map +1 -0
  27. package/dist/ts/prototype-renderer/react/hooks/actions.d.ts +14 -0
  28. package/dist/ts/prototype-renderer/react/hooks/actions.d.ts.map +1 -0
  29. package/dist/ts/prototype-renderer/react/hooks/index.d.ts +4 -0
  30. package/dist/ts/prototype-renderer/react/hooks/index.d.ts.map +1 -0
  31. package/dist/ts/prototype-renderer/react/hooks/state.d.ts +10 -0
  32. package/dist/ts/prototype-renderer/react/hooks/state.d.ts.map +1 -0
  33. package/dist/ts/prototype-renderer/react/hooks/useEvent.d.ts +8 -0
  34. package/dist/ts/prototype-renderer/react/hooks/useEvent.d.ts.map +1 -0
  35. package/dist/ts/prototype-renderer/react/index.d.ts +4 -0
  36. package/dist/ts/prototype-renderer/react/index.d.ts.map +1 -0
  37. package/dist/ts/prototype-renderer/react/internal.d.ts +26 -0
  38. package/dist/ts/prototype-renderer/react/internal.d.ts.map +1 -0
  39. package/dist/ts/prototype-renderer/react/reducer.d.ts +17 -0
  40. package/dist/ts/prototype-renderer/react/reducer.d.ts.map +1 -0
  41. package/dist/ts/prototype-renderer/react/types.d.ts +31 -0
  42. package/dist/ts/prototype-renderer/react/types.d.ts.map +1 -0
  43. package/dist/ts/prototype-renderer/react/utils.d.ts +6 -0
  44. package/dist/ts/prototype-renderer/react/utils.d.ts.map +1 -0
  45. package/dist/ts/types/Events.d.ts +2 -0
  46. package/dist/ts/types/Events.d.ts.map +1 -1
  47. package/dist/ts/types/PlayState.d.ts +18 -0
  48. package/dist/ts/types/PlayState.d.ts.map +1 -0
  49. package/dist/ts/types/index.d.ts +1 -0
  50. package/dist/ts/types/index.d.ts.map +1 -1
  51. package/dist/ts/types/wasm/JSBridge.d.ts +1 -0
  52. package/dist/ts/types/wasm/JSBridge.d.ts.map +1 -1
  53. package/dist/ts/types/wasm/PrototypeRendererWasm.d.ts +5 -0
  54. package/dist/ts/types/wasm/PrototypeRendererWasm.d.ts.map +1 -1
  55. package/dist/ts/types/wasm/RenderTarget.d.ts +1 -2
  56. package/dist/ts/types/wasm/RenderTarget.d.ts.map +1 -1
  57. package/dist/ts/utils/CanvasManager.d.ts.map +1 -1
  58. package/dist/ts/utils/EventEmitter/EventEmitter.d.ts.map +1 -1
  59. package/dist/ts/utils/GestureManager/GestureManager.d.ts.map +1 -1
  60. package/dist/ts/utils/ListenersCollector/ListenersCollector.d.ts.map +1 -1
  61. package/dist/ts/utils/Logger.d.ts +3 -3
  62. package/dist/ts/utils/Logger.d.ts.map +1 -1
  63. package/dist/ts/utils/WasmModule.d.ts +1 -2
  64. package/dist/ts/utils/WasmModule.d.ts.map +1 -1
  65. package/dist/ts/utils/misc.d.ts +16 -1
  66. package/dist/ts/utils/misc.d.ts.map +1 -1
  67. package/package.json +3 -4
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 m(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 v(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 g=["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 f(e){return e.toLowerCase().replace(/^angle ?\((.+)\)*$/,"$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)}})();const w=[],b=[];function P(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;)b[l]=e.charCodeAt(a+l),w[l]=++l;for(;d<r;)for(i=t.charCodeAt(a+d),s=d++,c=d,l=0;l<o;l++)u=i===b[l]?s:s+1,s=w[l],c=w[l]=s>c?u>c?c+1:u:u>s?s+1:u;return c}function E(e){return null!=e}class M extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const R=({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@4.0.47/dist/benchmarks"}={})=>v(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=>v(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 M("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,m="";if(d)d=f(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");m=d,d=f(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 w=(yield Promise.all(p.map((function(e){var t;return v(this,void 0,void 0,(function*(){const n=(e=>{const t=u?["adreno","apple","mali-t","mali","nvidia","powervr"]:["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 M)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;let m,[v,,,g]=p>1?h.map((t=>[t,P(e,t[0])])).sort((([,e],[,t])=>e-t))[0][0]:h[0],f=Number.MAX_VALUE;const{devicePixelRatio:y}=window,C=c.width*y*c.height*y;for(const e of g){const[t,n]=e,o=t*n,r=Math.abs(C-o);r<f&&(f=r,m=e)}if(!m)return;const[,,w,b]=m;return[f,w,v,b]}))})))).filter(E).sort((([e=Number.MAX_VALUE,t],[n=Number.MAX_VALUE,o])=>e===n?t-o:e-n));if(!w.length){const e=g.find((e=>d.includes(e)));return e?h(0,"BLOCKLISTED",e):h(1,"FALLBACK",`${d} (${m})`)}const[,b,R,L]=w[0];if(-1===b)return h(0,"BLOCKLISTED",R,b,L);const W=u?e:t;let I=0;for(let e=0;e<W.length;e++)b>=W[e]&&(I=e);return h(I,"BENCHMARK",R,b,L)}));var L,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(e){e.debug="debug",e.release="release"}(L||(L={}));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,m([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}(),x=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},S=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},D=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/,A=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(D);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 G(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 k(e,t,n){return Math.max(t,Math.min(n,e))}function F(){return A()&&!T.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1}function B(e){for(var t=e.size(),n=[],o=0;o<t;++o){var r=e.get(o);n.push(r)}return n}function U(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function z(e){var t=e;return Object.keys(t).forEach((function(e){void 0===t[e]&&delete t[e]})),t}var _=function(e){function t(t){var n=e.call(this)||this;return n.listenersCollector=new x,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(){U()||(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:k(e.x-this.targetBounds.x,0,this.target.clientWidth),y:k(e.y-this.targetBounds.y,0,this.target.clientHeight)}},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),O=function(e){function t(t){var n=e.call(this)||this;return n.listenersCollector=new x,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),N=function(){function e(){this.active=!0}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.debug.apply(console,m(["[WR:Debug]"],e,!1))},e.prototype.warning=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.warn.apply(console,m(["[WR:Warn]"],e,!1))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,m(["[WR:Error]"],e,!1))},e}(),j=new N,K=function(){function e(e){this.label=e,this.startTime=performance.now(),this.startTimestamp=Date.now(),j.debug("[Performance] Start: ".concat(this.label))}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);j.debug("[Performance] End: ".concat(this.label," -> ").concat(t," ms"))}else{var n=(e/1e3).toFixed(2);j.debug("[Performance] End: ".concat(this.label," -> ").concat(n," s"))}},e}();function $(e){setTimeout((function(){e()}),0)}var V=function(e){function t(t){var n=e.call(this)||this;return n.listenersCollector=new x,n.size={width:0,height:0},n.pixelRatio=1,n.handleCanvasResizeObserver=function(e){n.resizeCanvas(e[0].contentRect)},n.resizeCanvas=function(e){var t=e.width,o=e.height;window.requestAnimationFrame((function(){n.setSize(t,o),n.emit("resize",t,o,n.getDevicePixelRatio())}))},n.getCanvasCenterPoint=function(){var e=n.getBoundingClientRect();return{x:e.width/2+e.x,y:e.height/2+e.y}},n.container=t.container,n.canvas=t.canvas,n.canvasResizeObserver=new ResizeObserver(n.handleCanvasResizeObserver),n.canvasResizeObserver.observe(n.container),n.listenersCollector.add(window,"orientationchange",n.handleDeviceOrientationChange),n.setSize(n.container.clientWidth,n.container.clientHeight),n}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 k(window.devicePixelRatio,1,2)},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===L.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:F(),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),[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},t);j.debug("Using WebGL ".concat(n.majorVersion));var 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,n=null===(t=this.instance)||void 0===t?void 0:t.GL.getContext(e);if(n){var o=n.GLctx.getExtension("WEBGL_lose_context");o?o.loseContext():j.warning("Unable to retrieve WEBGL_lose_context extension")}else j.warning("Unable to loose context. WebGL rendering context not found")},e.prototype.importModule=function(){return this.isReleaseMode()?import("./module-release-890717f2.js"):import("./module-debug-7ee9ba03.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.dispose=function(){this.instance=void 0},e}(),H=function(e){function t(t){var n=e.call(this)||this;return n.status={type:"INIT"},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;null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchWheelEvent(e.x,e.y,n.wasmModule.mapPointerInfo(t))},n.handlePointerDownEvent=function(e){var t;null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerDownEvent(n.wasmModule.mapPointerInfo(e))},n.handlePointerMoveEvent=function(e){var t;null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerMoveEvent(n.wasmModule.mapPointerInfo(e))},n.handleGlobalPointerMoveEvent=function(e){var t;null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchGlobalPointerMoveEvent(n.wasmModule.mapPointerInfo(e))},n.handlePointerUpEvent=function(e){var t;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},z(t)),{featureFlags:d(d({},T),t.featureFlags)}),j.active=n.settings.mode===L.debug,n.gestureManager=new _(n.settings.container),n.canvasManager=new V({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.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,R()];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:"INIT"}),this.collectAndEmitDeviceInfo(),t.label=1;case 1:return t.trys.push([1,6,,7]),[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(),[4,this.preloadImages()];case 5:return t.sent(),[3,7];case 6:return e=t.sent(),[2,this.fail(e instanceof W?e:new W("ERROR","Unexpected exception initializing the web renderer",e))];case 7:return this.setInitialCameraState(),this.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.setInitialCameraState=function(){var e=void 0!==this.settings.initialZoom,t=void 0!==this.settings.initialPan;e||t?(e&&this.setZoom(this.settings.initialZoom),t&&this.setPan(this.settings.initialPan.x,this.settings.initialPan.y,this.settings.initialPan.centerPointInViewport)):this.zoomToFit()},t.prototype.preloadImages=function(){var e=this;return new Promise((function(t){var n;null===(n=e.pageCanvasWasm)||void 0===n||n.preloadImages((function(){t()}))}))},t.prototype.startRendering=function(){this.traceInitialRender=new K("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),this.pageCanvasWasm.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){j.debug("[C++] ".concat(e))},logWarning:function(e){j.warning("[C++] ".concat(e))},logError:function(e){j.error("[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]:(j.warning("Not able to resolve the url for the image 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",t.x,t.y)},onCursorChange:function(t){var n=e.wasmModule.mapToCSSCursor(t);e.emit("cursorChange",n)}}},t.prototype.downloadImages=function(){var e=this;return new Promise((function(t){var n,o=new K("ImagesDownload");null===(n=e.pageCanvasWasm)||void 0===n||n.downloadImages((function(){o.printMeasurement(),e.emit("metric",o.measure()),j.debug("Images downloaded"),t()}))}))},t.prototype.initWasmModule=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return e=new K("WasmModuleDownload"),[4,this.wasmModule.init()];case 1:return t.sent(),e.printMeasurement(),this.emit("metric",e.measure()),[2]}}))}))},t.prototype.initCanvasRendererWasm=function(){return h(this,void 0,void 0,(function(){return p(this,(function(e){try{this.webglCtxHandle=this.wasmModule.makeWebGLContext(this.settings.canvas,{preserveDrawingBuffer:this.settings.preserveDrawingBuffer,majorVersion:F()}),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(){return h(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return[4,this.downloadImages()];case 1:return e.sent(),[2,this.pageCanvasWasm.generateDocumentPNG()]}}))}))},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"}),this.downloadImages())},t.prototype.looseWebGLContext=function(){this.wasmModule.destroyWebGLContext(this.webglCtxHandle),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.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,o){t.pageCanvasWasm.setFile(e,(function(e,o,r,i){if(void 0===i&&(i=[]),i.length){j.debug("Parser warnings: ".concat(i));var a=i.map((function(e){return{key:e}}));t.emit("warnings",a)}t.setStatus({type:"FILE_READY"}),t.emit("fileReady",t.getDocument(),e,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()):"")}),j.error(e),e.cause&&j.error(e.cause)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&(j.debug("Status transition ".concat(this.status.type," => ").concat(e.type,"}")),this.status=e,this.emit("status",e))},t.prototype.getDocument=function(){if(!this.pageCanvasWasm)return null;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:B(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){if(this.pageCanvasWasm){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(){if(this.pageCanvasWasm){var e=this.getDocument();if(e){var t=e.bounds,n=this.pageCanvasWasm.getPan(),o=this.pageCanvasWasm.getZoom();return{x:n.x/o+t.x,y:n.y/o+t.y}}}},t.prototype.getZoom=function(){var e;return null===(e=this.pageCanvasWasm)||void 0===e?void 0:e.getZoom()},t.prototype.setPan=function(e,t,n){if(void 0===n&&(n=!1),this.pageCanvasWasm){var o=e,r=t,i=this.getDocument().bounds,a=this.pageCanvasWasm.getZoom();if(n){var s=Math.max(2*a*this.canvasManager.pixelRatio,Number.EPSILON);o+=this.canvasManager.size.width/s,r+=this.canvasManager.size.height/s}var u=(o-i.x)*a,c=(r-i.y)*a;this.pageCanvasWasm.setPan(u,c)}},t.prototype.dispose=function(){var e,t,n,o;try{this.detachAllListeners(),this.canvasManager.dispose(),this.gestureManager.dispose(),null===(e=this.pageCanvasWasm)||void 0===e||e.stopRenderLoop(),null===(t=this.pageCanvasWasm)||void 0===t||t.delete(),null===(n=this.renderTarget)||void 0===n||n.delete(),null===(o=this.wasmModule)||void 0===o||o.dispose(),this.userEventsCollectorWasm=null,this.pageCanvasWasm=null,this.wasmModule=null}catch(e){this.fail(new W("ERROR","Unexpected exception while disposing the wasm object",e))}},t}(I),X=t(void 0),q=t(void 0),J=t(void 0),Q=t(void 0),ee=t(void 0),te=t(void 0),ne=t("auto"),oe=t(void 0),re=function(){var e=n(oe);if(void 0===e)throw Error("useInternalContext must be used within a provider");return e},ie=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:null,zoom:null,pan:null,cursor:"auto"});case"post-init":return d(d({},e),{status:t.status,zoom:t.zoom});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}},ae=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return j.debug.apply(j,m(["CanvasRendererReact"],e,!1))};function se(e){return U()?{onTouchEnd:e}:{onClick:e}}var ue=function(t){var n=o(null),s=o(null),u=r(ie,{pan:null,zoom:null,status:null,document:null,isCameraZooming:!1,isCameraMoving:!1,cursor:"auto"}),c=u[0],l=c.status,m=c.document,v=c.zoom,g=c.pan,f=c.isCameraZooming,y=c.isCameraMoving,C=c.cursor,w=u[1],b=i((function(e){return w({type:"on-zoom",zoom:e})}),[]),P=i((function(e,t){return w({type:"on-pan",pan:{x:e,y:t}})}),[]),E=i((function(e){w({type:"on-status",status:e})}),[]),M=i((function(e){w({type:"on-file-ready",document:e})}),[]),R=i((function(){return w({type:"on-camera-zoom-start"})}),[]),L=i((function(){return w({type:"on-camera-zoom-end"})}),[]),W=i((function(){return w({type:"on-camera-move-start"})}),[]),I=i((function(){return w({type:"on-camera-move-end"})}),[]),x=i((function(e){return w({type:"on-cursor-change",cursor:e})}),[]),T=i((function(){var e=n.current;e&&(ae("dispose"),e.off("status",E),e.off("fileReady",M),e.off("cameraZoomChange",b),e.off("cameraPanChange",P),e.off("cameraZoomStart",R),e.off("cameraZoomEnd",L),e.off("cameraMoveStart",W),e.off("cameraMoveEnd",I),e.off("cursorChange",x),e.dispose(),n.current=null,w({type:"dispose"}))}),[E,M,P,b,R,L,W,I,x]),S=i((function(e,t,o){if(""!==e&&t&&o&&s.current){ae("init");var r=new H(d(d({},s.current),{filePath:e,container:o,canvas:t}));r.on("status",E),r.on("fileReady",M),r.on("cameraZoomChange",b),r.on("cameraPanChange",P),r.on("cameraZoomStart",R),r.on("cameraZoomEnd",L),r.on("cameraMoveStart",W),r.on("cameraMoveEnd",I),r.on("cursorChange",x);h(void 0,void 0,void 0,(function(){return p(this,(function(e){return w({type:"post-init",zoom:r.getZoom()||null,status:r.getStatus()||null,pan:r.getPan()||null}),[2]}))})),n.current=r}}),[E,M,b,P,R,L,W,I,x]),D=i((function(e){var t;ae("setSettings",e),e.backgroundColor&&(null===(t=n.current)||void 0===t||t.setBackgroundColor(e.backgroundColor)),s.current=e}),[]),A=i((function(){return n.current}),[]),G=a((function(){return{dispose:T,init:S,setSettings:D,getInstance:A,dispatch:w}}),[T,S,D,A]);return e.createElement(oe.Provider,{value:G},e.createElement(X.Provider,{value:l},e.createElement(q.Provider,{value:m},e.createElement(J.Provider,{value:v},e.createElement(te.Provider,{value:g},e.createElement(Q.Provider,{value:f},e.createElement(ee.Provider,{value:y},e.createElement(ne.Provider,{value:C},t.children))))))))},ce=function(){var e=n(X);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(J);if(void 0===e)throw Error("useZoom must be used within a provider");return e},he=function(){var e=n(te);if(void 0===e)throw Error("usePan must be used within a provider");return e},pe=function(){var e=n(ne);if(void 0===e)throw Error("useCursor must be used within a provider");return e},me=function(){var e=n(Q);if(void 0===status)throw Error("useIsCameraZooming must be used within a provider");return e},ve=function(){var e=n(ee);if(void 0===status)throw Error("useIsCameraMoving must be used within a provider");return e},ge=function(){var e=(0,re().getInstance)();return i((function(t){ae("setZoom",t),null==e||e.setZoom(t)}),[e])},fe=function(){var e=ge(),t=de();return i((function(){var n;(ae("incrementZoom"),"number"==typeof t)&&(n=t>=1?Math.round(2*t):t>.5?1:2*t,e(n))}),[e,t])},ye=function(){var e=ge(),t=de();return i((function(){ae("decrementZoom"),"number"==typeof t&&e(t/2)}),[e,t])},Ce=function(){var e=(0,re().getInstance)();return i((function(t){var n=t.x,o=t.y,r=t.centerPointInViewport;ae("setPan",n,o,"centerPointInViewport",r),null==e||e.setPan(n,o,r)}),[e])},we=function(){var e=(0,re().getInstance)();return i((function(){ae("zoomToFit"),null==e||e.zoomToFit()}),[e])},be=function(){var e=(0,re().getInstance)();return i((function(){ae("looseWebGLContext"),null==e||e.looseWebGLContext()}),[e])},Pe=function(){var e=(0,re().getInstance)();return i((function(){return h(void 0,void 0,void 0,(function(){return p(this,(function(t){switch(t.label){case 0:return ae("generateDocumentPNG"),[4,null==e?void 0:e.generateDocumentPNG()];case 1:return[2,t.sent()]}}))}))}),[e])},Ee=function(){var e=(0,re().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 ae("getArtboardAtPosition",t,n),[4,null==e?void 0:e.getArtboardAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},Me=function(){var e=(0,re().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 ae("getPanAtPosition",t,n),[4,null==e?void 0:e.getPanAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},Re=function(){var e=(0,re().getInstance)();return i((function(t){ae("setIsCameraLocked",t),null==e||e.setIsCameraLocked(t)}),[e])},Le=function(e,t){var n=(0,re().getInstance)();s((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])},We={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},Ie={position:"absolute",top:0,left:0},xe=function(t){j.active=t.mode===L.debug;var n=t.filePath,r=t.locateFile,c=t.imagesURLFormat,l=t.imagesURLMap,h=t.backgroundColor,p=t.mode,m=t.showTilesBorders,v=t.minimumZoomLevel,g=t.maximumZoomLevel,f=t.preserveDrawingBuffer,y=t.panBoundariesPadding,C=t.initialPan,w=t.initialZoom,b=t.children,P=t.containerProps,E=void 0===P?{}:P,M=t.canvasProps,R=void 0===M?{}:M,W=t.featureFlags,I=void 0===W?{}:W,x=o(null),T=o(null),S=u(!1),D=S[0],A=S[1],G=i((function(){return A(!0)}),[]),Z=re(),k=Z.dispose,F=Z.init,B=Z.setSettings,U=pe(),z=ce();Le("allImagesReady",G),s((function(){B({locateFile:r,imagesURLFormat:c,imagesURLMap:l,backgroundColor:h,mode:p,showTilesBorders:m,minimumZoomLevel:v,maximumZoomLevel:g,preserveDrawingBuffer:f,panBoundariesPadding:y,initialPan:C,initialZoom:w,featureFlags:I})}),[B,r,c,l,h,p,m,v,g,f,y,C,w,I]),s((function(){if(n)return F(n,x.current,T.current),function(){k()}}),[k,F,n]);var _=a((function(){var e;return null!==(e=t.cursor)&&void 0!==e?e:U}),[t.cursor,U]),O=a((function(){return d(d({},We),{cursor:_})}),[_]);return e.createElement("div",d({},E,{ref:T,style:O}),n&&e.createElement("canvas",d({},R,{key:n,ref:x,"data-sketchweb-all-images-ready":D,"data-testid":"sketchweb-canvas","data-sketchweb-status":"sketchweb-status-".concat((null==z?void 0:z.type.toLowerCase())||"null"),style:Ie})),"READY"===(null==z?void 0:z.type)&&b)},Te=function(e){function t(t){var n=e.call(this)||this;return n.status={type:"INIT"},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;null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchWheelEvent(e.x,e.y,n.wasmModule.mapPointerInfo(t))},n.handlePointerDownEvent=function(e){var t;null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerDownEvent(n.wasmModule.mapPointerInfo(e))},n.handlePointerMoveEvent=function(e){var t;null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerMoveEvent(n.wasmModule.mapPointerInfo(e))},n.handleGlobalPointerMoveEvent=function(e){var t;null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchGlobalPointerMoveEvent(n.wasmModule.mapPointerInfo(e))},n.handlePointerUpEvent=function(e){var t;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},z(t)),{featureFlags:d(d({},T),t.featureFlags)}),j.active=n.settings.mode===L.debug,n.gestureManager=new _(n.settings.container),n.canvasManager=new V({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.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,R()];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:"INIT"}),this.collectAndEmitDeviceInfo(),t.label=1;case 1:return t.trys.push([1,6,,7]),[4,this.initWasmModule()];case 2:return t.sent(),[4,this.initPlayerWasm()];case 3:return t.sent(),[4,this.setFile(this.settings.filePath)];case 4:return t.sent(),[4,this.preloadImages()];case 5:return t.sent(),[3,7];case 6:return e=t.sent(),[2,this.fail(e instanceof W?e:new W("ERROR","Unexpected exception initializing the web renderer",e))];case 7:return this.setInitialCameraState(),this.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.initWasmModule=function(){return h(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return e=new K("WasmModuleDownload"),[4,this.wasmModule.init()];case 1:return t.sent(),e.printMeasurement(),this.emit("metric",e.measure()),[2]}}))}))},t.prototype.setInitialCameraState=function(){this.zoomToFit()},t.prototype.preloadImages=function(){var e=this;return new Promise((function(t){var n;null===(n=e.playerWasm)||void 0===n||n.preloadImages((function(){t()}))}))},t.prototype.startRendering=function(){this.traceInitialRender=new K("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),this.playerWasm.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){j.debug("[C++] ".concat(e))},logWarning:function(e){j.warning("[C++] ".concat(e))},logError:function(e){j.error("[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]:(j.warning("Not able to resolve the url for the image 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=e.wasmModule.mapToCSSCursor(t);e.emit("cursorChange",n)}}},t.prototype.downloadImages=function(){var e=this;return new Promise((function(t){var n,o=new K("ImagesDownload");null===(n=e.playerWasm)||void 0===n||n.downloadImages((function(){o.printMeasurement(),e.emit("metric",o.measure()),j.debug("Images downloaded"),t()}))}))},t.prototype.initPlayerWasm=function(){return h(this,void 0,void 0,(function(){return p(this,(function(e){try{this.webglCtxHandle=this.wasmModule.makeWebGLContext(this.settings.canvas,{preserveDrawingBuffer:this.settings.preserveDrawingBuffer,majorVersion:F()}),this.renderTarget=this.wasmModule.instance.RenderTarget.MakeWebGL(this.webglCtxHandle,this.canvasManager.size.width,this.canvasManager.size.height,this.canvasManager.pixelRatio),this.playerWasm=new this.wasmModule.instance.PrototypeRenderer(this.renderTarget,{showTilesBorders:this.settings.showTilesBorders},this.settings.startArtboardUUID)}catch(e){throw new W("WASM_ERROR","An error occurred while trying to create the WebRendererWasm 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),[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"}),this.downloadImages())},t.prototype.looseWebGLContext=function(){this.wasmModule.destroyWebGLContext(this.webglCtxHandle),this.webglCtxHandle=-1},t.prototype.zoomToFit=function(){var e;null===(e=this.playerWasm)||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.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,o){t.playerWasm.setFile(e,(function(e,o,r,i){if(void 0===i&&(i=[]),i.length){j.debug("Parser warnings: ".concat(i));var a=i.map((function(e){return{key:e}}));t.emit("warnings",a)}t.setStatus({type:"FILE_READY"}),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()):"")}),j.error(e),e.cause&&j.error(e.cause)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&(j.debug("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,o;try{this.detachAllListeners(),this.canvasManager.dispose(),this.gestureManager.dispose(),null===(e=this.playerWasm)||void 0===e||e.stopRenderLoop(),null===(t=this.playerWasm)||void 0===t||t.delete(),null===(n=this.renderTarget)||void 0===n||n.delete(),null===(o=this.wasmModule)||void 0===o||o.dispose(),this.userEventsCollectorWasm=null,this.playerWasm=null,this.wasmModule=null}catch(e){this.fail(new W("ERROR","Unexpected exception while disposing the WebRendererWasm object",e))}},t}(I);export{ee as CameraMoveContext,Q as CameraZoomingContext,H as CanvasRenderer,ue as CanvasRendererProvider,xe as CanvasRendererReact,ne as CursorContext,T as DefaultFeatureFlags,q as DocumentContext,I as EventEmitter,_ as GestureManager,oe as InternalContext,O as KeyboardManager,x as ListenersCollector,N as Logger,te as PanContext,K as Performance,Te as PrototypeRenderer,X as StatusContext,W as WebRendererError,L as WebRendererMode,J as ZoomContext,k as clamp,B as convertEmbindVectorToArray,G as debounce,ae as debug,Z as extractPointer,F as getSupportedWebGLVersion,S as getiOSVersion,U as isTouchDevice,j as logger,$ as nextTick,A as parseSafariUserAgent,ie as reducer,z as removeUndefinedKeys,se as touchableClick,pe as useCursor,ye as useDecrementZoom,le as useDocument,Le as useEvent,Pe as useGenerateDocumentPNG,Ee as useGetArtboardAtPosititon,Me as useGetPanAtPosition,fe as useIncrementZoom,re as useInternalContext,ve as useIsCameraMoving,me as useIsCameraZooming,Re as useLockCamera,be as useLooseWebGLContext,he as usePan,Ce as useSetPan,ge as useSetZoom,ce as useStatus,de as useZoom,we as useZoomToFit};
1
+ import t,{createContext as e,useContext as n,useRef as o,useReducer as i,useCallback as r,useMemo as s,useEffect as a,useState as u}from"react";const c=new Int32Array(2);var d,l;new Float32Array(c.buffer),new Float64Array(c.buffer),new Uint16Array(new Uint8Array([1,0]).buffer)[0],function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"}(d||(d={})),function(t){t[t.Default=0]="Default",t[t.None=1]="None",t[t.Low=2]="Low",t[t.Medium=3]="Medium",t[t.High=4]="High"}(l||(l={}));var h,b=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.prototype.x=function(){return this.bb.readFloat32(this.bb_pos)},t.prototype.y=function(){return this.bb.readFloat32(this.bb_pos+4)},t.sizeOf=function(){return 8},t.createPoint=function(t,e,n){return t.prep(4,8),t.writeFloat32(n),t.writeFloat32(e),t.offset()},t}(),p=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.prototype.width=function(){return this.bb.readFloat32(this.bb_pos)},t.prototype.height=function(){return this.bb.readFloat32(this.bb_pos+4)},t.sizeOf=function(){return 8},t.createSize=function(t,e,n){return t.prep(4,8),t.writeFloat32(n),t.writeFloat32(e),t.offset()},t}(),f=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.prototype.origin=function(t){return(t||new b).__init(this.bb_pos,this.bb)},t.prototype.size=function(t){return(t||new p).__init(this.bb_pos+8,this.bb)},t.sizeOf=function(){return 16},t.createRect=function(t,e,n,o,i){return t.prep(4,16),t.prep(4,8),t.writeFloat32(i),t.writeFloat32(o),t.prep(4,8),t.writeFloat32(n),t.writeFloat32(e),t.offset()},t}(),_=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsImageDrawing=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsImageDrawing=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.imageIndex=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readUint32(this.bb_pos+t):0},t.prototype.rect=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?(t||new f).__init(this.bb_pos+e,this.bb):null},t.prototype.interpolationQuality=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt8(this.bb_pos+t):l.High},t.startImageDrawing=function(t){t.startObject(3)},t.addImageIndex=function(t,e){t.addFieldInt32(0,e,0)},t.addRect=function(t,e){t.addFieldStruct(1,e,0)},t.addInterpolationQuality=function(t,e){t.addFieldInt8(2,e,l.High)},t.endImageDrawing=function(t){return t.endObject()},t}(),g=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsShapeEllipse=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsShapeEllipse=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.rect=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new f).__init(this.bb_pos+e,this.bb):null},t.startShapeEllipse=function(t){t.startObject(1)},t.addRect=function(t,e){t.addFieldStruct(0,e,0)},t.endShapeEllipse=function(t){return t.endObject()},t.createShapeEllipse=function(e,n){return t.startShapeEllipse(e),t.addRect(e,n),t.endShapeEllipse(e)},t}();!function(t){t[t.Winding=0]="Winding",t[t.EvenOdd=1]="EvenOdd"}(h||(h={}));var m,v=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsPath=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsPath=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.points=function(t,e){var n=this.bb.__offset(this.bb_pos,4);return n?(e||new b).__init(this.bb.__vector(this.bb_pos+n)+8*t,this.bb):null},t.prototype.pointsLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},t.prototype.operations=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb.__vector(this.bb_pos+e)+t):0},t.prototype.operationsLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},t.prototype.operationsArray=function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Int8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},t.startPath=function(t){t.startObject(2)},t.addPoints=function(t,e){t.addFieldOffset(0,e,0)},t.startPointsVector=function(t,e){t.startVector(8,e,4)},t.addOperations=function(t,e){t.addFieldOffset(1,e,0)},t.createOperationsVector=function(t,e){t.startVector(1,e.length,1);for(var n=e.length-1;n>=0;n--)t.addInt8(e[n]);return t.endVector()},t.startOperationsVector=function(t,e){t.startVector(1,e,1)},t.endPath=function(t){var e=t.endObject();return t.requiredField(e,4),t.requiredField(e,6),e},t.createPath=function(e,n,o){return t.startPath(e),t.addPoints(e,n),t.addOperations(e,o),t.endPath(e)},t}(),w=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsShapePath=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsShapePath=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.path=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new v).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.prototype.fillRule=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):h.Winding},t.startShapePath=function(t){t.startObject(2)},t.addPath=function(t,e){t.addFieldOffset(0,e,0)},t.addFillRule=function(t,e){t.addFieldInt8(1,e,h.Winding)},t.endShapePath=function(t){var e=t.endObject();return t.requiredField(e,4),e},t.createShapePath=function(e,n,o){return t.startShapePath(e),t.addPath(e,n),t.addFillRule(e,o),t.endShapePath(e)},t}(),y=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsShapeRect=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsShapeRect=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.rect=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new f).__init(this.bb_pos+e,this.bb):null},t.startShapeRect=function(t){t.startObject(1)},t.addRect=function(t,e){t.addFieldStruct(0,e,0)},t.endShapeRect=function(t){return t.endObject()},t.createShapeRect=function(e,n){return t.startShapeRect(e),t.addRect(e,n),t.endShapeRect(e)},t}();!function(t){t[t.NONE=0]="NONE",t[t.ShapePath=1]="ShapePath",t[t.ShapeRect=2]="ShapeRect",t[t.ShapeEllipse=3]="ShapeEllipse"}(m||(m={}));var C,F=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsBackgroundFilterComponent=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsBackgroundFilterComponent=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.shapeType=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readUint8(this.bb_pos+t):m.NONE},t.prototype.shape=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__union(t,this.bb_pos+e):null},t.prototype.image=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?(t||new _).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.prototype.radius=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readFloat32(this.bb_pos+t):0},t.prototype.saturation=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readFloat32(this.bb_pos+t):1},t.startBackgroundFilterComponent=function(t){t.startObject(5)},t.addShapeType=function(t,e){t.addFieldInt8(0,e,m.NONE)},t.addShape=function(t,e){t.addFieldOffset(1,e,0)},t.addImage=function(t,e){t.addFieldOffset(2,e,0)},t.addRadius=function(t,e){t.addFieldFloat32(3,e,0)},t.addSaturation=function(t,e){t.addFieldFloat32(4,e,1)},t.endBackgroundFilterComponent=function(t){return t.endObject()},t}();!function(t){t[t.Normal=0]="Normal",t[t.DestAtop=1]="DestAtop",t[t.Clear=2]="Clear",t[t.Source=3]="Source",t[t.Darken=4]="Darken",t[t.Multiply=5]="Multiply",t[t.ColorBurn=6]="ColorBurn",t[t.Lighten=7]="Lighten",t[t.Screen=8]="Screen",t[t.ColorDodge=9]="ColorDodge",t[t.Overlay=10]="Overlay",t[t.SoftLight=11]="SoftLight",t[t.HardLight=12]="HardLight",t[t.Difference=13]="Difference",t[t.Exclusion=14]="Exclusion",t[t.Hue=15]="Hue",t[t.Saturation=16]="Saturation",t[t.Color=17]="Color",t[t.Luminosity=18]="Luminosity",t[t.PlusDarker=19]="PlusDarker",t[t.PlusLighter=20]="PlusLighter"}(C||(C={}));var P,I,S,R,E=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsBlendComponent=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsBlendComponent=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.mode=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):C.Normal},t.prototype.opacity=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readFloat32(this.bb_pos+t):1},t.startBlendComponent=function(t){t.startObject(2)},t.addMode=function(t,e){t.addFieldInt8(0,e,C.Normal)},t.addOpacity=function(t,e){t.addFieldFloat32(1,e,1)},t.endBlendComponent=function(t){return t.endObject()},t.createBlendComponent=function(e,n,o){return t.startBlendComponent(e),t.addMode(e,n),t.addOpacity(e,o),t.endBlendComponent(e)},t}(),M=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsCachedExtentComponent=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsCachedExtentComponent=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.rect=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new f).__init(this.bb_pos+e,this.bb):null},t.startCachedExtentComponent=function(t){t.startObject(1)},t.addRect=function(t,e){t.addFieldStruct(0,e,0)},t.endCachedExtentComponent=function(t){return t.endObject()},t.createCachedExtentComponent=function(e,n){return t.startCachedExtentComponent(e),t.addRect(e,n),t.endCachedExtentComponent(e)},t}(),L=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.prototype.r=function(){return this.bb.readFloat32(this.bb_pos)},t.prototype.g=function(){return this.bb.readFloat32(this.bb_pos+4)},t.prototype.b=function(){return this.bb.readFloat32(this.bb_pos+8)},t.prototype.a=function(){return this.bb.readFloat32(this.bb_pos+12)},t.sizeOf=function(){return 16},t.createRGBAColor=function(t,e,n,o,i){return t.prep(4,16),t.writeFloat32(i),t.writeFloat32(o),t.writeFloat32(n),t.writeFloat32(e),t.offset()},t}(),D=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsDrawingContentAngularGradient=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsDrawingContentAngularGradient=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.center=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new b).__init(this.bb_pos+e,this.bb):null},t.prototype.angle=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readFloat32(this.bb_pos+t):0},t.prototype.locations=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},t.prototype.locationsLength=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0},t.prototype.locationsArray=function(){var t=this.bb.__offset(this.bb_pos,8);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},t.prototype.colors=function(t,e){var n=this.bb.__offset(this.bb_pos,10);return n?(e||new L).__init(this.bb.__vector(this.bb_pos+n)+16*t,this.bb):null},t.prototype.colorsLength=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0},t.startDrawingContentAngularGradient=function(t){t.startObject(4)},t.addCenter=function(t,e){t.addFieldStruct(0,e,0)},t.addAngle=function(t,e){t.addFieldFloat32(1,e,0)},t.addLocations=function(t,e){t.addFieldOffset(2,e,0)},t.createLocationsVector=function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addFloat32(e[n]);return t.endVector()},t.startLocationsVector=function(t,e){t.startVector(4,e,4)},t.addColors=function(t,e){t.addFieldOffset(3,e,0)},t.startColorsVector=function(t,e){t.startVector(16,e,4)},t.endDrawingContentAngularGradient=function(t){var e=t.endObject();return t.requiredField(e,8),t.requiredField(e,10),e},t.createDrawingContentAngularGradient=function(e,n,o,i,r){return t.startDrawingContentAngularGradient(e),t.addCenter(e,n),t.addAngle(e,o),t.addLocations(e,i),t.addColors(e,r),t.endDrawingContentAngularGradient(e)},t}(),O=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsDrawingContentColor=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsDrawingContentColor=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.color=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new L).__init(this.bb_pos+e,this.bb):null},t.startDrawingContentColor=function(t){t.startObject(1)},t.addColor=function(t,e){t.addFieldStruct(0,e,0)},t.endDrawingContentColor=function(t){return t.endObject()},t.createDrawingContentColor=function(e,n){return t.startDrawingContentColor(e),t.addColor(e,n),t.endDrawingContentColor(e)},t}(),x=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsDrawingContentImage=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsDrawingContentImage=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.image=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new _).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.prototype.tile=function(){var t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)},t.startDrawingContentImage=function(t){t.startObject(2)},t.addImage=function(t,e){t.addFieldOffset(0,e,0)},t.addTile=function(t,e){t.addFieldInt8(1,+e,0)},t.endDrawingContentImage=function(t){var e=t.endObject();return t.requiredField(e,4),e},t.createDrawingContentImage=function(e,n,o){return t.startDrawingContentImage(e),t.addImage(e,n),t.addTile(e,o),t.endDrawingContentImage(e)},t}(),T=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsDrawingContentLinearGradient=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsDrawingContentLinearGradient=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.start=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new b).__init(this.bb_pos+e,this.bb):null},t.prototype.end=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?(t||new b).__init(this.bb_pos+e,this.bb):null},t.prototype.locations=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},t.prototype.locationsLength=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0},t.prototype.locationsArray=function(){var t=this.bb.__offset(this.bb_pos,8);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},t.prototype.colors=function(t,e){var n=this.bb.__offset(this.bb_pos,10);return n?(e||new L).__init(this.bb.__vector(this.bb_pos+n)+16*t,this.bb):null},t.prototype.colorsLength=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0},t.startDrawingContentLinearGradient=function(t){t.startObject(4)},t.addStart=function(t,e){t.addFieldStruct(0,e,0)},t.addEnd=function(t,e){t.addFieldStruct(1,e,0)},t.addLocations=function(t,e){t.addFieldOffset(2,e,0)},t.createLocationsVector=function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addFloat32(e[n]);return t.endVector()},t.startLocationsVector=function(t,e){t.startVector(4,e,4)},t.addColors=function(t,e){t.addFieldOffset(3,e,0)},t.startColorsVector=function(t,e){t.startVector(16,e,4)},t.endDrawingContentLinearGradient=function(t){var e=t.endObject();return t.requiredField(e,8),t.requiredField(e,10),e},t}(),A=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.prototype.a=function(){return this.bb.readFloat32(this.bb_pos)},t.prototype.b=function(){return this.bb.readFloat32(this.bb_pos+4)},t.prototype.c=function(){return this.bb.readFloat32(this.bb_pos+8)},t.prototype.d=function(){return this.bb.readFloat32(this.bb_pos+12)},t.prototype.tx=function(){return this.bb.readFloat32(this.bb_pos+16)},t.prototype.ty=function(){return this.bb.readFloat32(this.bb_pos+20)},t.sizeOf=function(){return 24},t.createMatrix=function(t,e,n,o,i,r,s){return t.prep(4,24),t.writeFloat32(s),t.writeFloat32(r),t.writeFloat32(i),t.writeFloat32(o),t.writeFloat32(n),t.writeFloat32(e),t.offset()},t}(),B=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsDrawingContentRadialGradient=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsDrawingContentRadialGradient=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.center=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new b).__init(this.bb_pos+e,this.bb):null},t.prototype.radius=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readFloat32(this.bb_pos+t):0},t.prototype.locations=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},t.prototype.locationsLength=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0},t.prototype.locationsArray=function(){var t=this.bb.__offset(this.bb_pos,8);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},t.prototype.colors=function(t,e){var n=this.bb.__offset(this.bb_pos,10);return n?(e||new L).__init(this.bb.__vector(this.bb_pos+n)+16*t,this.bb):null},t.prototype.colorsLength=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0},t.prototype.ellipseTransform=function(t){var e=this.bb.__offset(this.bb_pos,12);return e?(t||new A).__init(this.bb_pos+e,this.bb):null},t.startDrawingContentRadialGradient=function(t){t.startObject(5)},t.addCenter=function(t,e){t.addFieldStruct(0,e,0)},t.addRadius=function(t,e){t.addFieldFloat32(1,e,0)},t.addLocations=function(t,e){t.addFieldOffset(2,e,0)},t.createLocationsVector=function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addFloat32(e[n]);return t.endVector()},t.startLocationsVector=function(t,e){t.startVector(4,e,4)},t.addColors=function(t,e){t.addFieldOffset(3,e,0)},t.startColorsVector=function(t,e){t.startVector(16,e,4)},t.addEllipseTransform=function(t,e){t.addFieldStruct(4,e,0)},t.endDrawingContentRadialGradient=function(t){var e=t.endObject();return t.requiredField(e,8),t.requiredField(e,10),e},t}(),W=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsDrawingContentText=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsDrawingContentText=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startDrawingContentText=function(t){t.startObject(0)},t.endDrawingContentText=function(t){return t.endObject()},t.createDrawingContentText=function(e){return t.startDrawingContentText(e),t.endDrawingContentText(e)},t}();!function(t){t[t.NONE=0]="NONE",t[t.DrawingContentColor=1]="DrawingContentColor",t[t.DrawingContentLinearGradient=2]="DrawingContentLinearGradient",t[t.DrawingContentAngularGradient=3]="DrawingContentAngularGradient",t[t.DrawingContentRadialGradient=4]="DrawingContentRadialGradient",t[t.DrawingContentImage=5]="DrawingContentImage",t[t.DrawingContentText=6]="DrawingContentText"}(P||(P={})),function(t){t[t.Fill=0]="Fill",t[t.Stroke=1]="Stroke",t[t.Knockout=2]="Knockout"}(I||(I={})),function(t){t[t.Butt=0]="Butt",t[t.Round=1]="Round",t[t.Square=2]="Square"}(S||(S={})),function(t){t[t.Miter=0]="Miter",t[t.Round=1]="Round",t[t.Bevel=2]="Bevel"}(R||(R={}));var k,G=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsStroke=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsStroke=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.lineWidth=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readFloat32(this.bb_pos+t):0},t.prototype.lineCap=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):S.Butt},t.prototype.lineJoin=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt8(this.bb_pos+t):R.Miter},t.prototype.lineDashPhase=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readFloat32(this.bb_pos+t):0},t.prototype.lineDashPattern=function(t){var e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},t.prototype.lineDashPatternLength=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0},t.prototype.lineDashPatternArray=function(){var t=this.bb.__offset(this.bb_pos,12);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},t.prototype.miterLimit=function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readFloat32(this.bb_pos+t):10},t.startStroke=function(t){t.startObject(6)},t.addLineWidth=function(t,e){t.addFieldFloat32(0,e,0)},t.addLineCap=function(t,e){t.addFieldInt8(1,e,S.Butt)},t.addLineJoin=function(t,e){t.addFieldInt8(2,e,R.Miter)},t.addLineDashPhase=function(t,e){t.addFieldFloat32(3,e,0)},t.addLineDashPattern=function(t,e){t.addFieldOffset(4,e,0)},t.createLineDashPatternVector=function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addFloat32(e[n]);return t.endVector()},t.startLineDashPatternVector=function(t,e){t.startVector(4,e,4)},t.addMiterLimit=function(t,e){t.addFieldFloat32(5,e,10)},t.endStroke=function(t){var e=t.endObject();return t.requiredField(e,12),e},t.createStroke=function(e,n,o,i,r,s,a){return t.startStroke(e),t.addLineWidth(e,n),t.addLineCap(e,o),t.addLineJoin(e,i),t.addLineDashPhase(e,r),t.addLineDashPattern(e,s),t.addMiterLimit(e,a),t.endStroke(e)},t}(),N=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsDrawingMask=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsDrawingMask=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.mode=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):I.Fill},t.prototype.shapeType=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):m.NONE},t.prototype.shape=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null},t.prototype.stroke=function(t){var e=this.bb.__offset(this.bb_pos,10);return e?(t||new G).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.prototype.strokedPath=function(t){var e=this.bb.__offset(this.bb_pos,12);return e?(t||new v).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.prototype.knockoutRect=function(t){var e=this.bb.__offset(this.bb_pos,14);return e?(t||new f).__init(this.bb_pos+e,this.bb):null},t.startDrawingMask=function(t){t.startObject(6)},t.addMode=function(t,e){t.addFieldInt8(0,e,I.Fill)},t.addShapeType=function(t,e){t.addFieldInt8(1,e,m.NONE)},t.addShape=function(t,e){t.addFieldOffset(2,e,0)},t.addStroke=function(t,e){t.addFieldOffset(3,e,0)},t.addStrokedPath=function(t,e){t.addFieldOffset(4,e,0)},t.addKnockoutRect=function(t,e){t.addFieldStruct(5,e,0)},t.endDrawingMask=function(t){return t.endObject()},t}(),z=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsDrawingComponent=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsDrawingComponent=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.contentType=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readUint8(this.bb_pos+t):P.NONE},t.prototype.content=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__union(t,this.bb_pos+e):null},t.prototype.mask=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?(t||new N).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.startDrawingComponent=function(t){t.startObject(3)},t.addContentType=function(t,e){t.addFieldInt8(0,e,P.NONE)},t.addContent=function(t,e){t.addFieldOffset(1,e,0)},t.addMask=function(t,e){t.addFieldOffset(2,e,0)},t.endDrawingComponent=function(t){var e=t.endObject();return t.requiredField(e,6),e},t}(),j=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsLayerInfoComponent=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsLayerInfoComponent=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.bounds=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new f).__init(this.bb_pos+e,this.bb):null},t.prototype.objectId=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null},t.prototype.traits=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint32(this.bb_pos+t):0},t.prototype.name=function(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null},t.startLayerInfoComponent=function(t){t.startObject(4)},t.addBounds=function(t,e){t.addFieldStruct(0,e,0)},t.addObjectId=function(t,e){t.addFieldOffset(1,e,0)},t.addTraits=function(t,e){t.addFieldInt32(2,e,0)},t.addName=function(t,e){t.addFieldOffset(3,e,0)},t.endLayerInfoComponent=function(t){var e=t.endObject();return t.requiredField(e,6),t.requiredField(e,10),e},t.createLayerInfoComponent=function(e,n,o,i,r){return t.startLayerInfoComponent(e),t.addBounds(e,n),t.addObjectId(e,o),t.addTraits(e,i),t.addName(e,r),t.endLayerInfoComponent(e)},t}();!function(t){t[t.Node=0]="Node",t[t.Clip=1]="Clip",t[t.Knockout=2]="Knockout"}(k||(k={}));var U,Z=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsFragment=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFragment=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.objectId=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},t.startFragment=function(t){t.startObject(1)},t.addObjectId=function(t,e){t.addFieldOffset(0,e,0)},t.endFragment=function(t){return t.endObject()},t.createFragment=function(e,n){return t.startFragment(e),t.addObjectId(e,n),t.endFragment(e)},t}(),V=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsFilterColorControls=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFilterColorControls=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.saturation=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readFloat32(this.bb_pos+t):1},t.prototype.brightness=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readFloat32(this.bb_pos+t):0},t.prototype.contrast=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readFloat32(this.bb_pos+t):0},t.prototype.hue=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readFloat32(this.bb_pos+t):0},t.startFilterColorControls=function(t){t.startObject(4)},t.addSaturation=function(t,e){t.addFieldFloat32(0,e,1)},t.addBrightness=function(t,e){t.addFieldFloat32(1,e,0)},t.addContrast=function(t,e){t.addFieldFloat32(2,e,0)},t.addHue=function(t,e){t.addFieldFloat32(3,e,0)},t.endFilterColorControls=function(t){return t.endObject()},t.createFilterColorControls=function(e,n,o,i,r){return t.startFilterColorControls(e),t.addSaturation(e,n),t.addBrightness(e,o),t.addContrast(e,i),t.addHue(e,r),t.endFilterColorControls(e)},t}(),q=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsFilterGaussianBlur=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFilterGaussianBlur=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.radius=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readFloat32(this.bb_pos+t):0},t.startFilterGaussianBlur=function(t){t.startObject(1)},t.addRadius=function(t,e){t.addFieldFloat32(0,e,0)},t.endFilterGaussianBlur=function(t){return t.endObject()},t.createFilterGaussianBlur=function(e,n){return t.startFilterGaussianBlur(e),t.addRadius(e,n),t.endFilterGaussianBlur(e)},t}(),H=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsFilterMotionBlur=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFilterMotionBlur=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.radius=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readFloat32(this.bb_pos+t):0},t.prototype.angle=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readFloat32(this.bb_pos+t):0},t.startFilterMotionBlur=function(t){t.startObject(2)},t.addRadius=function(t,e){t.addFieldFloat32(0,e,0)},t.addAngle=function(t,e){t.addFieldFloat32(1,e,0)},t.endFilterMotionBlur=function(t){return t.endObject()},t.createFilterMotionBlur=function(e,n,o){return t.startFilterMotionBlur(e),t.addRadius(e,n),t.addAngle(e,o),t.endFilterMotionBlur(e)},t}(),K=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsShadow=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsShadow=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.radius=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readFloat32(this.bb_pos+t):0},t.prototype.offset=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?(t||new p).__init(this.bb_pos+e,this.bb):null},t.prototype.spread=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readFloat32(this.bb_pos+t):0},t.prototype.color=function(t){var e=this.bb.__offset(this.bb_pos,10);return e?(t||new L).__init(this.bb_pos+e,this.bb):null},t.startShadow=function(t){t.startObject(4)},t.addRadius=function(t,e){t.addFieldFloat32(0,e,0)},t.addOffset=function(t,e){t.addFieldStruct(1,e,0)},t.addSpread=function(t,e){t.addFieldFloat32(2,e,0)},t.addColor=function(t,e){t.addFieldStruct(3,e,0)},t.endShadow=function(t){return t.endObject()},t}(),Y=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsFilterShadow=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFilterShadow=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.shadow=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new K).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.startFilterShadow=function(t){t.startObject(1)},t.addShadow=function(t,e){t.addFieldOffset(0,e,0)},t.endFilterShadow=function(t){var e=t.endObject();return t.requiredField(e,4),e},t.createFilterShadow=function(e,n){return t.startFilterShadow(e),t.addShadow(e,n),t.endFilterShadow(e)},t}(),$=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsFilterZoomBlur=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFilterZoomBlur=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.radius=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readFloat32(this.bb_pos+t):0},t.prototype.center=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?(t||new b).__init(this.bb_pos+e,this.bb):null},t.startFilterZoomBlur=function(t){t.startObject(2)},t.addRadius=function(t,e){t.addFieldFloat32(0,e,0)},t.addCenter=function(t,e){t.addFieldStruct(1,e,0)},t.endFilterZoomBlur=function(t){return t.endObject()},t}();!function(t){t[t.NONE=0]="NONE",t[t.FilterColorControls=1]="FilterColorControls",t[t.FilterGaussianBlur=2]="FilterGaussianBlur",t[t.FilterMotionBlur=3]="FilterMotionBlur",t[t.FilterZoomBlur=4]="FilterZoomBlur",t[t.FilterShadow=5]="FilterShadow"}(U||(U={}));var X,J=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsSurfaceComponent=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsSurfaceComponent=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.shouldBlendSourceOver=function(){var t=this.bb.__offset(this.bb_pos,4);return!!t&&!!this.bb.readInt8(this.bb_pos+t)},t.prototype.filterType=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):U.NONE},t.prototype.filter=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null},t.startSurfaceComponent=function(t){t.startObject(3)},t.addShouldBlendSourceOver=function(t,e){t.addFieldInt8(0,+e,0)},t.addFilterType=function(t,e){t.addFieldInt8(1,e,U.NONE)},t.addFilter=function(t,e){t.addFieldOffset(2,e,0)},t.endSurfaceComponent=function(t){return t.endObject()},t.createSurfaceComponent=function(e,n,o,i){return t.startSurfaceComponent(e),t.addShouldBlendSourceOver(e,n),t.addFilterType(e,o),t.addFilter(e,i),t.endSurfaceComponent(e)},t}(),Q=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsTransformComponent=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsTransformComponent=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.matrix=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new A).__init(this.bb_pos+e,this.bb):null},t.startTransformComponent=function(t){t.startObject(1)},t.addMatrix=function(t,e){t.addFieldStruct(0,e,0)},t.endTransformComponent=function(t){return t.endObject()},t.createTransformComponent=function(e,n){return t.startTransformComponent(e),t.addMatrix(e,n),t.endTransformComponent(e)},t}(),tt=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsNode=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsNode=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.children=function(e,n){var o=this.bb.__offset(this.bb_pos,4);return o?(n||new t).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+o)+4*e),this.bb):null},t.prototype.childrenLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},t.prototype.enabled=function(){var t=this.bb.__offset(this.bb_pos,6);return!t||!!this.bb.readInt8(this.bb_pos+t)},t.prototype.name=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null},t.prototype.componentsType=function(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},t.prototype.componentsTypeLength=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0},t.prototype.componentsTypeArray=function(){var t=this.bb.__offset(this.bb_pos,10);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},t.prototype.components=function(t,e){var n=this.bb.__offset(this.bb_pos,12);return n?this.bb.__union(e,this.bb.__vector(this.bb_pos+n)+4*t):null},t.prototype.componentsLength=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0},t.prototype.drawing=function(t){var e=this.bb.__offset(this.bb_pos,14);return e?(t||new z).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.prototype.layerInfo=function(t){var e=this.bb.__offset(this.bb_pos,16);return e?(t||new j).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.prototype.transform=function(t){var e=this.bb.__offset(this.bb_pos,18);return e?(t||new Q).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.prototype.mask=function(t){var e=this.bb.__offset(this.bb_pos,20);return e?(t||new et).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.prototype.blend=function(t){var e=this.bb.__offset(this.bb_pos,22);return e?(t||new E).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.prototype.surface=function(t){var e=this.bb.__offset(this.bb_pos,24);return e?(t||new J).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.prototype.backgroundFilter=function(t){var e=this.bb.__offset(this.bb_pos,26);return e?(t||new F).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.prototype.cachedExtent=function(t){var e=this.bb.__offset(this.bb_pos,28);return e?(t||new M).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.prototype.fragment=function(t){var e=this.bb.__offset(this.bb_pos,30);return e?(t||new Z).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.startNode=function(t){t.startObject(14)},t.addChildren=function(t,e){t.addFieldOffset(0,e,0)},t.createChildrenVector=function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()},t.startChildrenVector=function(t,e){t.startVector(4,e,4)},t.addEnabled=function(t,e){t.addFieldInt8(1,+e,1)},t.addName=function(t,e){t.addFieldOffset(2,e,0)},t.addComponentsType=function(t,e){t.addFieldOffset(3,e,0)},t.createComponentsTypeVector=function(t,e){t.startVector(1,e.length,1);for(var n=e.length-1;n>=0;n--)t.addInt8(e[n]);return t.endVector()},t.startComponentsTypeVector=function(t,e){t.startVector(1,e,1)},t.addComponents=function(t,e){t.addFieldOffset(4,e,0)},t.createComponentsVector=function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()},t.startComponentsVector=function(t,e){t.startVector(4,e,4)},t.addDrawing=function(t,e){t.addFieldOffset(5,e,0)},t.addLayerInfo=function(t,e){t.addFieldOffset(6,e,0)},t.addTransform=function(t,e){t.addFieldOffset(7,e,0)},t.addMask=function(t,e){t.addFieldOffset(8,e,0)},t.addBlend=function(t,e){t.addFieldOffset(9,e,0)},t.addSurface=function(t,e){t.addFieldOffset(10,e,0)},t.addBackgroundFilter=function(t,e){t.addFieldOffset(11,e,0)},t.addCachedExtent=function(t,e){t.addFieldOffset(12,e,0)},t.addFragment=function(t,e){t.addFieldOffset(13,e,0)},t.endNode=function(t){var e=t.endObject();return t.requiredField(e,4),e},t}(),et=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsMaskComponent=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsMaskComponent=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.mode=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):k.Node},t.prototype.clipShapeType=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):m.NONE},t.prototype.clipShape=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null},t.prototype.node=function(t){var e=this.bb.__offset(this.bb_pos,10);return e?(t||new tt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.prototype.knockoutRect=function(t){var e=this.bb.__offset(this.bb_pos,12);return e?(t||new f).__init(this.bb_pos+e,this.bb):null},t.startMaskComponent=function(t){t.startObject(5)},t.addMode=function(t,e){t.addFieldInt8(0,e,k.Node)},t.addClipShapeType=function(t,e){t.addFieldInt8(1,e,m.NONE)},t.addClipShape=function(t,e){t.addFieldOffset(2,e,0)},t.addNode=function(t,e){t.addFieldOffset(3,e,0)},t.addKnockoutRect=function(t,e){t.addFieldStruct(4,e,0)},t.endMaskComponent=function(t){return t.endObject()},t}();!function(t){t[t.NONE=0]="NONE",t[t.TransformComponent=1]="TransformComponent",t[t.BlendComponent=2]="BlendComponent",t[t.MaskComponent=3]="MaskComponent",t[t.DrawingComponent=4]="DrawingComponent",t[t.CachedExtentComponent=5]="CachedExtentComponent",t[t.LayerInfoComponent=6]="LayerInfoComponent",t[t.SurfaceComponent=7]="SurfaceComponent",t[t.BackgroundFilterComponent=8]="BackgroundFilterComponent"}(X||(X={}));var nt,ot=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsImage=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsImage=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.prototype.uuid=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},t.prototype.width=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint32(this.bb_pos+t):0},t.prototype.height=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint32(this.bb_pos+t):0},t.prototype.format=function(t){var e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null},t.startImage=function(t){t.startObject(4)},t.addUuid=function(t,e){t.addFieldOffset(0,e,0)},t.addWidth=function(t,e){t.addFieldInt32(1,e,0)},t.addHeight=function(t,e){t.addFieldInt32(2,e,0)},t.addFormat=function(t,e){t.addFieldOffset(3,e,0)},t.endImage=function(t){var e=t.endObject();return t.requiredField(e,10),e},t.createImage=function(e,n,o,i,r){return t.startImage(e),t.addUuid(e,n),t.addWidth(e,o),t.addHeight(e,i),t.addFormat(e,r),t.endImage(e)},t}();!function(t){t[t.MoveTo=0]="MoveTo",t[t.LineTo=1]="LineTo",t[t.QuadTo=2]="QuadTo",t[t.CubicTo=3]="CubicTo",t[t.Close=4]="Close"}(nt||(nt={}));var it=function(){function t(){this.bb=null,this.bb_pos=0}return t.prototype.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},t.getRootAsPresentation=function(e,n){return(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsPresentation=function(e,n){return e.setPosition(e.position()+4),(n||new t).__init(e.readInt32(e.position())+e.position(),e)},t.bufferHasIdentifier=function(t){return t.__has_identifier("PRMR")},t.prototype.images=function(t,e){var n=this.bb.__offset(this.bb_pos,4);return n?(e||new ot).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+4*t),this.bb):null},t.prototype.imagesLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},t.prototype.root=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?(t||new tt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},t.prototype.schemaVersion=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null},t.startPresentation=function(t){t.startObject(3)},t.addImages=function(t,e){t.addFieldOffset(0,e,0)},t.createImagesVector=function(t,e){t.startVector(4,e.length,4);for(var n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()},t.startImagesVector=function(t,e){t.startVector(4,e,4)},t.addRoot=function(t,e){t.addFieldOffset(1,e,0)},t.addSchemaVersion=function(t,e){t.addFieldOffset(2,e,0)},t.endPresentation=function(t){var e=t.endObject();return t.requiredField(e,4),t.requiredField(e,6),t.requiredField(e,8),e},t.finishPresentationBuffer=function(t,e){t.finish(e,"PRMR")},t.finishSizePrefixedPresentationBuffer=function(t,e){t.finish(e,"PRMR",!0)},t}(),rt=Object.freeze({__proto__:null,SCHEMA_VERSION:"0.1.5",FILE_IDENTIFIER:"PRMR",BackgroundFilterComponent:F,BlendComponent:E,get BlendMode(){return C},CachedExtentComponent:M,get Component(){return X},unionToComponent:function(t,e){switch(X[t]){case"NONE":default:return null;case"TransformComponent":return e(new Q);case"BlendComponent":return e(new E);case"MaskComponent":return e(new et);case"DrawingComponent":return e(new z);case"CachedExtentComponent":return e(new M);case"LayerInfoComponent":return e(new j);case"SurfaceComponent":return e(new J);case"BackgroundFilterComponent":return e(new F)}},unionListToComponent:function(t,e,n){switch(X[t]){case"NONE":default:return null;case"TransformComponent":return e(n,new Q);case"BlendComponent":return e(n,new E);case"MaskComponent":return e(n,new et);case"DrawingComponent":return e(n,new z);case"CachedExtentComponent":return e(n,new M);case"LayerInfoComponent":return e(n,new j);case"SurfaceComponent":return e(n,new J);case"BackgroundFilterComponent":return e(n,new F)}},DrawingComponent:z,get DrawingContent(){return P},unionToDrawingContent:function(t,e){switch(P[t]){case"NONE":default:return null;case"DrawingContentColor":return e(new O);case"DrawingContentLinearGradient":return e(new T);case"DrawingContentAngularGradient":return e(new D);case"DrawingContentRadialGradient":return e(new B);case"DrawingContentImage":return e(new x);case"DrawingContentText":return e(new W)}},unionListToDrawingContent:function(t,e,n){switch(P[t]){case"NONE":default:return null;case"DrawingContentColor":return e(n,new O);case"DrawingContentLinearGradient":return e(n,new T);case"DrawingContentAngularGradient":return e(n,new D);case"DrawingContentRadialGradient":return e(n,new B);case"DrawingContentImage":return e(n,new x);case"DrawingContentText":return e(n,new W)}},DrawingContentAngularGradient:D,DrawingContentColor:O,DrawingContentImage:x,DrawingContentLinearGradient:T,DrawingContentRadialGradient:B,DrawingContentText:W,DrawingMask:N,get DrawingMaskMode(){return I},get FillRule(){return h},get Filter(){return U},unionToFilter:function(t,e){switch(U[t]){case"NONE":default:return null;case"FilterColorControls":return e(new V);case"FilterGaussianBlur":return e(new q);case"FilterMotionBlur":return e(new H);case"FilterZoomBlur":return e(new $);case"FilterShadow":return e(new Y)}},unionListToFilter:function(t,e,n){switch(U[t]){case"NONE":default:return null;case"FilterColorControls":return e(n,new V);case"FilterGaussianBlur":return e(n,new q);case"FilterMotionBlur":return e(n,new H);case"FilterZoomBlur":return e(n,new $);case"FilterShadow":return e(n,new Y)}},FilterColorControls:V,FilterGaussianBlur:q,FilterMotionBlur:H,FilterShadow:Y,FilterZoomBlur:$,Fragment:Z,Image:ot,ImageDrawing:_,get InterpolationQuality(){return l},LayerInfoComponent:j,get LineCap(){return S},get LineJoin(){return R},MaskComponent:et,get MaskComponentMode(){return k},Matrix:A,Node:tt,Path:v,get PathOperation(){return nt},Point:b,Presentation:it,RGBAColor:L,Rect:f,Shadow:K,get Shape(){return m},unionToShape:function(t,e){switch(m[t]){case"NONE":default:return null;case"ShapePath":return e(new w);case"ShapeRect":return e(new y);case"ShapeEllipse":return e(new g)}},unionListToShape:function(t,e,n){switch(m[t]){case"NONE":default:return null;case"ShapePath":return e(n,new w);case"ShapeRect":return e(n,new y);case"ShapeEllipse":return e(n,new g)}},ShapeEllipse:g,ShapePath:w,ShapeRect:y,Size:p,Stroke:G,SurfaceComponent:J,TransformComponent:Q}),st=function(t,e){return st=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},st(t,e)};function at(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}st(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var ut=function(){return ut=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},ut.apply(this,arguments)};function ct(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{u(o.next(t))}catch(t){r(t)}}function a(t){try{u(o.throw(t))}catch(t){r(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((o=o.apply(t,e||[])).next())}))}function dt(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;r&&(r=0,a[0]&&(s=0)),s;)try{if(n=1,o&&(i=2&a[0]?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,o=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],o=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function lt(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))}function ht(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{u(o.next(t))}catch(t){r(t)}}function a(t){try{u(o.throw(t))}catch(t){r(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((o=o.apply(t,e||[])).next())}))}const bt=["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 pt(t){return t.toLowerCase().replace(/^angle ?\((.+)\)*$/,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"").replace(/(?:vulkan|opengl) \d+\.\d+(?:\.\d+)?(?: \((.*)\))?/,"$1")}const ft="undefined"==typeof window,_t=(()=>{if(ft)return;const{userAgent:t,platform:e,maxTouchPoints:n}=window.navigator,o=/(iphone|ipod|ipad)/i.test(t),i="iPad"===e||"MacIntel"===e&&n>0&&!window.MSStream;return{isIpad:i,isMobile:/android/i.test(t)||o||i,isSafari12:/Version\/12.+Safari/.test(t)}})();const gt=[],mt=[];function vt(t,e){if(t===e)return 0;const n=t;t.length>e.length&&(t=e,e=n);let o=t.length,i=e.length;for(;o>0&&t.charCodeAt(~-o)===e.charCodeAt(~-i);)o--,i--;let r,s=0;for(;s<o&&t.charCodeAt(s)===e.charCodeAt(s);)s++;if(o-=s,i-=s,0===o)return i;let a,u,c=0,d=0,l=0;for(;d<o;)mt[d]=t.charCodeAt(s+d),gt[d]=++d;for(;l<i;)for(r=e.charCodeAt(s+l),a=l++,c=l,d=0;d<o;d++)u=r===mt[d]?a:a+1,a=gt[d],c=gt[d]=a>c?u>c?c+1:u:u>a?a+1:u;return c}function wt(t){return null!=t}class yt extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype)}}const Ct=({mobileTiers:t=[0,15,30,60],desktopTiers:e=[0,15,30,60],override:n={},glContext:o,failIfMajorPerformanceCaveat:i=!1,benchmarksURL:r="https://unpkg.com/detect-gpu@4.0.47/dist/benchmarks"}={})=>ht(void 0,void 0,void 0,(function*(){const s={};if(ft)return{tier:0,type:"SSR"};const{isIpad:a=!!(null==_t?void 0:_t.isIpad),isMobile:u=!!(null==_t?void 0:_t.isMobile),screenSize:c=window.screen,loadBenchmarks:d=(t=>ht(void 0,void 0,void 0,(function*(){const e=yield fetch(`${r}/${t}`).then((t=>t.json()));if(parseInt(e.shift().split(".")[0],10)<4)throw new yt("Detect GPU benchmark data is out of date. Please update to version 4x");return e})))}=n;let{renderer:l}=n;const h=(t,e,n,o,i)=>({device:i,fps:o,gpu:n,isMobile:u,tier:t,type:e});let b,p="";if(l)l=pt(l),b=[l];else{const t=o||function(t,e=!1){const n={alpha:!1,antialias:!1,depth:!1,failIfMajorPerformanceCaveat:e,powerPreference:"high-performance",stencil:!1};t&&delete n.powerPreference;const o=window.document.createElement("canvas"),i=o.getContext("webgl",n)||o.getContext("experimental-webgl",n);return null!=i?i:void 0}(null==_t?void 0:_t.isSafari12,i);if(!t)return h(0,"WEBGL_UNSUPPORTED");const e=t.getExtension("WEBGL_debug_renderer_info");if(e&&(l=t.getParameter(e.UNMASKED_RENDERER_WEBGL)),!l)return h(1,"FALLBACK");p=l,l=pt(l),b=function(t,e,n){return"apple gpu"===e?function(t,e,n){if(!n)return[e];const o=function(t){const e=t.createShader(35633),n=t.createShader(35632),o=t.createProgram();if(!(n&&e&&o))return;t.shaderSource(e,"\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 "),t.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 "),t.compileShader(e),t.compileShader(n),t.attachShader(o,e),t.attachShader(o,n),t.linkProgram(o),t.detachShader(o,e),t.detachShader(o,n),t.deleteShader(e),t.deleteShader(n),t.useProgram(o);const i=t.createBuffer();t.bindBuffer(34962,i),t.bufferData(34962,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);const r=t.getAttribLocation(o,"aPosition");t.vertexAttribPointer(r,3,5126,!1,0,0),t.enableVertexAttribArray(r),t.clearColor(1,1,1,1),t.clear(16384),t.viewport(0,0,1,1),t.drawArrays(4,0,3);const s=new Uint8Array(4);return t.readPixels(0,0,1,1,6408,5121,s),t.deleteProgram(o),t.deleteBuffer(i),s.join("")}(t),i="801621810",r="8016218135",s="80162181161",a=(null==_t?void 0:_t.isIpad)?[["a7",s,12],["a8",r,15],["a8x",r,15],["a9",r,15],["a9x",r,15],["a10",r,15],["a10x",r,15],["a12",i,15],["a12x",i,15],["a12z",i,15],["a14",i,15],["m1",i,15]]:[["a7",s,12],["a8",r,12],["a9",r,15],["a10",r,15],["a11",i,15],["a12",i,15],["a13",i,15],["a14",i,15]];let u;return"80162181255"===o?u=a.filter((([,,t])=>t>=14)):(u=a.filter((([,t])=>t===o)),u.length||(u=a)),u.map((([t])=>`apple ${t} gpu`))}(t,e,n):[e]}(t,l,u)}const f=(yield Promise.all(b.map((function(t){var e;return ht(this,void 0,void 0,(function*(){const n=(t=>{const e=u?["adreno","apple","mali-t","mali","nvidia","powervr"]:["intel","apple","amd","radeon","nvidia","geforce"];for(const n of e)if(t.includes(n))return n})(t);if(!n)return;const o=`${u?"m":"d"}-${n}${a?"-ipad":""}.json`,i=s[o]=null!==(e=s[o])&&void 0!==e?e:d(o);let r;try{r=yield i}catch(n){if(n instanceof yt)throw n;return}const l=function(t){var e;const n=(t=t.replace(/\([^)]+\)/,"")).match(/\d+/)||t.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);return null!==(e=null==n?void 0:n.join("").replace(/\W|amd/g,""))&&void 0!==e?e:""}(t);let h=r.filter((([,t])=>t===l));h.length||(h=r.filter((([e])=>e.includes(t))));const b=h.length;if(0===b)return;let p,[f,,,_]=b>1?h.map((e=>[e,vt(t,e[0])])).sort((([,t],[,e])=>t-e))[0][0]:h[0],g=Number.MAX_VALUE;const{devicePixelRatio:m}=window,v=c.width*m*c.height*m;for(const t of _){const[e,n]=t,o=e*n,i=Math.abs(v-o);i<g&&(g=i,p=t)}if(!p)return;const[,,w,y]=p;return[g,w,f,y]}))})))).filter(wt).sort((([t=Number.MAX_VALUE,e],[n=Number.MAX_VALUE,o])=>t===n?e-o:t-n));if(!f.length){const t=bt.find((t=>l.includes(t)));return t?h(0,"BLOCKLISTED",t):h(1,"FALLBACK",`${l} (${p})`)}const[,_,g,m]=f[0];if(-1===_)return h(0,"BLOCKLISTED",g,_,m);const v=u?t:e;let w=0;for(let t=0;t<v.length;t++)_>=v[t]&&(w=t);return h(w,"BENCHMARK",g,_,m)}));var Ft,Pt=function(t){function e(n,o,i){var r=this.constructor,s=t.call(this,"(".concat(n,") ").concat(o))||this;return s.code=n,s.cause=i,s.name=e.name,Object.setPrototypeOf(s,r.prototype),s}return at(e,t),e}(Error);!function(t){t.debug="debug",t.release="release"}(Ft||(Ft={}));var It=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){var n,o;this.listeners[t]=null!==(n=this.listeners[t])&&void 0!==n?n:new Set,null===(o=this.listeners[t])||void 0===o||o.add(e)},t.prototype.off=function(t,e){var n;null===(n=this.listeners[t])||void 0===n||n.delete(e)},t.prototype.forwardEvent=function(t,e){this.on(e,(function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];t.emit.apply(t,lt([e],n,!1))}))},t.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var o=this.listeners[t];(null==o?void 0:o.size)&&o.forEach((function(t){Promise.resolve().then((function(){t.apply(void 0,e)}))}))},t.prototype.detachAllListeners=function(){this.listeners={}},t}(),St=function(){function t(){this.removeListenerCallbacks=[]}return t.prototype.add=function(t,e,n,o){t.addEventListener(e,n,o);var i=function(){t.removeEventListener(e,n,o)};return this.removeListenerCallbacks.push(i),i},t.prototype.dispose=function(){this.removeListenerCallbacks.forEach((function(t){return t()}))},t}(),Rt={delayedDraw:!0,offscreenCanvas:!1,useDirtyRectsRendering:!0,safariWebGL2:!1,pageBoundariesLimit:!1},Et=function(t){return parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(t)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||!1},Mt=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/,Lt=function(t){if(void 0===t&&(t=window.navigator.userAgent),t.includes("Chrome/")||t.includes("Chromium/")||t.includes("Opera/")||t.includes("Firefox/"))return null;var e=t.match(Mt);if(!e)return null;var n=e[1];return"Macintosh"!==n&&"iPad"!==n&&"iPhone"!==n?null:{hardware:n,version:{major:parseInt(e[4])||0,minor:parseInt(e[5])||0,patch:parseInt(e[6])||0}}};function Dt(t,e){var n;function o(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];clearTimeout(n),n=setTimeout((function(){t.apply(void 0,o)}),e)}return o.cancel=function(){n&&clearTimeout(n)},o}function Ot(t){var e,n,o,i,r,s=null!==(n=null===(e=t.touches)||void 0===e?void 0:e[0])&&void 0!==n?n:null===(o=t.changedTouches)||void 0===o?void 0:o[0];return{x:null!==(i=null==s?void 0:s.clientX)&&void 0!==i?i:t.clientX,y:null!==(r=null==s?void 0:s.clientY)&&void 0!==r?r:t.clientY}}function xt(t,e,n){return Math.max(e,Math.min(n,t))}function Tt(){return Lt()&&!Rt.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1}function At(t){for(var e=t.size(),n=[],o=0;o<e;++o){var i=t.get(o);if(null==i)throw Error("Error converting embind vector to array");n.push(i)}return n}function Bt(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function Wt(t){var e=t;return Object.keys(e).forEach((function(t){void 0===e[t]&&delete e[t]})),e}function kt(t){return Bt()?{onTouchEnd:t}:{onClick:t}}var Gt=function(t){function e(e){var n=t.call(this)||this;return n.listenersCollector=new St,n.state={pinchToZoomLastDistance:0,lastGestureScale:1,isCtrlPressed:!1},n.handleGestureStart=function(t){t.preventDefault(),n.state.lastGestureScale=t.scale},n.handleGestureChange=function(t){t.preventDefault();var e=t.scale/n.state.lastGestureScale;n.state.lastGestureScale=t.scale;var o=n.getCorrectPointerPosition(t);n.emitZoomEvent(e,o)},n.handleGestureEnd=function(t){t.preventDefault()},n.handleTouchStart=function(t){t.preventDefault(),n.handleTouchPinchToZoomStart(t),n.emit("pointerdown",{type:"touch",position:n.getCorrectPointerPosition(t),button:0,touchesCount:t.touches.length})},n.handleMouseDown=function(t){t.ctrlKey||(t.preventDefault(),n.emit("pointerdown",{type:"mouse",position:n.getCorrectPointerPosition(t),button:t.button,touchesCount:0}))},n.handleTouchMove=function(t){n.handleTouchPinchToZoomChange(t),n.emit("pointermove",{type:"touch",position:n.getCorrectPointerPosition(t),button:0,touchesCount:t.touches.length})},n.handleMouseMove=function(t){n.updateMousePosition(t)},n.handleGlobalTouchMove=function(t){n.emit("globalpointermove",{type:"touch",position:n.getCorrectPointerPosition(t),button:0,touchesCount:t.touches.length})},n.handleGlobalMouseMove=function(t){n.updateGlobalMousePosition(t)},n.handleTouchPinchToZoomStart=function(t){var e;!t.touches||(null===(e=t.touches)||void 0===e?void 0:e.length)<2||(n.state.pinchToZoomLastDistance=n.calculateDistanceBetweenTouches(t.touches[0],t.touches[1]))},n.handleTouchPinchToZoomChange=function(t){var e;if(t.touches&&!((null===(e=t.touches)||void 0===e?void 0:e.length)<2)){var o=n.calculateDistanceBetweenTouches(t.touches[0],t.touches[1]),i=n.getCorrectPointerPosition(t),r=1+.004*(o-n.state.pinchToZoomLastDistance);n.state.pinchToZoomLastDistance=o,n.emitZoomEvent(r,i)}},n.handleTouchEnd=function(t){var e=n.getCorrectPointerPosition(t);n.emit("pointerup",{position:e,type:"touch",button:0,touchesCount:t.touches.length})},n.handleMouseUp=function(t){n.emit("pointerup",{type:"mouse",position:n.getCorrectPointerPosition(t),button:t.button,touchesCount:0})},n.handleMouseWheel=function(t){t.preventDefault();var e=t.ctrlKey&&!n.state.isCtrlPressed,o=t.metaKey||e||n.state.isCtrlPressed;if(n.updateMousePosition(t),n.updateGlobalMousePosition(t),o){var i=e?-1:1,r=n.getCorrectPointerPosition(t),s=1+.005*t.deltaY*i;n.emitZoomEvent(s,r)}else n.emit("wheel",{x:-t.deltaX,y:-t.deltaY},{type:"mouse",position:n.getCorrectPointerPosition(t),button:t.button,touchesCount:0})},n.target=e,n.targetBounds=e.getBoundingClientRect(),n.addListeners(),n}return at(e,t),e.prototype.updateTargetBounds=function(){this.targetBounds=this.target.getBoundingClientRect()},e.prototype.addListeners=function(){this.addTouchEventListeners(),this.addMouseEventListeners(),this.addKeyboardEventListeners(),this.addSafariGesturesEventListeners()},e.prototype.addKeyboardEventListeners=function(){var t=this;this.listenersCollector.add(document,"keydown",(function(e){"Control"===e.key&&(t.state.isCtrlPressed=!0)})),this.listenersCollector.add(document,"keyup",(function(e){"Control"===e.key&&(t.state.isCtrlPressed=!1)})),this.listenersCollector.add(document,"contextmenu",(function(e){e.ctrlKey&&(t.state.isCtrlPressed=!1)}))},e.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)},e.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)},e.prototype.addSafariGesturesEventListeners=function(){Bt()||(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}))},e.prototype.clampPointerToTargetBounds=function(t){return{x:xt(t.x-this.targetBounds.x,0,this.target.clientWidth),y:xt(t.y-this.targetBounds.y,0,this.target.clientHeight)}},e.prototype.getCorrectPointerPosition=function(t){var e,n={x:0,y:0};if((null===(e=t.touches)||void 0===e?void 0:e.length)>1){var o=t,i=o.touches[0],r=o.touches[1];n={x:(i.clientX+r.clientX)/2,y:(i.clientY+r.clientY)/2}}else n=Ot(t);return this.clampPointerToTargetBounds(n)},e.prototype.updateMousePosition=function(t){this.emit("pointermove",{type:"mouse",position:this.getCorrectPointerPosition(t),button:t.button,touchesCount:0})},e.prototype.updateGlobalMousePosition=function(t){this.emit("globalpointermove",{type:"mouse",position:this.getCorrectPointerPosition(t),button:t.button,touchesCount:0})},e.prototype.calculateDistanceBetweenTouches=function(t,e){return Math.hypot(t.clientX-e.clientX,t.clientY-e.clientY)},e.prototype.emitZoomEvent=function(t,e){this.emit("pinchToZoom",t,e)},e.prototype.dispose=function(){this.listenersCollector.dispose()},e}(It),Nt=function(t){function e(e){var n=t.call(this)||this;return n.listenersCollector=new St,n.handleKeyUp=function(t){n.emit("keyUp",t.code)},n.target=e,n.addListeners(),n}return at(e,t),e.prototype.addListeners=function(){this.listenersCollector.add(this.target,"keyup",this.handleKeyUp)},e.prototype.dispose=function(){this.listenersCollector.dispose()},e}(It),zt=function(){function t(){this.active=!0}return t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.active&&console.debug.apply(console,lt(["[WR:Debug]"],t,!1))},t.prototype.warning=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.active&&console.warn.apply(console,lt(["[WR:Warn]"],t,!1))},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];console.error.apply(console,lt(["[WR:Error]"],t,!1))},t}(),jt=new zt,Ut=function(){function t(t){this.label=t,this.startTime=performance.now(),this.startTimestamp=Date.now(),jt.debug("[Performance] Start: ".concat(this.label))}return t.prototype.measure=function(){return{duration:performance.now()-this.startTime,end:Date.now(),start:this.startTimestamp,id:this.label}},t.prototype.printMeasurement=function(){var t=this.measure().duration;if(t<1e3){var e=t.toFixed(2);jt.debug("[Performance] End: ".concat(this.label," -> ").concat(e," ms"))}else{var n=(t/1e3).toFixed(2);jt.debug("[Performance] End: ".concat(this.label," -> ").concat(n," s"))}},t}();function Zt(t){setTimeout((function(){t()}),0)}var Vt=function(t){function e(e){var n=t.call(this)||this;return n.listenersCollector=new St,n.size={width:0,height:0},n.pixelRatio=1,n.handleCanvasResizeObserver=function(t){n.resizeCanvas(t[0].contentRect)},n.resizeCanvas=function(t){var e=t.width,o=t.height;window.requestAnimationFrame((function(){n.setSize(e,o),n.emit("resize",e,o,n.getDevicePixelRatio())}))},n.getCanvasCenterPoint=function(){var t=n.getBoundingClientRect();return{x:t.width/2+t.x,y:t.height/2+t.y}},n.container=e.container,n.canvas=e.canvas,n.canvasResizeObserver=new ResizeObserver(n.handleCanvasResizeObserver),n.canvasResizeObserver.observe(n.container),n.listenersCollector.add(window,"orientationchange",n.handleDeviceOrientationChange),n.setSize(n.container.clientWidth,n.container.clientHeight),n}return at(e,t),e.prototype.setSize=function(t,e){this.pixelRatio=this.getDevicePixelRatio(),this.canvas.style.width="".concat(t,"px"),this.canvas.style.height="".concat(e,"px"),this.size.width=t*this.pixelRatio,this.size.height=e*this.pixelRatio,this.canvas.width=this.size.width,this.canvas.height=this.size.height},e.prototype.handleDeviceOrientationChange=function(){this.resizeCanvas({width:this.container.clientWidth,height:this.container.clientHeight})},e.prototype.getDevicePixelRatio=function(){return xt(window.devicePixelRatio,1,2)},e.prototype.getBoundingClientRect=function(){return this.canvas.getBoundingClientRect()},e.prototype.dispose=function(){this.detachAllListeners(),this.canvasResizeObserver.disconnect(),this.listenersCollector.dispose()},e}(It),qt=function(){function t(t){this.settings=t}return t.prototype.isReleaseMode=function(){return this.settings.mode===Ft.release},t.prototype.init=function(){return ct(this,void 0,void 0,(function(){var t,e,n,o,i,r=this;return dt(this,(function(s){switch(s.label){case 0:return[4,this.importModule()];case 1:t=s.sent(),e=t.default,s.label=2;case 2:return s.trys.push([2,4,,5]),n=this,[4,e({FeatureFlags:this.settings.featureFlags,currentWebGLVersion:Tt(),bridge:this.settings.jsBridge,locateFile:function(t){return r.settings.locateFile.replace("{file}",t)}})];case 3:return n.instance=s.sent(),[3,5];case 4:throw o=s.sent(),new Pt("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=((i={})[this.instance.PRCursorType.Auto.value]="auto",i[this.instance.PRCursorType.Default.value]="default",i[this.instance.PRCursorType.Pointer.value]="pointer",i[this.instance.PRCursorType.Grab.value]="grab",i[this.instance.PRCursorType.Grabbing.value]="grabbing",i),[2]}}))}))},t.prototype.makeWebGLContext=function(t,e){void 0===e&&(e={});var n=ut({antialias:!1,alpha:!1,stencil:!1,depth:!1,powerPreference:"high-performance",preserveDrawingBuffer:!1,desynchronized:!0},e);jt.debug("Using WebGL ".concat(n.majorVersion));var o=this.instance.GL.createContext(t,n);if(!o)throw new Pt("WEBGL_ERROR","Unable to create WebGL context. WebGL might be unsupported, disabled, or this device is not able to run WebGL correctly.");return o},t.prototype.destroyWebGLContext=function(t){var e,n=null===(e=this.instance)||void 0===e?void 0:e.GL.getContext(t);if(n){var o=n.GLctx.getExtension("WEBGL_lose_context");o?o.loseContext():jt.warning("Unable to retrieve WEBGL_lose_context extension")}else jt.warning("Unable to loose context. WebGL rendering context not found")},t.prototype.importModule=function(){return this.isReleaseMode()?import("./module-release-0b378fd1.js"):import("./module-debug-7ee9ba03.js")},t.prototype.mapToCSSCursor=function(t){return this.prCursorTypeToCSSCursorMap[t.value]},t.prototype.mapToPRPointerType=function(t){var e;return null!==(e=this.pointerTypeToWASMMap[t])&&void 0!==e?e:this.instance.PRUserPointerType.Unset},t.prototype.mapPointerInfo=function(t){return ut(ut({},t),{type:this.mapToPRPointerType(t.type)})},t}(),Ht=function(t){function e(e){var n=t.call(this)||this;return n.status={type:"INIT"},n.handleCanvasResize=function(t,e,o){var i;null===(i=n.pageCanvasWasm)||void 0===i||i.resize(t,e,o)},n.handleWebGLContextLost=function(){n.setStatus({type:"WEBGL_CONTEXT_LOST"})},n.handlePinchToZoomEvent=function(t,e){var o;null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchPinchToZoomEvent(t,e.x,e.y)},n.handleWheelEvent=function(t,e){var o;null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchWheelEvent(t.x,t.y,n.wasmModule.mapPointerInfo(e))},n.handlePointerDownEvent=function(t){var e;null===(e=n.userEventsCollectorWasm)||void 0===e||e.dispatchPointerDownEvent(n.wasmModule.mapPointerInfo(t))},n.handlePointerMoveEvent=function(t){var e;null===(e=n.userEventsCollectorWasm)||void 0===e||e.dispatchPointerMoveEvent(n.wasmModule.mapPointerInfo(t))},n.handleGlobalPointerMoveEvent=function(t){var e;null===(e=n.userEventsCollectorWasm)||void 0===e||e.dispatchGlobalPointerMoveEvent(n.wasmModule.mapPointerInfo(t))},n.handlePointerUpEvent=function(t){var e;null===(e=n.userEventsCollectorWasm)||void 0===e||e.dispatchPointerUpEvent(n.wasmModule.mapPointerInfo(t))},n.settings=ut(ut({backgroundColor:{r:1,g:1,b:1,a:1},showTilesBorders:!1,preserveDrawingBuffer:!1,panBoundariesPadding:0},Wt(e)),{featureFlags:ut(ut({},Rt),e.featureFlags)}),jt.active=n.settings.mode===Ft.debug,n.gestureManager=new Gt(n.settings.container),n.canvasManager=new Vt({container:n.settings.container,canvas:n.settings.canvas}),n.wasmModule=new qt({mode:n.settings.mode,locateFile:n.settings.locateFile,jsBridge:n.createJSBridge(),featureFlags:n.settings.featureFlags}),n.settings.manualInitialization||n.init(),n}return at(e,t),e.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)},e.prototype.collectAndEmitDeviceInfo=function(){return ct(this,void 0,void 0,(function(){var t;return dt(this,(function(e){switch(e.label){case 0:return[4,Ct()];case 1:return t=e.sent(),this.deviceInfo=ut(ut({},t),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},e.prototype.init=function(){return ct(this,void 0,void 0,(function(){var t;return dt(this,(function(e){switch(e.label){case 0:this.traceFirstPaint=new Ut("FirstPaint"),this.setStatus({type:"INIT"}),this.collectAndEmitDeviceInfo(),e.label=1;case 1:return e.trys.push([1,6,,7]),[4,this.initWasmModule()];case 2:return e.sent(),[4,this.initCanvasRendererWasm()];case 3:return e.sent(),[4,this.setFile(this.settings.filePath)];case 4:return e.sent(),[4,this.preloadImages()];case 5:return e.sent(),[3,7];case 6:return t=e.sent(),[2,this.fail(t instanceof Pt?t:new Pt("ERROR","Unexpected exception initializing the web renderer",t))];case 7:return this.setInitialCameraState(),this.startRendering(),this.addListeners(),[2]}}))}))},e.prototype.setInitialCameraState=function(){var t,e,n,o=void 0!==this.settings.initialZoom,i=void 0!==this.settings.initialPan;o||i?(o&&this.setZoom(this.settings.initialZoom||1),i&&this.setPan((null===(t=this.settings.initialPan)||void 0===t?void 0:t.x)||0,(null===(e=this.settings.initialPan)||void 0===e?void 0:e.y)||0,null===(n=this.settings.initialPan)||void 0===n?void 0:n.centerPointInViewport)):this.zoomToFit()},e.prototype.preloadImages=function(){var t=this;return new Promise((function(e){var n;null===(n=t.pageCanvasWasm)||void 0===n||n.preloadImages((function(){e()}))}))},e.prototype.startRendering=function(){this.traceInitialRender=new Ut("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),this.pageCanvasWasm.startRenderLoop()},e.prototype.createJSBridge=function(){var t=this;return{logDebug:function(t){jt.debug("[C++] ".concat(t))},logWarning:function(t){jt.warning("[C++] ".concat(t))},logError:function(t){jt.error("[C++] ".concat(t))},emitMetric:function(e,n,o,i){t.emit("metric",{id:e,start:n,end:o,duration:i})},resolveImageUrl:function(e){return t.settings.imagesURLFormat?t.settings.imagesURLFormat.replace(":imageId",e):t.settings.imagesURLMap&&t.settings.imagesURLMap[e]?t.settings.imagesURLMap[e]:(jt.warning("Not able to resolve the url for the image with UUID: ".concat(e)),"")},onDrawComplete:this.handleDrawComplete.bind(this),onAllImagesReady:function(){t.emit("allImagesReady")},onCameraMoveStart:function(){t.emit("cameraMoveStart")},onCameraMoveEnd:function(){t.emit("cameraMoveEnd")},onCameraZoomStart:function(){t.emit("cameraZoomStart")},onCameraZoomEnd:function(){t.emit("cameraZoomEnd")},onCameraZoomChange:function(e){t.emit("cameraZoomChange",e)},onCameraPanChange:function(){var e=t.getPan();t.emit("cameraPanChange",(null==e?void 0:e.x)||0,(null==e?void 0:e.y)||0)},onCursorChange:function(e){var n=t.wasmModule.mapToCSSCursor(e);t.emit("cursorChange",n)},onPlayStateChange:function(){}}},e.prototype.downloadImages=function(){var t=this;return new Promise((function(e){var n,o=new Ut("ImagesDownload");null===(n=t.pageCanvasWasm)||void 0===n||n.downloadImages((function(){o.printMeasurement(),t.emit("metric",o.measure()),jt.debug("Images downloaded"),e()}))}))},e.prototype.initWasmModule=function(){return ct(this,void 0,void 0,(function(){var t;return dt(this,(function(e){switch(e.label){case 0:return t=new Ut("WasmModuleDownload"),[4,this.wasmModule.init()];case 1:return e.sent(),t.printMeasurement(),this.emit("metric",t.measure()),[2]}}))}))},e.prototype.initCanvasRendererWasm=function(){return ct(this,void 0,void 0,(function(){return dt(this,(function(t){try{this.webglCtxHandle=this.wasmModule.makeWebGLContext(this.settings.canvas,{preserveDrawingBuffer:this.settings.preserveDrawingBuffer,majorVersion:Tt()}),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(t){throw new Pt("WASM_ERROR","An error occurred while trying to create the wasm object.",t)}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]}))}))},e.prototype.setIsCameraLocked=function(t){this.pageCanvasWasm.setIsCameraLocked(t)},e.prototype.setBackgroundColor=function(t){t.r===this.settings.backgroundColor.r&&t.g===this.settings.backgroundColor.g&&t.b===this.settings.backgroundColor.b&&t.a===this.settings.backgroundColor.a||(this.pageCanvasWasm.setBackgroundColor(t.r,t.g,t.b,t.a),this.settings.backgroundColor=t)},e.prototype.generateDocumentPNG=function(){return ct(this,void 0,void 0,(function(){return dt(this,(function(t){switch(t.label){case 0:return[4,this.downloadImages()];case 1:return t.sent(),[2,this.pageCanvasWasm.generateDocumentPNG()]}}))}))},e.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"}),this.downloadImages())},e.prototype.looseWebGLContext=function(){this.wasmModule.destroyWebGLContext(this.webglCtxHandle),this.webglCtxHandle=-1},e.prototype.zoomToFit=function(){this.pageCanvasWasm.scaleDocumentToFit()},e.prototype.setFile=function(t){return ct(this,void 0,void 0,(function(){var e=this;return dt(this,(function(n){return this.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,o){e.pageCanvasWasm.setFile(t,(function(t,o,i,r){if(void 0===r&&(r=[]),r.length){jt.debug("Parser warnings: ".concat(r));var s=r.map((function(t){return{key:t}}));e.emit("warnings",s)}e.setStatus({type:"FILE_READY"}),e.emit("fileReady",e.getDocument(),t,o,i),n()}),(function(){return o(new Pt("FILE_ERROR","Error encountered while fetching and parsing the file"))}))}))]}))}))},e.prototype.fail=function(t){this.setStatus({type:"FAILURE",code:t.code,message:"".concat(t.toString()).concat(t.cause?"\nWrapped Error: ".concat(t.cause.toString()):"")}),jt.error(t),t.cause&&jt.error(t.cause)},e.prototype.setStatus=function(t){"FAILURE"!==this.status.type&&(jt.debug("Status transition ".concat(this.status.type," => ").concat(t.type,"}")),this.status=t,this.emit("status",t))},e.prototype.getDocument=function(){if(!this.cachedDocumentInfo||this.cachedDocumentInfo.filePath!==this.settings.filePath){var t=this.pageCanvasWasm.getPRFile();this.cachedDocumentInfo={filePath:this.settings.filePath,document:ut(ut({},t),{artboards:At(t.artboards)})}}return this.cachedDocumentInfo.document},e.prototype.getArtboardAtPosition=function(t,e){if(this.pageCanvasWasm){var n=this.getDocument();if(n){for(var o=this.pageCanvasWasm.getPan(),i=this.pageCanvasWasm.getZoom(),r=(t-o.x)/i,s=(e-o.y)/i,a=0,u=n.artboards;a<u.length;a++){var c=u[a],d=c.bounds.x+c.bounds.width,l=c.bounds.y+c.bounds.height;if(r>=c.bounds.x&&s>=c.bounds.y&&r<=d&&s<=l)return c.objectId}return null}}},e.prototype.getPanAtPosition=function(t,e){var n=this.getPan(),o=Math.max(this.getZoom(),Number.EPSILON),i=t/o,r=e/o;return{x:n.x-i,y:n.y-r}},e.prototype.getStatus=function(){return this.status},e.prototype.setZoom=function(t,e){var n,o=null!=e?e:this.canvasManager.getCanvasCenterPoint();null===(n=this.pageCanvasWasm)||void 0===n||n.setZoom(t,o.x,o.y)},e.prototype.getPan=function(){var t=this.getDocument().bounds,e=this.pageCanvasWasm.getPan(),n=this.pageCanvasWasm.getZoom();return{x:e.x/n+t.x,y:e.y/n+t.y}},e.prototype.getZoom=function(){return this.pageCanvasWasm.getZoom()},e.prototype.setPan=function(t,e,n){void 0===n&&(n=!1);var o=t,i=e,r=this.getDocument().bounds,s=this.pageCanvasWasm.getZoom();if(n){var a=Math.max(2*s*this.canvasManager.pixelRatio,Number.EPSILON);o+=this.canvasManager.size.width/a,i+=this.canvasManager.size.height/a}var u=(o-r.x)*s,c=(i-r.y)*s;this.pageCanvasWasm.setPan(u,c)},e.prototype.dispose=function(){try{this.detachAllListeners(),this.canvasManager.dispose(),this.gestureManager.dispose(),this.pageCanvasWasm.stopRenderLoop(),this.pageCanvasWasm.delete(),this.renderTarget.delete()}catch(t){this.fail(new Pt("ERROR","Unexpected exception while disposing the wasm object",t))}},e}(It),Kt=e(void 0),Yt=e(void 0),$t=e(void 0),Xt=e(void 0),Jt=e(void 0),Qt=e(void 0),te=e("auto"),ee=e(void 0),ne=function(){var t=n(ee);if(void 0===t)throw Error("useInternalContext must be used within a provider");return t},oe=function(t,e){switch(e.type){case"on-status":return ut(ut({},t),{status:e.status});case"on-file-ready":return ut(ut({},t),{document:e.document});case"on-zoom":return ut(ut({},t),{zoom:e.zoom});case"on-pan":return ut(ut({},t),{pan:e.pan});case"dispose":return ut(ut({},t),{status:null,zoom:null,pan:null,cursor:"auto"});case"on-camera-zoom-start":return ut(ut({},t),{isCameraZooming:!0});case"on-camera-zoom-end":return ut(ut({},t),{isCameraZooming:!1});case"on-camera-move-start":return ut(ut({},t),{isCameraMoving:!0});case"on-camera-move-end":return ut(ut({},t),{isCameraMoving:!1});case"on-cursor-change":return ut(ut({},t),{cursor:e.cursor});default:return t}},ie=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return jt.debug.apply(jt,lt(["CanvasRendererReact"],t,!1))},re=function(e){var n=o(null),a=o(null),u=i(oe,{pan:null,zoom:null,status:null,document:null,isCameraZooming:!1,isCameraMoving:!1,cursor:"auto"}),c=u[0],d=c.status,l=c.document,h=c.zoom,b=c.pan,p=c.isCameraZooming,f=c.isCameraMoving,_=c.cursor,g=u[1],m=r((function(t){return g({type:"on-zoom",zoom:t})}),[]),v=r((function(t,e){return g({type:"on-pan",pan:{x:t,y:e}})}),[]),w=r((function(t){g({type:"on-status",status:t})}),[]),y=r((function(t){g({type:"on-file-ready",document:t})}),[]),C=r((function(){return g({type:"on-camera-zoom-start"})}),[]),F=r((function(){return g({type:"on-camera-zoom-end"})}),[]),P=r((function(){return g({type:"on-camera-move-start"})}),[]),I=r((function(){return g({type:"on-camera-move-end"})}),[]),S=r((function(t){return g({type:"on-cursor-change",cursor:t})}),[]),R=r((function(){var t=n.current;t&&(ie("dispose"),t.off("status",w),t.off("fileReady",y),t.off("cameraZoomChange",m),t.off("cameraPanChange",v),t.off("cameraZoomStart",C),t.off("cameraZoomEnd",F),t.off("cameraMoveStart",P),t.off("cameraMoveEnd",I),t.off("cursorChange",S),t.dispose(),n.current=null,g({type:"dispose"}))}),[w,y,v,m,C,F,P,I,S]),E=r((function(t,e,o){if(""!==t&&e&&o&&a.current){ie("init");var i=new Ht(ut(ut({},a.current),{filePath:t,container:o,canvas:e}));i.on("status",w),i.on("fileReady",y),i.on("cameraZoomChange",m),i.on("cameraPanChange",v),i.on("cameraZoomStart",C),i.on("cameraZoomEnd",F),i.on("cameraMoveStart",P),i.on("cameraMoveEnd",I),i.on("cursorChange",S),n.current=i}}),[w,y,m,v,C,F,P,I,S]),M=r((function(t){var e;ie("setSettings",t),t.backgroundColor&&(null===(e=n.current)||void 0===e||e.setBackgroundColor(t.backgroundColor)),a.current=t}),[]),L=r((function(){return n.current}),[]),D=s((function(){return{dispose:R,init:E,setSettings:M,getInstance:L,dispatch:g}}),[R,E,M,L]);return t.createElement(ee.Provider,{value:D},t.createElement(Kt.Provider,{value:d},t.createElement(Yt.Provider,{value:l},t.createElement($t.Provider,{value:h},t.createElement(Qt.Provider,{value:b},t.createElement(Xt.Provider,{value:p},t.createElement(Jt.Provider,{value:f},t.createElement(te.Provider,{value:_},e.children))))))))},se=function(){var t=n(Kt);if(void 0===t)throw Error("useStatus must be used within a provider");return t},ae=function(){var t=n(Yt);if(void 0===t)throw Error("useDocument must be used within a provider");return t},ue=function(){var t=n($t);if(void 0===t)throw Error("useZoom must be used within a provider");return t},ce=function(){var t=n(Qt);if(void 0===t)throw Error("usePan must be used within a provider");return t},de=function(){var t=n(te);if(void 0===t)throw Error("useCursor must be used within a provider");return t},le=function(){var t=n(Xt);if(void 0===status)throw Error("useIsCameraZooming must be used within a provider");return t},he=function(){var t=n(Jt);if(void 0===status)throw Error("useIsCameraMoving must be used within a provider");return t},be=function(){var t=(0,ne().getInstance)();return r((function(e){ie("setZoom",e),null==t||t.setZoom(e)}),[t])},pe=function(){var t=be(),e=ue();return r((function(){var n;(ie("incrementZoom"),"number"==typeof e)&&(n=e>=1?Math.round(2*e):e>.5?1:2*e,t(n))}),[t,e])},fe=function(){var t=be(),e=ue();return r((function(){ie("decrementZoom"),"number"==typeof e&&t(e/2)}),[t,e])},_e=function(){var t=(0,ne().getInstance)();return r((function(e){var n=e.x,o=e.y,i=e.centerPointInViewport;ie("setPan",n,o,"centerPointInViewport",i),null==t||t.setPan(n,o,i)}),[t])},ge=function(){var t=(0,ne().getInstance)();return r((function(){ie("zoomToFit"),null==t||t.zoomToFit()}),[t])},me=function(){var t=(0,ne().getInstance)();return r((function(){ie("looseWebGLContext"),null==t||t.looseWebGLContext()}),[t])},ve=function(){var t=(0,ne().getInstance)();return r((function(){return ct(void 0,void 0,void 0,(function(){return dt(this,(function(e){switch(e.label){case 0:return ie("generateDocumentPNG"),[4,null==t?void 0:t.generateDocumentPNG()];case 1:return[2,e.sent()]}}))}))}),[t])},we=function(){var t=(0,ne().getInstance)();return r((function(e,n){return ct(void 0,void 0,void 0,(function(){return dt(this,(function(o){switch(o.label){case 0:return ie("getArtboardAtPosition",e,n),[4,null==t?void 0:t.getArtboardAtPosition(e,n)];case 1:return[2,o.sent()||null]}}))}))}),[t])},ye=function(){var t=(0,ne().getInstance)();return r((function(e,n){return ct(void 0,void 0,void 0,(function(){return dt(this,(function(o){switch(o.label){case 0:return ie("getPanAtPosition",e,n),[4,null==t?void 0:t.getPanAtPosition(e,n)];case 1:return[2,o.sent()||null]}}))}))}),[t])},Ce=function(){var t=(0,ne().getInstance)();return r((function(e){ie("setIsCameraLocked",e),null==t||t.setIsCameraLocked(e)}),[t])},Fe=function(t,e){var n=(0,ne().getInstance)();a((function(){return null==n||n.on(t,e),function(){null==n||n.off(t,e)}}),[t,n,e])},Pe={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},Ie={position:"absolute",top:0,left:0},Se=function(e){jt.active=e.mode===Ft.debug;var n=e.filePath,i=e.locateFile,c=e.imagesURLFormat,d=e.imagesURLMap,l=e.backgroundColor,h=e.mode,b=e.showTilesBorders,p=e.minimumZoomLevel,f=e.maximumZoomLevel,_=e.preserveDrawingBuffer,g=e.panBoundariesPadding,m=e.initialPan,v=e.initialZoom,w=e.children,y=e.containerProps,C=void 0===y?{}:y,F=e.canvasProps,P=void 0===F?{}:F,I=e.featureFlags,S=void 0===I?{}:I,R=o(null),E=o(null),M=u(!1),L=M[0],D=M[1],O=r((function(){return D(!0)}),[]),x=ne(),T=x.dispose,A=x.init,B=x.setSettings,W=de(),k=se();Fe("allImagesReady",O),a((function(){B({locateFile:i,imagesURLFormat:c,imagesURLMap:d,backgroundColor:l,mode:h,showTilesBorders:b,minimumZoomLevel:p,maximumZoomLevel:f,preserveDrawingBuffer:_,panBoundariesPadding:g,initialPan:m,initialZoom:v,featureFlags:S})}),[B,i,c,d,l,h,b,p,f,_,g,m,v,S]),a((function(){if(n)return A(n,R.current,E.current),function(){T()}}),[T,A,n]);var G=s((function(){var t;return null!==(t=e.cursor)&&void 0!==t?t:W}),[e.cursor,W]),N=s((function(){return ut(ut({},Pe),{cursor:G})}),[G]);return t.createElement("div",ut({},C,{ref:E,style:N}),n&&t.createElement("canvas",ut({},P,{key:n,ref:R,"data-sketchweb-all-images-ready":L,"data-testid":"sketchweb-canvas","data-sketchweb-status":"sketchweb-status-".concat((null==k?void 0:k.type.toLowerCase())||"null"),style:Ie})),"READY"===(null==k?void 0:k.type)&&w)},Re=function(t){function e(e){var n=t.call(this)||this;return n.status={type:"INIT"},n.handleCanvasResize=function(t,e,o){var i;null===(i=n.playerWasm)||void 0===i||i.resize(t,e,o)},n.handleWebGLContextLost=function(){n.setStatus({type:"WEBGL_CONTEXT_LOST"})},n.handlePinchToZoomEvent=function(t,e){var o;null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchPinchToZoomEvent(t,e.x,e.y)},n.handleWheelEvent=function(t,e){n.userEventsCollectorWasm.dispatchWheelEvent(t.x,t.y,n.wasmModule.mapPointerInfo(e))},n.handlePointerDownEvent=function(t){n.userEventsCollectorWasm.dispatchPointerDownEvent(n.wasmModule.mapPointerInfo(t))},n.handlePointerMoveEvent=function(t){n.userEventsCollectorWasm.dispatchPointerMoveEvent(n.wasmModule.mapPointerInfo(t))},n.handleGlobalPointerMoveEvent=function(t){n.userEventsCollectorWasm.dispatchGlobalPointerMoveEvent(n.wasmModule.mapPointerInfo(t))},n.handlePointerUpEvent=function(t){n.userEventsCollectorWasm.dispatchPointerUpEvent(n.wasmModule.mapPointerInfo(t))},n.restartPrototype=function(t){n.playerWasm.restartPrototype(t)},n.goBack=function(){n.playerWasm.goBack()},n.goForwards=function(){n.playerWasm.goForwards()},n.settings=ut(ut({backgroundColor:{r:1,g:1,b:1,a:1},showTilesBorders:!1,preserveDrawingBuffer:!1},Wt(e)),{featureFlags:ut(ut({},Rt),e.featureFlags)}),jt.active=n.settings.mode===Ft.debug,n.gestureManager=new Gt(n.settings.container),n.canvasManager=new Vt({container:n.settings.container,canvas:n.settings.canvas}),n.wasmModule=new qt({mode:n.settings.mode,locateFile:n.settings.locateFile,jsBridge:n.createJSBridge(),featureFlags:n.settings.featureFlags}),n.settings.manualInitialization||n.init(),n}return at(e,t),e.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)},e.prototype.collectAndEmitDeviceInfo=function(){return ct(this,void 0,void 0,(function(){var t;return dt(this,(function(e){switch(e.label){case 0:return[4,Ct()];case 1:return t=e.sent(),this.deviceInfo=ut(ut({},t),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},e.prototype.init=function(){return ct(this,void 0,void 0,(function(){var t;return dt(this,(function(e){switch(e.label){case 0:this.traceFirstPaint=new Ut("FirstPaint"),this.setStatus({type:"INIT"}),this.collectAndEmitDeviceInfo(),e.label=1;case 1:return e.trys.push([1,6,,7]),[4,this.initWasmModule()];case 2:return e.sent(),[4,this.initPlayerWasm()];case 3:return e.sent(),[4,this.setFile(this.settings.filePath)];case 4:return e.sent(),[4,this.preloadImages()];case 5:return e.sent(),[3,7];case 6:return t=e.sent(),[2,this.fail(t instanceof Pt?t:new Pt("ERROR","Unexpected exception initializing the web renderer",t))];case 7:return this.setInitialCameraState(),this.startRendering(),this.addListeners(),[2]}}))}))},e.prototype.initWasmModule=function(){return ct(this,void 0,void 0,(function(){var t;return dt(this,(function(e){switch(e.label){case 0:return t=new Ut("WasmModuleDownload"),[4,this.wasmModule.init()];case 1:return e.sent(),t.printMeasurement(),this.emit("metric",t.measure()),[2]}}))}))},e.prototype.setInitialCameraState=function(){this.zoomToFit()},e.prototype.preloadImages=function(){var t=this;return new Promise((function(e){var n;null===(n=t.playerWasm)||void 0===n||n.preloadImages((function(){e()}))}))},e.prototype.startRendering=function(){this.traceInitialRender=new Ut("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),this.playerWasm.startRenderLoop()},e.prototype.createJSBridge=function(){var t=this;return{logDebug:function(t){jt.debug("[C++] ".concat(t))},logWarning:function(t){jt.warning("[C++] ".concat(t))},logError:function(t){jt.error("[C++] ".concat(t))},emitMetric:function(e,n,o,i){t.emit("metric",{id:e,start:n,end:o,duration:i})},resolveImageUrl:function(e){return t.settings.imagesURLFormat?t.settings.imagesURLFormat.replace(":imageId",e):t.settings.imagesURLMap&&t.settings.imagesURLMap[e]?t.settings.imagesURLMap[e]:(jt.warning("Not able to resolve the url for the image with UUID: ".concat(e)),"")},onDrawComplete:this.handleDrawComplete.bind(this),onAllImagesReady:function(){t.emit("allImagesReady")},onCameraMoveStart:function(){t.emit("cameraMoveStart")},onCameraMoveEnd:function(){t.emit("cameraMoveEnd")},onCameraZoomStart:function(){t.emit("cameraZoomStart")},onCameraZoomEnd:function(){t.emit("cameraZoomEnd")},onCameraZoomChange:function(e){t.emit("cameraZoomChange",e)},onCameraPanChange:function(e,n){t.emit("cameraPanChange",e,n)},onCursorChange:function(e){var n=t.wasmModule.mapToCSSCursor(e);t.emit("cursorChange",n)},onPlayStateChange:function(e,n,o){t.emit("playStateChange",{screenArtboardId:e,canGoBack:n,canGoForwards:o})}}},e.prototype.downloadImages=function(){var t=this;return new Promise((function(e){var n,o=new Ut("ImagesDownload");null===(n=t.playerWasm)||void 0===n||n.downloadImages((function(){o.printMeasurement(),t.emit("metric",o.measure()),jt.debug("Images downloaded"),e()}))}))},e.prototype.initPlayerWasm=function(){return ct(this,void 0,void 0,(function(){return dt(this,(function(t){try{this.webglCtxHandle=this.wasmModule.makeWebGLContext(this.settings.canvas,{preserveDrawingBuffer:this.settings.preserveDrawingBuffer,majorVersion:Tt()}),this.renderTarget=this.wasmModule.instance.RenderTarget.MakeWebGL(this.webglCtxHandle,this.canvasManager.size.width,this.canvasManager.size.height,this.canvasManager.pixelRatio),this.playerWasm=new this.wasmModule.instance.PrototypeRenderer(this.renderTarget,{showTilesBorders:this.settings.showTilesBorders},this.settings.startArtboardUUID)}catch(t){throw new Pt("WASM_ERROR","An error occurred while trying to create the WebRendererWasm object.",t)}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),[2]}))}))},e.prototype.setIsCameraLocked=function(t){var e;null===(e=this.playerWasm)||void 0===e||e.setIsCameraLocked(t)},e.prototype.setBackgroundColor=function(t){var e;t.r===this.settings.backgroundColor.r&&t.g===this.settings.backgroundColor.g&&t.b===this.settings.backgroundColor.b&&t.a===this.settings.backgroundColor.a||(null===(e=this.playerWasm)||void 0===e||e.setBackgroundColor(t.r,t.g,t.b,t.a),this.settings.backgroundColor=t)},e.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"}),this.downloadImages())},e.prototype.looseWebGLContext=function(){this.wasmModule.destroyWebGLContext(this.webglCtxHandle),this.webglCtxHandle=-1},e.prototype.zoomToFit=function(){this.playerWasm.scaleDocumentToFit()},e.prototype.setFile=function(t){return ct(this,void 0,void 0,(function(){var e=this;return dt(this,(function(n){return this.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,o){e.playerWasm.setFile(t,(function(t,o,i,r){if(void 0===r&&(r=[]),r.length){jt.debug("Parser warnings: ".concat(r));var s=r.map((function(t){return{key:t}}));e.emit("warnings",s)}e.setStatus({type:"FILE_READY"}),e.emit("fileReady",e.getDocument(),t,o,i),n()}),(function(){return o(new Pt("FILE_ERROR","Error encountered while fetching and parsing the file"))}))}))]}))}))},e.prototype.fail=function(t){this.setStatus({type:"FAILURE",code:t.code,message:"".concat(t.toString()).concat(t.cause?"\nWrapped Error: ".concat(t.cause.toString()):"")}),jt.error(t),t.cause&&jt.error(t.cause)},e.prototype.setStatus=function(t){"FAILURE"!==this.status.type&&(jt.debug("Status transition ".concat(this.status.type," => ").concat(t.type,"}")),this.status=t,this.emit("status",t))},e.prototype.getStatus=function(){return this.status},e.prototype.getDocument=function(){if(!this.cachedDocumentInfo||this.cachedDocumentInfo.filePath!==this.settings.filePath){var t=this.playerWasm.getPRFile();this.cachedDocumentInfo={filePath:this.settings.filePath,document:ut(ut({},t),{artboards:At(t.artboards)})}}return this.cachedDocumentInfo.document},e.prototype.dispose=function(){try{this.detachAllListeners(),this.canvasManager.dispose(),this.gestureManager.dispose(),this.playerWasm.stopRenderLoop(),this.playerWasm.delete(),this.renderTarget.delete()}catch(t){this.fail(new Pt("ERROR","Unexpected exception while disposing the WebRendererWasm object",t))}},e}(It),Ee=e(void 0),Me=e("auto"),Le=e(void 0),De=e(void 0),Oe=function(){var t=n(De);if(void 0===t)throw Error("useInternalContext must be used within a provider");return t},xe=function(t,e){switch(e.type){case"on-status":return ut(ut({},t),{status:e.status});case"dispose":return ut(ut({},t),{status:null,cursor:"auto"});case"on-cursor-change":return ut(ut({},t),{cursor:e.cursor});case"on-play-state-change":return ut(ut({},t),{playState:ut(ut({},t.playState),e.playState)});default:return t}},Te=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return jt.debug.apply(jt,lt(["PrototypeRendererReact"],t,!1))},Ae=function(e){var n=o(null),a=o(null),u=i(xe,{status:null,cursor:"auto",playState:{screenArtboardId:"",canGoBack:!0,canGoForwards:!0}}),c=u[0],d=c.status,l=c.cursor,h=c.playState,b=u[1],p=r((function(t){b({type:"on-status",status:t})}),[]),f=r((function(t){return b({type:"on-cursor-change",cursor:t})}),[]),_=r((function(t){return b({type:"on-play-state-change",playState:t})}),[]),g=r((function(){var t=n.current;t&&(Te("dispose"),t.off("status",p),t.off("cursorChange",f),t.off("playStateChange",_),t.dispose(),n.current=null,b({type:"dispose"}))}),[p,f,_]),m=r((function(t,e,o){if(""!==t&&e&&o&&a.current){Te("init");var i=new Re(ut(ut({},a.current),{filePath:t,container:o,canvas:e}));i.on("status",p),i.on("cursorChange",f),i.on("playStateChange",_),n.current=i}}),[p,f,_]),v=r((function(t){var e;Te("setSettings",t),t.backgroundColor&&(null===(e=n.current)||void 0===e||e.setBackgroundColor(t.backgroundColor)),a.current=t}),[]),w=r((function(){return n.current}),[]),y=s((function(){return{dispose:g,init:m,setSettings:v,getInstance:w,dispatch:b}}),[g,m,v,w]);return t.createElement(De.Provider,{value:y},t.createElement(Ee.Provider,{value:d},t.createElement(Me.Provider,{value:l},t.createElement(Le.Provider,{value:h},e.children))))},Be=function(){var t=(0,Oe().getInstance)();return r((function(e){null==t||t.restartPrototype(e)}),[t])},We=function(){var t=(0,Oe().getInstance)();return r((function(){null==t||t.goBack()}),[t])},ke=function(){var t=(0,Oe().getInstance)();return r((function(){null==t||t.goForwards()}),[t])},Ge=function(){var t=n(Ee);if(void 0===t)throw Error("usePrototypeStatus must be used within a provider");return t},Ne=function(){var t=n(Me);if(void 0===t)throw Error("usePrototypeCursor must be used within a provider");return t},ze=function(){var t=n(Le);if(void 0===t)throw Error("usePrototypePlayState must be used within a provider");return t},je=function(t,e){var n=(0,Oe().getInstance)();a((function(){return null==n||n.on(t,e),function(){null==n||n.off(t,e)}}),[t,n,e])},Ue={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},Ze={position:"absolute",top:0,left:0},Ve=function(e){jt.active=e.mode===Ft.debug;var n=e.filePath,i=e.locateFile,r=e.imagesURLFormat,u=e.imagesURLMap,c=e.backgroundColor,d=e.mode,l=e.showTilesBorders,h=e.minimumZoomLevel,b=e.maximumZoomLevel,p=e.preserveDrawingBuffer,f=e.children,_=e.containerProps,g=void 0===_?{}:_,m=e.canvasProps,v=void 0===m?{}:m,w=e.featureFlags,y=void 0===w?{}:w,C=e.startArtboardUUID,F=o(null),P=o(null),I=Oe(),S=I.dispose,R=I.init,E=I.setSettings,M=Ne(),L=Ge();a((function(){E({locateFile:i,imagesURLFormat:r,imagesURLMap:u,backgroundColor:c,mode:d,showTilesBorders:l,minimumZoomLevel:h,maximumZoomLevel:b,preserveDrawingBuffer:p,featureFlags:y,startArtboardUUID:C})}),[E,i,r,u,c,d,l,h,b,p,y,C]),a((function(){if(n)return R(n,F.current,P.current),function(){S()}}),[S,R,n]);var D=s((function(){return ut(ut({},Ue),{cursor:M})}),[M]);return t.createElement("div",ut({},g,{ref:P,style:D}),n&&t.createElement("canvas",ut({},v,{key:n,ref:F,"data-testid":"prototype-canvas","data-prototype-status":"prototype-status-".concat((null==L?void 0:L.type.toLowerCase())||"null"),style:Ze})),"READY"===(null==L?void 0:L.type)&&f)};export{Jt as CameraMoveContext,Xt as CameraZoomingContext,Ht as CanvasRenderer,re as CanvasRendererProvider,Se as CanvasRendererReact,te as CursorContext,Rt as DefaultFeatureFlags,Yt as DocumentContext,It as EventEmitter,rt as FileFormat,Gt as GestureManager,Nt as KeyboardManager,St as ListenersCollector,zt as Logger,Qt as PanContext,Ut as Performance,Re as PrototypeRenderer,Ae as PrototypeRendererProvider,Ve as PrototypeRendererReact,Kt as StatusContext,Pt as WebRendererError,Ft as WebRendererMode,$t as ZoomContext,xt as clamp,At as convertEmbindVectorToArray,Dt as debounce,Ot as extractPointer,Tt as getSupportedWebGLVersion,Et as getiOSVersion,Bt as isTouchDevice,jt as logger,Zt as nextTick,Lt as parseSafariUserAgent,oe as reducer,Wt as removeUndefinedKeys,kt as touchableClick,de as useCursor,fe as useDecrementZoom,ae as useDocument,Fe as useEvent,ve as useGenerateDocumentPNG,we as useGetArtboardAtPosititon,ye as useGetPanAtPosition,We as useGoBack,ke as useGoForwards,pe as useIncrementZoom,he as useIsCameraMoving,le as useIsCameraZooming,Ce as useLockCamera,me as useLooseWebGLContext,ce as usePan,Ne as usePrototypeCursor,je as usePrototypeEvent,ze as usePrototypePlayState,Ge as usePrototypeStatus,Be as useRestartPrototype,_e as useSetPan,be as useSetZoom,se as useStatus,ue as useZoom,ge as useZoomToFit};
Binary file