@sketch-hq/sketch-web-renderer 3.2.0 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/featureFlags.d.ts +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/module-debug.wasm +0 -0
  6. package/dist/module-release.wasm +0 -0
  7. package/dist/static/js/web-renderer-8addc65e32c7f00a9bf5.chunk.js +1 -0
  8. package/dist/static/js/web-renderer-8cbabe889ae0a40da834.chunk.js +1 -0
  9. package/dist/static/js/web-renderer-dcd9a388dd98f28adced.chunk.js +1 -0
  10. package/dist/ts/Manager.d.ts +21 -11
  11. package/dist/ts/Manager.d.ts.map +1 -1
  12. package/dist/ts/SketchWeb.d.ts +25 -15
  13. package/dist/ts/SketchWeb.d.ts.map +1 -1
  14. package/dist/ts/react/SketchWebProvider.d.ts.map +1 -1
  15. package/dist/ts/react/contexts.d.ts +5 -1
  16. package/dist/ts/react/contexts.d.ts.map +1 -1
  17. package/dist/ts/react/hooks/actions.d.ts +4 -1
  18. package/dist/ts/react/hooks/actions.d.ts.map +1 -1
  19. package/dist/ts/react/hooks/state.d.ts +1 -1
  20. package/dist/ts/react/hooks/state.d.ts.map +1 -1
  21. package/dist/ts/react/hooks/useEvent.d.ts +1 -1
  22. package/dist/ts/react/hooks/useEvent.d.ts.map +1 -1
  23. package/dist/ts/react/reducer.d.ts.map +1 -1
  24. package/dist/ts/react/types.d.ts +4 -15
  25. package/dist/ts/react/types.d.ts.map +1 -1
  26. package/dist/ts/types/CSSCursor.d.ts +12 -0
  27. package/dist/ts/types/CSSCursor.d.ts.map +1 -0
  28. package/dist/ts/types/Events.d.ts +8 -4
  29. package/dist/ts/types/Events.d.ts.map +1 -1
  30. package/dist/ts/types/JSBridge.d.ts +8 -0
  31. package/dist/ts/types/JSBridge.d.ts.map +1 -1
  32. package/dist/ts/types/PointerInfo.d.ts +11 -0
  33. package/dist/ts/types/PointerInfo.d.ts.map +1 -0
  34. package/dist/ts/types/WASM.d.ts +74 -38
  35. package/dist/ts/types/WASM.d.ts.map +1 -1
  36. package/dist/ts/utils/GestureManager/GestureManager.d.ts +23 -43
  37. package/dist/ts/utils/GestureManager/GestureManager.d.ts.map +1 -1
  38. package/dist/ts/utils/misc.d.ts +0 -1
  39. package/dist/ts/utils/misc.d.ts.map +1 -1
  40. package/package.json +3 -3
  41. package/dist/static/js/web-renderer-17fd55cdb979ed59dbc9.chunk.js +0 -1
  42. package/dist/static/js/web-renderer-b584c7152f956c9cbea5.chunk.js +0 -1
  43. package/dist/static/js/web-renderer-e4d5f4f314c42815f663.chunk.js +0 -1
  44. package/dist/ts/utils/CameraMoveTracker/CameraMoveTracker.d.ts +0 -48
  45. package/dist/ts/utils/CameraMoveTracker/CameraMoveTracker.d.ts.map +0 -1
  46. package/dist/ts/utils/CameraMoveTracker/CameraMoveTracker.test.d.ts +0 -2
  47. package/dist/ts/utils/CameraMoveTracker/CameraMoveTracker.test.d.ts.map +0 -1
  48. package/dist/ts/utils/CameraMoveTracker/index.d.ts +0 -2
  49. package/dist/ts/utils/CameraMoveTracker/index.d.ts.map +0 -1
  50. package/dist/ts/utils/GestureManager/GestureManager.test.d.ts +0 -2
  51. package/dist/ts/utils/GestureManager/GestureManager.test.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @sketch-hq/sketch-web-renderer
2
2
 
3
+ ## 3.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - f0425288: Delegate events management to C++
8
+ - 11b6c0cd: Prevent transparent edges around background blurs
9
+ - caf38ea4: Fix getArtboardAtPositition, which wasn't returning the correct artboard
10
+ - 7dbac1b6: Delegate cursor management to C++
11
+ - 02ca3bae: Correctly track the first update completion
12
+
13
+ ## 3.2.1
14
+
15
+ ### Patch Changes
16
+
17
+ - 8d267822: Improved tiling system and how images are drawn in the canvas after being downloaded
18
+ - 0c7e22f7: - Read node's components stored as properties in marina files
19
+ - Update flatbuffers to v22.9.29 for both List and Marina schemas
20
+ - 1ad70e2b: Fix potential crash when PRImage format was missing
21
+
3
22
  ## 3.2.0
4
23
 
5
24
  ### Minor Changes
@@ -3,8 +3,8 @@
3
3
  */
4
4
  declare const FeatureFlags: {
5
5
  delayedDraw: boolean;
6
- useNewTiledRenderer: boolean;
7
6
  offscreenCanvas: boolean;
7
+ useDirtyRectsRendering: boolean;
8
8
  safariWebGL2: boolean;
9
9
  pageBoundariesLimit: boolean;
10
10
  };
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import { Manager } from './ts/Manager';
2
2
  export default Manager;
3
3
  export declare const DefaultFeatureFlags: {
4
4
  delayedDraw: boolean;
5
- useNewTiledRenderer: boolean;
6
5
  offscreenCanvas: boolean;
6
+ useDirtyRectsRendering: boolean;
7
7
  safariWebGL2: boolean;
8
8
  pageBoundariesLimit: boolean;
9
9
  };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var n="object"==typeof exports?t(require("react")):t(e.react);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(self,(function(e){return(()=>{var t,n,o,r,i={975:(e,t,n)=>{"use strict";function o(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())}))}n.d(t,{M:()=>f});const r=["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 i(e){return e.toLowerCase().replace(/^angle ?\((.+)\)*$/,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"")}const a="undefined"==typeof window,s=(()=>{if(a)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)}})(),u=[],c=[];function l(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,l,d=0,h=0,f=0;for(;h<o;)c[h]=e.charCodeAt(a+h),u[h]=++h;for(;f<r;)for(i=t.charCodeAt(a+f),s=f++,d=f,h=0;h<o;h++)l=i===c[h]?s:s+1,s=u[h],d=u[h]=s>d?l>d?d+1:l:l>s?s+1:l;return d}function d(e){return null!=e}class h extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const f=({mobileTiers:e=[0,15,30,60],desktopTiers:t=[0,15,30,60],override:n={},glContext:u,failIfMajorPerformanceCaveat:c=!1,benchmarksURL:f="https://unpkg.com/detect-gpu@4.0.37/dist/benchmarks"}={})=>o(void 0,void 0,void 0,(function*(){const v={};if(a)return{tier:0,type:"SSR"};const{isIpad:m=!!(null==s?void 0:s.isIpad),isMobile:p=!!(null==s?void 0:s.isMobile),screenSize:g=window.screen,loadBenchmarks:b=(e=>o(void 0,void 0,void 0,(function*(){const t=yield fetch(`${f}/${e}`).then((e=>e.json()));if(parseInt(t.shift().split(".")[0],10)<4)throw new h("Detect GPU benchmark data is out of date. Please update to version 4x");return t})))}=n;let{renderer:y}=n;const w=(e,t,n,o,r)=>({device:r,fps:o,gpu:n,isMobile:p,tier:e,type:t});let C,k="";if(y)y=i(y),C=[y];else{const e=u||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==s?void 0:s.isSafari12,c);if(!e)return w(0,"WEBGL_UNSUPPORTED");const t=e.getExtension("WEBGL_debug_renderer_info");if(t&&(y=e.getParameter(t.UNMASKED_RENDERER_WEBGL)),!y)return w(1,"FALLBACK");k=y,y=i(y),C=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",u=(null==s?void 0:s.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 c;return"80162181255"===o?c=u.filter((([,,e])=>e>=14)):(c=u.filter((([,e])=>e===o)),c.length||(c=u)),c.map((([e])=>`apple ${e} gpu`))}(e,t,n):[t]}(e,y,p)}const P=(yield Promise.all(C.map((function(e){var t;return o(this,void 0,void 0,(function*(){const n=(e=>{const t=p?["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=`${p?"m":"d"}-${n}${m?"-ipad":""}.json`,r=v[o]=null!==(t=v[o])&&void 0!==t?t:b(o);let i;try{i=yield r}catch(n){if(n instanceof h)throw n;return}const a=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 s=i.filter((([,e])=>e===a));s.length||(s=i.filter((([t])=>t.includes(e))));const u=s.length;if(0===u)return;let c,[d,,,f]=u>1?s.map((t=>[t,l(e,t[0])])).sort((([,e],[,t])=>e-t))[0][0]:s[0],y=Number.MAX_VALUE;const{devicePixelRatio:w}=window,C=g.width*w*g.height*w;for(const e of f){const[t,n]=e,o=t*n,r=Math.abs(C-o);r<y&&(y=r,c=e)}if(!c)return;const[,,k,P]=c;return[y,k,d,P]}))})))).filter(d).sort((([e=Number.MAX_VALUE,t],[n=Number.MAX_VALUE,o])=>e===n?t-o:e-n));if(!P.length){const e=r.find((e=>y.includes(e)));return e?w(0,"BLOCKLISTED",e):w(1,"FALLBACK",`${y} (${k})`)}const[,E,W,M]=P[0];if(-1===E)return w(0,"BLOCKLISTED",W,E,M);const S=p?e:t;let x=0;for(let e=0;e<S.length;e++)E>=S[e]&&(x=e);return w(x,"BENCHMARK",W,E,M)}))},519:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});const o={delayedDraw:!0,useNewTiledRenderer:!0,offscreenCanvas:!1,safariWebGL2:!1,pageBoundariesLimit:!1}},946:(e,t,n)=>{"use strict";n.d(t,{d:()=>B});var o,r=n(354),i=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}(),a=n(388),s=function(){function e(e,t){var n=this;this.cameraMoveState={status:"inactive"},this.endInteractionDebounced=(0,a.Ds)((function(){"inactive"!==n.cameraMoveState.status&&("moving"===n.cameraMoveState.status&&n.onCameraMoveEnd(),n.setCameraMoveStatus("inactive"))}),100),this.onCameraMoveStart=e,this.onCameraMoveEnd=t}return e.prototype.dispose=function(){this.endInteractionDebounced.cancel(),this.cameraMoveState={status:"inactive"}},e.prototype.handleCameraMoveEvent=function(){var e;this.endInteractionDebounced(),"inactive"===this.cameraMoveState.status&&this.setCameraMoveStatus("uncertain"),"uncertain"===this.cameraMoveState.status&&(e=this.cameraMoveState,Date.now()-e.interactionStartTimestamp>=20)&&(this.onCameraMoveStart(),this.setCameraMoveStatus("moving"))},e.prototype.setCameraMoveStatus=function(e){this.cameraMoveState="uncertain"===e?{status:"uncertain",interactionStartTimestamp:Date.now()}:{status:e}},e}(),u=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),c=function(){return(c=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}).apply(this,arguments)},l=function(e){function t(t,n){var o=e.call(this)||this;return o.listenersCollector=new i,o.state={panning:!1,zooming:!1,pinchToZoomLastDistance:0,lastPan:{x:0,y:0},zoomCenter:{x:0,y:0},lastGestureScale:1,mouse:{x:0,y:0},isCameraLocked:!1,isWaitingForSecondClick:!1,lastMouseClickPosition:{x:0,y:0}},o.handleGestureStart=function(e){e.preventDefault(),o.state.isCameraLocked||(o.state.lastGestureScale=e.scale,o.emitZoomStartEvent())},o.handleGestureChange=function(e){if(e.preventDefault(),!o.state.isCameraLocked){o.state.zoomCenter=o.getCorrectPointerPosition(e);var t=e.scale/o.state.lastGestureScale;o.state.lastGestureScale=e.scale,o.emitZoomEvent(t,o.state.zoomCenter,!1),o.cameraMoveTracker.handleCameraMoveEvent()}},o.handleGestureEnd=function(e){e.preventDefault(),o.emitZoomEndEvent()},o.handlePointerDown=function(e){(e instanceof MouseEvent&&0===e.button||(0,a.z6)(e))&&(e.preventDefault(),o.updateMousePosition(e),o.handlePanStart(),o.handleTouchPinchToZoomStart(e),o.emit("mousedown"))},o.handlePanStart=function(){o.state.panning=!0,o.state.lastPan.x=o.state.mouse.x,o.state.lastPan.y=o.state.mouse.y},o.handleTouchPinchToZoomStart=function(e){var t;if(e.touches&&!((null===(t=e.touches)||void 0===t?void 0:t.length)<2)){o.emitZoomStartEvent();var n=e.touches[0],r=e.touches[1];o.state.pinchToZoomLastDistance=Math.hypot(n.clientX-r.clientX,n.clientY-r.clientY)}},o.handlePointerMove=function(e){(0,a.z6)(e)&&o.handleTouchPinchToZoomChange(e),o.state.panning||o.updateMousePosition(e)},o.handleTouchPinchToZoomChange=function(e){var t;if(e.touches&&!((null===(t=e.touches)||void 0===t?void 0:t.length)<2)){var n=e.touches[0],r=e.touches[1],i=Math.hypot(n.clientX-r.clientX,n.clientY-r.clientY),a=o.clampPointerToTargetBounds({x:(n.clientX+r.clientX)/2,y:(n.clientY+r.clientY)/2}),s=i/Math.max(o.state.pinchToZoomLastDistance,1);o.state.pinchToZoomLastDistance=i,o.emitZoomEvent(s,a,!1)}},o.handlePanMove=function(e){if(o.state.panning&&!o.state.isCameraLocked){var t=o.getCorrectPointerPosition(e),n=o.state.lastPan.x-t.x,r=o.state.lastPan.y-t.y;o.state.lastPan.x=t.x,o.state.lastPan.y=t.y,o.emit("panChange",-n,-r),o.cameraMoveTracker.handleCameraMoveEvent()}},o.handleDoubleClick=function(e){if(!("undefined"!=typeof TouchEvent&&e instanceof TouchEvent&&e.touches.length>0)){var t=o.getCorrectPointerPosition(e),n=Math.hypot(o.state.lastMouseClickPosition.x-t.x,o.state.lastMouseClickPosition.y-t.y)>("undefined"!=typeof TouchEvent&&e instanceof TouchEvent?15:0);if(!o.state.isWaitingForSecondClick||n)return o.state.isWaitingForSecondClick=!0,o.state.lastMouseClickPosition=o.getCorrectPointerPosition(e),void o.resetDoubleClick();o.state.isWaitingForSecondClick=!1,o.emit("doubleClick")}},o.resetDoubleClick=(0,a.Ds)((function(){o.state.isWaitingForSecondClick=!1}),500),o.handlePanEnd=function(){o.state.panning=!1},o.handlePointerUp=function(e){var t;o.handleTouchPinchToZoomEnd(e),(null===(t=e.touches)||void 0===t?void 0:t.length)>1||o.emit("mouseup")},o.handleTouchPinchToZoomEnd=function(e){var t;(null===(t=e.touches)||void 0===t?void 0:t.length)>2||o.emitZoomEndEvent()},o.handleMouseWheel=function(e){if(e.preventDefault(),!o.state.isCameraLocked){var t=e.metaKey||e.ctrlKey;if(o.updateMousePosition(e),t){var n=e.ctrlKey?-1:1;o.state.zoomCenter=o.getCorrectPointerPosition(e);var r=1+.01*e.deltaY*n;o.emitZoomEvent(r,o.state.zoomCenter)}else o.emit("panChange",-e.deltaX,-e.deltaY);o.cameraMoveTracker.handleCameraMoveEvent()}},o.emitZoomEndEvent=(0,a.Ds)((function(){o.state.zooming&&(o.state.zooming=!1,o.emit("zoomEnd"))}),90),o.handleCameraMoveStart=function(){o.emit("cameraMoveStart")},o.handleCameraMoveEnd=function(){o.emit("cameraMoveEnd")},o.target=t,o.settings=n,o.targetBounds=t.getBoundingClientRect(),o.addListeners(),o.cameraMoveTracker=new s(o.handleCameraMoveStart,o.handleCameraMoveEnd),o}return u(t,e),t.prototype.updateTargetBounds=function(){this.targetBounds=this.target.getBoundingClientRect()},t.prototype.addListeners=function(){this.addTouchEventListeners(),this.addMouseEventListeners(),this.addSafariGesturesEventListeners()},t.prototype.addMouseEventListeners=function(){this.listenersCollector.add(this.target,"mousedown",this.handlePointerDown),this.listenersCollector.add(this.target,"mousemove",this.handlePointerMove),this.listenersCollector.add(document,"mousemove",this.handlePanMove),this.listenersCollector.add(this.target,"mouseup",this.handlePointerUp),this.listenersCollector.add(document,"mouseup",this.handlePanEnd),this.listenersCollector.add(this.target,"wheel",this.handleMouseWheel),this.listenersCollector.add(this.target,"mouseup",this.handleDoubleClick)},t.prototype.addTouchEventListeners=function(){this.listenersCollector.add(this.target,"touchstart",this.handlePointerDown),this.listenersCollector.add(document,"touchmove",this.handlePanMove,{passive:!0}),this.listenersCollector.add(this.target,"touchmove",this.handlePointerMove,{passive:!0}),this.listenersCollector.add(this.target,"touchend",this.handlePointerUp),this.listenersCollector.add(this.target,"touchcancel",this.handlePointerUp),this.listenersCollector.add(document,"touchend",this.handlePanEnd),this.listenersCollector.add(this.target,"touchend",this.handleDoubleClick)},t.prototype.addSafariGesturesEventListeners=function(){(0,a.b1)()||(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:(0,a.uZ)(e.x-this.targetBounds.x,0,this.target.clientWidth),y:(0,a.uZ)(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=(0,a.MP)(e);return this.clampPointerToTargetBounds(n)},t.prototype.updateMousePosition=function(e){this.state.mouse=this.getCorrectPointerPosition(e),this.emit("mousemove",this.state.mouse.x,this.state.mouse.y)},t.prototype.emitZoomEvent=function(e,t,n){void 0===n&&(n=!0),n&&this.emitZoomStartEvent(),this.emit("zoomChange",e,t),n&&this.emitZoomEndEvent()},t.prototype.emitZoomStartEvent=function(){this.state.zooming||(this.state.zooming=!0,this.emit("zoomStart"))},t.prototype.getMouse=function(){return c({},this.state.mouse)},t.prototype.setMouse=function(e,t){this.state.mouse.x=e,this.state.mouse.y=t,this.emit("mousemove",this.state.mouse.x,this.state.mouse.y)},t.prototype.setIsCameraLocked=function(e){this.state.isCameraLocked=e},t.prototype.getMinZoomLevel=function(){return this.settings.minimumZoomLevel},t.prototype.getMaxZoomLevel=function(){return this.settings.maximumZoomLevel},t.prototype.dispose=function(){this.listenersCollector.dispose(),this.cameraMoveTracker.dispose()},t}(r.v),d=n(475),h=n(419);const f=Symbol("Comlink.proxy"),v=Symbol("Comlink.endpoint"),m=Symbol("Comlink.releaseProxy"),p=Symbol("Comlink.thrown"),g=e=>"object"==typeof e&&null!==e||"function"==typeof e,b=new Map([["proxy",{canHandle:e=>g(e)&&e[f],serialize(e){const{port1:t,port2:n}=new MessageChannel;return y(e,t),[n,[n]]},deserialize:e=>(e.start(),C(e))}],["throw",{canHandle:e=>g(e)&&p in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function y(e,t=self){t.addEventListener("message",(function n(o){if(!o||!o.data)return;const{id:r,type:i,path:a}=Object.assign({path:[]},o.data),s=(o.data.argumentList||[]).map(L);let u;try{const t=a.slice(0,-1).reduce(((e,t)=>e[t]),e),n=a.reduce(((e,t)=>e[t]),e);switch(i){case"GET":u=n;break;case"SET":t[a.slice(-1)[0]]=L(o.data.value),u=!0;break;case"APPLY":u=n.apply(t,s);break;case"CONSTRUCT":u=S(new n(...s));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;y(e,n),u=M(t,[t])}break;case"RELEASE":u=void 0;break;default:return}}catch(e){u={value:e,[p]:0}}Promise.resolve(u).catch((e=>({value:e,[p]:0}))).then((e=>{const[o,a]=x(e);t.postMessage(Object.assign(Object.assign({},o),{id:r}),a),"RELEASE"===i&&(t.removeEventListener("message",n),w(t))}))})),t.start&&t.start()}function w(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function C(e,t){return P(e,[],t)}function k(e){if(e)throw new Error("Proxy has been released and is not useable")}function P(e,t=[],n=function(){}){let o=!1;const r=new Proxy(n,{get(n,i){if(k(o),i===m)return()=>D(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{w(e),o=!0}));if("then"===i){if(0===t.length)return{then:()=>r};const n=D(e,{type:"GET",path:t.map((e=>e.toString()))}).then(L);return n.then.bind(n)}return P(e,[...t,i])},set(n,r,i){k(o);const[a,s]=x(i);return D(e,{type:"SET",path:[...t,r].map((e=>e.toString())),value:a},s).then(L)},apply(n,r,i){k(o);const a=t[t.length-1];if(a===v)return D(e,{type:"ENDPOINT"}).then(L);if("bind"===a)return P(e,t.slice(0,-1));const[s,u]=E(i);return D(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:s},u).then(L)},construct(n,r){k(o);const[i,a]=E(r);return D(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:i},a).then(L)}});return r}function E(e){const t=e.map(x);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const W=new WeakMap;function M(e,t){return W.set(e,t),e}function S(e){return Object.assign(e,{[f]:!0})}function x(e){for(const[t,n]of b)if(n.canHandle(e)){const[o,r]=n.serialize(e);return[{type:"HANDLER",name:t,value:o},r]}return[{type:"RAW",value:e},W.get(e)||[]]}function L(e){switch(e.type){case"HANDLER":return b.get(e.name).deserialize(e.value);case"RAW":return e.value}}function D(e,t,n){return new Promise((o=>{const r=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===r&&(e.removeEventListener("message",t),o(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:r},t),n)}))}var Z,R=n(849),T=n(519),O=n(332),z=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),A=function(e){function t(t){var n=e.call(this)||this;return n.listenersCollector=new i,n.handleKeyUp=function(e){n.emit("keyUp",e.code)},n.target=t,n.addListeners(),n}return z(t,e),t.prototype.addListeners=function(){this.listenersCollector.add(this.target,"keyup",this.handleKeyUp)},t.prototype.dispose=function(){this.listenersCollector.dispose()},t}(r.v),_=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),I=function(){return(I=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}).apply(this,arguments)},F=function(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())}))},G=function(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(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},j=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o};!function(e){e[e.browser=0]="browser",e[e.worker=1]="worker"}(Z||(Z={}));var B=function(e){function t(t){var n,o=e.call(this)||this;o.listenersCollector=new i,o.handleZoomStart=function(){o.emit("zoomStart")},o.handleZoomEnd=function(){o.emit("zoomEnd")},o.handleCameraMoveStart=function(){var e;null===(e=o.sketchWeb)||void 0===e||e.setIsCameraMoving(!0)},o.handleCameraMoveEnd=function(){var e;null===(e=o.sketchWeb)||void 0===e||e.setIsCameraMoving(!1)},o.handleMouseChange=function(e,t){var n;null===(n=o.sketchWeb)||void 0===n||n.setMouse(e,t)},o.handlePanChange=function(e,t){return F(o,void 0,void 0,(function(){var n;return G(this,(function(o){return null===(n=this.sketchWeb)||void 0===n||n.addPan(e,t),this.emitPanEvent(),[2]}))}))},o.handleZoomChange=function(e,t){return F(o,void 0,void 0,(function(){var n;return G(this,(function(o){return null===(n=this.sketchWeb)||void 0===n||n.addZoom(e,t),this.emitZoomEvent(),this.emitPanEvent(),[2]}))}))},o.handleCanvasResizeObserver=function(e){o.resizeCanvas(e[0].contentRect)},o.resizeCanvas=function(e){var t=e.width,n=e.height;window.requestAnimationFrame((function(){var e;o.setCanvasSize(t,n),o.gestureManager.updateTargetBounds(),null===(e=o.sketchWeb)||void 0===e||e.setSize(t,n,o.getDevicePixelRatio())}))};var r=null!==(n=t.featureFlags)&&void 0!==n?n:{};return o.featureFlags=I(I({},T.Z),r),o.settings=t,o.canvas=t.canvas,o.gestureManager=new l(o.settings.container,{minimumZoomLevel:t.minimumZoomLevel,maximumZoomLevel:t.maximumZoomLevel}),o.keyboardManager=new A(document.body),R.Z.active=t.mode===O.p.debug,o.init(),o}return _(t,e),t.prototype.init=function(){var e;return F(this,void 0,void 0,(function(){var t,n,o;return G(this,(function(r){switch(r.label){case 0:return this.setCanvasSize(this.settings.container.clientWidth,this.settings.container.clientHeight),[4,this.initSketchWeb()];case 1:return r.sent(),[4,null===(e=this.sketchWeb)||void 0===e?void 0:e.getStatus()];case 2:return"FILE_READY"!==(null==(t=r.sent())?void 0:t.type)?[2]:(n=void 0!==this.settings.initialZoom,o=void 0!==this.settings.initialPan,n||o?n?[4,this.setZoom(this.settings.initialZoom)]:[3,4]:[3,7]);case 3:r.sent(),r.label=4;case 4:return o?[4,this.setPan(this.settings.initialPan.x,this.settings.initialPan.y,this.settings.initialPan.centerPointInViewport)]:[3,6];case 5:r.sent(),r.label=6;case 6:return[3,9];case 7:return[4,this.zoomToFit()];case 8:r.sent(),r.label=9;case 9:return this.sketchWeb.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.initSketchWeb=function(){return F(this,void 0,void 0,(function(){var e,t,o,r,i;return G(this,(function(a){switch(a.label){case 0:return e=this.featureFlags.offscreenCanvas&&"function"==typeof this.canvas.transferControlToOffscreen,t=I(I({},this.settings),{size:{width:this.canvas.width,height:this.canvas.height},pixelRatio:this.getDevicePixelRatio(),featureFlags:this.featureFlags}),e?(this.environment=Z.worker,R.Z.debug("Using offscreen canvas"),this.offscreenCanvas=this.canvas.transferControlToOffscreen(),this.worker=new Worker(new URL(n.p+n.u(667),n.b),{type:void 0}),o=C(this.worker),r=this,[4,new o(M(I(I({},t),{canvas:this.offscreenCanvas}),[this.offscreenCanvas]))]):[3,2];case 1:return r.sketchWeb=a.sent(),[3,3];case 2:this.environment=Z.browser,R.Z.debug("Using normal canvas"),this.sketchWeb=new d.U(t),a.label=3;case 3:return(i=this.sketchWeb).on("status",this.forwardEvent("status")),i.on("fileReady",this.forwardEvent("fileReady")),i.on("metric",this.forwardEvent("metric")),i.on("warnings",this.forwardEvent("warnings")),i.on("allImagesReady",this.forwardEvent("allImagesReady")),i.on("deviceInfo",this.forwardEvent("deviceInfo")),[4,this.sketchWeb.init()];case 4:return a.sent(),[2]}}))}))},t.prototype.forwardEvent=function(e){var t=this,n=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];t.emit.apply(t,j([e],n))};return this.environment===Z.worker?S(n):n},t.prototype.isRunningInsideWorker=function(){return this.environment===Z.worker},t.prototype.looseWebGLContext=function(){var e;null===(e=this.sketchWeb)||void 0===e||e.looseWebGLContext()},t.prototype.addListeners=function(){this.canvasResizeObserver=new ResizeObserver(this.handleCanvasResizeObserver),this.canvasResizeObserver.observe(this.settings.container),this.listenersCollector.add(window,"orientationchange",this.handleDeviceOrientationChange),this.gestureManager.on("panChange",this.handlePanChange),this.gestureManager.on("mousemove",this.handleMouseChange),this.gestureManager.on("zoomChange",this.handleZoomChange),this.gestureManager.on("zoomStart",this.handleZoomStart),this.gestureManager.on("zoomEnd",this.handleZoomEnd),this.gestureManager.on("cameraMoveStart",this.handleCameraMoveStart),this.gestureManager.on("cameraMoveEnd",this.handleCameraMoveEnd)},t.prototype.emitPanEvent=function(){var e;return F(this,void 0,void 0,(function(){var t;return G(this,(function(n){switch(n.label){case 0:return[4,null===(e=this.sketchWeb)||void 0===e?void 0:e.getPan()];case 1:return(t=n.sent())?(this.emit("pan",t.x,t.y),[2]):[2]}}))}))},t.prototype.emitZoomEvent=function(){var e;return F(this,void 0,void 0,(function(){var t;return G(this,(function(n){switch(n.label){case 0:return[4,null===(e=this.sketchWeb)||void 0===e?void 0:e.getZoom()];case 1:return void 0===(t=n.sent())||this.emit("zoom",t),[2]}}))}))},t.prototype.getDevicePixelRatio=function(){return(0,h.uZ)(window.devicePixelRatio,1,2)},t.prototype.setCanvasSize=function(e,t){this.canvas.style.width=e+"px",this.canvas.style.height=t+"px",this.canvas.width=e*this.getDevicePixelRatio(),this.canvas.height=t*this.getDevicePixelRatio()},t.prototype.handleDeviceOrientationChange=function(){this.resizeCanvas({width:this.settings.container.clientWidth,height:this.settings.container.clientHeight})},t.prototype.setBackgroundColor=function(e){var t;null===(t=this.sketchWeb)||void 0===t||t.setBackgroundColor(e)},t.prototype.zoomToFit=function(){return F(this,void 0,void 0,(function(){return G(this,(function(e){switch(e.label){case 0:return[4,this.sketchWeb.scaleDocumentToFit()];case 1:return e.sent(),this.emitZoomEvent(),this.emitPanEvent(),[2]}}))}))},t.prototype.getStatus=function(){var e;return F(this,void 0,void 0,(function(){return G(this,(function(t){return[2,null===(e=this.sketchWeb)||void 0===e?void 0:e.getStatus()]}))}))},t.prototype.generateDocumentPNG=function(){var e;return F(this,void 0,void 0,(function(){return G(this,(function(t){return[2,null===(e=this.sketchWeb)||void 0===e?void 0:e.generateDocumentPNG()]}))}))},t.prototype.getDocument=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getDocument()},t.prototype.getArtboardAtPosition=function(e,t){var n;return F(this,void 0,void 0,(function(){return G(this,(function(o){switch(o.label){case 0:return[4,null===(n=this.sketchWeb)||void 0===n?void 0:n.getArtboardAtPosition(e,t)];case 1:return[2,o.sent()||null]}}))}))},t.prototype.getPanAtPosition=function(e,t){var n;return null===(n=this.sketchWeb)||void 0===n?void 0:n.getPanAtPosition(e,t)},t.prototype.setPan=function(e,t,n){var o;return F(this,void 0,void 0,(function(){return G(this,(function(r){switch(r.label){case 0:return[4,null===(o=this.sketchWeb)||void 0===o?void 0:o.setPan(e,t,Boolean(n))];case 1:return r.sent(),this.emitPanEvent(),[2]}}))}))},t.prototype.setZoom=function(e,t){var n;return F(this,void 0,void 0,(function(){var o;return G(this,(function(r){return o=null!=t?t:this.getCanvasCenterPoint(),null===(n=this.sketchWeb)||void 0===n||n.setZoom(e,o),this.emitZoomEvent(),this.emitPanEvent(),[2]}))}))},t.prototype.getCanvasCenterPoint=function(){var e=this.canvas.getBoundingClientRect();return{x:e.width/2+e.x,y:e.height/2+e.y}},t.prototype.getZoom=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getZoom()},t.prototype.getPan=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getPan()},t.prototype.dispose=function(){var e,t,n,o;return F(this,void 0,void 0,(function(){return G(this,(function(r){switch(r.label){case 0:return this.gestureManager.dispose(),this.keyboardManager.dispose(),this.listenersCollector.dispose(),null===(e=this.canvasResizeObserver)||void 0===e||e.disconnect(),this.isRunningInsideWorker()?[4,null===(t=this.sketchWeb)||void 0===t?void 0:t.dispose()]:[3,2];case 1:return r.sent(),null===(n=this.worker)||void 0===n||n.terminate(),[3,3];case 2:null===(o=this.sketchWeb)||void 0===o||o.dispose(),r.label=3;case 3:return[2]}}))}))},t}(r.v)},475:(e,t,n)=>{"use strict";n.d(t,{U:()=>p});var o,r=n(419),i=n(519),a=n(354),s=n(108),u=n(849),c=n(758),l=n(332),d=n(975),h=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),f=function(){return(f=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}).apply(this,arguments)},v=function(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())}))},m=function(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(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},p=(globalThis.indexedDB,function(e){function t(t){var n=t.canvas,o=t.locateFile,a=t.filePath,c=t.imagesURLFormat,d=t.imagesURLMap,h=t.backgroundColor,v=void 0===h?{r:1,g:1,b:1,a:1}:h,m=t.size,p=t.pixelRatio,g=t.mode,b=t.showTilesBorders,y=void 0!==b&&b,w=t.minimumZoomLevel,C=t.maximumZoomLevel,k=t.preserveDrawingBuffer,P=void 0!==k&&k,E=t.panBoundariesPadding,W=void 0===E?40:E,M=t.featureFlags,S=void 0===M?{}:M,x=e.call(this)||this;return x.status={type:"INIT"},x.isZooming=!1,x.handleWebGLContextLost=function(){x.setStatus({type:"WEBGL_CONTEXT_LOST"})},x.debouncedFullDraw=(0,r.Ds)((function(){return x.draw(!0)}),60),x.notifyZoomDidEndDebounced=(0,r.Ds)((function(){var e;x.isZooming&&(x.isZooming=!1,null===(e=x.sketchWebWasm)||void 0===e||e.setIsZooming(!1),x.delayedDraw())}),80),x.canvas=n,x.locateFile=o,x.filePath=a,x.imagesURLFormat=c,x.imagesURLMap=d,x.backgroundColor=v,x.size=m,x.pixelRatio=p,x.mode=g,x.showTilesBorders=y,x.currentWebGLVersion=(0,r.wX)(),x.zoomLevels={min:w,max:C},x.preserveDrawingBuffer=P,x.panBoundariesPadding=W,x.featureFlags=f(f({},i.Z),S),u.Z.active=g===l.p.debug,x.traceFirstPaint=new s.S("FirstPaint"),x}return h(t,e),t.prototype.collectAndEmitDeviceInfo=function(){return v(this,void 0,void 0,(function(){var e;return m(this,(function(t){switch(t.label){case 0:return[4,(0,d.M)()];case 1:return e=t.sent(),this.deviceInfo=f(f({},e),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},t.prototype.init=function(){return v(this,void 0,void 0,(function(){var e;return m(this,(function(t){switch(t.label){case 0:this.setStatus({type:"INIT"}),this.collectAndEmitDeviceInfo(),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,this.initSketchWebWasm()];case 2:return t.sent(),[4,this.setFile(this.filePath)];case 3:return t.sent(),[4,this.preloadImages()];case 4:return t.sent(),[3,6];case 5:return e=t.sent(),[2,this.fail(e instanceof c.k?e:new c.k("ERROR","Unexpected exception initializing the web renderer",e))];case 6:return[2]}}))}))},t.prototype.preloadImages=function(){var e=this;return new Promise((function(t){var n;null===(n=e.sketchWebWasm)||void 0===n||n.preloadImages((function(){t()}))}))},t.prototype.startRendering=function(){this.traceInitialRender=new s.S("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),this.draw(!0,!1),this.sketchWebWasm.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){u.Z.debug("[C++] "+e)},logWarning:function(e){u.Z.warning("[C++] "+e)},logError:function(e){u.Z.error("[C++] "+e)},emitMetric:function(t,n,o,r){e.emit("metric",{id:t,start:n,end:o,duration:r})},resolveImageUrl:function(t){return e.imagesURLFormat?e.imagesURLFormat.replace(":imageId",t):e.imagesURLMap&&e.imagesURLMap[t]?e.imagesURLMap[t]:(u.Z.warning("Not able to resolve the url for the image with UUID: "+t),"")},onDrawComplete:this.handleDrawComplete.bind(this),onAllImagesReady:function(){e.emit("allImagesReady")}}},t.prototype.downloadImages=function(){var e=this;return new Promise((function(t){var n,o=new s.S("ImagesDownload");null===(n=e.sketchWebWasm)||void 0===n||n.downloadImages((function(){o.printMeasurement(),e.emit("metric",o.measure()),u.Z.debug("Images downloaded"),t()}))}))},t.prototype.initSketchWebWasm=function(){return v(this,void 0,void 0,(function(){var e,t,o,r,i,a,d,h=this;return m(this,(function(f){switch(f.label){case 0:return e=new s.S("WasmModuleDownload"),this.mode!==l.p.debug?[3,2]:[4,n.e(706).then(n.t.bind(n,706,23))];case 1:return t=f.sent(),[3,4];case 2:return[4,n.e(610).then(n.t.bind(n,610,23))];case 3:t=f.sent(),f.label=4;case 4:o=t.default,f.label=5;case 5:return f.trys.push([5,7,,8]),r=this,[4,o({FeatureFlags:this.featureFlags,currentWebGLVersion:this.currentWebGLVersion,locateFile:function(e){return h.locateFile.replace("{file}",e)},bridge:this.createJSBridge()})];case 6:return r.wasmModule=f.sent(),[3,8];case 7:throw i=f.sent(),new c.k("WASM_ERROR","An error occurred while trying to create the wasm module.",i);case 8:if(e.printMeasurement(),this.emit("metric",e.measure()),a={majorVersion:this.currentWebGLVersion,antialias:!1,alpha:!1,stencil:!1,depth:!1,powerPreference:"high-performance",preserveDrawingBuffer:this.preserveDrawingBuffer},u.Z.debug("Using WebGL "+a.majorVersion),!(d=this.wasmModule.GL.createContext(this.canvas,a)))throw new c.k("WEBGL_ERROR","Unable to create WebGL context. WebGL might be unsupported, disabled, or this device is not able to run WebGL correctly.");this.webglCtxHandle=d;try{this.sketchWebWasm=this.wasmModule.SketchWeb.MakeGL(this.webglCtxHandle,this.canvas.width,this.size.height,this.pixelRatio,{showTilesBorders:this.showTilesBorders})}catch(e){throw new c.k("WASM_ERROR","An error occurred while trying to create the SketchWebWasm object.",e)}return this.sketchWebWasm.setBackgroundColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),this.sketchWebWasm.setZoomLevels(this.zoomLevels.min,this.zoomLevels.max),this.sketchWebWasm.setPanBoundariesPadding(this.panBoundariesPadding),this.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost),[2]}}))}))},t.prototype.setBackgroundColor=function(e){var t;e.r===this.backgroundColor.r&&e.g===this.backgroundColor.g&&e.b===this.backgroundColor.b&&e.a===this.backgroundColor.a||(null===(t=this.sketchWebWasm)||void 0===t||t.setBackgroundColor(e.r,e.g,e.b,e.a),this.backgroundColor=e,this.delayedDraw())},t.prototype.generateDocumentPNG=function(){return v(this,void 0,void 0,(function(){return m(this,(function(e){switch(e.label){case 0:return[4,this.downloadImages()];case 1:return e.sent(),[2,this.sketchWebWasm.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(){var e=this.wasmModule.GL.getContext(this.webglCtxHandle);if(e){var t=e.GLctx.getExtension("WEBGL_lose_context");t?t.loseContext():console.warn("Unable to retrieve WEBGL_lose_context extension")}else console.warn("Unable to loose context. WebGL rendering context not found")},t.prototype.scaleDocumentToFit=function(){var e;null===(e=this.sketchWebWasm)||void 0===e||e.scaleDocumentToFit(),this.delayedDraw()},t.prototype.setFile=function(e){return v(this,void 0,void 0,(function(){var t=this;return m(this,(function(n){return this.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,o){t.sketchWebWasm.setFile(e,(function(e,o,r,i){if(void 0===i&&(i=[]),i.length){u.Z.debug("Parser warnings: "+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 c.k("FILE_ERROR","Error encountered while fetching and parsing the file"))}))}))]}))}))},t.prototype.delayedDraw=function(){if(!this.featureFlags.delayedDraw)return this.draw(!0);this.draw(),this.debouncedFullDraw()},t.prototype.draw=function(e,t){var n;void 0===e&&(e=!1),void 0===t&&(t=!1),null===(n=this.sketchWebWasm)||void 0===n||n.setNeedsUpdate(e,t)},t.prototype.fail=function(e){this.setStatus({type:"FAILURE",code:e.code,message:e.toString()+(e.cause?"\nWrapped Error: "+e.cause.toString():"")}),u.Z.error(e),e.cause&&u.Z.error(e.cause)},t.prototype.setPixelRatio=function(e){this.pixelRatio=e,this.setSize(this.size.width*this.pixelRatio,this.size.height*this.pixelRatio,this.pixelRatio),this.delayedDraw()},t.prototype.setSize=function(e,t,n){var o;this.size.width=e*n,this.size.height=t*n,this.canvas.width=e*n,this.canvas.height=t*n,null===(o=this.sketchWebWasm)||void 0===o||o.resize(e,t,n)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&(u.Z.debug("Status transition "+this.status.type+" => "+e.type+"}"),this.status=e,this.emit("status",e))},t.prototype.getDocument=function(){if(!this.sketchWebWasm)return null;if(!this.cachedDocumentInfo||this.cachedDocumentInfo.filePath!==this.filePath){var e=this.sketchWebWasm.getPRFile();this.cachedDocumentInfo={filePath:this.filePath,document:f(f({},e),{artboards:(0,r.gi)(e.artboards)})}}return this.cachedDocumentInfo.document},t.prototype.getArtboardAtPosition=function(e,t){var n;return null===(n=this.sketchWebWasm)||void 0===n?void 0:n.getArtboardAtPosition(e,t)},t.prototype.getPanAtPosition=function(e,t){var n;return null===(n=this.sketchWebWasm)||void 0===n?void 0:n.getPanAtPosition(e,t)},t.prototype.getStatus=function(){return this.status},t.prototype.setZoom=function(e,t){var n,o;null===(n=this.sketchWebWasm)||void 0===n||n.setZoomCenter(t.x,t.y),null===(o=this.sketchWebWasm)||void 0===o||o.setZoom(e),this.delayedDraw()},t.prototype.addZoom=function(e,t){var n,o;this.notifyZoomDidStart(),null===(n=this.sketchWebWasm)||void 0===n||n.setZoomCenter(t.x,t.y),null===(o=this.sketchWebWasm)||void 0===o||o.addZoom(e),this.notifyZoomDidEndDebounced(),this.delayedDraw()},t.prototype.notifyZoomDidStart=function(){var e;this.isZooming||(this.isZooming=!0,null===(e=this.sketchWebWasm)||void 0===e||e.setIsZooming(!0))},t.prototype.setPan=function(e,t,n){var o;void 0===n&&(n=!1),null===(o=this.sketchWebWasm)||void 0===o||o.setPan(e,t,n),this.delayedDraw()},t.prototype.addPan=function(e,t){var n;null===(n=this.sketchWebWasm)||void 0===n||n.addPan(e,t),this.delayedDraw()},t.prototype.getPan=function(){if(this.sketchWebWasm)return this.sketchWebWasm.getPan()},t.prototype.getZoom=function(){var e;return null===(e=this.sketchWebWasm)||void 0===e?void 0:e.getZoom()},t.prototype.setMouse=function(e,t){var n;null===(n=this.sketchWebWasm)||void 0===n||n.setMouse(e,t)},t.prototype.setIsCameraMoving=function(e){var t;null===(t=this.sketchWebWasm)||void 0===t||t.setIsCameraMoving(e)},t.prototype.dispose=function(){var e,t;try{null===(e=this.sketchWebWasm)||void 0===e||e.stopRenderLoop(),null===(t=this.sketchWebWasm)||void 0===t||t.delete(),this.looseWebGLContext(),this.sketchWebWasm=null,this.wasmModule=null}catch(e){this.fail(new c.k("ERROR","Unexpected exception while disposing the SketchWebWasm object",e))}},t}(a.v))},536:(e,t,n)=>{"use strict";n.d(t,{z0:()=>V,oW:()=>B,jr:()=>P,tm:()=>D,ky:()=>w,zX:()=>I,ex:()=>O,Jw:()=>z,m_:()=>A,Yy:()=>L,d6:()=>W,aP:()=>E,EY:()=>_,pt:()=>T,od:()=>k,ph:()=>Z,lt:()=>x,$z:()=>y,BO:()=>C,us:()=>R});var o,r=n(297),i=n.n(r),a=n(332),s=n(849),u=(0,r.createContext)(void 0),c=function(){var e=(0,r.useContext)(u);if(void 0===e)throw Error("useSketchWebInternalContext must be used within a SketchWebProvider");return e},l=(n(419),function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o}),d=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s.Z.debug.apply(s.Z,l(["SketchWebReact"],e))},h=(0,r.createContext)(void 0),f=(0,r.createContext)(void 0),v=(0,r.createContext)(void 0),m=(0,r.createContext)(void 0),p=(0,r.createContext)(void 0),g=(0,r.createContext)(void 0),b=(0,r.createContext)(void 0),y=function(){var e=(0,r.useContext)(h);if(void 0===e)throw Error("useStatus must be used within a SketchWebProvider");return e},w=function(){var e=(0,r.useContext)(f);if(void 0===e)throw Error("useDocument must be used within a SketchWebProvider");return e},C=function(){var e=(0,r.useContext)(v);if(void 0===e)throw Error("useZoom must be used within a SketchWebProvider");return e},k=function(){var e=(0,r.useContext)(g);if(void 0===e)throw Error("usePan must be used within a SketchWebProvider");return e},P=function(){var e=(0,r.useContext)(b);if(void 0===e)throw Error("useCursor must be used within a SketchWebProvider");return e},E=function(){var e=(0,r.useContext)(m);if(void 0===status)throw Error("useIsCameraZooming must be used within a SketchWebProvider");return e},W=function(){var e=(0,r.useContext)(p);if(void 0===status)throw Error("useIsCameraMoving must be used within a SketchWebProvider");return e},M=function(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())}))},S=function(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(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},x=function(){var e=(0,c().getManager)();return(0,r.useCallback)((function(t){d("setZoom",t),null==e||e.setZoom(t)}),[e])},L=function(){var e=x(),t=C();return(0,r.useCallback)((function(){var n;d("incrementZoom"),"number"==typeof t&&(n=t>=1?Math.round(2*t):t>.5?1:2*t,e(n))}),[e,t])},D=function(){var e=x(),t=C();return(0,r.useCallback)((function(){d("decrementZoom"),"number"==typeof t&&e(t/2)}),[e,t])},Z=function(){var e=(0,c().getManager)();return(0,r.useCallback)((function(t){var n=t.x,o=t.y,r=t.centerPointInViewport;d("setPan",n,o,"centerPointInViewport",r),null==e||e.setPan(n,o,r)}),[e])},R=function(){var e=(0,c().getManager)();return(0,r.useCallback)((function(){d("zoomToFit"),null==e||e.zoomToFit()}),[e])},T=function(){var e=(0,c().getManager)();return(0,r.useCallback)((function(){d("looseWebGLContext"),null==e||e.looseWebGLContext()}),[e])},O=function(){var e=(0,c().getManager)();return(0,r.useCallback)((function(){return M(void 0,void 0,void 0,(function(){return S(this,(function(t){switch(t.label){case 0:return d("generateDocumentPNG"),[4,null==e?void 0:e.generateDocumentPNG()];case 1:return[2,t.sent()]}}))}))}),[e])},z=function(){var e=(0,c().getManager)();return(0,r.useCallback)((function(t,n){return M(void 0,void 0,void 0,(function(){return S(this,(function(o){switch(o.label){case 0:return d("getArtboardAtPosition",t,n),[4,null==e?void 0:e.getArtboardAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},A=function(){var e=(0,c().getManager)();return(0,r.useCallback)((function(t,n){return M(void 0,void 0,void 0,(function(){return S(this,(function(o){switch(o.label){case 0:return d("getPanAtPosition",t,n),[4,null==e?void 0:e.getPanAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},_=function(){var e=(0,c().getManager)();return(0,r.useCallback)((function(t){d("setIsCameraLocked",t),null==e||e.gestureManager.setIsCameraLocked(t)}),[e])},I=function(e,t){var n=(0,c().getManager)();(0,r.useEffect)((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])},F=function(){return(F=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}).apply(this,arguments)},G={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},j={position:"absolute",top:0,left:0},B=function(e){s.Z.active=e.mode===a.p.debug;var t=e.filePath,n=e.locateFile,o=e.imagesURLFormat,u=e.imagesURLMap,l=e.backgroundColor,d=e.mode,h=e.showTilesBorders,f=e.minimumZoomLevel,v=e.maximumZoomLevel,m=e.preserveDrawingBuffer,p=e.panBoundariesPadding,g=e.initialPan,b=e.initialZoom,w=e.children,C=e.containerProps,k=void 0===C?{}:C,E=e.canvasProps,W=void 0===E?{}:E,M=e.featureFlags,S=void 0===M?{}:M,x=(0,r.useRef)(null),L=(0,r.useRef)(null),D=(0,r.useState)(!1),Z=D[0],R=D[1],T=(0,r.useCallback)((function(){return R(!0)}),[]),O=c(),z=O.dispose,A=O.init,_=O.setSettings,B=P(),U=y();I("allImagesReady",T),(0,r.useEffect)((function(){_({locateFile:n,imagesURLFormat:o,imagesURLMap:u,backgroundColor:l,mode:d,showTilesBorders:h,minimumZoomLevel:f,maximumZoomLevel:v,preserveDrawingBuffer:m,panBoundariesPadding:p,initialPan:g,initialZoom:b,featureFlags:S})}),[_,n,o,u,l,d,h,f,v,m,p,g,b,S]),(0,r.useEffect)((function(){if(t)return A(t,x.current,L.current),function(){z()}}),[z,A,t]);var N=(0,r.useMemo)((function(){var t;return null!==(t=e.cursor)&&void 0!==t?t:B}),[e.cursor,B]),X=(0,r.useMemo)((function(){return F(F({},G),{cursor:N})}),[N]);return i().createElement("div",F({},k,{ref:L,style:X}),t&&i().createElement("canvas",F({},W,{key:t,ref:x,"data-sketchweb-all-images-ready":Z,"data-testid":"sketchweb-canvas","data-sketchweb-status":"sketchweb-status-"+((null==U?void 0:U.type.toLowerCase())||"null"),style:j})),"READY"===(null==U?void 0:U.type)&&w)},U=n(946);!function(e){e.Draggable="grab",e.Dragging="grabbing",e.Hover="pointer",e.Default="auto"}(o||(o={}));var N=function(){return(N=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}).apply(this,arguments)},X=function(e,t){switch(d('dispatched: "'+t.type+'"',t),t.type){case"on-status":return N(N({},e),{status:t.status});case"on-file-ready":return N(N({},e),{document:t.document});case"on-zoom":return N(N({},e),{zoom:t.zoom});case"on-pan":return N(N({},e),{pan:t.pan});case"dispose":return N(N({},e),{status:null,zoom:null,pan:null,cursor:o.Default});case"post-init":return N(N({},e),{status:t.status,zoom:t.zoom});case"on-camera-zoom-start":return N(N({},e),{isCameraZooming:!0});case"on-camera-zoom-end":return N(N({},e),{isCameraZooming:!1});case"on-camera-move-start":return N(N({},e),{cursor:e.isMouseDown?o.Dragging:o.Draggable,isCameraMoving:!0});case"on-camera-move-end":return N(N({},e),{isCameraMoving:!1});case"on-mouse-down":return N(N({},e),{cursor:o.Dragging,isMouseDown:!0});case"on-mouse-up":return N(N({},e),{cursor:o.Draggable,isMouseDown:!1});default:return e}},Y=function(){return(Y=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}).apply(this,arguments)},V=function(e){var t=e.children,n=(0,r.useRef)(null),a=(0,r.useRef)(null),s=(0,r.useReducer)(X,{pan:null,zoom:null,status:null,document:null,isCameraZooming:!1,isCameraMoving:!1,cursor:o.Default,isMouseDown:!1}),c=s[0],l=c.status,y=c.document,w=c.zoom,C=c.pan,k=c.isCameraZooming,P=c.isCameraMoving,E=c.cursor,W=s[1],M=(0,r.useCallback)((function(e){return W({type:"on-zoom",zoom:e})}),[]),S=(0,r.useCallback)((function(e,t){return W({type:"on-pan",pan:{x:e,y:t}})}),[]),x=(0,r.useCallback)((function(e){W({type:"on-status",status:e})}),[]),L=(0,r.useCallback)((function(e){W({type:"on-file-ready",document:e})}),[]),D=(0,r.useCallback)((function(){return W({type:"on-mouse-down"})}),[]),Z=(0,r.useCallback)((function(){return W({type:"on-mouse-up"})}),[]),R=(0,r.useCallback)((function(){return W({type:"on-camera-zoom-start"})}),[]),T=(0,r.useCallback)((function(){return W({type:"on-camera-zoom-end"})}),[]),O=(0,r.useCallback)((function(){return W({type:"on-camera-move-start"})}),[]),z=(0,r.useCallback)((function(){return W({type:"on-camera-move-end"})}),[]),A=(0,r.useCallback)((function(){var e=n.current;e&&(d("dispose"),e.off("status",x),e.off("fileReady",L),e.off("zoom",M),e.off("pan",S),e.gestureManager.off("mousedown",D),e.gestureManager.off("mouseup",Z),e.gestureManager.off("zoomStart",R),e.gestureManager.off("zoomEnd",T),e.gestureManager.off("cameraMoveStart",O),e.gestureManager.off("cameraMoveEnd",z),e.dispose(),n.current=null,W({type:"dispose"}))}),[x,L,S,M,Z,D,R,T,O,z]),_=(0,r.useCallback)((function(e,t,o){if(""!==e&&t&&o&&a.current){d("init");var r=new U.d(Y(Y({},a.current),{filePath:e,container:o,canvas:t}));r.on("status",x),r.on("fileReady",L),r.on("zoom",M),r.on("pan",S),r.gestureManager.on("mousedown",D),r.gestureManager.on("mouseup",Z),r.gestureManager.on("zoomStart",R),r.gestureManager.on("zoomEnd",T),r.gestureManager.on("cameraMoveStart",O),r.gestureManager.on("cameraMoveEnd",z),i=void 0,s=void 0,c=function(){var e,t;return function(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(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}(this,(function(n){switch(n.label){case 0:return e=W,t={type:"post-init"},[4,r.getZoom()];case 1:return t.zoom=n.sent()||null,[4,r.getStatus()];case 2:return t.status=n.sent()||null,[4,r.getPan()];case 3:return e.apply(void 0,[(t.pan=n.sent()||null,t)]),[2]}}))},new((u=void 0)||(u=Promise))((function(e,t){function n(e){try{r(c.next(e))}catch(e){t(e)}}function o(e){try{r(c.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):(r=t.value,r instanceof u?r:new u((function(e){e(r)}))).then(n,o)}r((c=c.apply(i,s||[])).next())})),n.current=r}var i,s,u,c}),[x,L,M,S,D,Z,R,T,O,z]),I=(0,r.useCallback)((function(e){var t;d("setSettings",e),e.backgroundColor&&(null===(t=n.current)||void 0===t||t.setBackgroundColor(e.backgroundColor)),a.current=e}),[]),F=(0,r.useCallback)((function(){return n.current}),[]),G=(0,r.useMemo)((function(){return{dispose:A,init:_,setSettings:I,getManager:F,dispatch:W}}),[A,_,I,F]);return i().createElement(u.Provider,{value:G},i().createElement(h.Provider,{value:l},i().createElement(f.Provider,{value:y},i().createElement(v.Provider,{value:w},i().createElement(g.Provider,{value:C},i().createElement(m.Provider,{value:k},i().createElement(p.Provider,{value:P},i().createElement(b.Provider,{value:E},t))))))))}},758:(e,t,n)=>{"use strict";n.d(t,{k:()=>i});var o,r=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(n,o,r){var i=this.constructor,a=e.call(this,"("+n+") "+o)||this;return a.code=n,a.cause=r,a.name=t.name,Object.setPrototypeOf(a,i.prototype),a}return r(t,e),t}(Error)},18:()=>{},689:()=>{},332:(e,t,n)=>{"use strict";var o;n.d(t,{p:()=>o}),function(e){e.debug="debug",e.release="release"}(o||(o={}))},119:()=>{},650:()=>{},312:()=>{},552:(e,t,n)=>{"use strict";n.d(t,{v:()=>o});var o=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.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}()},354:(e,t,n)=>{"use strict";n.d(t,{v:()=>o.v});var o=n(552)},849:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o};const r=new(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,o(["[SketchWeb] [Debug]"],e))},e.prototype.warning=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.warn.apply(console,o(["[SketchWeb] [Warn]"],e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,o(["[SketchWeb] [Error]"],e))},e}())},108:(e,t,n)=>{"use strict";n.d(t,{S:()=>r});var o=n(849),r=function(){function e(e){this.label=e,this.startTime=performance.now(),this.startTimestamp=Date.now(),o.Z.debug("[Performance] Start: "+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);o.Z.debug("[Performance] End: "+this.label+" -> "+t+" ms")}else{var n=(e/1e3).toFixed(2);o.Z.debug("[Performance] End: "+this.label+" -> "+n+" s")}},e}()},419:(e,t,n)=>{"use strict";n.d(t,{uZ:()=>o.uZ,gi:()=>o.gi,Ds:()=>o.Ds,wX:()=>o.wX});var o=n(388)},388:(e,t,n)=>{"use strict";n.d(t,{Ds:()=>i,MP:()=>a,uZ:()=>s,wX:()=>u,gi:()=>c,b1:()=>l,z6:()=>d});var o=n(519),r=n(66);function i(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 a(e){var t,n,o,r,i,a,s,u;return{x:null!==(r=null!==(t=e.pageX)&&void 0!==t?t:null===(o=null===(n=e.touches)||void 0===n?void 0:n[0])||void 0===o?void 0:o.pageX)&&void 0!==r?r:e.clientX,y:null!==(u=null!==(i=e.pageY)&&void 0!==i?i:null===(s=null===(a=e.touches)||void 0===a?void 0:a[0])||void 0===s?void 0:s.pageY)&&void 0!==u?u:e.clientY}}function s(e,t,n){return Math.max(t,Math.min(n,e))}function u(){return(0,r.t)()&&!o.Z.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1}function c(e){for(var t=e.size(),n=[],o=0;o<t;++o){var r=e.get(o);n.push(r)}return n}function l(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function d(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent||void 0!==e.touches||void 0!==e.targetTouches||void 0!==e.changedTouches}},66:(e,t,n)=>{"use strict";n.d(t,{t:()=>r});var o=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/,r=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(o);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}}}},297:t=>{"use strict";t.exports=e}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return i[e](n,n.exports,s),n.exports}s.m=i,s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.t=function(e,o){if(1&o&&(e=this(e)),8&o)return e;if("object"==typeof e&&e){if(4&o&&e.__esModule)return e;if(16&o&&"function"==typeof e.then)return e}var r=Object.create(null);s.r(r);var i={};t=t||[null,n({}),n([]),n(n)];for(var a=2&o&&e;"object"==typeof a&&!~t.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,s.d(r,i),r},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce(((t,n)=>(s.f[n](e,t),t)),[])),s.u=e=>"static/js/web-renderer-"+{610:"17fd55cdb979ed59dbc9",667:"e4d5f4f314c42815f663",706:"b584c7152f956c9cbea5"}[e]+".chunk.js",s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o={},r="@sketch-hq/sketch-web-renderer:",s.l=(e,t,n,i)=>{if(o[e])o[e].push(t);else{var a,u;if(void 0!==n)for(var c=document.getElementsByTagName("script"),l=0;l<c.length;l++){var d=c[l];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==r+n){a=d;break}}a||(u=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,s.nc&&a.setAttribute("nonce",s.nc),a.setAttribute("data-webpack",r+n),a.src=e),o[e]=[t];var h=(t,n)=>{a.onerror=a.onload=null,clearTimeout(f);var r=o[e];if(delete o[e],a.parentNode&&a.parentNode.removeChild(a),r&&r.forEach((e=>e(n))),t)return t(n)},f=setTimeout(h.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=h.bind(null,a.onerror),a.onload=h.bind(null,a.onload),u&&document.head.appendChild(a)}},s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.p="/",(()=>{s.b=document.baseURI||self.location.href;var e={826:0};s.f.j=(t,n)=>{var o=s.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise(((n,r)=>o=e[t]=[n,r]));n.push(o[2]=r);var i=s.p+s.u(t),a=new Error;s.l(i,(n=>{if(s.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+r+": "+i+")",a.name="ChunkLoadError",a.type=r,a.request=i,o[1](a)}}),"chunk-"+t,t)}};var t=(t,n)=>{var o,r,[i,a,u]=n,c=0;if(i.some((t=>0!==e[t]))){for(o in a)s.o(a,o)&&(s.m[o]=a[o]);u&&u(s)}for(t&&t(n);c<i.length;c++)r=i[c],s.o(e,r)&&e[r]&&e[r][0](),e[i[c]]=0},n=self.webpackChunk_sketch_hq_sketch_web_renderer=self.webpackChunk_sketch_hq_sketch_web_renderer||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var u={};return(()=>{"use strict";s.r(u),s.d(u,{default:()=>v,DefaultFeatureFlags:()=>m,SketchWeb:()=>n.U,SketchWebMode:()=>a.p,SketchWebError:()=>l.k,SketchWebProvider:()=>f.z0,SketchWebReact:()=>f.oW,useCursor:()=>f.jr,useDecrementZoom:()=>f.tm,useDocument:()=>f.ky,useEvent:()=>f.zX,useGenerateDocumentPNG:()=>f.ex,useGetArtboardAtPosititon:()=>f.Jw,useGetPanAtPosition:()=>f.m_,useIncrementZoom:()=>f.Yy,useIsCameraMoving:()=>f.d6,useIsCameraZooming:()=>f.aP,useLockCamera:()=>f.EY,useLooseWebGLContext:()=>f.pt,usePan:()=>f.od,useSetPan:()=>f.ph,useSetZoom:()=>f.lt,useStatus:()=>f.$z,useZoom:()=>f.BO,useZoomToFit:()=>f.us});var e=s(946),t=s(519),n=s(475),o=s(18),r={};for(const e in o)["default","DefaultFeatureFlags","SketchWeb"].indexOf(e)<0&&(r[e]=()=>o[e]);s.d(u,r);var i=s(119);r={};for(const e in i)["default","DefaultFeatureFlags","SketchWeb"].indexOf(e)<0&&(r[e]=()=>i[e]);s.d(u,r);var a=s(332),c=s(312);r={};for(const e in c)["default","DefaultFeatureFlags","SketchWeb","SketchWebMode"].indexOf(e)<0&&(r[e]=()=>c[e]);s.d(u,r);var l=s(758),d=s(689);r={};for(const e in d)["default","DefaultFeatureFlags","SketchWeb","SketchWebMode","SketchWebError"].indexOf(e)<0&&(r[e]=()=>d[e]);s.d(u,r);var h=s(650);r={};for(const e in h)["default","DefaultFeatureFlags","SketchWeb","SketchWebMode","SketchWebError"].indexOf(e)<0&&(r[e]=()=>h[e]);s.d(u,r);var f=s(536);const v=e.d;var m=t.Z})(),u})()}));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var n="object"==typeof exports?t(require("react")):t(e.react);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(self,(function(e){return(()=>{var t,n,o,r,i={975:(e,t,n)=>{"use strict";function o(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())}))}n.d(t,{M:()=>f});const r=["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 i(e){return e.toLowerCase().replace(/^angle ?\((.+)\)*$/,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"")}const a="undefined"==typeof window,s=(()=>{if(a)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)}})(),u=[],c=[];function l(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,l,h=0,d=0,f=0;for(;d<o;)c[d]=e.charCodeAt(a+d),u[d]=++d;for(;f<r;)for(i=t.charCodeAt(a+f),s=f++,h=f,d=0;d<o;d++)l=i===c[d]?s:s+1,s=u[d],h=u[d]=s>h?l>h?h+1:l:l>s?s+1:l;return h}function h(e){return null!=e}class d extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const f=({mobileTiers:e=[0,15,30,60],desktopTiers:t=[0,15,30,60],override:n={},glContext:u,failIfMajorPerformanceCaveat:c=!1,benchmarksURL:f="https://unpkg.com/detect-gpu@4.0.37/dist/benchmarks"}={})=>o(void 0,void 0,void 0,(function*(){const v={};if(a)return{tier:0,type:"SSR"};const{isIpad:p=!!(null==s?void 0:s.isIpad),isMobile:m=!!(null==s?void 0:s.isMobile),screenSize:g=window.screen,loadBenchmarks:b=(e=>o(void 0,void 0,void 0,(function*(){const t=yield fetch(`${f}/${e}`).then((e=>e.json()));if(parseInt(t.shift().split(".")[0],10)<4)throw new d("Detect GPU benchmark data is out of date. Please update to version 4x");return t})))}=n;let{renderer:y}=n;const w=(e,t,n,o,r)=>({device:r,fps:o,gpu:n,isMobile:m,tier:e,type:t});let P,C="";if(y)y=i(y),P=[y];else{const e=u||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==s?void 0:s.isSafari12,c);if(!e)return w(0,"WEBGL_UNSUPPORTED");const t=e.getExtension("WEBGL_debug_renderer_info");if(t&&(y=e.getParameter(t.UNMASKED_RENDERER_WEBGL)),!y)return w(1,"FALLBACK");C=y,y=i(y),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",u=(null==s?void 0:s.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 c;return"80162181255"===o?c=u.filter((([,,e])=>e>=14)):(c=u.filter((([,e])=>e===o)),c.length||(c=u)),c.map((([e])=>`apple ${e} gpu`))}(e,t,n):[t]}(e,y,m)}const k=(yield Promise.all(P.map((function(e){var t;return o(this,void 0,void 0,(function*(){const n=(e=>{const t=m?["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=`${m?"m":"d"}-${n}${p?"-ipad":""}.json`,r=v[o]=null!==(t=v[o])&&void 0!==t?t:b(o);let i;try{i=yield r}catch(n){if(n instanceof d)throw n;return}const a=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 s=i.filter((([,e])=>e===a));s.length||(s=i.filter((([t])=>t.includes(e))));const u=s.length;if(0===u)return;let c,[h,,,f]=u>1?s.map((t=>[t,l(e,t[0])])).sort((([,e],[,t])=>e-t))[0][0]:s[0],y=Number.MAX_VALUE;const{devicePixelRatio:w}=window,P=g.width*w*g.height*w;for(const e of f){const[t,n]=e,o=t*n,r=Math.abs(P-o);r<y&&(y=r,c=e)}if(!c)return;const[,,C,k]=c;return[y,C,h,k]}))})))).filter(h).sort((([e=Number.MAX_VALUE,t],[n=Number.MAX_VALUE,o])=>e===n?t-o:e-n));if(!k.length){const e=r.find((e=>y.includes(e)));return e?w(0,"BLOCKLISTED",e):w(1,"FALLBACK",`${y} (${C})`)}const[,W,E,x]=k[0];if(-1===W)return w(0,"BLOCKLISTED",E,W,x);const S=m?e:t;let M=0;for(let e=0;e<S.length;e++)W>=S[e]&&(M=e);return w(M,"BENCHMARK",E,W,x)}))},519:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});const o={delayedDraw:!0,offscreenCanvas:!1,useDirtyRectsRendering:!0,safariWebGL2:!1,pageBoundariesLimit:!1}},41:(e,t,n)=>{"use strict";n.d(t,{d:()=>z});var o,r=n(354),i=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}(),a=n(388),s=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),u=function(e){function t(t,n){var o=e.call(this)||this;return o.listenersCollector=new i,o.state={pinchToZoomLastDistance:0,lastGestureScale:1,isCtrlPressed:!1},o.handleGestureStart=function(e){e.preventDefault(),o.state.lastGestureScale=e.scale},o.handleGestureChange=function(e){e.preventDefault();var t=e.scale/o.state.lastGestureScale;o.state.lastGestureScale=e.scale;var n=o.getCorrectPointerPosition(e);o.emitZoomEvent(t,n)},o.handleGestureEnd=function(e){e.preventDefault()},o.handleTouchStart=function(e){e.preventDefault(),o.handleTouchPinchToZoomStart(e),o.emit("pointerdown",{type:"touch",position:o.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},o.handleMouseDown=function(e){e.ctrlKey||(e.preventDefault(),o.emit("pointerdown",{type:"mouse",position:o.getCorrectPointerPosition(e),button:e.button,touchesCount:0}))},o.handleTouchMove=function(e){o.handleTouchPinchToZoomChange(e),o.emit("pointermove",{type:"touch",position:o.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},o.handleMouseMove=function(e){o.updateMousePosition(e)},o.handleGlobalTouchMove=function(e){o.emit("globalpointermove",{type:"touch",position:o.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},o.handleGlobalMouseMove=function(e){o.updateGlobalMousePosition(e)},o.handleTouchPinchToZoomStart=function(e){var t;!e.touches||(null===(t=e.touches)||void 0===t?void 0:t.length)<2||(o.state.pinchToZoomLastDistance=o.calculateDistanceBetweenTouches(e.touches[0],e.touches[1]))},o.handleTouchPinchToZoomChange=function(e){var t;if(e.touches&&!((null===(t=e.touches)||void 0===t?void 0:t.length)<2)){var n=o.calculateDistanceBetweenTouches(e.touches[0],e.touches[1]),r=o.getCorrectPointerPosition(e),i=1+.004*(n-o.state.pinchToZoomLastDistance);o.state.pinchToZoomLastDistance=n,o.emitZoomEvent(i,r)}},o.handleTouchEnd=function(e){var t=e.touches.length<1?{x:0,y:0}:o.getCorrectPointerPosition(e);o.emit("pointerup",{position:t,type:"touch",button:0,touchesCount:e.touches.length})},o.handleMouseUp=function(e){o.emit("pointerup",{type:"mouse",position:o.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},o.handleMouseWheel=function(e){e.preventDefault();var t=e.ctrlKey&&!o.state.isCtrlPressed,n=e.metaKey||t||o.state.isCtrlPressed;if(o.updateMousePosition(e),o.updateGlobalMousePosition(e),n){var r=t?-1:1,i=o.getCorrectPointerPosition(e),a=1+.005*e.deltaY*r;o.emitZoomEvent(a,i)}else o.emit("wheel",{x:-e.deltaX,y:-e.deltaY},{type:"mouse",position:o.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},o.target=t,o.settings=n,o.targetBounds=t.getBoundingClientRect(),o.addListeners(),o}return s(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(){(0,a.b1)()||(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:(0,a.uZ)(e.x-this.targetBounds.x,0,this.target.clientWidth),y:(0,a.uZ)(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=(0,a.MP)(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}(r.v),c=n(475),l=n(419);const h=Symbol("Comlink.proxy"),d=Symbol("Comlink.endpoint"),f=Symbol("Comlink.releaseProxy"),v=Symbol("Comlink.thrown"),p=e=>"object"==typeof e&&null!==e||"function"==typeof e,m=new Map([["proxy",{canHandle:e=>p(e)&&e[h],serialize(e){const{port1:t,port2:n}=new MessageChannel;return g(e,t),[n,[n]]},deserialize:e=>(e.start(),y(e))}],["throw",{canHandle:e=>p(e)&&v in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function g(e,t=self){t.addEventListener("message",(function n(o){if(!o||!o.data)return;const{id:r,type:i,path:a}=Object.assign({path:[]},o.data),s=(o.data.argumentList||[]).map(S);let u;try{const t=a.slice(0,-1).reduce(((e,t)=>e[t]),e),n=a.reduce(((e,t)=>e[t]),e);switch(i){case"GET":u=n;break;case"SET":t[a.slice(-1)[0]]=S(o.data.value),u=!0;break;case"APPLY":u=n.apply(t,s);break;case"CONSTRUCT":u=E(new n(...s));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;g(e,n),u=W(t,[t])}break;case"RELEASE":u=void 0;break;default:return}}catch(e){u={value:e,[v]:0}}Promise.resolve(u).catch((e=>({value:e,[v]:0}))).then((e=>{const[o,a]=x(e);t.postMessage(Object.assign(Object.assign({},o),{id:r}),a),"RELEASE"===i&&(t.removeEventListener("message",n),b(t))}))})),t.start&&t.start()}function b(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function y(e,t){return P(e,[],t)}function w(e){if(e)throw new Error("Proxy has been released and is not useable")}function P(e,t=[],n=function(){}){let o=!1;const r=new Proxy(n,{get(n,i){if(w(o),i===f)return()=>M(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{b(e),o=!0}));if("then"===i){if(0===t.length)return{then:()=>r};const n=M(e,{type:"GET",path:t.map((e=>e.toString()))}).then(S);return n.then.bind(n)}return P(e,[...t,i])},set(n,r,i){w(o);const[a,s]=x(i);return M(e,{type:"SET",path:[...t,r].map((e=>e.toString())),value:a},s).then(S)},apply(n,r,i){w(o);const a=t[t.length-1];if(a===d)return M(e,{type:"ENDPOINT"}).then(S);if("bind"===a)return P(e,t.slice(0,-1));const[s,u]=C(i);return M(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:s},u).then(S)},construct(n,r){w(o);const[i,a]=C(r);return M(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:i},a).then(S)}});return r}function C(e){const t=e.map(x);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const k=new WeakMap;function W(e,t){return k.set(e,t),e}function E(e){return Object.assign(e,{[h]:!0})}function x(e){for(const[t,n]of m)if(n.canHandle(e)){const[o,r]=n.serialize(e);return[{type:"HANDLER",name:t,value:o},r]}return[{type:"RAW",value:e},k.get(e)||[]]}function S(e){switch(e.type){case"HANDLER":return m.get(e.name).deserialize(e.value);case"RAW":return e.value}}function M(e,t,n){return new Promise((o=>{const r=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===r&&(e.removeEventListener("message",t),o(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:r},t),n)}))}var L,R=n(849),T=n(519),Z=n(332),A=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),D=function(e){function t(t){var n=e.call(this)||this;return n.listenersCollector=new i,n.handleKeyUp=function(e){n.emit("keyUp",e.code)},n.target=t,n.addListeners(),n}return A(t,e),t.prototype.addListeners=function(){this.listenersCollector.add(this.target,"keyup",this.handleKeyUp)},t.prototype.dispose=function(){this.listenersCollector.dispose()},t}(r.v),O=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),I=function(){return(I=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}).apply(this,arguments)},_=function(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())}))},G=function(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(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},F=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o};!function(e){e[e.browser=0]="browser",e[e.worker=1]="worker"}(L||(L={}));var z=function(e){function t(t){var n,o=e.call(this)||this;o.listenersCollector=new i,o.handlePointerDownEvent=function(e){var t;null===(t=o.sketchWeb)||void 0===t||t.handlePointerDownEvent(e)},o.handlePointerMoveEvent=function(e){var t;null===(t=o.sketchWeb)||void 0===t||t.handlePointerMoveEvent(e)},o.handleGlobalPointerMoveEvent=function(e){var t;null===(t=o.sketchWeb)||void 0===t||t.setGlobalPointerPosition(e)},o.handlePointerUpEvent=function(e){var t;null===(t=o.sketchWeb)||void 0===t||t.handlePointerUpEvent(e)},o.handleWheelEvent=function(e,t){return _(o,void 0,void 0,(function(){var n;return G(this,(function(o){return null===(n=this.sketchWeb)||void 0===n||n.handleWheelEvent(e,t),[2]}))}))},o.handlePinchToZoomEvent=function(e,t){return _(o,void 0,void 0,(function(){var n;return G(this,(function(o){return null===(n=this.sketchWeb)||void 0===n||n.handlePinchToZoomEvent(e,t),[2]}))}))},o.handleCanvasResizeObserver=function(e){o.resizeCanvas(e[0].contentRect)},o.resizeCanvas=function(e){var t=e.width,n=e.height;window.requestAnimationFrame((function(){var e;o.setCanvasSize(t,n),o.gestureManager.updateTargetBounds(),null===(e=o.sketchWeb)||void 0===e||e.setSize(t,n,o.getDevicePixelRatio())}))};var r=null!==(n=t.featureFlags)&&void 0!==n?n:{};return o.featureFlags=I(I({},T.Z),r),o.settings=t,o.canvas=t.canvas,o.gestureManager=new u(o.settings.container,{minimumZoomLevel:t.minimumZoomLevel,maximumZoomLevel:t.maximumZoomLevel}),o.keyboardManager=new D(document.body),R.Z.active=t.mode===Z.p.debug,o.init(),o}return O(t,e),t.prototype.init=function(){var e;return _(this,void 0,void 0,(function(){var t,n,o;return G(this,(function(r){switch(r.label){case 0:return this.setCanvasSize(this.settings.container.clientWidth,this.settings.container.clientHeight),[4,this.initSketchWeb()];case 1:return r.sent(),[4,null===(e=this.sketchWeb)||void 0===e?void 0:e.getStatus()];case 2:return"FILE_READY"!==(null==(t=r.sent())?void 0:t.type)?[2]:(n=void 0!==this.settings.initialZoom,o=void 0!==this.settings.initialPan,n||o?n?[4,this.setZoom(this.settings.initialZoom)]:[3,4]:[3,7]);case 3:r.sent(),r.label=4;case 4:return o?[4,this.setPan(this.settings.initialPan.x,this.settings.initialPan.y,this.settings.initialPan.centerPointInViewport)]:[3,6];case 5:r.sent(),r.label=6;case 6:return[3,9];case 7:return[4,this.zoomToFit()];case 8:r.sent(),r.label=9;case 9:return this.sketchWeb.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.initSketchWeb=function(){return _(this,void 0,void 0,(function(){var e,t,o,r,i;return G(this,(function(a){switch(a.label){case 0:return e=this.featureFlags.offscreenCanvas&&"function"==typeof this.canvas.transferControlToOffscreen,t=I(I({},this.settings),{size:{width:this.canvas.width,height:this.canvas.height},pixelRatio:this.getDevicePixelRatio(),featureFlags:this.featureFlags}),e?(this.environment=L.worker,R.Z.debug("Using offscreen canvas"),this.offscreenCanvas=this.canvas.transferControlToOffscreen(),this.worker=new Worker(new URL(n.p+n.u(667),n.b),{type:void 0}),o=y(this.worker),r=this,[4,new o(W(I(I({},t),{canvas:this.offscreenCanvas}),[this.offscreenCanvas]))]):[3,2];case 1:return r.sketchWeb=a.sent(),[3,3];case 2:this.environment=L.browser,R.Z.debug("Using normal canvas"),this.sketchWeb=new c.U(t),a.label=3;case 3:return(i=this.sketchWeb).on("status",this.forwardEvent("status")),i.on("fileReady",this.forwardEvent("fileReady")),i.on("metric",this.forwardEvent("metric")),i.on("warnings",this.forwardEvent("warnings")),i.on("allImagesReady",this.forwardEvent("allImagesReady")),i.on("deviceInfo",this.forwardEvent("deviceInfo")),i.on("cameraMoveStart",this.forwardEvent("cameraMoveStart")),i.on("cameraMoveEnd",this.forwardEvent("cameraMoveEnd")),i.on("cameraZoomStart",this.forwardEvent("cameraZoomStart")),i.on("cameraZoomEnd",this.forwardEvent("cameraZoomEnd")),i.on("cameraZoomChange",this.forwardEvent("cameraZoomChange")),i.on("cameraPanChange",this.forwardEvent("cameraPanChange")),i.on("cursorChange",this.forwardEvent("cursorChange")),[4,this.sketchWeb.init()];case 4:return a.sent(),[2]}}))}))},t.prototype.forwardEvent=function(e){var t=this,n=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];t.emit.apply(t,F([e],n))};return this.environment===L.worker?E(n):n},t.prototype.isRunningInsideWorker=function(){return this.environment===L.worker},t.prototype.looseWebGLContext=function(){var e;null===(e=this.sketchWeb)||void 0===e||e.looseWebGLContext()},t.prototype.addListeners=function(){this.canvasResizeObserver=new ResizeObserver(this.handleCanvasResizeObserver),this.canvasResizeObserver.observe(this.settings.container),this.listenersCollector.add(window,"orientationchange",this.handleDeviceOrientationChange),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)},t.prototype.getDevicePixelRatio=function(){return(0,l.uZ)(window.devicePixelRatio,1,2)},t.prototype.setCanvasSize=function(e,t){this.canvas.style.width=e+"px",this.canvas.style.height=t+"px",this.canvas.width=e*this.getDevicePixelRatio(),this.canvas.height=t*this.getDevicePixelRatio()},t.prototype.handleDeviceOrientationChange=function(){this.resizeCanvas({width:this.settings.container.clientWidth,height:this.settings.container.clientHeight})},t.prototype.setBackgroundColor=function(e){var t;null===(t=this.sketchWeb)||void 0===t||t.setBackgroundColor(e)},t.prototype.zoomToFit=function(){return _(this,void 0,void 0,(function(){return G(this,(function(e){switch(e.label){case 0:return[4,this.sketchWeb.scaleDocumentToFit()];case 1:return e.sent(),[2]}}))}))},t.prototype.getStatus=function(){var e;return _(this,void 0,void 0,(function(){return G(this,(function(t){return[2,null===(e=this.sketchWeb)||void 0===e?void 0:e.getStatus()]}))}))},t.prototype.generateDocumentPNG=function(){var e;return _(this,void 0,void 0,(function(){return G(this,(function(t){return[2,null===(e=this.sketchWeb)||void 0===e?void 0:e.generateDocumentPNG()]}))}))},t.prototype.getDocument=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getDocument()},t.prototype.getArtboardAtPosition=function(e,t){var n;return _(this,void 0,void 0,(function(){return G(this,(function(o){switch(o.label){case 0:return[4,null===(n=this.sketchWeb)||void 0===n?void 0:n.getArtboardAtPosition(e,t)];case 1:return[2,o.sent()||null]}}))}))},t.prototype.getPanAtPosition=function(e,t){var n;return null===(n=this.sketchWeb)||void 0===n?void 0:n.getPanAtPosition(e,t)},t.prototype.setPan=function(e,t,n){var o;return _(this,void 0,void 0,(function(){return G(this,(function(r){switch(r.label){case 0:return[4,null===(o=this.sketchWeb)||void 0===o?void 0:o.setPan(e,t,Boolean(n))];case 1:return r.sent(),[2]}}))}))},t.prototype.setZoom=function(e,t){var n;return _(this,void 0,void 0,(function(){var o;return G(this,(function(r){return o=null!=t?t:this.getCanvasCenterPoint(),null===(n=this.sketchWeb)||void 0===n||n.setZoom(e,o),[2]}))}))},t.prototype.getCanvasCenterPoint=function(){var e=this.canvas.getBoundingClientRect();return{x:e.width/2+e.x,y:e.height/2+e.y}},t.prototype.getZoom=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getZoom()},t.prototype.getPan=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getPan()},t.prototype.setIsCameraLocked=function(e){var t;null===(t=this.sketchWeb)||void 0===t||t.setIsCameraLocked(e)},t.prototype.dispose=function(){var e,t,n,o;return _(this,void 0,void 0,(function(){return G(this,(function(r){switch(r.label){case 0:return this.gestureManager.dispose(),this.keyboardManager.dispose(),this.listenersCollector.dispose(),null===(e=this.canvasResizeObserver)||void 0===e||e.disconnect(),this.isRunningInsideWorker()?[4,null===(t=this.sketchWeb)||void 0===t?void 0:t.dispose()]:[3,2];case 1:return r.sent(),null===(n=this.worker)||void 0===n||n.terminate(),[3,3];case 2:null===(o=this.sketchWeb)||void 0===o||o.dispose(),r.label=3;case 3:return[2]}}))}))},t}(r.v)},475:(e,t,n)=>{"use strict";n.d(t,{U:()=>m});var o,r=n(419),i=n(519),a=n(354),s=n(108),u=n(849),c=n(758),l=n(332),h=n(975),d=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),f=function(){return(f=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}).apply(this,arguments)},v=function(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())}))},p=function(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(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},m=(globalThis.indexedDB,function(e){function t(t){var n=t.canvas,o=t.locateFile,a=t.filePath,c=t.imagesURLFormat,h=t.imagesURLMap,d=t.backgroundColor,v=void 0===d?{r:1,g:1,b:1,a:1}:d,p=t.size,m=t.pixelRatio,g=t.mode,b=t.showTilesBorders,y=void 0!==b&&b,w=t.minimumZoomLevel,P=t.maximumZoomLevel,C=t.preserveDrawingBuffer,k=void 0!==C&&C,W=t.panBoundariesPadding,E=void 0===W?40:W,x=t.featureFlags,S=void 0===x?{}:x,M=e.call(this)||this;return M.status={type:"INIT"},M.handleWebGLContextLost=function(){M.setStatus({type:"WEBGL_CONTEXT_LOST"})},M.canvas=n,M.locateFile=o,M.filePath=a,M.imagesURLFormat=c,M.imagesURLMap=h,M.backgroundColor=v,M.size=p,M.pixelRatio=m,M.mode=g,M.showTilesBorders=y,M.currentWebGLVersion=(0,r.wX)(),M.zoomLevels={min:w,max:P},M.preserveDrawingBuffer=k,M.panBoundariesPadding=E,M.featureFlags=f(f({},i.Z),S),u.Z.active=g===l.p.debug,M.traceFirstPaint=new s.S("FirstPaint"),M}return d(t,e),t.prototype.collectAndEmitDeviceInfo=function(){return v(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return[4,(0,h.M)()];case 1:return e=t.sent(),this.deviceInfo=f(f({},e),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},t.prototype.init=function(){return v(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.setStatus({type:"INIT"}),this.collectAndEmitDeviceInfo(),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,this.initSketchWebWasm()];case 2:return t.sent(),[4,this.setFile(this.filePath)];case 3:return t.sent(),[4,this.preloadImages()];case 4:return t.sent(),[3,6];case 5:return e=t.sent(),[2,this.fail(e instanceof c.k?e:new c.k("ERROR","Unexpected exception initializing the web renderer",e))];case 6:return this.mode===l.p.debug&&(window.sketchWeb=this.sketchWebWasm,globalThis.PRFindCriteria=this.wasmModule.PRFindCriteria,globalThis.PRTimingFunction=this.wasmModule.PRTimingFunction),[2]}}))}))},t.prototype.preloadImages=function(){var e=this;return new Promise((function(t){var n;null===(n=e.sketchWebWasm)||void 0===n||n.preloadImages((function(){t()}))}))},t.prototype.startRendering=function(){this.traceInitialRender=new s.S("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),this.sketchWebWasm.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){u.Z.debug("[C++] "+e)},logWarning:function(e){u.Z.warning("[C++] "+e)},logError:function(e){u.Z.error("[C++] "+e)},emitMetric:function(t,n,o,r){e.emit("metric",{id:t,start:n,end:o,duration:r})},resolveImageUrl:function(t){return e.imagesURLFormat?e.imagesURLFormat.replace(":imageId",t):e.imagesURLMap&&e.imagesURLMap[t]?e.imagesURLMap[t]:(u.Z.warning("Not able to resolve the url for the image with UUID: "+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.prCursorTypeToCSSCursorMap[t.value];n?e.emit("cursorChange",n):u.Z.warning("Unknown cursor type "+t.value)}}},t.prototype.downloadImages=function(){var e=this;return new Promise((function(t){var n,o=new s.S("ImagesDownload");null===(n=e.sketchWebWasm)||void 0===n||n.downloadImages((function(){o.printMeasurement(),e.emit("metric",o.measure()),u.Z.debug("Images downloaded"),t()}))}))},t.prototype.initSketchWebWasm=function(){return v(this,void 0,void 0,(function(){var e,t,o,r,i,a,h,d,f=this;return p(this,(function(v){switch(v.label){case 0:return e=new s.S("WasmModuleDownload"),this.mode!==l.p.debug?[3,2]:[4,n.e(706).then(n.t.bind(n,706,23))];case 1:return t=v.sent(),[3,4];case 2:return[4,n.e(610).then(n.t.bind(n,610,23))];case 3:t=v.sent(),v.label=4;case 4:o=t.default,v.label=5;case 5:return v.trys.push([5,7,,8]),r=this,[4,o({FeatureFlags:this.featureFlags,currentWebGLVersion:this.currentWebGLVersion,locateFile:function(e){return f.locateFile.replace("{file}",e)},bridge:this.createJSBridge()})];case 6:return r.wasmModule=v.sent(),[3,8];case 7:throw i=v.sent(),new c.k("WASM_ERROR","An error occurred while trying to create the wasm module.",i);case 8:if(this.pointerTypeToWASMMap={unset:this.wasmModule.PRUserPointerType.Unset,mouse:this.wasmModule.PRUserPointerType.Mouse,touch:this.wasmModule.PRUserPointerType.Touch},this.prCursorTypeToCSSCursorMap=((d={})[this.wasmModule.PRCursorType.Auto.value]="auto",d[this.wasmModule.PRCursorType.Default.value]="default",d[this.wasmModule.PRCursorType.Pointer.value]="pointer",d[this.wasmModule.PRCursorType.Grab.value]="grab",d[this.wasmModule.PRCursorType.Grabbing.value]="grabbing",d),e.printMeasurement(),this.emit("metric",e.measure()),a={majorVersion:this.currentWebGLVersion,antialias:!1,alpha:!1,stencil:!1,depth:!1,powerPreference:"high-performance",preserveDrawingBuffer:this.preserveDrawingBuffer},u.Z.debug("Using WebGL "+a.majorVersion),!(h=this.wasmModule.GL.createContext(this.canvas,a)))throw new c.k("WEBGL_ERROR","Unable to create WebGL context. WebGL might be unsupported, disabled, or this device is not able to run WebGL correctly.");this.webglCtxHandle=h;try{this.sketchWebWasm=this.wasmModule.SketchWeb.MakeGL(this.webglCtxHandle,this.canvas.width,this.size.height,this.pixelRatio,{showTilesBorders:this.showTilesBorders})}catch(e){throw new c.k("WASM_ERROR","An error occurred while trying to create the SketchWebWasm object.",e)}return this.userEventsCollectorWasm=this.sketchWebWasm.getUserEventsCollector(),this.sketchWebWasm.setBackgroundColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),this.sketchWebWasm.setZoomLevels(this.zoomLevels.min,this.zoomLevels.max),this.sketchWebWasm.setPanBoundariesPadding(this.panBoundariesPadding),this.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost),[2]}}))}))},t.prototype.setIsCameraLocked=function(e){var t;null===(t=this.sketchWebWasm)||void 0===t||t.setIsCameraLocked(e)},t.prototype.setBackgroundColor=function(e){var t;e.r===this.backgroundColor.r&&e.g===this.backgroundColor.g&&e.b===this.backgroundColor.b&&e.a===this.backgroundColor.a||(null===(t=this.sketchWebWasm)||void 0===t||t.setBackgroundColor(e.r,e.g,e.b,e.a),this.backgroundColor=e)},t.prototype.generateDocumentPNG=function(){return v(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.sketchWebWasm.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(){var e=this.wasmModule.GL.getContext(this.webglCtxHandle);if(e){var t=e.GLctx.getExtension("WEBGL_lose_context");t?t.loseContext():console.warn("Unable to retrieve WEBGL_lose_context extension")}else console.warn("Unable to loose context. WebGL rendering context not found")},t.prototype.scaleDocumentToFit=function(){var e;null===(e=this.sketchWebWasm)||void 0===e||e.scaleDocumentToFit()},t.prototype.setFile=function(e){return v(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.sketchWebWasm.setFile(e,(function(e,o,r,i){if(void 0===i&&(i=[]),i.length){u.Z.debug("Parser warnings: "+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 c.k("FILE_ERROR","Error encountered while fetching and parsing the file"))}))}))]}))}))},t.prototype.fail=function(e){this.setStatus({type:"FAILURE",code:e.code,message:e.toString()+(e.cause?"\nWrapped Error: "+e.cause.toString():"")}),u.Z.error(e),e.cause&&u.Z.error(e.cause)},t.prototype.setSize=function(e,t,n){var o;this.size.width=e*n,this.size.height=t*n,this.canvas.width=e*n,this.canvas.height=t*n,null===(o=this.sketchWebWasm)||void 0===o||o.resize(e,t,n)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&(u.Z.debug("Status transition "+this.status.type+" => "+e.type+"}"),this.status=e,this.emit("status",e))},t.prototype.getDocument=function(){if(!this.sketchWebWasm)return null;if(!this.cachedDocumentInfo||this.cachedDocumentInfo.filePath!==this.filePath){var e=this.sketchWebWasm.getPRFile();this.cachedDocumentInfo={filePath:this.filePath,document:f(f({},e),{artboards:(0,r.gi)(e.artboards)})}}return this.cachedDocumentInfo.document},t.prototype.getArtboardAtPosition=function(e,t){if(this.sketchWebWasm){var n=this.getDocument();if(n){for(var o=this.sketchWebWasm.getPan(),r=this.sketchWebWasm.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,h=c.bounds.y+c.bounds.height;if(i>=c.bounds.x&&a>=c.bounds.y&&i<=l&&a<=h)return c.objectId}return null}}},t.prototype.getPanAtPosition=function(e,t){if(this.sketchWebWasm){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;null===(n=this.sketchWebWasm)||void 0===n||n.setZoom(e,t.x,t.y)},t.prototype.getPan=function(){if(this.sketchWebWasm){var e=this.getDocument();if(e){var t=e.bounds,n=this.sketchWebWasm.getPan(),o=this.sketchWebWasm.getZoom();return{x:n.x/o+t.x,y:n.y/o+t.y}}}},t.prototype.getZoom=function(){var e;return null===(e=this.sketchWebWasm)||void 0===e?void 0:e.getZoom()},t.prototype.handlePinchToZoomEvent=function(e,t){var n;null===(n=this.userEventsCollectorWasm)||void 0===n||n.dispatchPinchToZoomEvent(e,t.x,t.y)},t.prototype.pointerInfoToWASM=function(e){var t,n;return this.pointerTypeToWASMMap||u.Z.warning("An user event was triggered, but the WASM module is not available."),f(f({},e),{type:null!==(n=null===(t=this.pointerTypeToWASMMap)||void 0===t?void 0:t[e.type])&&void 0!==n?n:this.wasmModule.PRUserPointerType.Unset})},t.prototype.setPan=function(e,t,n){if(void 0===n&&(n=!1),this.sketchWebWasm){var o=e,r=t,i=this.getDocument().bounds,a=this.sketchWebWasm.getZoom();if(n){var s=Math.max(2*a*this.pixelRatio,Number.EPSILON);o+=this.size.width/s,r+=this.size.height/s}var u=(o-i.x)*a,c=(r-i.y)*a;this.sketchWebWasm.setPan(u,c)}},t.prototype.handleWheelEvent=function(e,t){var n;null===(n=this.userEventsCollectorWasm)||void 0===n||n.dispatchWheelEvent(e.x,e.y,this.pointerInfoToWASM(t))},t.prototype.handlePointerDownEvent=function(e){var t;null===(t=this.userEventsCollectorWasm)||void 0===t||t.dispatchPointerDownEvent(this.pointerInfoToWASM(e))},t.prototype.handlePointerMoveEvent=function(e){var t;null===(t=this.userEventsCollectorWasm)||void 0===t||t.dispatchPointerMoveEvent(this.pointerInfoToWASM(e))},t.prototype.setGlobalPointerPosition=function(e){var t;null===(t=this.userEventsCollectorWasm)||void 0===t||t.dispatchGlobalPointerMoveEvent(this.pointerInfoToWASM(e))},t.prototype.handlePointerUpEvent=function(e){var t;null===(t=this.userEventsCollectorWasm)||void 0===t||t.dispatchPointerUpEvent(this.pointerInfoToWASM(e))},t.prototype.dispose=function(){var e,t;try{null===(e=this.sketchWebWasm)||void 0===e||e.stopRenderLoop(),null===(t=this.sketchWebWasm)||void 0===t||t.delete(),this.looseWebGLContext(),this.userEventsCollectorWasm=null,this.sketchWebWasm=null,this.wasmModule=null}catch(e){this.fail(new c.k("ERROR","Unexpected exception while disposing the SketchWebWasm object",e))}},t}(a.v))},35:(e,t,n)=>{"use strict";n.d(t,{z0:()=>Y,oW:()=>j,jr:()=>C,tm:()=>L,ky:()=>y,zX:()=>_,ex:()=>A,Jw:()=>D,m_:()=>O,Yy:()=>M,d6:()=>W,aP:()=>k,EY:()=>I,pt:()=>Z,od:()=>P,ph:()=>R,lt:()=>S,$z:()=>b,BO:()=>w,us:()=>T});var o=n(297),r=n.n(o),i=n(332),a=n(849),s=(0,o.createContext)(void 0),u=function(){var e=(0,o.useContext)(s);if(void 0===e)throw Error("useSketchWebInternalContext must be used within a SketchWebProvider");return e},c=(n(419),function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o}),l=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return a.Z.debug.apply(a.Z,c(["SketchWebReact"],e))},h=(0,o.createContext)(void 0),d=(0,o.createContext)(void 0),f=(0,o.createContext)(void 0),v=(0,o.createContext)(void 0),p=(0,o.createContext)(void 0),m=(0,o.createContext)(void 0),g=(0,o.createContext)("auto"),b=function(){var e=(0,o.useContext)(h);if(void 0===e)throw Error("useStatus must be used within a SketchWebProvider");return e},y=function(){var e=(0,o.useContext)(d);if(void 0===e)throw Error("useDocument must be used within a SketchWebProvider");return e},w=function(){var e=(0,o.useContext)(f);if(void 0===e)throw Error("useZoom must be used within a SketchWebProvider");return e},P=function(){var e=(0,o.useContext)(m);if(void 0===e)throw Error("usePan must be used within a SketchWebProvider");return e},C=function(){var e=(0,o.useContext)(g);if(void 0===e)throw Error("useCursor must be used within a SketchWebProvider");return e},k=function(){var e=(0,o.useContext)(v);if(void 0===status)throw Error("useIsCameraZooming must be used within a SketchWebProvider");return e},W=function(){var e=(0,o.useContext)(p);if(void 0===status)throw Error("useIsCameraMoving must be used within a SketchWebProvider");return e},E=function(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())}))},x=function(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(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},S=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t){l("setZoom",t),null==e||e.setZoom(t)}),[e])},M=function(){var e=S(),t=w();return(0,o.useCallback)((function(){var n;l("incrementZoom"),"number"==typeof t&&(n=t>=1?Math.round(2*t):t>.5?1:2*t,e(n))}),[e,t])},L=function(){var e=S(),t=w();return(0,o.useCallback)((function(){l("decrementZoom"),"number"==typeof t&&e(t/2)}),[e,t])},R=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t){var n=t.x,o=t.y,r=t.centerPointInViewport;l("setPan",n,o,"centerPointInViewport",r),null==e||e.setPan(n,o,r)}),[e])},T=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(){l("zoomToFit"),null==e||e.zoomToFit()}),[e])},Z=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(){l("looseWebGLContext"),null==e||e.looseWebGLContext()}),[e])},A=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(){return E(void 0,void 0,void 0,(function(){return x(this,(function(t){switch(t.label){case 0:return l("generateDocumentPNG"),[4,null==e?void 0:e.generateDocumentPNG()];case 1:return[2,t.sent()]}}))}))}),[e])},D=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t,n){return E(void 0,void 0,void 0,(function(){return x(this,(function(o){switch(o.label){case 0:return l("getArtboardAtPosition",t,n),[4,null==e?void 0:e.getArtboardAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},O=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t,n){return E(void 0,void 0,void 0,(function(){return x(this,(function(o){switch(o.label){case 0:return l("getPanAtPosition",t,n),[4,null==e?void 0:e.getPanAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},I=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t){l("setIsCameraLocked",t),null==e||e.setIsCameraLocked(t)}),[e])},_=function(e,t){var n=(0,u().getManager)();(0,o.useEffect)((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])},G=function(){return(G=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}).apply(this,arguments)},F={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},z={position:"absolute",top:0,left:0},j=function(e){a.Z.active=e.mode===i.p.debug;var t=e.filePath,n=e.locateFile,s=e.imagesURLFormat,c=e.imagesURLMap,l=e.backgroundColor,h=e.mode,d=e.showTilesBorders,f=e.minimumZoomLevel,v=e.maximumZoomLevel,p=e.preserveDrawingBuffer,m=e.panBoundariesPadding,g=e.initialPan,y=e.initialZoom,w=e.children,P=e.containerProps,k=void 0===P?{}:P,W=e.canvasProps,E=void 0===W?{}:W,x=e.featureFlags,S=void 0===x?{}:x,M=(0,o.useRef)(null),L=(0,o.useRef)(null),R=(0,o.useState)(!1),T=R[0],Z=R[1],A=(0,o.useCallback)((function(){return Z(!0)}),[]),D=u(),O=D.dispose,I=D.init,j=D.setSettings,B=C(),U=b();_("allImagesReady",A),(0,o.useEffect)((function(){j({locateFile:n,imagesURLFormat:s,imagesURLMap:c,backgroundColor:l,mode:h,showTilesBorders:d,minimumZoomLevel:f,maximumZoomLevel:v,preserveDrawingBuffer:p,panBoundariesPadding:m,initialPan:g,initialZoom:y,featureFlags:S})}),[j,n,s,c,l,h,d,f,v,p,m,g,y,S]),(0,o.useEffect)((function(){if(t)return I(t,M.current,L.current),function(){O()}}),[O,I,t]);var N=(0,o.useMemo)((function(){var t;return null!==(t=e.cursor)&&void 0!==t?t:B}),[e.cursor,B]),X=(0,o.useMemo)((function(){return G(G({},F),{cursor:N})}),[N]);return r().createElement("div",G({},k,{ref:L,style:X}),t&&r().createElement("canvas",G({},E,{key:t,ref:M,"data-sketchweb-all-images-ready":T,"data-testid":"sketchweb-canvas","data-sketchweb-status":"sketchweb-status-"+((null==U?void 0:U.type.toLowerCase())||"null"),style:z})),"READY"===(null==U?void 0:U.type)&&w)},B=n(41),U=function(){return(U=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}).apply(this,arguments)},N=function(e,t){switch(t.type){case"on-status":return U(U({},e),{status:t.status});case"on-file-ready":return U(U({},e),{document:t.document});case"on-zoom":return U(U({},e),{zoom:t.zoom});case"on-pan":return U(U({},e),{pan:t.pan});case"dispose":return U(U({},e),{status:null,zoom:null,pan:null,cursor:"auto"});case"post-init":return U(U({},e),{status:t.status,zoom:t.zoom});case"on-camera-zoom-start":return U(U({},e),{isCameraZooming:!0});case"on-camera-zoom-end":return U(U({},e),{isCameraZooming:!1});case"on-camera-move-start":return U(U({},e),{isCameraMoving:!0});case"on-camera-move-end":return U(U({},e),{isCameraMoving:!1});case"on-cursor-change":return U(U({},e),{cursor:t.cursor});default:return e}},X=function(){return(X=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}).apply(this,arguments)},Y=function(e){var t=e.children,n=(0,o.useRef)(null),i=(0,o.useRef)(null),a=(0,o.useReducer)(N,{pan:null,zoom:null,status:null,document:null,isCameraZooming:!1,isCameraMoving:!1,cursor:"auto"}),u=a[0],c=u.status,b=u.document,y=u.zoom,w=u.pan,P=u.isCameraZooming,C=u.isCameraMoving,k=u.cursor,W=a[1],E=(0,o.useCallback)((function(e){return W({type:"on-zoom",zoom:e})}),[]),x=(0,o.useCallback)((function(e,t){return W({type:"on-pan",pan:{x:e,y:t}})}),[]),S=(0,o.useCallback)((function(e){W({type:"on-status",status:e})}),[]),M=(0,o.useCallback)((function(e){W({type:"on-file-ready",document:e})}),[]),L=(0,o.useCallback)((function(){return W({type:"on-camera-zoom-start"})}),[]),R=(0,o.useCallback)((function(){return W({type:"on-camera-zoom-end"})}),[]),T=(0,o.useCallback)((function(){return W({type:"on-camera-move-start"})}),[]),Z=(0,o.useCallback)((function(){return W({type:"on-camera-move-end"})}),[]),A=(0,o.useCallback)((function(e){return W({type:"on-cursor-change",cursor:e})}),[]),D=(0,o.useCallback)((function(){var e=n.current;e&&(l("dispose"),e.off("status",S),e.off("fileReady",M),e.off("cameraZoomChange",E),e.off("cameraPanChange",x),e.off("cameraZoomStart",L),e.off("cameraZoomEnd",R),e.off("cameraMoveStart",T),e.off("cameraMoveEnd",Z),e.off("cursorChange",A),e.dispose(),n.current=null,W({type:"dispose"}))}),[S,M,x,E,L,R,T,Z,A]),O=(0,o.useCallback)((function(e,t,o){if(""!==e&&t&&o&&i.current){l("init");var r=new B.d(X(X({},i.current),{filePath:e,container:o,canvas:t}));r.on("status",S),r.on("fileReady",M),r.on("cameraZoomChange",E),r.on("cameraPanChange",x),r.on("cameraZoomStart",L),r.on("cameraZoomEnd",R),r.on("cameraMoveStart",T),r.on("cameraMoveEnd",Z),r.on("cursorChange",A),a=void 0,s=void 0,c=function(){var e,t;return function(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(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}(this,(function(n){switch(n.label){case 0:return e=W,t={type:"post-init"},[4,r.getZoom()];case 1:return t.zoom=n.sent()||null,[4,r.getStatus()];case 2:return t.status=n.sent()||null,[4,r.getPan()];case 3:return e.apply(void 0,[(t.pan=n.sent()||null,t)]),[2]}}))},new((u=void 0)||(u=Promise))((function(e,t){function n(e){try{r(c.next(e))}catch(e){t(e)}}function o(e){try{r(c.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):(r=t.value,r instanceof u?r:new u((function(e){e(r)}))).then(n,o)}r((c=c.apply(a,s||[])).next())})),n.current=r}var a,s,u,c}),[S,M,E,x,L,R,T,Z,A]),I=(0,o.useCallback)((function(e){var t;l("setSettings",e),e.backgroundColor&&(null===(t=n.current)||void 0===t||t.setBackgroundColor(e.backgroundColor)),i.current=e}),[]),_=(0,o.useCallback)((function(){return n.current}),[]),G=(0,o.useMemo)((function(){return{dispose:D,init:O,setSettings:I,getManager:_,dispatch:W}}),[D,O,I,_]);return r().createElement(s.Provider,{value:G},r().createElement(h.Provider,{value:c},r().createElement(d.Provider,{value:b},r().createElement(f.Provider,{value:y},r().createElement(m.Provider,{value:w},r().createElement(v.Provider,{value:P},r().createElement(p.Provider,{value:C},r().createElement(g.Provider,{value:k},t))))))))}},758:(e,t,n)=>{"use strict";n.d(t,{k:()=>i});var o,r=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(n,o,r){var i=this.constructor,a=e.call(this,"("+n+") "+o)||this;return a.code=n,a.cause=r,a.name=t.name,Object.setPrototypeOf(a,i.prototype),a}return r(t,e),t}(Error)},18:()=>{},689:()=>{},332:(e,t,n)=>{"use strict";var o;n.d(t,{p:()=>o}),function(e){e.debug="debug",e.release="release"}(o||(o={}))},119:()=>{},650:()=>{},312:()=>{},552:(e,t,n)=>{"use strict";n.d(t,{v:()=>o});var o=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.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}()},354:(e,t,n)=>{"use strict";n.d(t,{v:()=>o.v});var o=n(552)},849:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o};const r=new(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,o(["[SketchWeb] [Debug]"],e))},e.prototype.warning=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.warn.apply(console,o(["[SketchWeb] [Warn]"],e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,o(["[SketchWeb] [Error]"],e))},e}())},108:(e,t,n)=>{"use strict";n.d(t,{S:()=>r});var o=n(849),r=function(){function e(e){this.label=e,this.startTime=performance.now(),this.startTimestamp=Date.now(),o.Z.debug("[Performance] Start: "+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);o.Z.debug("[Performance] End: "+this.label+" -> "+t+" ms")}else{var n=(e/1e3).toFixed(2);o.Z.debug("[Performance] End: "+this.label+" -> "+n+" s")}},e}()},419:(e,t,n)=>{"use strict";n.d(t,{uZ:()=>o.uZ,gi:()=>o.gi,wX:()=>o.wX});var o=n(388)},388:(e,t,n)=>{"use strict";n.d(t,{MP:()=>i,uZ:()=>a,wX:()=>s,gi:()=>u,b1:()=>c});var o=n(519),r=n(66);function i(e){var t,n,o,r,i,a;return{x:null!==(o=null===(n=null===(t=e.touches)||void 0===t?void 0:t[0])||void 0===n?void 0:n.clientX)&&void 0!==o?o:e.clientX,y:null!==(a=null===(i=null===(r=e.touches)||void 0===r?void 0:r[0])||void 0===i?void 0:i.clientY)&&void 0!==a?a:e.clientY}}function a(e,t,n){return Math.max(t,Math.min(n,e))}function s(){return(0,r.t)()&&!o.Z.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1}function u(e){for(var t=e.size(),n=[],o=0;o<t;++o){var r=e.get(o);n.push(r)}return n}function c(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}},66:(e,t,n)=>{"use strict";n.d(t,{t:()=>r});var o=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/,r=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(o);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}}}},297:t=>{"use strict";t.exports=e}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return i[e](n,n.exports,s),n.exports}s.m=i,s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.t=function(e,o){if(1&o&&(e=this(e)),8&o)return e;if("object"==typeof e&&e){if(4&o&&e.__esModule)return e;if(16&o&&"function"==typeof e.then)return e}var r=Object.create(null);s.r(r);var i={};t=t||[null,n({}),n([]),n(n)];for(var a=2&o&&e;"object"==typeof a&&!~t.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,s.d(r,i),r},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce(((t,n)=>(s.f[n](e,t),t)),[])),s.u=e=>"static/js/web-renderer-"+{610:"dcd9a388dd98f28adced",667:"8cbabe889ae0a40da834",706:"8addc65e32c7f00a9bf5"}[e]+".chunk.js",s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o={},r="@sketch-hq/sketch-web-renderer:",s.l=(e,t,n,i)=>{if(o[e])o[e].push(t);else{var a,u;if(void 0!==n)for(var c=document.getElementsByTagName("script"),l=0;l<c.length;l++){var h=c[l];if(h.getAttribute("src")==e||h.getAttribute("data-webpack")==r+n){a=h;break}}a||(u=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,s.nc&&a.setAttribute("nonce",s.nc),a.setAttribute("data-webpack",r+n),a.src=e),o[e]=[t];var d=(t,n)=>{a.onerror=a.onload=null,clearTimeout(f);var r=o[e];if(delete o[e],a.parentNode&&a.parentNode.removeChild(a),r&&r.forEach((e=>e(n))),t)return t(n)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),u&&document.head.appendChild(a)}},s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.p="/",(()=>{s.b=document.baseURI||self.location.href;var e={826:0};s.f.j=(t,n)=>{var o=s.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise(((n,r)=>o=e[t]=[n,r]));n.push(o[2]=r);var i=s.p+s.u(t),a=new Error;s.l(i,(n=>{if(s.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+r+": "+i+")",a.name="ChunkLoadError",a.type=r,a.request=i,o[1](a)}}),"chunk-"+t,t)}};var t=(t,n)=>{var o,r,[i,a,u]=n,c=0;if(i.some((t=>0!==e[t]))){for(o in a)s.o(a,o)&&(s.m[o]=a[o]);u&&u(s)}for(t&&t(n);c<i.length;c++)r=i[c],s.o(e,r)&&e[r]&&e[r][0](),e[i[c]]=0},n=self.webpackChunk_sketch_hq_sketch_web_renderer=self.webpackChunk_sketch_hq_sketch_web_renderer||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var u={};return(()=>{"use strict";s.r(u),s.d(u,{default:()=>v,DefaultFeatureFlags:()=>p,SketchWeb:()=>n.U,SketchWebMode:()=>a.p,SketchWebError:()=>l.k,SketchWebProvider:()=>f.z0,SketchWebReact:()=>f.oW,useCursor:()=>f.jr,useDecrementZoom:()=>f.tm,useDocument:()=>f.ky,useEvent:()=>f.zX,useGenerateDocumentPNG:()=>f.ex,useGetArtboardAtPosititon:()=>f.Jw,useGetPanAtPosition:()=>f.m_,useIncrementZoom:()=>f.Yy,useIsCameraMoving:()=>f.d6,useIsCameraZooming:()=>f.aP,useLockCamera:()=>f.EY,useLooseWebGLContext:()=>f.pt,usePan:()=>f.od,useSetPan:()=>f.ph,useSetZoom:()=>f.lt,useStatus:()=>f.$z,useZoom:()=>f.BO,useZoomToFit:()=>f.us});var e=s(41),t=s(519),n=s(475),o=s(18),r={};for(const e in o)["default","DefaultFeatureFlags","SketchWeb"].indexOf(e)<0&&(r[e]=()=>o[e]);s.d(u,r);var i=s(119);r={};for(const e in i)["default","DefaultFeatureFlags","SketchWeb"].indexOf(e)<0&&(r[e]=()=>i[e]);s.d(u,r);var a=s(332),c=s(312);r={};for(const e in c)["default","DefaultFeatureFlags","SketchWeb","SketchWebMode"].indexOf(e)<0&&(r[e]=()=>c[e]);s.d(u,r);var l=s(758),h=s(689);r={};for(const e in h)["default","DefaultFeatureFlags","SketchWeb","SketchWebMode","SketchWebError"].indexOf(e)<0&&(r[e]=()=>h[e]);s.d(u,r);var d=s(650);r={};for(const e in d)["default","DefaultFeatureFlags","SketchWeb","SketchWebMode","SketchWebError"].indexOf(e)<0&&(r[e]=()=>d[e]);s.d(u,r);var f=s(35);const v=e.d;var p=t.Z})(),u})()}));
Binary file
Binary file