@sketch-hq/sketch-web-renderer 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/index.d.ts +9 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/module-debug.wasm +0 -0
- package/dist/module-release.wasm +0 -0
- package/dist/static/js/web-renderer-370688708cb08dced537.chunk.js +1 -0
- package/dist/static/js/{web-renderer-9b37447975c587246e2d.chunk.js → web-renderer-5f40dbb4c3823984584b.chunk.js} +1 -1
- package/dist/static/js/web-renderer-ce56606bbb268b01c7c9.chunk.js +1 -0
- package/dist/{RendererGL → ts}/Manager.d.ts +28 -20
- package/dist/ts/Manager.d.ts.map +1 -0
- package/dist/{RendererGL/RendererGL.d.ts → ts/SketchWeb.d.ts} +29 -29
- package/dist/ts/SketchWeb.d.ts.map +1 -0
- package/dist/{RendererGL → ts}/Worker.d.ts +0 -0
- package/dist/{RendererGL → ts}/Worker.d.ts.map +1 -1
- package/dist/ts/react/SketchWebContext.d.ts +77 -0
- package/dist/ts/react/SketchWebContext.d.ts.map +1 -0
- package/dist/ts/react/SketchWebReact.d.ts +27 -0
- package/dist/ts/react/SketchWebReact.d.ts.map +1 -0
- package/dist/ts/react/index.d.ts +3 -0
- package/dist/ts/react/index.d.ts.map +1 -0
- package/dist/ts/types/Error.d.ts +7 -0
- package/dist/ts/types/Error.d.ts.map +1 -0
- package/dist/ts/types/Events.d.ts +15 -0
- package/dist/ts/types/Events.d.ts.map +1 -0
- package/dist/ts/types/JSBridge.d.ts +20 -0
- package/dist/ts/types/JSBridge.d.ts.map +1 -0
- package/dist/{RendererGL → ts/types}/Metric.d.ts +0 -0
- package/dist/ts/types/Metric.d.ts.map +1 -0
- package/dist/ts/types/Mode.d.ts +5 -0
- package/dist/ts/types/Mode.d.ts.map +1 -0
- package/dist/{RendererGL → ts/types}/Status.d.ts +3 -3
- package/dist/ts/types/Status.d.ts.map +1 -0
- package/dist/{WasmModuleTypes.d.ts → ts/types/WASM.d.ts} +1 -1
- package/dist/ts/types/WASM.d.ts.map +1 -0
- package/dist/ts/types/Warning.d.ts +7 -0
- package/dist/ts/types/Warning.d.ts.map +1 -0
- package/dist/{CameraMoveTracker.d.ts → ts/utils/CameraMoveTracker.d.ts} +0 -0
- package/dist/ts/utils/CameraMoveTracker.d.ts.map +1 -0
- package/dist/{CameraMoveTracker.test.d.ts → ts/utils/CameraMoveTracker.test.d.ts} +0 -0
- package/dist/ts/utils/CameraMoveTracker.test.d.ts.map +1 -0
- package/dist/{EventEmitter.d.ts → ts/utils/EventEmitter.d.ts} +0 -0
- package/dist/ts/utils/EventEmitter.d.ts.map +1 -0
- package/dist/{GestureManager.d.ts → ts/utils/GestureManager.d.ts} +0 -0
- package/dist/ts/utils/GestureManager.d.ts.map +1 -0
- package/dist/{KeyboardManager.d.ts → ts/utils/KeyboardManager.d.ts} +0 -0
- package/dist/ts/utils/KeyboardManager.d.ts.map +1 -0
- package/dist/{ListenersCollector.d.ts → ts/utils/ListenersCollector.d.ts} +0 -0
- package/dist/ts/utils/ListenersCollector.d.ts.map +1 -0
- package/dist/{Logger.d.ts → ts/utils/Logger.d.ts} +3 -3
- package/dist/ts/utils/Logger.d.ts.map +1 -0
- package/dist/{Performance.d.ts → ts/utils/Performance.d.ts} +1 -1
- package/dist/ts/utils/Performance.d.ts.map +1 -0
- package/dist/{utils → ts/utils}/index.d.ts +0 -0
- package/dist/ts/utils/index.d.ts.map +1 -0
- package/dist/{utils → ts/utils}/misc.d.ts +0 -0
- package/dist/ts/utils/misc.d.ts.map +1 -0
- package/dist/{utils → ts/utils}/userAgent.d.ts +0 -0
- package/dist/ts/utils/userAgent.d.ts.map +1 -0
- package/package.json +14 -6
- package/dist/CameraMoveTracker.d.ts.map +0 -1
- package/dist/CameraMoveTracker.test.d.ts.map +0 -1
- package/dist/EventEmitter.d.ts.map +0 -1
- package/dist/GestureManager.d.ts.map +0 -1
- package/dist/KeyboardManager.d.ts.map +0 -1
- package/dist/ListenersCollector.d.ts.map +0 -1
- package/dist/Logger.d.ts.map +0 -1
- package/dist/Performance.d.ts.map +0 -1
- package/dist/RendererGL/Error.d.ts +0 -7
- package/dist/RendererGL/Error.d.ts.map +0 -1
- package/dist/RendererGL/Manager.d.ts.map +0 -1
- package/dist/RendererGL/Metric.d.ts.map +0 -1
- package/dist/RendererGL/Mode.d.ts +0 -5
- package/dist/RendererGL/Mode.d.ts.map +0 -1
- package/dist/RendererGL/RendererGL.d.ts.map +0 -1
- package/dist/RendererGL/Status.d.ts.map +0 -1
- package/dist/RendererGL/Warning.d.ts +0 -7
- package/dist/RendererGL/Warning.d.ts.map +0 -1
- package/dist/RendererRaster.d.ts +0 -13
- package/dist/RendererRaster.d.ts.map +0 -1
- package/dist/WasmModuleTypes.d.ts.map +0 -1
- package/dist/static/js/web-renderer-07635504672b8c4bd252.chunk.js +0 -1
- package/dist/static/js/web-renderer-e4d33468cc166de5734d.chunk.js +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/misc.d.ts.map +0 -1
- package/dist/utils/userAgent.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @sketch-hq/sketch-web-renderer
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7bdcdad: Add a `getArtboardAtPosition` API.
|
|
8
|
+
- 3e796b6: Introduced a SketchWeb component and started using it in the Viewer.
|
|
9
|
+
- aba76e2: Internal restructure
|
|
10
|
+
- 8135d4a: SketchWebReact pre-integration tweaks.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 52fc201: Update the pan values correctly
|
|
15
|
+
- b9cdb54: - `initialPan` and `setPan` now accept a new property: `centerPointInViewport` that will center a given point to the client's viewport.
|
|
16
|
+
- Add a new method `getPanAtPosition` that returns the correct pan value, given a point relative to the viewport
|
|
17
|
+
|
|
3
18
|
## 0.9.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Manager } from './
|
|
1
|
+
import { Manager } from './ts/Manager';
|
|
2
2
|
export default Manager;
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
3
|
+
export * from './ts/SketchWeb';
|
|
4
|
+
export * from './ts/types/Events';
|
|
5
|
+
export * from './ts/types/Status';
|
|
6
|
+
export * from './ts/types/Mode';
|
|
7
|
+
export * from './ts/types/Warning';
|
|
8
|
+
export * from './ts/types/Error';
|
|
9
|
+
export * from './ts/types/Metric';
|
|
10
|
+
export * from './ts/react';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,eAAe,OAAO,CAAA;AAEtB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,(function(){return(()=>{var e,t,n,r,o={660:(e,t,n)=>{"use strict";n.d(t,{v:()=>r});var r=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){var n,r;this.listeners[e]=null!==(n=this.listeners[e])&&void 0!==n?n:new Set,null===(r=this.listeners[e])||void 0===r||r.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 r=this.listeners[e];(null==r?void 0:r.size)&&r.forEach((function(e){Promise.resolve().then((function(){e.apply(void 0,t)}))}))},e}()},530:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r};const o=new(function(){function e(){this.active=!0}return e.prototype.debug=function(e){this.active&&console.debug("[WebRenderer] [Debug] "+e)},e.prototype.warning=function(e){this.active&&console.warn("[WebRenderer] [Warn] "+e)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,r(["[WebRenderer] [Error]"],e))},e}())},850:(e,t,n)=>{"use strict";n.d(t,{S:()=>o});var r=n(530),o=function(){function e(e){this.label=e,this.startTime=performance.now(),this.startTimestamp=Date.now(),r.Z.debug("[Performance] Start: "+this.label)}return e.prototype.measure=function(){var e=performance.now()-this.startTime;return{duration:e,end:this.startTimestamp+e,start:this.startTimestamp,id:this.label}},e.prototype.printMeasurement=function(){var e=this.measure().duration;if(e<1e3){var t=e.toFixed(2);r.Z.debug("[Performance] End: "+this.label+" -> "+t+" ms")}else{var n=(e/1e3).toFixed(2);r.Z.debug("[Performance] End: "+this.label+" -> "+n+" s")}},e}()},99:(e,t,n)=>{"use strict";n.d(t,{f:()=>i});var r,o=(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(n,r,o){var i=this.constructor,a=e.call(this,"("+n+") "+r)||this;return a.code=n,a.cause=o,a.name=t.name,Object.setPrototypeOf(a,i.prototype),a}return o(t,e),t}(Error)},871:(e,t,n)=>{"use strict";n.d(t,{d:()=>G});var r,o=n(660),i=function(){function e(){this.removeListenerCallbacks=[]}return e.prototype.add=function(e,t,n,r){e.addEventListener(t,n,r);var o=function(){e.removeEventListener(t,n,r)};return this.removeListenerCallbacks.push(o),o},e.prototype.dispose=function(){this.removeListenerCallbacks.forEach((function(e){return e()}))},e}(),a=n(928),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=(r=function(e,t){return(r=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}r(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,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},l=function(e){function t(t,n){var r=e.call(this)||this;return r.listenersCollector=new i,r.state={panning:!1,lastPan:{x:0,y:0},zoomCenter:{x:0,y:0},lastGestureScale:1,mouse:{x:0,y:0},isWaitingForSecondClick:!1,lastMouseClickPosition:{x:0,y:0}},r.handleGestureStart=function(e){e.preventDefault(),r.state.lastGestureScale=e.scale},r.handleGestureChange=function(e){e.preventDefault(),r.state.zoomCenter=r.getCorrectPointerPosition(e);var t=e.scale/r.state.lastGestureScale;r.state.lastGestureScale=e.scale,r.emit("zoomChange",t,r.state.zoomCenter),r.cameraMoveTracker.handleCameraMoveEvent()},r.handleGestureEnd=function(e){e.preventDefault()},r.handlePointerDown=function(e){var t=e instanceof MouseEvent&&0===e.button,n="undefined"!=typeof TouchEvent&&e instanceof TouchEvent;(t||n)&&(e.preventDefault(),r.updateMousePosition(e),r.state.panning=!0,r.state.lastPan.x=r.state.mouse.x,r.state.lastPan.y=r.state.mouse.y,r.emit("mousedown"))},r.handlePointerMove=function(e){r.state.panning||r.updateMousePosition(e)},r.handlePanMove=function(e){if(r.state.panning){e.preventDefault();var t=r.getCorrectPointerPosition(e),n=r.state.lastPan.x-t.x,o=r.state.lastPan.y-t.y;r.state.lastPan.x=t.x,r.state.lastPan.y=t.y,r.emit("panChange",-n,-o),r.cameraMoveTracker.handleCameraMoveEvent()}},r.handleDoubleClick=function(e){if(!("undefined"!=typeof TouchEvent&&e instanceof TouchEvent&&e.touches.length>0)){var t=r.getCorrectPointerPosition(e),n=Math.hypot(r.state.lastMouseClickPosition.x-t.x,r.state.lastMouseClickPosition.y-t.y)>("undefined"!=typeof TouchEvent&&e instanceof TouchEvent?15:0);if(!r.state.isWaitingForSecondClick||n)return r.state.isWaitingForSecondClick=!0,r.state.lastMouseClickPosition=r.getCorrectPointerPosition(e),void r.resetDoubleClick();r.state.isWaitingForSecondClick=!1,r.emit("doubleClick")}},r.resetDoubleClick=(0,a.Ds)((function(){r.state.isWaitingForSecondClick=!1}),500),r.handlePanEnd=function(){r.state.panning=!1},r.handlePointerUp=function(e){"undefined"!=typeof TouchEvent&&e instanceof TouchEvent&&e.touches.length>0||r.emit("mouseup")},r.handleMouseWheel=function(e){e.preventDefault();var t=e.metaKey||e.ctrlKey;if(r.updateMousePosition(e),t){var n=e.ctrlKey?-1:1;r.state.zoomCenter=r.getCorrectPointerPosition(e);var o=1+.01*e.deltaY*n;r.emit("zoomChange",o,r.state.zoomCenter)}else r.emit("panChange",-e.deltaX,-e.deltaY);r.cameraMoveTracker.handleCameraMoveEvent()},r.handleCameraMoveStart=function(){r.emit("cameraMoveStart")},r.handleCameraMoveEnd=function(){r.emit("cameraMoveEnd")},r.target=t,r.settings=n,r.targetBounds=t.getBoundingClientRect(),r.addListeners(),r.cameraMoveTracker=new s(r.handleCameraMoveStart,r.handleCameraMoveEnd),r}return u(t,e),t.prototype.updateTargetBounds=function(){this.targetBounds=this.target.getBoundingClientRect()},t.prototype.addListeners=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),this.listenersCollector.add(this.target,"touchstart",this.handlePointerDown),this.listenersCollector.add(document,"touchmove",this.handlePanMove),this.listenersCollector.add(this.target,"touchmove",this.handlePointerMove),this.listenersCollector.add(this.target,"touchend",this.handlePointerUp),this.listenersCollector.add(document,"touchend",this.handlePanEnd),this.listenersCollector.add(this.target,"touchend",this.handleDoubleClick),this.listenersCollector.add(this.target,"gesturestart",this.handleGestureStart),this.listenersCollector.add(this.target,"gesturechange",this.handleGestureChange),this.listenersCollector.add(this.target,"gestureend",this.handleGestureEnd)},t.prototype.getCorrectPointerPosition=function(e){var t=(0,a.MP)(e),n={x:0,y:0};return n.x=(0,a.uZ)(t.x-this.targetBounds.x,0,this.target.clientWidth),n.y=(0,a.uZ)(t.y-this.targetBounds.y,0,this.target.clientHeight),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.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.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}(o.v),f=n(94);const d=Symbol("Comlink.proxy"),h=Symbol("Comlink.endpoint"),p=Symbol("Comlink.releaseProxy"),v=Symbol("Comlink.thrown"),m=e=>"object"==typeof e&&null!==e||"function"==typeof e,g=new Map([["proxy",{canHandle:e=>m(e)&&e[d],serialize(e){const{port1:t,port2:n}=new MessageChannel;return y(e,t),[n,[n]]},deserialize:e=>(e.start(),w(e))}],["throw",{canHandle:e=>m(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 y(e,t=self){t.addEventListener("message",(function n(r){if(!r||!r.data)return;const{id:o,type:i,path:a}=Object.assign({path:[]},r.data),s=(r.data.argumentList||[]).map(T);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]]=T(r.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=E(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[r,a]=k(e);t.postMessage(Object.assign(Object.assign({},r),{id:o}),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 w(e,t){return x(e,[],t)}function C(e){if(e)throw new Error("Proxy has been released and is not useable")}function x(e,t=[],n=function(){}){let r=!1;const o=new Proxy(n,{get(n,i){if(C(r),i===p)return()=>M(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{b(e),r=!0}));if("then"===i){if(0===t.length)return{then:()=>o};const n=M(e,{type:"GET",path:t.map((e=>e.toString()))}).then(T);return n.then.bind(n)}return x(e,[...t,i])},set(n,o,i){C(r);const[a,s]=k(i);return M(e,{type:"SET",path:[...t,o].map((e=>e.toString())),value:a},s).then(T)},apply(n,o,i){C(r);const a=t[t.length-1];if(a===h)return M(e,{type:"ENDPOINT"}).then(T);if("bind"===a)return x(e,t.slice(0,-1));const[s,u]=P(i);return M(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:s},u).then(T)},construct(n,o){C(r);const[i,a]=P(o);return M(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:i},a).then(T)}});return o}function P(e){const t=e.map(k);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const _=new WeakMap;function E(e,t){return _.set(e,t),e}function S(e){return Object.assign(e,{[d]:!0})}function k(e){for(const[t,n]of g)if(n.canHandle(e)){const[r,o]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},o]}return[{type:"RAW",value:e},_.get(e)||[]]}function T(e){switch(e.type){case"HANDLER":return g.get(e.name).deserialize(e.value);case"RAW":return e.value}}function M(e,t,n){return new Promise((r=>{const o=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===o&&(e.removeEventListener("message",t),r(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),n)}))}var D,A=n(530),L=n(519),j=n(194),I=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 r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),R=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 I(t,e),t.prototype.addListeners=function(){this.listenersCollector.add(this.target,"keyup",this.handleKeyUp)},t.prototype.dispose=function(){this.listenersCollector.dispose()},t}(o.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 r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),F=function(){return(F=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},$=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},W=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[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,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},B=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r};!function(e){e[e.browser=0]="browser",e[e.worker=1]="worker"}(D||(D={}));var G=function(e){function t(t){var n=e.call(this)||this;return n.handleKeyUp=function(e){var t;null===(t=n.renderer)||void 0===t||t.keyUp(e)},n.handleMouseDoubleClick=function(){var e;null===(e=n.renderer)||void 0===e||e.mouseDoubleClick()},n.handleCameraMoveStart=function(){var e;null===(e=n.renderer)||void 0===e||e.setIsCameraMoving(!0)},n.handleCameraMoveEnd=function(){var e;null===(e=n.renderer)||void 0===e||e.setIsCameraMoving(!1)},n.handleMouseChange=function(e,t){var r;null===(r=n.renderer)||void 0===r||r.setMouse(e,t)},n.handlePanChange=function(e,t){return $(n,void 0,void 0,(function(){var n;return W(this,(function(r){return null===(n=this.renderer)||void 0===n||n.addPan(e,t),this.emitPanEvent(),[2]}))}))},n.handleZoomChange=function(e,t){return $(n,void 0,void 0,(function(){var n;return W(this,(function(r){return null===(n=this.renderer)||void 0===n||n.addZoom(e,t),this.emitZoomEvent(),this.emitPanEvent(),[2]}))}))},n.handleMouseDown=function(){var e;null===(e=n.renderer)||void 0===e||e.mouseDown()},n.handleMouseUp=function(){var e;null===(e=n.renderer)||void 0===e||e.mouseUp()},n.handleCanvasResize=function(e){window.requestAnimationFrame((function(){var t,r,o=e[0].contentRect,i=o.width,a=o.height;n.setCanvasSize(i,a),n.gestureManager.updateTargetBounds(),null===(t=n.renderer)||void 0===t||t.setPixelRatio(n.getDevicePixelRatio()),null===(r=n.renderer)||void 0===r||r.setSize(i*n.getDevicePixelRatio(),a*n.getDevicePixelRatio())}))},n.settings=t,n.canvas=t.canvas,n.gestureManager=new l(n.canvas,{minimumZoomLevel:t.minimumZoomLevel,maximumZoomLevel:t.maximumZoomLevel}),n.keyboardManager=new R(document.body),A.Z.active=t.mode===j.b.debug,n.init(),n}return O(t,e),t.prototype.init=function(){var e;return $(this,void 0,void 0,(function(){var t,n,r;return W(this,(function(o){switch(o.label){case 0:return this.setCanvasSize(this.settings.container.clientWidth,this.settings.container.clientHeight),[4,this.initRenderer()];case 1:return o.sent(),[4,null===(e=this.renderer)||void 0===e?void 0:e.getStatus()];case 2:return"FILE_READY"!==(null==(t=o.sent())?void 0:t.type)?[2]:(n=void 0!==this.settings.initialZoom,r=void 0!==this.settings.initialPan,n||r?n?[4,this.setZoom(this.settings.initialZoom)]:[3,4]:[3,7]);case 3:o.sent(),o.label=4;case 4:return r?[4,this.setPan(this.settings.initialPan.x,this.settings.initialPan.y)]:[3,6];case 5:o.sent(),o.label=6;case 6:return[3,9];case 7:return[4,this.zoomToFit()];case 8:o.sent(),o.label=9;case 9:return this.renderer.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.initRenderer=function(){return $(this,void 0,void 0,(function(){var e,t,r,o,i;return W(this,(function(a){switch(a.label){case 0:return e=L.Z.offscreenCanvas&&"function"==typeof this.canvas.transferControlToOffscreen,t=F(F({},this.settings),{size:{width:this.canvas.width,height:this.canvas.height},pixelRatio:this.getDevicePixelRatio()}),e?(this.environment=D.worker,A.Z.debug("Using offscreen canvas"),this.offscreenCanvas=this.canvas.transferControlToOffscreen(),this.worker=new Worker(new URL(n.p+n.u(522),n.b),{type:void 0}),r=w(this.worker),o=this,[4,new r(E(F(F({},t),{canvas:this.offscreenCanvas}),[this.offscreenCanvas]))]):[3,2];case 1:return o.renderer=a.sent(),[3,3];case 2:this.environment=D.browser,A.Z.debug("Using normal canvas"),this.renderer=new f.p(t),a.label=3;case 3:return(i=this.renderer).on("status",this.forwardEvent("status")),i.on("metric",this.forwardEvent("metric")),i.on("warnings",this.forwardEvent("warnings")),i.on("artboardSelected",this.forwardEvent("artboardSelected")),i.on("artboardDeselected",this.forwardEvent("artboardDeselected")),i.on("artboardMouseEnter",this.forwardEvent("artboardMouseEnter")),i.on("artboardMouseLeave",this.forwardEvent("artboardMouseLeave")),i.on("goToArtboard",this.forwardEvent("goToArtboard")),[4,this.renderer.init()];case 4:return a.sent(),[2]}}))}))},t.prototype.forwardEvent=function(e){var t=this,n=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];t.emit.apply(t,B([e],n))};return this.environment===D.worker?S(n):n},t.prototype.isRunningInsideWorker=function(){return this.environment===D.worker},t.prototype.looseWebGLContext=function(){var e;null===(e=this.renderer)||void 0===e||e.looseWebGLContext()},t.prototype.addListeners=function(){this.canvasResizeObserver=new ResizeObserver(this.handleCanvasResize),this.canvasResizeObserver.observe(this.settings.container),this.gestureManager.on("panChange",this.handlePanChange),this.gestureManager.on("mousemove",this.handleMouseChange),this.gestureManager.on("mousedown",this.handleMouseDown),this.gestureManager.on("mouseup",this.handleMouseUp),this.gestureManager.on("doubleClick",this.handleMouseDoubleClick),this.gestureManager.on("zoomChange",this.handleZoomChange),this.gestureManager.on("cameraMoveStart",this.handleCameraMoveStart),this.gestureManager.on("cameraMoveEnd",this.handleCameraMoveEnd),this.keyboardManager.on("keyUp",this.handleKeyUp)},t.prototype.emitPanEvent=function(){var e;return $(this,void 0,void 0,(function(){var t;return W(this,(function(n){switch(n.label){case 0:return[4,null===(e=this.renderer)||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 $(this,void 0,void 0,(function(){var t;return W(this,(function(n){switch(n.label){case 0:return[4,null===(e=this.renderer)||void 0===e?void 0:e.getZoom()];case 1:return"undefined"===(t=n.sent())||this.emit("zoom",t),[2]}}))}))},t.prototype.getDevicePixelRatio=function(){return(0,a.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.zoomToFit=function(){return $(this,void 0,void 0,(function(){return W(this,(function(e){switch(e.label){case 0:return[4,this.renderer.scaleDocumentToFit()];case 1:return e.sent(),this.emitZoomEvent(),this.emitPanEvent(),[2]}}))}))},t.prototype.getStatus=function(){var e;return $(this,void 0,void 0,(function(){return W(this,(function(t){return[2,null===(e=this.renderer)||void 0===e?void 0:e.getStatus()]}))}))},t.prototype.generateDocumentPNG=function(){var e;return $(this,void 0,void 0,(function(){return W(this,(function(t){return[2,null===(e=this.renderer)||void 0===e?void 0:e.generateDocumentPNG()]}))}))},t.prototype.setPan=function(e,t){var n;return $(this,void 0,void 0,(function(){return W(this,(function(r){switch(r.label){case 0:return[4,null===(n=this.renderer)||void 0===n?void 0:n.setPan(e,t)];case 1:return r.sent(),this.emitPanEvent(),[2]}}))}))},t.prototype.setZoom=function(e,t){var n;return $(this,void 0,void 0,(function(){var r;return W(this,(function(o){return r=null!=t?t:this.getCanvasCenterPoint(),null===(n=this.renderer)||void 0===n||n.setZoom(e,r),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.getPan=function(){var e;return null===(e=this.renderer)||void 0===e?void 0:e.getPan()},t.prototype.dispose=function(){var e,t,n,r;return $(this,void 0,void 0,(function(){return W(this,(function(o){switch(o.label){case 0:return this.gestureManager.dispose(),this.keyboardManager.dispose(),null===(e=this.canvasResizeObserver)||void 0===e||e.disconnect(),this.isRunningInsideWorker()?[4,null===(t=this.renderer)||void 0===t?void 0:t.dispose()]:[3,2];case 1:return o.sent(),null===(n=this.worker)||void 0===n||n.terminate(),[3,3];case 2:null===(r=this.renderer)||void 0===r||r.dispose(),o.label=3;case 3:return[2]}}))}))},t}(o.v)},783:()=>{},194:(e,t,n)=>{"use strict";var r;n.d(t,{b:()=>r}),function(e){e.debug="debug",e.release="release"}(r||(r={}))},94:(e,t,n)=>{"use strict";n.d(t,{p:()=>p});var r,o=n(928),i=n(519),a=n(660),s=n(850),u=n(530),c=n(99),l=n(194),f=(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),d=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},h=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[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,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=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,r=t.locateFile,i=t.filePath,a=t.imagesURLFormat,c=t.imagesURLMap,f=t.backgroundColor,d=void 0===f?{r:1,g:1,b:1,a:1}:f,h=t.highlightColor,p=void 0===h?{r:0,g:0,b:0,a:1}:h,v=t.size,m=t.pixelRatio,g=t.mode,y=t.showTilesBorders,b=void 0!==y&&y,w=t.minimumZoomLevel,C=t.maximumZoomLevel,x=t.preserveDrawingBuffer,P=void 0!==x&&x,_=t.panBoundariesPadding,E=void 0===_?40:_,S=e.call(this)||this;return S.status={type:"INIT"},S.handleWebGLContextLost=function(){S.setStatus({type:"WEBGL_CONTEXT_LOST"})},S.debouncedFullDraw=(0,o.Ds)((function(){return S.draw(!0)}),200),S.canvas=n,S.locateFile=r,S.filePath=i,S.imagesURLFormat=a,S.imagesURLMap=c,S.backgroundColor=d,S.highlightColor=p,S.size=v,S.pixelRatio=m,S.mode=g,S.showTilesBorders=b,S.currentWebGLVersion=(0,o.wX)(),S.zoomLevels={min:w,max:C},S.preserveDrawingBuffer=P,S.panBoundariesPadding=E,u.Z.active=g===l.b.debug,S.traceFirstPaint=new s.S("FirstPaint"),S}return f(t,e),t.prototype.init=function(){return d(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:this.setStatus({type:"INIT"}),t.label=1;case 1:return t.trys.push([1,4,,5]),[4,this.initSketchKit()];case 2:return t.sent(),[4,this.setFile(this.filePath)];case 3:return t.sent(),[3,5];case 4:return e=t.sent(),[2,this.fail(e instanceof c.f?e:new c.f("ERROR","Unexpected exception initializing the web renderer",e))];case 5:return[2]}}))}))},t.prototype.startRendering=function(){this.traceInitialRender=new s.S("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),this.draw(!0,!1),this.sketchKit.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,r,o){e.emit("metric",{id:t,start:n,end:r,duration:o})},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),"")}}},t.prototype.downloadImages=function(){var e=this;return new Promise((function(t){var n=new s.S("ImagesDownload");e.sketchKit.downloadImages((function(){n.printMeasurement(),e.emit("metric",n.measure()),u.Z.debug("Images downloaded"),t()}))}))},t.prototype.initSketchKit=function(){return d(this,void 0,void 0,(function(){var e,t,r,o,a,f,d,p=this;return h(this,(function(h){switch(h.label){case 0:return e=new s.S("WasmModuleDownload"),this.mode!==l.b.debug?[3,2]:[4,n.e(83).then(n.t.bind(n,83,23))];case 1:return r=h.sent(),[3,4];case 2:return[4,n.e(427).then(n.t.bind(n,427,23))];case 3:r=h.sent(),h.label=4;case 4:t=r.default,h.label=5;case 5:return h.trys.push([5,7,,8]),o=this,[4,t({FeatureFlags:i.Z,currentWebGLVersion:this.currentWebGLVersion,locateFile:function(e){return p.locateFile.replace("{file}",e)},bridge:this.createJSBridge(),onDrawComplete:this.handleDrawComplete.bind(this),onArtboardMouseEnter:function(e){p.emit("artboardMouseEnter",e)},onArtboardMouseLeave:function(e){p.emit("artboardMouseLeave",e)},onArtboardSelected:function(e){p.emit("artboardSelected",e)},onArtboardDeselected:function(e){p.emit("artboardDeselected",e)},onGoToArtboard:function(e,t){p.emit("goToArtboard",e,t)}})];case 6:return o.wasmModule=h.sent(),[3,8];case 7:throw a=h.sent(),new c.f("WASM_ERROR","An error occurred while trying to create the wasm module.",a);case 8:if(e.printMeasurement(),this.emit("metric",e.measure()),f={antialias:!1,majorVersion:this.currentWebGLVersion,alpha:!0,powerPreference:"high-performance",preserveDrawingBuffer:this.preserveDrawingBuffer},u.Z.debug("Using WebGL "+f.majorVersion),!(d=this.wasmModule.GL.createContext(this.canvas,f)))throw new c.f("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.sketchKit=this.wasmModule.SketchKit.MakeGL(this.webglCtxHandle,this.canvas.width,this.size.height)}catch(e){throw new c.f("WASM_ERROR","An error occurred while trying to create the SketchKit object.",e)}return this.sketchKit.setPixelRatio(this.pixelRatio),this.sketchKit.setBackgroundColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),this.sketchKit.setHighlightColor(this.highlightColor.r,this.highlightColor.g,this.highlightColor.b,this.highlightColor.a),this.sketchKit.setRendererConfiguration({showTilesBorders:this.showTilesBorders}),this.sketchKit.setZoomLevels(this.zoomLevels.min,this.zoomLevels.max),this.sketchKit.setPanBoundariesPadding(this.panBoundariesPadding),this.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost),[2]}}))}))},t.prototype.generateDocumentPNG=function(){var e;return d(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.downloadImages()];case 1:return t.sent(),[2,null===(e=this.sketchKit)||void 0===e?void 0:e.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.sketchKit)||void 0===e||e.scaleDocumentToFit(),this.delayedDraw()},t.prototype.setFile=function(e){return d(this,void 0,void 0,(function(){var t=this;return h(this,(function(n){return this.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,r){t.sketchKit.setFile(e,(function(e){if(void 0===e&&(e=[]),e.length){u.Z.debug("Parser warnings: "+e);var r=e.map((function(e){return{key:e}}));t.emit("warnings",r)}t.setStatus({type:"FILE_READY"}),n()}),(function(){return r(new c.f("FILE_ERROR","Error encountered while fetching and parsing the file"))}))}))]}))}))},t.prototype.delayedDraw=function(){if(!i.Z.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.sketchKit)||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){var t;this.pixelRatio=e,null===(t=this.sketchKit)||void 0===t||t.setPixelRatio(e),this.delayedDraw()},t.prototype.setSize=function(e,t){var n;this.size.width=e,this.size.height=t,this.canvas.width=e,this.canvas.height=t,null===(n=this.sketchKit)||void 0===n||n.resize(e,t)},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.getStatus=function(){return this.status},t.prototype.setZoom=function(e,t){var n,r;null===(n=this.sketchKit)||void 0===n||n.setZoomCenter(t.x,t.y),null===(r=this.sketchKit)||void 0===r||r.setZoom(e),this.delayedDraw()},t.prototype.addZoom=function(e,t){var n,r;null===(n=this.sketchKit)||void 0===n||n.setZoomCenter(t.x,t.y),null===(r=this.sketchKit)||void 0===r||r.addZoom(e),this.delayedDraw()},t.prototype.setPan=function(e,t){var n;null===(n=this.sketchKit)||void 0===n||n.setPan(e,t),this.delayedDraw()},t.prototype.addPan=function(e,t){var n;null===(n=this.sketchKit)||void 0===n||n.addPan(e,t),this.delayedDraw()},t.prototype.getPan=function(){if(this.sketchKit){var e=this.sketchKit.getPan();return{x:e[0],y:e[1]}}},t.prototype.getZoom=function(){var e;return null===(e=this.sketchKit)||void 0===e?void 0:e.getZoom()},t.prototype.setMouse=function(e,t){var n;null===(n=this.sketchKit)||void 0===n||n.setMouse(e,t)},t.prototype.setIsCameraMoving=function(e){var t;null===(t=this.sketchKit)||void 0===t||t.setIsCameraMoving(e)},t.prototype.mouseDown=function(){var e;null===(e=this.sketchKit)||void 0===e||e.mouseDown()},t.prototype.mouseUp=function(){var e;null===(e=this.sketchKit)||void 0===e||e.mouseUp()},t.prototype.mouseDoubleClick=function(){var e;null===(e=this.sketchKit)||void 0===e||e.mouseDoubleClick()},t.prototype.keyUp=function(e){var t;null===(t=this.sketchKit)||void 0===t||t.keyUp(e)},t.prototype.dispose=function(){var e,t;try{null===(e=this.sketchKit)||void 0===e||e.stopRenderLoop(),null===(t=this.sketchKit)||void 0===t||t.delete()}catch(e){this.fail(new c.f("ERROR","Unexpected exception while disposing the SketchKit object",e))}this.sketchKit=null},t}(a.v))},847:()=>{},632:()=>{},65:(e,t,n)=>{"use strict";n.d(t,{t:()=>i});var r=n(427),o=n.n(r),i=function(){function e(e,t,n){void 0===n&&(n=""),this.assetsFolder=n.replace(/\/$/,""),this.width=e,this.height=t}return e.prototype.init=function(){return e=this,t=void 0,r=function(){var e,t,n=this;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[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,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}(this,(function(r){switch(r.label){case 0:return e=this,[4,o()({locateFile:function(e){return n.assetsFolder+"/"+e}})];case 1:if(e.wasmModule=r.sent(),!(t=this.wasmModule.SketchKit.MakeRaster(this.width,this.height)))throw new Error("Not able to initialize SketchKit");return this.sketchKit=t,this.draw(),[2]}}))},new((n=void 0)||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}));var e,t,n,r},e.prototype.exportPNGBlob=function(){var e=this.sketchKit.exportPNGBuffer();return new Blob([e],{type:"image/png"})},e.prototype.draw=function(){this.sketchKit.draw()},e.prototype.dispose=function(){this.sketchKit.delete()},e}()},519:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r={delayedDraw:!0,offscreenCanvas:!1,safariWebGL2:!1,pageBoundariesLimit:!1}},928:(e,t,n)=>{"use strict";n.d(t,{uZ:()=>r.uZ,Ds:()=>r.Ds,MP:()=>r.MP,wX:()=>r.wX});var r=n(235)},235:(e,t,n)=>{"use strict";n.d(t,{Ds:()=>i,MP:()=>a,uZ:()=>s,wX:()=>u});var r=n(519),o=n(800);function i(e,t){var n;function r(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];clearTimeout(n),n=setTimeout((function(){e.apply(void 0,r)}),t)}return r.cancel=function(){n&&clearTimeout(n)},r}function a(e){var t,n;return{x:null!==(t=e.pageX)&&void 0!==t?t:e.clientX,y:null!==(n=e.pageY)&&void 0!==n?n:e.clientY}}function s(e,t,n){return Math.max(t,Math.min(n,e))}function u(){return(0,o.t)()&&!r.Z.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1}},800:(e,t,n)=>{"use strict";n.d(t,{t:()=>o});var r=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/,o=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(r);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}}}},427:e=>{var t,n=(t="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e){var n,r,o=void 0!==(e=e||{})?e:{};o.ready=new Promise((function(e,t){n=e,r=t}));var i,a={};for(i in o)o.hasOwnProperty(i)&&(a[i]=o[i]);var s=[],u="./this.program",c="";"undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),t&&(c=t),c=0!==c.indexOf("blob:")?c.substr(0,c.lastIndexOf("/")+1):"";var l=o.print||console.log.bind(console),f=o.printErr||console.warn.bind(console);for(i in a)a.hasOwnProperty(i)&&(o[i]=a[i]);a=null,o.arguments&&(s=o.arguments),o.thisProgram&&(u=o.thisProgram),o.quit&&o.quit;var d,h,p=0;o.wasmBinary&&(d=o.wasmBinary),o.noExitRuntime,"object"!=typeof WebAssembly&&Y("no native wasm support detected");var v=!1,m="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function g(e,t,n){for(var r=t+n,o=t;e[o]&&!(o>=r);)++o;if(o-t>16&&e.subarray&&m)return m.decode(e.subarray(t,o));for(var i="";t<o;){var a=e[t++];if(128&a){var s=63&e[t++];if(192!=(224&a)){var u=63&e[t++];if((a=224==(240&a)?(15&a)<<12|s<<6|u:(7&a)<<18|s<<12|u<<6|63&e[t++])<65536)i+=String.fromCharCode(a);else{var c=a-65536;i+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else i+=String.fromCharCode((31&a)<<6|s)}else i+=String.fromCharCode(a)}return i}function y(e,t){return e?g(_,e,t):""}function b(e,t,n,r){if(!(r>0))return 0;for(var o=n,i=n+r-1,a=0;a<e.length;++a){var s=e.charCodeAt(a);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(n>=i)break;t[n++]=s}else if(s<=2047){if(n+1>=i)break;t[n++]=192|s>>6,t[n++]=128|63&s}else if(s<=65535){if(n+2>=i)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|63&s}else{if(n+3>=i)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}}return t[n]=0,n-o}function w(e,t,n){return b(e,_,t,n)}function C(e){for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r>=55296&&r<=57343&&(r=65536+((1023&r)<<10)|1023&e.charCodeAt(++n)),r<=127?++t:t+=r<=2047?2:r<=65535?3:4}return t}var x,P,_,E,S,k,T,M,D,A="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function L(e,t){for(var n=e,r=n>>1,o=r+t/2;!(r>=o)&&S[r];)++r;if((n=r<<1)-e>32&&A)return A.decode(_.subarray(e,n));for(var i="",a=0;!(a>=t/2);++a){var s=E[e+2*a>>1];if(0==s)break;i+=String.fromCharCode(s)}return i}function j(e,t,n){if(void 0===n&&(n=2147483647),n<2)return 0;for(var r=t,o=(n-=2)<2*e.length?n/2:e.length,i=0;i<o;++i){var a=e.charCodeAt(i);E[t>>1]=a,t+=2}return E[t>>1]=0,t-r}function I(e){return 2*e.length}function R(e,t){for(var n=0,r="";!(n>=t/4);){var o=k[e+4*n>>2];if(0==o)break;if(++n,o>=65536){var i=o-65536;r+=String.fromCharCode(55296|i>>10,56320|1023&i)}else r+=String.fromCharCode(o)}return r}function O(e,t,n){if(void 0===n&&(n=2147483647),n<4)return 0;for(var r=t,o=r+n-4,i=0;i<e.length;++i){var a=e.charCodeAt(i);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++i)),k[t>>2]=a,(t+=4)+4>o)break}return k[t>>2]=0,t-r}function F(e){for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r>=55296&&r<=57343&&++n,t+=4}return t}function $(e){x=e,o.HEAP8=P=new Int8Array(e),o.HEAP16=E=new Int16Array(e),o.HEAP32=k=new Int32Array(e),o.HEAPU8=_=new Uint8Array(e),o.HEAPU16=S=new Uint16Array(e),o.HEAPU32=T=new Uint32Array(e),o.HEAPF32=M=new Float32Array(e),o.HEAPF64=D=new Float64Array(e)}o.INITIAL_MEMORY;var W,B=[],G=[],U=[],N=[],Z=0,z=null,K=null;function V(e){Z++,o.monitorRunDependencies&&o.monitorRunDependencies(Z)}function H(e){if(Z--,o.monitorRunDependencies&&o.monitorRunDependencies(Z),0==Z&&(null!==z&&(clearInterval(z),z=null),K)){var t=K;K=null,t()}}function Y(e){o.onAbort&&o.onAbort(e),f(e+=""),v=!0,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.";var t=new WebAssembly.RuntimeError(e);throw r(t),t}function q(e){return t=e,n="data:application/octet-stream;base64,",String.prototype.startsWith?t.startsWith(n):0===t.indexOf(n);var t,n}o.preloadedImages={},o.preloadedAudios={};var X,J="module-release.wasm";function Q(e){try{if(e==J&&d)return new Uint8Array(d);throw"both async and sync fetching of the wasm failed"}catch(e){Y(e)}}function ee(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var n=t.func;"number"==typeof n?void 0===t.arg?W.get(n)():W.get(n)(t.arg):n(void 0===t.arg?null:t.arg)}else t(o)}}q(J)||(X=J,J=o.locateFile?o.locateFile(X,c):c+X);function te(e){this.excPtr=e,this.ptr=e-16,this.set_type=function(e){k[this.ptr+8>>2]=e},this.get_type=function(){return k[this.ptr+8>>2]},this.set_destructor=function(e){k[this.ptr+0>>2]=e},this.get_destructor=function(){return k[this.ptr+0>>2]},this.set_refcount=function(e){k[this.ptr+4>>2]=e},this.set_caught=function(e){e=e?1:0,P[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=P[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,P[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=P[this.ptr+13>>0]},this.init=function(e,t){this.set_type(e),this.set_destructor(t),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var e=k[this.ptr+4>>2];k[this.ptr+4>>2]=e+1},this.release_ref=function(){var e=k[this.ptr+4>>2];return k[this.ptr+4>>2]=e-1,1===e}}var ne={mappings:{},buffers:[null,[],[]],printChar:function(e,t){var n=ne.buffers[e];0===t||10===t?((1===e?l:f)(g(n,0)),n.length=0):n.push(t)},varargs:void 0,get:function(){return ne.varargs+=4,k[ne.varargs-4>>2]},getStr:function(e){return y(e)},get64:function(e,t){return e}};function re(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}var oe=void 0;function ie(e){for(var t="",n=e;_[n];)t+=oe[_[n++]];return t}var ae={},se={},ue={};function ce(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?"_"+e:e}function le(e,t){return e=ce(e),new Function("body","return function "+e+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(t)}function fe(e,t){var n=le(t,(function(e){this.name=t,this.message=e;var n=new Error(e).stack;void 0!==n&&(this.stack=this.toString()+"\n"+n.replace(/^Error(:[^\n]*)?\n/,""))}));return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},n}var de=void 0;function he(e){throw new de(e)}var pe=void 0;function ve(e){throw new pe(e)}function me(e,t,n){function r(t){var r=n(t);r.length!==e.length&&ve("Mismatched type converter count");for(var o=0;o<e.length;++o)ge(e[o],r[o])}e.forEach((function(e){ue[e]=t}));var o=new Array(t.length),i=[],a=0;t.forEach((function(e,t){se.hasOwnProperty(e)?o[t]=se[e]:(i.push(e),ae.hasOwnProperty(e)||(ae[e]=[]),ae[e].push((function(){o[t]=se[e],++a===i.length&&r(o)})))})),0===i.length&&r(o)}function ge(e,t,n){if(n=n||{},!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var r=t.name;if(e||he('type "'+r+'" must have a positive integer typeid pointer'),se.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;he("Cannot register type '"+r+"' twice")}if(se[e]=t,delete ue[e],ae.hasOwnProperty(e)){var o=ae[e];delete ae[e],o.forEach((function(e){e()}))}}function ye(e){he(e.$$.ptrType.registeredClass.name+" instance already deleted")}var be=!1;function we(e){}function Ce(e){e.count.value-=1,0===e.count.value&&function(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}(e)}function xe(e){return"undefined"==typeof FinalizationGroup?(xe=function(e){return e},e):(be=new FinalizationGroup((function(e){for(var t=e.next();!t.done;t=e.next()){var n=t.value;n.ptr?Ce(n):console.warn("object already deleted: "+n.ptr)}})),we=function(e){be.unregister(e.$$)},(xe=function(e){return be.register(e,e.$$,e.$$),e})(e))}var Pe=void 0,_e=[];function Ee(){for(;_e.length;){var e=_e.pop();e.$$.deleteScheduled=!1,e.delete()}}function Se(){}var ke={};function Te(e,t,n){if(void 0===e[t].overloadTable){var r=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||he("Function '"+n+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[r.argCount]=r}}function Me(e,t,n,r,o,i,a,s){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=r,this.baseClass=o,this.getActualType=i,this.upcast=a,this.downcast=s,this.pureVirtualFunctions=[]}function De(e,t,n){for(;t!==n;)t.upcast||he("Expected null or instance of "+n.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function Ae(e,t){if(null===t)return this.isReference&&he("null is not a valid "+this.name),0;t.$$||he('Cannot pass "'+Je(t)+'" as a '+this.name),t.$$.ptr||he("Cannot pass deleted object as a pointer of type "+this.name);var n=t.$$.ptrType.registeredClass;return De(t.$$.ptr,n,this.registeredClass)}function Le(e,t){var n;if(null===t)return this.isReference&&he("null is not a valid "+this.name),this.isSmartPointer?(n=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,n),n):0;t.$$||he('Cannot pass "'+Je(t)+'" as a '+this.name),t.$$.ptr||he("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&he("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var r=t.$$.ptrType.registeredClass;if(n=De(t.$$.ptr,r,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&he("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?n=t.$$.smartPtr:he("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:n=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)n=t.$$.smartPtr;else{var o=t.clone();n=this.rawShare(n,Xe((function(){o.delete()}))),null!==e&&e.push(this.rawDestructor,n)}break;default:he("Unsupporting sharing policy")}return n}function je(e,t){if(null===t)return this.isReference&&he("null is not a valid "+this.name),0;t.$$||he('Cannot pass "'+Je(t)+'" as a '+this.name),t.$$.ptr||he("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&he("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var n=t.$$.ptrType.registeredClass;return De(t.$$.ptr,n,this.registeredClass)}function Ie(e){return this.fromWireType(T[e>>2])}function Re(e,t,n){if(t===n)return e;if(void 0===n.baseClass)return null;var r=Re(e,t,n.baseClass);return null===r?null:n.downcast(r)}var Oe={};function Fe(e,t){return t.ptrType&&t.ptr||ve("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&ve("Both smartPtrType and smartPtr must be specified"),t.count={value:1},xe(Object.create(e,{$$:{value:t}}))}function $e(e,t,n,r,o,i,a,s,u,c,l){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=r,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=a,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=c,this.rawDestructor=l,o||void 0!==t.baseClass?this.toWireType=Le:r?(this.toWireType=Ae,this.destructorFunction=null):(this.toWireType=je,this.destructorFunction=null)}function We(e,t,n){return-1!=e.indexOf("j")?function(e,t,n){var r=o["dynCall_"+e];return n&&n.length?r.apply(null,[t].concat(n)):r.call(null,t)}(e,t,n):W.get(t).apply(null,n)}function Be(e,t){var n,r,o,i=-1!=(e=ie(e)).indexOf("j")?(n=e,r=t,o=[],function(){o.length=arguments.length;for(var e=0;e<arguments.length;e++)o[e]=arguments[e];return We(n,r,o)}):W.get(t);return"function"!=typeof i&&he("unknown function pointer with signature "+e+": "+t),i}var Ge=void 0;function Ue(e){var t=Nt(e),n=ie(t);return Gt(t),n}function Ne(e,t){var n=[],r={};throw t.forEach((function e(t){r[t]||se[t]||(ue[t]?ue[t].forEach(e):(n.push(t),r[t]=!0))})),new Ge(e+": "+n.map(Ue).join([", "]))}function Ze(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var n=le(e.name||"unknownFunctionName",(function(){}));n.prototype=e.prototype;var r=new n,o=e.apply(r,t);return o instanceof Object?o:r}function ze(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function Ke(e,t,n,r,o){var i=t.length;i<2&&he("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==n,s=!1,u=1;u<t.length;++u)if(null!==t[u]&&void 0===t[u].destructorFunction){s=!0;break}var c="void"!==t[0].name,l="",f="";for(u=0;u<i-2;++u)l+=(0!==u?", ":"")+"arg"+u,f+=(0!==u?", ":"")+"arg"+u+"Wired";var d="return function "+ce(e)+"("+l+") {\nif (arguments.length !== "+(i-2)+") {\nthrowBindingError('function "+e+" called with ' + arguments.length + ' arguments, expected "+(i-2)+" args!');\n}\n";s&&(d+="var destructors = [];\n");var h=s?"destructors":"null",p=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],v=[he,r,o,ze,t[0],t[1]];for(a&&(d+="var thisWired = classParam.toWireType("+h+", this);\n"),u=0;u<i-2;++u)d+="var arg"+u+"Wired = argType"+u+".toWireType("+h+", arg"+u+"); // "+t[u+2].name+"\n",p.push("argType"+u),v.push(t[u+2]);if(a&&(f="thisWired"+(f.length>0?", ":"")+f),d+=(c?"var rv = ":"")+"invoker(fn"+(f.length>0?", ":"")+f+");\n",s)d+="runDestructors(destructors);\n";else for(u=a?1:2;u<t.length;++u){var m=1===u?"thisWired":"arg"+(u-2)+"Wired";null!==t[u].destructorFunction&&(d+=m+"_dtor("+m+"); // "+t[u].name+"\n",p.push(m+"_dtor"),v.push(t[u].destructorFunction))}return c&&(d+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),d+="}\n",p.push(d),Ze(Function,p).apply(null,v)}function Ve(e,t){for(var n=[],r=0;r<e;r++)n.push(k[(t>>2)+r]);return n}var He=[],Ye=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function qe(e){e>4&&0==--Ye[e].refcount&&(Ye[e]=void 0,He.push(e))}function Xe(e){switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var t=He.length?He.pop():Ye.length;return Ye[t]={refcount:1,value:e},t}}function Je(e){if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e}function Qe(e,t){switch(t){case 2:return function(e){return this.fromWireType(M[e>>2])};case 3:return function(e){return this.fromWireType(D[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function et(e,t,n){switch(t){case 0:return n?function(e){return P[e]}:function(e){return _[e]};case 1:return n?function(e){return E[e>>1]}:function(e){return S[e>>1]};case 2:return n?function(e){return k[e>>2]}:function(e){return T[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function tt(e){return e||he("Cannot use deleted val. handle = "+e),Ye[e].value}function nt(e,t){var n=se[e];return void 0===n&&he(t+" has unknown type "+Ue(e)),n}function rt(e,t){for(var n=new Array(e),r=0;r<e;++r)n[r]=nt(k[(t>>2)+r],"parameter "+r);return n}var ot={};function it(e){var t=ot[e];return void 0===t?ie(e):t}var at,st=[];function ut(){return"object"==typeof globalThis?globalThis:Function("return this")()}at=function(){return performance.now()};var ct={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],uniforms:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},timerQueriesEXT:[],queries:[],samplers:[],transformFeedbacks:[],syncs:[],programInfos:{},stringCache:{},stringiCache:{},unpackAlignment:4,recordError:function(e){ct.lastError||(ct.lastError=e)},getNewId:function(e){for(var t=ct.counter++,n=e.length;n<t;n++)e[n]=null;return t},getSource:function(e,t,n,r){for(var o="",i=0;i<t;++i){var a=r?k[r+4*i>>2]:-1;o+=y(k[n+4*i>>2],a<0?void 0:a)}return o},createContext:function(e,t){e.getContextSafariWebGL2Fixed||(e.getContextSafariWebGL2Fixed=e.getContext,e.getContext=function(t,n){var r=e.getContextSafariWebGL2Fixed(t,n);return"webgl"==t==r instanceof WebGLRenderingContext?r:null});var n=t.majorVersion>1?e.getContext("webgl2",t):e.getContext("webgl",t);return n?ct.registerContext(n,t):0},registerContext:function(e,t){var n=ct.getNewId(ct.contexts),r={handle:n,attributes:t,version:t.majorVersion,GLctx:e};return e.canvas&&(e.canvas.GLctxObject=r),ct.contexts[n]=r,(void 0===t.enableExtensionsByDefault||t.enableExtensionsByDefault)&&ct.initExtensions(r),n},makeContextCurrent:function(e){return ct.currentContext=ct.contexts[e],o.ctx=Dt=ct.currentContext&&ct.currentContext.GLctx,!(e&&!Dt)},getContext:function(e){return ct.contexts[e]},deleteContext:function(e){ct.currentContext===ct.contexts[e]&&(ct.currentContext=null),"object"==typeof JSEvents&&JSEvents.removeAllHandlersOnTarget(ct.contexts[e].GLctx.canvas),ct.contexts[e]&&ct.contexts[e].GLctx.canvas&&(ct.contexts[e].GLctx.canvas.GLctxObject=void 0),ct.contexts[e]=null},initExtensions:function(e){if(e||(e=ct.currentContext),!e.initExtensionsDone){e.initExtensionsDone=!0;var t,n=e.GLctx;!function(e){var t=e.getExtension("ANGLE_instanced_arrays");t&&(e.vertexAttribDivisor=function(e,n){t.vertexAttribDivisorANGLE(e,n)},e.drawArraysInstanced=function(e,n,r,o){t.drawArraysInstancedANGLE(e,n,r,o)},e.drawElementsInstanced=function(e,n,r,o,i){t.drawElementsInstancedANGLE(e,n,r,o,i)})}(n),function(e){var t=e.getExtension("OES_vertex_array_object");t&&(e.createVertexArray=function(){return t.createVertexArrayOES()},e.deleteVertexArray=function(e){t.deleteVertexArrayOES(e)},e.bindVertexArray=function(e){t.bindVertexArrayOES(e)},e.isVertexArray=function(e){return t.isVertexArrayOES(e)})}(n),function(e){var t=e.getExtension("WEBGL_draw_buffers");t&&(e.drawBuffers=function(e,n){t.drawBuffersWEBGL(e,n)})}(n),(t=n).dibvbi=t.getExtension("WEBGL_draw_instanced_base_vertex_base_instance"),function(e){e.mdibvbi=e.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance")}(n),n.disjointTimerQueryExt=n.getExtension("EXT_disjoint_timer_query"),function(e){e.multiDrawWebgl=e.getExtension("WEBGL_multi_draw")}(n),(n.getSupportedExtensions()||[]).forEach((function(e){e.indexOf("lose_context")<0&&e.indexOf("debug")<0&&n.getExtension(e)}))}},populateUniformTable:function(e){for(var t=ct.programs[e],n=ct.programInfos[e]={uniforms:{},maxUniformLength:0,maxAttributeLength:-1,maxUniformBlockNameLength:-1},r=n.uniforms,o=Dt.getProgramParameter(t,35718),i=0;i<o;++i){var a=Dt.getActiveUniform(t,i),s=a.name;n.maxUniformLength=Math.max(n.maxUniformLength,s.length+1),"]"==s.slice(-1)&&(s=s.slice(0,s.lastIndexOf("[")));var u=Dt.getUniformLocation(t,s);if(u){var c=ct.getNewId(ct.uniforms);r[s]=[a.size,c],ct.uniforms[c]=u;for(var l=1;l<a.size;++l){var f=s+"["+l+"]";u=Dt.getUniformLocation(t,f),c=ct.getNewId(ct.uniforms),ct.uniforms[c]=u}}}}};function lt(e,t){return(e>>>0)+4294967296*t}var ft=[];function dt(e,t,n,r){for(var o=0;o<e;o++){var i=Dt[n](),a=i&&ct.getNewId(r);i?(i.name=a,r[a]=i):ct.recordError(1282),k[t+4*o>>2]=a}}function ht(e,t,n){if(t){var r,o,i=void 0;switch(e){case 36346:i=1;break;case 36344:return void(0!=n&&1!=n&&ct.recordError(1280));case 34814:case 36345:i=0;break;case 34466:var a=Dt.getParameter(34467);i=a?a.length:0;break;case 33309:if(ct.currentContext.version<2)return void ct.recordError(1282);i=2*(Dt.getSupportedExtensions()||[]).length;break;case 33307:case 33308:if(ct.currentContext.version<2)return void ct.recordError(1280);i=33307==e?3:0}if(void 0===i){var s=Dt.getParameter(e);switch(typeof s){case"number":i=s;break;case"boolean":i=s?1:0;break;case"string":return void ct.recordError(1280);case"object":if(null===s)switch(e){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:i=0;break;default:return void ct.recordError(1280)}else{if(s instanceof Float32Array||s instanceof Uint32Array||s instanceof Int32Array||s instanceof Array){for(var u=0;u<s.length;++u)switch(n){case 0:k[t+4*u>>2]=s[u];break;case 2:M[t+4*u>>2]=s[u];break;case 4:P[t+u>>0]=s[u]?1:0}return}try{i=0|s.name}catch(t){return ct.recordError(1280),void f("GL_INVALID_ENUM in glGet"+n+"v: Unknown object returned from WebGL getParameter("+e+")! (error: "+t+")")}}break;default:return ct.recordError(1280),void f("GL_INVALID_ENUM in glGet"+n+"v: Native code calling glGet"+n+"v("+e+") and it returns "+s+" of type "+typeof s+"!")}}switch(n){case 1:o=i,T[(r=t)>>2]=o,T[r+4>>2]=(o-T[r>>2])/4294967296;break;case 0:k[t>>2]=i;break;case 2:M[t>>2]=i;break;case 4:P[t>>0]=i?1:0}}else ct.recordError(1281)}function pt(e){var t=C(e)+1,n=Wt(t);return w(e,n,t),n}function vt(e){return 0==(e-=5120)?P:1==e?_:2==e?E:4==e?k:6==e?M:5==e||28922==e||28520==e||30779==e||30782==e?T:S}function mt(e){return 31-Math.clz32(e.BYTES_PER_ELEMENT)}function gt(e,t,n,r,o,i){var a=vt(e),s=mt(a),u=1<<s,c=function(e,t,n,r){var o;return t*(e*n+(o=r)-1&-o)}(n,r,function(e){return{5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[e-6402]||1}(t)*u,ct.unpackAlignment);return a.subarray(o>>s,o+c>>s)}var yt=[],bt=[];function wt(){return!0}function Ct(e){try{return h.grow(e-x.byteLength+65535>>>16),$(h.buffer),1}catch(e){}}o._emscripten_is_main_browser_thread=wt;var xt={xhrs:[],setu64:function(e,t){T[e>>2]=t,T[e+4>>2]=t/4294967296|0},openDatabase:function(e,t,n,r){try{var o=indexedDB.open(e,t)}catch(e){return r(e)}o.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains("FILES")&&t.deleteObjectStore("FILES"),t.createObjectStore("FILES")},o.onsuccess=function(e){n(e.target.result)},o.onerror=function(e){r(e)}},staticInit:function(){xt.openDatabase("emscripten_filesystem",1,(function(e){xt.dbInstance=e,H()}),(function(){xt.dbInstance=!1,H()})),"undefined"!=typeof ENVIRONMENT_IS_FETCH_WORKER&&ENVIRONMENT_IS_FETCH_WORKER||V()}};function Pt(e,t,n,r,o){var i=T[e+8>>2];if(i){var a=y(i),s=e+112,u=y(s);u||(u="GET"),T[e+4>>2];var c=T[s+52>>2],l=T[s+56>>2],f=!!T[s+60>>2],d=(T[s+64>>2],T[s+68>>2]),h=T[s+72>>2],p=T[s+76>>2],v=T[s+80>>2],m=T[s+84>>2],g=T[s+88>>2],b=!!(1&c),C=!!(2&c),x=!!(64&c),P=d?y(d):void 0,E=h?y(h):void 0,k=v?y(v):void 0,M=new XMLHttpRequest;if(M.withCredentials=f,M.open(u,a,!x,P,E),x||(M.timeout=l),M.url_=a,M.responseType="arraybuffer",v&&M.overrideMimeType(k),p)for(;;){var D=T[p>>2];if(!D)break;var A=T[p+4>>2];if(!A)break;p+=8;var L=y(D),j=y(A);M.setRequestHeader(L,j)}xt.xhrs.push(M);var I=xt.xhrs.length;T[e+0>>2]=I;var R=m&&g?_.slice(m,m+g):null;M.onload=function(r){O(b&&!C);var o=M.response?M.response.byteLength:0;xt.setu64(e+24,0),o&&xt.setu64(e+32,o),S[e+40>>1]=M.readyState,S[e+42>>1]=M.status,M.statusText&&w(M.statusText,e+44,64),M.status>=200&&M.status<300?t&&t(e,M,r):n&&n(e,M,r)},M.onerror=function(t){O(b);var r=M.status;xt.setu64(e+24,0),xt.setu64(e+32,M.response?M.response.byteLength:0),S[e+40>>1]=M.readyState,S[e+42>>1]=r,n&&n(e,M,t)},M.ontimeout=function(t){n&&n(e,M,t)},M.onprogress=function(t){var n=b&&C&&M.response?M.response.byteLength:0,o=0;b&&C&&(o=Wt(n),_.set(new Uint8Array(M.response),o)),T[e+12>>2]=o,xt.setu64(e+16,n),xt.setu64(e+24,t.loaded-n),xt.setu64(e+32,t.total),S[e+40>>1]=M.readyState,M.readyState>=3&&0===M.status&&t.loaded>0&&(M.status=200),S[e+42>>1]=M.status,M.statusText&&w(M.statusText,e+44,64),r&&r(e,M,t),o&&Gt(o)},M.onreadystatechange=function(t){S[e+40>>1]=M.readyState,M.readyState>=2&&(S[e+42>>1]=M.status),o&&o(e,M,t)};try{M.send(R)}catch(t){n&&n(e,M,t)}}else n(e,0,"no url specified!");function O(t){var n=0,r=0;t&&(r=M.response?M.response.byteLength:0,n=Wt(r),_.set(new Uint8Array(M.response),n)),T[e+12>>2]=n,xt.setu64(e+16,r)}}function _t(e){try{e()}catch(e){if(e instanceof Ht)return;if("unwind"!==e)throw e&&"object"==typeof e&&e.stack&&f("exception thrown: "+[e,e.stack]),e}}function Et(e,t,n,r,o){if(e){var i=T[t+112+64>>2];i||(i=T[t+8>>2]);var a=y(i);try{var s=e.transaction(["FILES"],"readwrite").objectStore("FILES").put(n,a);s.onsuccess=function(e){S[t+40>>1]=4,S[t+42>>1]=200,w("OK",t+44,64),r(t,0,a)},s.onerror=function(e){S[t+40>>1]=4,S[t+42>>1]=413,w("Payload Too Large",t+44,64),o(t,0,e)}}catch(e){o(t,0,e)}}else o(t,0,"IndexedDB not available!")}var St={};function kt(){if(!kt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"};for(var t in St)e[t]=St[t];var n=[];for(var t in e)n.push(t+"="+e[t]);kt.strings=n}return kt.strings}function Tt(e){return e%4==0&&(e%100!=0||e%400==0)}function Mt(e,t){for(var n=0,r=0;r<=t;n+=e[r++]);return n}var Dt,At=[31,29,31,30,31,30,31,31,30,31,30,31],Lt=[31,28,31,30,31,30,31,31,30,31,30,31];function jt(e,t){for(var n=new Date(e.getTime());t>0;){var r=Tt(n.getFullYear()),o=n.getMonth(),i=(r?At:Lt)[o];if(!(t>i-n.getDate()))return n.setDate(n.getDate()+t),n;t-=i-n.getDate()+1,n.setDate(1),o<11?n.setMonth(o+1):(n.setMonth(0),n.setFullYear(n.getFullYear()+1))}return n}!function(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);oe=e}(),de=o.BindingError=fe(Error,"BindingError"),pe=o.InternalError=fe(Error,"InternalError"),Se.prototype.isAliasOf=function(e){if(!(this instanceof Se))return!1;if(!(e instanceof Se))return!1;for(var t=this.$$.ptrType.registeredClass,n=this.$$.ptr,r=e.$$.ptrType.registeredClass,o=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;r.baseClass;)o=r.upcast(o),r=r.baseClass;return t===r&&n===o},Se.prototype.clone=function(){if(this.$$.ptr||ye(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=xe(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},Se.prototype.delete=function(){this.$$.ptr||ye(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&he("Object already scheduled for deletion"),we(this),Ce(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},Se.prototype.isDeleted=function(){return!this.$$.ptr},Se.prototype.deleteLater=function(){return this.$$.ptr||ye(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&he("Object already scheduled for deletion"),_e.push(this),1===_e.length&&Pe&&Pe(Ee),this.$$.deleteScheduled=!0,this},$e.prototype.getPointee=function(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},$e.prototype.destructor=function(e){this.rawDestructor&&this.rawDestructor(e)},$e.prototype.argPackAdvance=8,$e.prototype.readValueFromPointer=Ie,$e.prototype.deleteObject=function(e){null!==e&&e.delete()},$e.prototype.fromWireType=function(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=function(e,t){return t=function(e,t){for(void 0===t&&he("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}(e,t),Oe[t]}(this.registeredClass,t);if(void 0!==n){if(0===n.$$.count.value)return n.$$.ptr=t,n.$$.smartPtr=e,n.clone();var r=n.clone();return this.destructor(e),r}function o(){return this.isSmartPointer?Fe(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Fe(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i,a=this.registeredClass.getActualType(t),s=ke[a];if(!s)return o.call(this);i=this.isConst?s.constPointerType:s.pointerType;var u=Re(t,this.registeredClass,i.registeredClass);return null===u?o.call(this):this.isSmartPointer?Fe(i.registeredClass.instancePrototype,{ptrType:i,ptr:u,smartPtrType:this,smartPtr:e}):Fe(i.registeredClass.instancePrototype,{ptrType:i,ptr:u})},o.getInheritedInstanceCount=function(){return Object.keys(Oe).length},o.getLiveInheritedInstances=function(){var e=[];for(var t in Oe)Oe.hasOwnProperty(t)&&e.push(Oe[t]);return e},o.flushPendingDeletes=Ee,o.setDelayFunction=function(e){Pe=e,_e.length&&Pe&&Pe(Ee)},Ge=o.UnboundTypeError=fe(Error,"UnboundTypeError"),o.count_emval_handles=function(){for(var e=0,t=5;t<Ye.length;++t)void 0!==Ye[t]&&++e;return e},o.get_first_emval=function(){for(var e=5;e<Ye.length;++e)if(void 0!==Ye[e])return Ye[e];return null};for(var It=0;It<32;++It)ft.push(new Array(It));var Rt=new Float32Array(288);for(It=0;It<288;++It)yt[It]=Rt.subarray(0,It+1);var Ot=new Int32Array(288);for(It=0;It<288;++It)bt[It]=Ot.subarray(0,It+1);xt.staticInit();var Ft,$t={t:function(e,t,n,r){Y("Assertion failed: "+y(e)+", at: "+[t?y(t):"unknown filename",n,r?y(r):"unknown function"])},g:function(e){return Wt(e+16)+16},f:function(e,t,n){throw new te(e).init(t,n),e},F:function(e,t,n){return ne.varargs=n,0},xb:function(e,t){},tb:function(e,t,n){return ne.varargs=n,0},ub:function(e,t,n,r,o,i){return function(e,t,n,r,o,i){var a;i<<=12;var s=!1;return 0!=(16&r)&&e%16384!=0?-28:0==(32&r)?-52:(a=Vt(16384,t))?(Bt(a,0,t),s=!0,ne.mappings[a]={malloc:a,len:t,allocated:s,fd:o,prot:n,flags:r,offset:i},a):-48}(e,t,n,r,o,i)},vb:function(e,t){return function(e,t){if(-1==(0|e)||0===t)return-28;var n=ne.mappings[e];return n?(t===n.len&&(ne.mappings[e]=null,n.allocated&&Gt(n.malloc)),0):0}(e,t)},I:function(e,t,n){ne.varargs=n},H:function(e,t){},Db:function(e,t,n,r,o){var i=re(n);ge(e,{name:t=ie(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:o},argPackAdvance:8,readValueFromPointer:function(e){var r;if(1===n)r=P;else if(2===n)r=E;else{if(4!==n)throw new TypeError("Unknown boolean type size: "+t);r=k}return this.fromWireType(r[e>>i])},destructorFunction:null})},Cb:function(e,t,n,r,i,a,s,u,c,l,f,d,h){f=ie(f),a=Be(i,a),u&&(u=Be(s,u)),l&&(l=Be(c,l)),h=Be(d,h);var p=ce(f);!function(e,t,n){o.hasOwnProperty(e)?(he("Cannot register public name '"+e+"' twice"),Te(o,e,e),o.hasOwnProperty(n)&&he("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),o[e].overloadTable[void 0]=t):o[e]=t}(p,(function(){Ne("Cannot construct "+f+" due to unbound types",[r])})),me([e,t,n],r?[r]:[],(function(t){var n,i;t=t[0],i=r?(n=t.registeredClass).instancePrototype:Se.prototype;var s=le(p,(function(){if(Object.getPrototypeOf(this)!==c)throw new de("Use 'new' to construct "+f);if(void 0===d.constructor_body)throw new de(f+" has no accessible constructor");var e=d.constructor_body[arguments.length];if(void 0===e)throw new de("Tried to invoke ctor of "+f+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(d.constructor_body).toString()+") parameters instead!");return e.apply(this,arguments)})),c=Object.create(i,{constructor:{value:s}});s.prototype=c;var d=new Me(f,s,c,h,n,a,u,l),v=new $e(f,d,!0,!1,!1),m=new $e(f+"*",d,!1,!1,!1),g=new $e(f+" const*",d,!1,!0,!1);return ke[e]={pointerType:m,constPointerType:g},function(e,t,n){o.hasOwnProperty(e)||ve("Replacing nonexistant public symbol"),o[e].overloadTable,o[e]=t,o[e].argCount=n}(p,s),[v,m,g]}))},D:function(e,t,n,r,o,i,a){var s=Ve(n,r);t=ie(t),i=Be(o,i),me([],[e],(function(e){var r=(e=e[0]).name+"."+t;function o(){Ne("Cannot call "+r+" due to unbound types",s)}var u=e.registeredClass.constructor;return void 0===u[t]?(o.argCount=n-1,u[t]=o):(Te(u,t,r),u[t].overloadTable[n-1]=o),me([],s,(function(e){var o=[e[0],null].concat(e.slice(1)),s=Ke(r,o,null,i,a);return void 0===u[t].overloadTable?(s.argCount=n-1,u[t]=s):u[t].overloadTable[n-1]=s,[]})),[]}))},j:function(e,t,n,r,o,i,a,s){var u=Ve(n,r);t=ie(t),i=Be(o,i),me([],[e],(function(e){var r=(e=e[0]).name+"."+t;function o(){Ne("Cannot call "+r+" due to unbound types",u)}s&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,l=c[t];return void 0===l||void 0===l.overloadTable&&l.className!==e.name&&l.argCount===n-2?(o.argCount=n-2,o.className=e.name,c[t]=o):(Te(c,t,r),c[t].overloadTable[n-2]=o),me([],u,(function(o){var s=Ke(r,o,e,i,a);return void 0===c[t].overloadTable?(s.argCount=n-2,c[t]=s):c[t].overloadTable[n-2]=s,[]})),[]}))},Bb:function(e,t){ge(e,{name:t=ie(t),fromWireType:function(e){var t=Ye[e].value;return qe(e),t},toWireType:function(e,t){return Xe(t)},argPackAdvance:8,readValueFromPointer:Ie,destructorFunction:null})},J:function(e,t,n){var r=re(n);ge(e,{name:t=ie(t),fromWireType:function(e){return e},toWireType:function(e,t){if("number"!=typeof t&&"boolean"!=typeof t)throw new TypeError('Cannot convert "'+Je(t)+'" to '+this.name);return t},argPackAdvance:8,readValueFromPointer:Qe(t,r),destructorFunction:null})},o:function(e,t,n,r,o){t=ie(t),-1===o&&(o=4294967295);var i=re(n),a=function(e){return e};if(0===r){var s=32-8*n;a=function(e){return e<<s>>>s}}var u=-1!=t.indexOf("unsigned");ge(e,{name:t,fromWireType:a,toWireType:function(e,n){if("number"!=typeof n&&"boolean"!=typeof n)throw new TypeError('Cannot convert "'+Je(n)+'" to '+this.name);if(n<r||n>o)throw new TypeError('Passing a number "'+Je(n)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+r+", "+o+"]!");return u?n>>>0:0|n},argPackAdvance:8,readValueFromPointer:et(t,i,0!==r),destructorFunction:null})},n:function(e,t,n){var r=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function o(e){var t=T,n=t[e>>=2],o=t[e+1];return new r(x,o,n)}ge(e,{name:n=ie(n),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},wb:function(e,t,n,r,o,i,a,s,u,c,l,f){n=ie(n),i=Be(o,i),s=Be(a,s),c=Be(u,c),f=Be(l,f),me([e],[t],(function(e){return e=e[0],[new $e(n,e.registeredClass,!1,!1,!0,e,r,i,s,c,f)]}))},K:function(e,t){var n="std::string"===(t=ie(t));ge(e,{name:t,fromWireType:function(e){var t,r=T[e>>2];if(n)for(var o=e+4,i=0;i<=r;++i){var a=e+4+i;if(i==r||0==_[a]){var s=y(o,a-o);void 0===t?t=s:(t+=String.fromCharCode(0),t+=s),o=a+1}}else{var u=new Array(r);for(i=0;i<r;++i)u[i]=String.fromCharCode(_[e+4+i]);t=u.join("")}return Gt(e),t},toWireType:function(e,t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var r="string"==typeof t;r||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||he("Cannot pass non-string to std::string");var o=(n&&r?function(){return C(t)}:function(){return t.length})(),i=Wt(4+o+1);if(T[i>>2]=o,n&&r)w(t,i+4,o+1);else if(r)for(var a=0;a<o;++a){var s=t.charCodeAt(a);s>255&&(Gt(i),he("String has UTF-16 code units that do not fit in 8 bits")),_[i+4+a]=s}else for(a=0;a<o;++a)_[i+4+a]=t[a];return null!==e&&e.push(Gt,i),i},argPackAdvance:8,readValueFromPointer:Ie,destructorFunction:function(e){Gt(e)}})},v:function(e,t,n){var r,o,i,a,s;n=ie(n),2===t?(r=L,o=j,a=I,i=function(){return S},s=1):4===t&&(r=R,o=O,a=F,i=function(){return T},s=2),ge(e,{name:n,fromWireType:function(e){for(var n,o=T[e>>2],a=i(),u=e+4,c=0;c<=o;++c){var l=e+4+c*t;if(c==o||0==a[l>>s]){var f=r(u,l-u);void 0===n?n=f:(n+=String.fromCharCode(0),n+=f),u=l+t}}return Gt(e),n},toWireType:function(e,r){"string"!=typeof r&&he("Cannot pass non-string to C++ string type "+n);var i=a(r),u=Wt(4+i+t);return T[u>>2]=i>>s,o(r,u+4,i+t),null!==e&&e.push(Gt,u),u},argPackAdvance:8,readValueFromPointer:Ie,destructorFunction:function(e){Gt(e)}})},Eb:function(e,t){ge(e,{isVoid:!0,name:t=ie(t),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})},yb:function(e){delete xt.xhrs[e-1]},s:function(e,t,n){e=tt(e),t=nt(t,"emval::as");var r=[],o=Xe(r);return k[n>>2]=o,t.toWireType(r,e)},Z:function(e,t,n,r){e=tt(e);for(var o=rt(t,n),i=new Array(t),a=0;a<t;++a){var s=o[a];i[a]=s.readValueFromPointer(r),r+=s.argPackAdvance}return Xe(e.apply(void 0,i))},x:function(e,t,n,r,o){return(e=st[e])(t=tt(t),n=it(n),function(e){var t=[];return k[e>>2]=Xe(t),t}(r),o)},w:function(e,t,n,r){(e=st[e])(t=tt(t),n=it(n),null,r)},G:qe,bc:function(e){return 0===e?Xe(ut()):(e=it(e),Xe(ut()[e]))},q:function(e,t){for(var n=rt(e,t),r=n[0],o=r.name+"_$"+n.slice(1).map((function(e){return e.name})).join("_")+"$",i=["retType"],a=[r],s="",u=0;u<e-1;++u)s+=(0!==u?", ":"")+"arg"+u,i.push("argType"+u),a.push(n[1+u]);var c,l,f="return function "+ce("methodCaller_"+o)+"(handle, name, destructors, args) {\n",d=0;for(u=0;u<e-1;++u)f+=" var arg"+u+" = argType"+u+".readValueFromPointer(args"+(d?"+"+d:"")+");\n",d+=n[u+1].argPackAdvance;for(f+=" var rv = handle[name]("+s+");\n",u=0;u<e-1;++u)n[u+1].deleteObject&&(f+=" argType"+u+".deleteObject(arg"+u+");\n");return r.isVoid||(f+=" return retType.toWireType(destructors, rv);\n"),f+="};\n",i.push(f),c=Ze(Function,i).apply(null,a),l=st.length,st.push(c),l},ta:function(e){return e=it(e),Xe(o[e])},A:function(e,t){return Xe((e=tt(e))[t=tt(t)])},O:function(e){e>4&&(Ye[e].refcount+=1)},$c:function(){return Xe([])},Sb:function(e){return Xe(it(e))},Qc:function(e){ze(Ye[e].value),qe(e)},N:function(e,t){return Xe((e=nt(e,"_emval_take_value")).readValueFromPointer(t))},ia:function(e){return Xe(typeof(e=tt(e)))},c:function(){Y()},C:function(e,t){var n;if(0===e)n=Date.now();else{if(1!==e&&4!==e)return 28,k[Ut()>>2]=28,-1;n=at()}return k[t>>2]=n/1e3|0,k[t+4>>2]=n%1e3*1e3*1e3|0,0},Ea:function(e){cancelAnimationFrame(e)},_c:function(e){Dt.activeTexture(e)},P:function(e,t){Dt.attachShader(ct.programs[e],ct.shaders[t])},Q:function(e,t,n){Dt.bindAttribLocation(ct.programs[e],t,y(n))},R:function(e,t){35051==e?Dt.currentPixelPackBufferBinding=t:35052==e&&(Dt.currentPixelUnpackBufferBinding=t),Dt.bindBuffer(e,ct.buffers[t])},$b:function(e,t){Dt.bindFramebuffer(e,ct.framebuffers[t])},ac:function(e,t){Dt.bindRenderbuffer(e,ct.renderbuffers[t])},Mb:function(e,t){Dt.bindSampler(e,ct.samplers[t])},S:function(e,t){Dt.bindTexture(e,ct.textures[t])},vc:function(e){Dt.bindVertexArray(ct.vaos[e])},yc:function(e){Dt.bindVertexArray(ct.vaos[e])},T:function(e,t,n,r){Dt.blendColor(e,t,n,r)},U:function(e){Dt.blendEquation(e)},V:function(e,t){Dt.blendFunc(e,t)},Ub:function(e,t,n,r,o,i,a,s,u,c){Dt.blitFramebuffer(e,t,n,r,o,i,a,s,u,c)},W:function(e,t,n,r){ct.currentContext.version>=2?n?Dt.bufferData(e,_,r,n,t):Dt.bufferData(e,t,r):Dt.bufferData(e,n?_.subarray(n,n+t):t,r)},X:function(e,t,n,r){ct.currentContext.version>=2?Dt.bufferSubData(e,t,_,r,n):Dt.bufferSubData(e,t,_.subarray(r,r+n))},cc:function(e){return Dt.checkFramebufferStatus(e)},Y:function(e){Dt.clear(e)},_:function(e,t,n,r){Dt.clearColor(e,t,n,r)},$:function(e){Dt.clearStencil(e)},db:function(e,t,n,r){return Dt.clientWaitSync(ct.syncs[e],t,lt(n,r))},aa:function(e,t,n,r){Dt.colorMask(!!e,!!t,!!n,!!r)},ba:function(e){Dt.compileShader(ct.shaders[e])},ca:function(e,t,n,r,o,i,a,s){ct.currentContext.version>=2?Dt.currentPixelUnpackBufferBinding?Dt.compressedTexImage2D(e,t,n,r,o,i,a,s):Dt.compressedTexImage2D(e,t,n,r,o,i,_,s,a):Dt.compressedTexImage2D(e,t,n,r,o,i,s?_.subarray(s,s+a):null)},da:function(e,t,n,r,o,i,a,s,u){ct.currentContext.version>=2?Dt.currentPixelUnpackBufferBinding?Dt.compressedTexSubImage2D(e,t,n,r,o,i,a,s,u):Dt.compressedTexSubImage2D(e,t,n,r,o,i,a,_,u,s):Dt.compressedTexSubImage2D(e,t,n,r,o,i,a,u?_.subarray(u,u+s):null)},ea:function(e,t,n,r,o,i,a,s){Dt.copyTexSubImage2D(e,t,n,r,o,i,a,s)},fa:function(){var e=ct.getNewId(ct.programs),t=Dt.createProgram();return t.name=e,ct.programs[e]=t,e},ga:function(e){var t=ct.getNewId(ct.shaders);return ct.shaders[t]=Dt.createShader(e),t},ha:function(e){Dt.cullFace(e)},ja:function(e,t){for(var n=0;n<e;n++){var r=k[t+4*n>>2],o=ct.buffers[r];o&&(Dt.deleteBuffer(o),o.name=0,ct.buffers[r]=null,r==Dt.currentPixelPackBufferBinding&&(Dt.currentPixelPackBufferBinding=0),r==Dt.currentPixelUnpackBufferBinding&&(Dt.currentPixelUnpackBufferBinding=0))}},dc:function(e,t){for(var n=0;n<e;++n){var r=k[t+4*n>>2],o=ct.framebuffers[r];o&&(Dt.deleteFramebuffer(o),o.name=0,ct.framebuffers[r]=null)}},ka:function(e){if(e){var t=ct.programs[e];t?(Dt.deleteProgram(t),t.name=0,ct.programs[e]=null,ct.programInfos[e]=null):ct.recordError(1281)}},ec:function(e,t){for(var n=0;n<e;n++){var r=k[t+4*n>>2],o=ct.renderbuffers[r];o&&(Dt.deleteRenderbuffer(o),o.name=0,ct.renderbuffers[r]=null)}},Nb:function(e,t){for(var n=0;n<e;n++){var r=k[t+4*n>>2],o=ct.samplers[r];o&&(Dt.deleteSampler(o),o.name=0,ct.samplers[r]=null)}},la:function(e){if(e){var t=ct.shaders[e];t?(Dt.deleteShader(t),ct.shaders[e]=null):ct.recordError(1281)}},Wb:function(e){if(e){var t=ct.syncs[e];t?(Dt.deleteSync(t),t.name=0,ct.syncs[e]=null):ct.recordError(1281)}},ma:function(e,t){for(var n=0;n<e;n++){var r=k[t+4*n>>2],o=ct.textures[r];o&&(Dt.deleteTexture(o),o.name=0,ct.textures[r]=null)}},wc:function(e,t){for(var n=0;n<e;n++){var r=k[t+4*n>>2];Dt.deleteVertexArray(ct.vaos[r]),ct.vaos[r]=null}},zc:function(e,t){for(var n=0;n<e;n++){var r=k[t+4*n>>2];Dt.deleteVertexArray(ct.vaos[r]),ct.vaos[r]=null}},na:function(e){Dt.depthMask(!!e)},oa:function(e){Dt.disable(e)},pa:function(e){Dt.disableVertexAttribArray(e)},qa:function(e,t,n){Dt.drawArrays(e,t,n)},tc:function(e,t,n,r){Dt.drawArraysInstanced(e,t,n,r)},rc:function(e,t,n,r,o){Dt.dibvbi.drawArraysInstancedBaseInstanceWEBGL(e,t,n,r,o)},pc:function(e,t){for(var n=ft[e],r=0;r<e;r++)n[r]=k[t+4*r>>2];Dt.drawBuffers(n)},ra:function(e,t,n,r){Dt.drawElements(e,t,n,r)},uc:function(e,t,n,r,o){Dt.drawElementsInstanced(e,t,n,r,o)},sc:function(e,t,n,r,o,i,a){Dt.dibvbi.drawElementsInstancedBaseVertexBaseInstanceWEBGL(e,t,n,r,o,i,a)},jc:function(e,t,n,r,o,i){!function(e,t,n,r){Dt.drawElements(e,t,n,r)}(e,r,o,i)},sa:function(e){Dt.enable(e)},ua:function(e){Dt.enableVertexAttribArray(e)},Rb:function(e,t){var n=Dt.fenceSync(e,t);if(n){var r=ct.getNewId(ct.syncs);return n.name=r,ct.syncs[r]=n,r}return 0},va:function(){Dt.finish()},wa:function(){Dt.flush()},fc:function(e,t,n,r){Dt.framebufferRenderbuffer(e,t,n,ct.renderbuffers[r])},gc:function(e,t,n,r,o){Dt.framebufferTexture2D(e,t,n,ct.textures[r],o)},xa:function(e){Dt.frontFace(e)},ya:function(e,t){dt(e,t,"createBuffer",ct.buffers)},hc:function(e,t){dt(e,t,"createFramebuffer",ct.framebuffers)},ic:function(e,t){dt(e,t,"createRenderbuffer",ct.renderbuffers)},Ob:function(e,t){dt(e,t,"createSampler",ct.samplers)},za:function(e,t){dt(e,t,"createTexture",ct.textures)},xc:function(e,t){dt(e,t,"createVertexArray",ct.vaos)},Ac:function(e,t){dt(e,t,"createVertexArray",ct.vaos)},Xb:function(e){Dt.generateMipmap(e)},Aa:function(e,t,n){n?k[n>>2]=Dt.getBufferParameter(e,t):ct.recordError(1281)},Ba:function(){var e=Dt.getError()||ct.lastError;return ct.lastError=0,e},Yb:function(e,t,n,r){var o=Dt.getFramebufferAttachmentParameter(e,t,n);(o instanceof WebGLRenderbuffer||o instanceof WebGLTexture)&&(o=0|o.name),k[r>>2]=o},bb:function(e,t){ht(e,t,0)},Ca:function(e,t,n,r){var o=Dt.getProgramInfoLog(ct.programs[e]);null===o&&(o="(unknown error)");var i=t>0&&r?w(o,r,t):0;n&&(k[n>>2]=i)},Da:function(e,t,n){if(n)if(e>=ct.counter)ct.recordError(1281);else{var r=ct.programInfos[e];if(r)if(35716==t){var o=Dt.getProgramInfoLog(ct.programs[e]);null===o&&(o="(unknown error)"),k[n>>2]=o.length+1}else if(35719==t)k[n>>2]=r.maxUniformLength;else if(35722==t){if(-1==r.maxAttributeLength){e=ct.programs[e];var i=Dt.getProgramParameter(e,35721);r.maxAttributeLength=0;for(var a=0;a<i;++a){var s=Dt.getActiveAttrib(e,a);r.maxAttributeLength=Math.max(r.maxAttributeLength,s.name.length+1)}}k[n>>2]=r.maxAttributeLength}else if(35381==t){if(-1==r.maxUniformBlockNameLength){e=ct.programs[e];var u=Dt.getProgramParameter(e,35382);for(r.maxUniformBlockNameLength=0,a=0;a<u;++a){var c=Dt.getActiveUniformBlockName(e,a);r.maxUniformBlockNameLength=Math.max(r.maxUniformBlockNameLength,c.length+1)}}k[n>>2]=r.maxUniformBlockNameLength}else k[n>>2]=Dt.getProgramParameter(ct.programs[e],t);else ct.recordError(1282)}else ct.recordError(1281)},Zb:function(e,t,n){n?k[n>>2]=Dt.getRenderbufferParameter(e,t):ct.recordError(1281)},Fa:function(e,t,n,r){var o=Dt.getShaderInfoLog(ct.shaders[e]);null===o&&(o="(unknown error)");var i=t>0&&r?w(o,r,t):0;n&&(k[n>>2]=i)},Jb:function(e,t,n,r){var o=Dt.getShaderPrecisionFormat(e,t);k[n>>2]=o.rangeMin,k[n+4>>2]=o.rangeMax,k[r>>2]=o.precision},Ga:function(e,t,n){if(n)if(35716==t){var r=Dt.getShaderInfoLog(ct.shaders[e]);null===r&&(r="(unknown error)");var o=r?r.length+1:0;k[n>>2]=o}else if(35720==t){var i=Dt.getShaderSource(ct.shaders[e]),a=i?i.length+1:0;k[n>>2]=a}else k[n>>2]=Dt.getShaderParameter(ct.shaders[e],t);else ct.recordError(1281)},z:function(e){if(ct.stringCache[e])return ct.stringCache[e];var t;switch(e){case 7939:var n=Dt.getSupportedExtensions()||[];t=pt((n=n.concat(n.map((function(e){return"GL_"+e})))).join(" "));break;case 7936:case 7937:case 37445:case 37446:var r=Dt.getParameter(e);r||ct.recordError(1280),t=pt(r);break;case 7938:var o=Dt.getParameter(7938);t=pt(o=ct.currentContext.version>=2?"OpenGL ES 3.0 ("+o+")":"OpenGL ES 2.0 ("+o+")");break;case 35724:var i=Dt.getParameter(35724),a=i.match(/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/);null!==a&&(3==a[1].length&&(a[1]=a[1]+"0"),i="OpenGL ES GLSL ES "+a[1]+" ("+i+")"),t=pt(i);break;default:return ct.recordError(1280),0}return ct.stringCache[e]=t,t},cb:function(e,t){if(ct.currentContext.version<2)return ct.recordError(1282),0;var n=ct.stringiCache[e];if(n)return t<0||t>=n.length?(ct.recordError(1281),0):n[t];switch(e){case 7939:var r=Dt.getSupportedExtensions()||[];return r=(r=r.concat(r.map((function(e){return"GL_"+e})))).map((function(e){return pt(e)})),n=ct.stringiCache[e]=r,t<0||t>=n.length?(ct.recordError(1281),0):n[t];default:return ct.recordError(1280),0}},Ha:function(e,t){var n,r=0;if("]"==(t=y(t))[t.length-1]){var o=t.lastIndexOf("[");r="]"!=t[o+1]?(n=t.slice(o+1),parseInt(n)):0,t=t.slice(0,o)}var i=ct.programInfos[e]&&ct.programInfos[e].uniforms[t];return i&&r>=0&&r<i[0]?i[1]+r:-1},Kb:function(e,t,n){for(var r=ft[t],o=0;o<t;o++)r[o]=k[n+4*o>>2];Dt.invalidateFramebuffer(e,r)},Lb:function(e,t,n,r,o,i,a){for(var s=ft[t],u=0;u<t;u++)s[u]=k[n+4*u>>2];Dt.invalidateSubFramebuffer(e,s,r,o,i,a)},Tb:function(e){return Dt.isSync(ct.syncs[e])},Ia:function(e){var t=ct.textures[e];return t?Dt.isTexture(t):0},Ja:function(e){Dt.lineWidth(e)},Ka:function(e){Dt.linkProgram(ct.programs[e]),ct.populateUniformTable(e)},nc:function(e,t,n,r,o,i){Dt.mdibvbi.multiDrawArraysInstancedBaseInstanceWEBGL(e,k,t>>2,k,n>>2,k,r>>2,T,o>>2,i)},oc:function(e,t,n,r,o,i,a,s){Dt.mdibvbi.multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL(e,k,t>>2,n,k,r>>2,k,o>>2,k,i>>2,T,a>>2,s)},La:function(e,t){3317==e&&(ct.unpackAlignment=t),Dt.pixelStorei(e,t)},qc:function(e){Dt.readBuffer(e)},Ma:function(e,t,n,r,o,i,a){if(ct.currentContext.version>=2)if(Dt.currentPixelPackBufferBinding)Dt.readPixels(e,t,n,r,o,i,a);else{var s=vt(i);Dt.readPixels(e,t,n,r,o,i,s,a>>mt(s))}else{var u=gt(i,o,n,r,a);u?Dt.readPixels(e,t,n,r,o,i,u):ct.recordError(1280)}},_b:function(e,t,n,r){Dt.renderbufferStorage(e,t,n,r)},Vb:function(e,t,n,r,o){Dt.renderbufferStorageMultisample(e,t,n,r,o)},Pb:function(e,t,n){Dt.samplerParameteri(ct.samplers[e],t,n)},Qb:function(e,t,n){var r=k[n>>2];Dt.samplerParameteri(ct.samplers[e],t,r)},Na:function(e,t,n,r){Dt.scissor(e,t,n,r)},Oa:function(e,t,n,r){var o=ct.getSource(e,t,n,r);Dt.shaderSource(ct.shaders[e],o)},Pa:function(e,t,n){Dt.stencilFunc(e,t,n)},Qa:function(e,t,n,r){Dt.stencilFuncSeparate(e,t,n,r)},Ra:function(e){Dt.stencilMask(e)},Sa:function(e,t){Dt.stencilMaskSeparate(e,t)},Ta:function(e,t,n){Dt.stencilOp(e,t,n)},Ua:function(e,t,n,r){Dt.stencilOpSeparate(e,t,n,r)},Va:function(e,t,n,r,o,i,a,s,u){if(ct.currentContext.version>=2)if(Dt.currentPixelUnpackBufferBinding)Dt.texImage2D(e,t,n,r,o,i,a,s,u);else if(u){var c=vt(s);Dt.texImage2D(e,t,n,r,o,i,a,s,c,u>>mt(c))}else Dt.texImage2D(e,t,n,r,o,i,a,s,null);else Dt.texImage2D(e,t,n,r,o,i,a,s,u?gt(s,a,r,o,u):null)},Wa:function(e,t,n){Dt.texParameterf(e,t,n)},Xa:function(e,t,n){var r=M[n>>2];Dt.texParameterf(e,t,r)},Ya:function(e,t,n){Dt.texParameteri(e,t,n)},Za:function(e,t,n){var r=k[n>>2];Dt.texParameteri(e,t,r)},kc:function(e,t,n,r,o){Dt.texStorage2D(e,t,n,r,o)},_a:function(e,t,n,r,o,i,a,s,u){if(ct.currentContext.version>=2)if(Dt.currentPixelUnpackBufferBinding)Dt.texSubImage2D(e,t,n,r,o,i,a,s,u);else if(u){var c=vt(s);Dt.texSubImage2D(e,t,n,r,o,i,a,s,c,u>>mt(c))}else Dt.texSubImage2D(e,t,n,r,o,i,a,s,null);else{var l=null;u&&(l=gt(s,a,o,i,u)),Dt.texSubImage2D(e,t,n,r,o,i,a,s,l)}},$a:function(e,t){Dt.uniform1f(ct.uniforms[e],t)},ab:function(e,t,n){if(ct.currentContext.version>=2)Dt.uniform1fv(ct.uniforms[e],M,n>>2,t);else{if(t<=288)for(var r=yt[t-1],o=0;o<t;++o)r[o]=M[n+4*o>>2];else r=M.subarray(n>>2,n+4*t>>2);Dt.uniform1fv(ct.uniforms[e],r)}},Wc:function(e,t){Dt.uniform1i(ct.uniforms[e],t)},Xc:function(e,t,n){if(ct.currentContext.version>=2)Dt.uniform1iv(ct.uniforms[e],k,n>>2,t);else{if(t<=288)for(var r=bt[t-1],o=0;o<t;++o)r[o]=k[n+4*o>>2];else r=k.subarray(n>>2,n+4*t>>2);Dt.uniform1iv(ct.uniforms[e],r)}},Yc:function(e,t,n){Dt.uniform2f(ct.uniforms[e],t,n)},Zc:function(e,t,n){if(ct.currentContext.version>=2)Dt.uniform2fv(ct.uniforms[e],M,n>>2,2*t);else{if(t<=144)for(var r=yt[2*t-1],o=0;o<2*t;o+=2)r[o]=M[n+4*o>>2],r[o+1]=M[n+(4*o+4)>>2];else r=M.subarray(n>>2,n+8*t>>2);Dt.uniform2fv(ct.uniforms[e],r)}},Vc:function(e,t,n){Dt.uniform2i(ct.uniforms[e],t,n)},Uc:function(e,t,n){if(ct.currentContext.version>=2)Dt.uniform2iv(ct.uniforms[e],k,n>>2,2*t);else{if(t<=144)for(var r=bt[2*t-1],o=0;o<2*t;o+=2)r[o]=k[n+4*o>>2],r[o+1]=k[n+(4*o+4)>>2];else r=k.subarray(n>>2,n+8*t>>2);Dt.uniform2iv(ct.uniforms[e],r)}},Tc:function(e,t,n,r){Dt.uniform3f(ct.uniforms[e],t,n,r)},Sc:function(e,t,n){if(ct.currentContext.version>=2)Dt.uniform3fv(ct.uniforms[e],M,n>>2,3*t);else{if(t<=96)for(var r=yt[3*t-1],o=0;o<3*t;o+=3)r[o]=M[n+4*o>>2],r[o+1]=M[n+(4*o+4)>>2],r[o+2]=M[n+(4*o+8)>>2];else r=M.subarray(n>>2,n+12*t>>2);Dt.uniform3fv(ct.uniforms[e],r)}},Rc:function(e,t,n,r){Dt.uniform3i(ct.uniforms[e],t,n,r)},Pc:function(e,t,n){if(ct.currentContext.version>=2)Dt.uniform3iv(ct.uniforms[e],k,n>>2,3*t);else{if(t<=96)for(var r=bt[3*t-1],o=0;o<3*t;o+=3)r[o]=k[n+4*o>>2],r[o+1]=k[n+(4*o+4)>>2],r[o+2]=k[n+(4*o+8)>>2];else r=k.subarray(n>>2,n+12*t>>2);Dt.uniform3iv(ct.uniforms[e],r)}},Oc:function(e,t,n,r,o){Dt.uniform4f(ct.uniforms[e],t,n,r,o)},Nc:function(e,t,n){if(ct.currentContext.version>=2)Dt.uniform4fv(ct.uniforms[e],M,n>>2,4*t);else{if(t<=72){var r=yt[4*t-1],o=M;n>>=2;for(var i=0;i<4*t;i+=4){var a=n+i;r[i]=o[a],r[i+1]=o[a+1],r[i+2]=o[a+2],r[i+3]=o[a+3]}}else r=M.subarray(n>>2,n+16*t>>2);Dt.uniform4fv(ct.uniforms[e],r)}},Bc:function(e,t,n,r,o){Dt.uniform4i(ct.uniforms[e],t,n,r,o)},Cc:function(e,t,n){if(ct.currentContext.version>=2)Dt.uniform4iv(ct.uniforms[e],k,n>>2,4*t);else{if(t<=72)for(var r=bt[4*t-1],o=0;o<4*t;o+=4)r[o]=k[n+4*o>>2],r[o+1]=k[n+(4*o+4)>>2],r[o+2]=k[n+(4*o+8)>>2],r[o+3]=k[n+(4*o+12)>>2];else r=k.subarray(n>>2,n+16*t>>2);Dt.uniform4iv(ct.uniforms[e],r)}},Dc:function(e,t,n,r){if(ct.currentContext.version>=2)Dt.uniformMatrix2fv(ct.uniforms[e],!!n,M,r>>2,4*t);else{if(t<=72)for(var o=yt[4*t-1],i=0;i<4*t;i+=4)o[i]=M[r+4*i>>2],o[i+1]=M[r+(4*i+4)>>2],o[i+2]=M[r+(4*i+8)>>2],o[i+3]=M[r+(4*i+12)>>2];else o=M.subarray(r>>2,r+16*t>>2);Dt.uniformMatrix2fv(ct.uniforms[e],!!n,o)}},Ec:function(e,t,n,r){if(ct.currentContext.version>=2)Dt.uniformMatrix3fv(ct.uniforms[e],!!n,M,r>>2,9*t);else{if(t<=32)for(var o=yt[9*t-1],i=0;i<9*t;i+=9)o[i]=M[r+4*i>>2],o[i+1]=M[r+(4*i+4)>>2],o[i+2]=M[r+(4*i+8)>>2],o[i+3]=M[r+(4*i+12)>>2],o[i+4]=M[r+(4*i+16)>>2],o[i+5]=M[r+(4*i+20)>>2],o[i+6]=M[r+(4*i+24)>>2],o[i+7]=M[r+(4*i+28)>>2],o[i+8]=M[r+(4*i+32)>>2];else o=M.subarray(r>>2,r+36*t>>2);Dt.uniformMatrix3fv(ct.uniforms[e],!!n,o)}},Fc:function(e,t,n,r){if(ct.currentContext.version>=2)Dt.uniformMatrix4fv(ct.uniforms[e],!!n,M,r>>2,16*t);else{if(t<=18){var o=yt[16*t-1],i=M;r>>=2;for(var a=0;a<16*t;a+=16){var s=r+a;o[a]=i[s],o[a+1]=i[s+1],o[a+2]=i[s+2],o[a+3]=i[s+3],o[a+4]=i[s+4],o[a+5]=i[s+5],o[a+6]=i[s+6],o[a+7]=i[s+7],o[a+8]=i[s+8],o[a+9]=i[s+9],o[a+10]=i[s+10],o[a+11]=i[s+11],o[a+12]=i[s+12],o[a+13]=i[s+13],o[a+14]=i[s+14],o[a+15]=i[s+15]}}else o=M.subarray(r>>2,r+64*t>>2);Dt.uniformMatrix4fv(ct.uniforms[e],!!n,o)}},Gc:function(e){Dt.useProgram(ct.programs[e])},Hc:function(e,t){Dt.vertexAttrib1f(e,t)},Ic:function(e,t){Dt.vertexAttrib2f(e,M[t>>2],M[t+4>>2])},Jc:function(e,t){Dt.vertexAttrib3f(e,M[t>>2],M[t+4>>2],M[t+8>>2])},Kc:function(e,t){Dt.vertexAttrib4f(e,M[t>>2],M[t+4>>2],M[t+8>>2],M[t+12>>2])},lc:function(e,t){Dt.vertexAttribDivisor(e,t)},mc:function(e,t,n,r,o){Dt.vertexAttribIPointer(e,t,n,r,o)},Lc:function(e,t,n,r,o,i){Dt.vertexAttribPointer(e,t,n,!!r,o,i)},Mc:function(e,t,n,r){Dt.viewport(e,t,n,r)},eb:function(e,t,n,r){Dt.waitSync(ct.syncs[e],t,lt(n,r))},Ab:wt,d:function(e,t){return function(e,t){throw Kt(e,t||1),"longjmp"}(e,t)},mb:function(e,t,n){_.copyWithin(e,t,t+n)},y:function(e,t){return requestAnimationFrame((function(n){W.get(e)(n,t)}))},nb:function(e){var t,n=_.length,r=2147483648;if(e>r)return!1;for(var o=1;o<=4;o*=2){var i=n*(1+.2/o);if(i=Math.min(i,e+100663296),Ct(Math.min(r,((t=Math.max(e,i))%65536>0&&(t+=65536-t%65536),t))))return!0}return!1},zb:function(e,t,n,r,o){var i=e+112,a=y(i),s=T[i+36>>2],u=T[i+40>>2],c=T[i+44>>2],l=T[i+48>>2],f=T[i+52>>2],d=!!(4&f),h=!!(32&f),p=!!(16&f),v=function(e,n,r){_t((function(){s?W.get(s)(e):t&&t(e)}))},m=function(e,t,n){_t((function(){c?W.get(c)(e):r&&r(e)}))},g=function(e,t,r){_t((function(){u?W.get(u)(e):n&&n(e)}))},b=function(e,t,n){_t((function(){l?W.get(l)(e):o&&o(e)}))},C=function(e,n,r){Et(xt.dbInstance,e,n.response,(function(e,n,r){_t((function(){s?W.get(s)(e):t&&t(e)}))}),(function(e,n,r){_t((function(){s?W.get(s)(e):t&&t(e)}))}))};if("EM_IDB_STORE"===a){var x=T[i+84>>2];Et(xt.dbInstance,e,_.slice(x,x+T[i+88>>2]),v,g)}else if("EM_IDB_DELETE"===a)!function(e,t,n,r){if(e){var o=T[t+112+64>>2];o||(o=T[t+8>>2]);var i=y(o);try{var a=e.transaction(["FILES"],"readwrite").objectStore("FILES").delete(i);a.onsuccess=function(e){var r=e.target.result;T[t+12>>2]=0,xt.setu64(t+16,0),xt.setu64(t+24,0),xt.setu64(t+32,0),S[t+40>>1]=4,S[t+42>>1]=200,w("OK",t+44,64),n(t,0,r)},a.onerror=function(e){S[t+40>>1]=4,S[t+42>>1]=404,w("Not Found",t+44,64),r(t,0,e)}}catch(e){r(t,0,e)}}else r(t,0,"IndexedDB not available!")}(xt.dbInstance,e,v,g);else if(p){if(h)return 0;Pt(e,d?C:v,g,m,b)}else!function(e,t,n,r){if(e){var o=T[t+112+64>>2];o||(o=T[t+8>>2]);var i=y(o);try{var a=e.transaction(["FILES"],"readonly").objectStore("FILES").get(i);a.onsuccess=function(e){if(e.target.result){var o=e.target.result,i=o.byteLength||o.length,a=Wt(i);_.set(new Uint8Array(o),a),T[t+12>>2]=a,xt.setu64(t+16,i),xt.setu64(t+24,0),xt.setu64(t+32,i),S[t+40>>1]=4,S[t+42>>1]=200,w("OK",t+44,64),n(t,0,o)}else S[t+40>>1]=4,S[t+42>>1]=404,w("Not Found",t+44,64),r(t,0,"no data")},a.onerror=function(e){S[t+40>>1]=4,S[t+42>>1]=404,w("Not Found",t+44,64),r(t,0,e)}}catch(e){r(t,0,e)}}else r(t,0,"IndexedDB not available!")}(xt.dbInstance,e,v,h?g:d?function(e,t,n){Pt(e,C,g,m,b)}:function(e,t,n){Pt(e,v,g,m,b)});return e},jb:function(e){return ct.makeContextCurrent(e)?0:-5},qb:function(e,t){var n=0;return kt().forEach((function(r,o){var i=t+n;k[e+4*o>>2]=i,function(e,t,n){for(var r=0;r<e.length;++r)P[t++>>0]=e.charCodeAt(r);P[t>>0]=0}(r,i),n+=r.length+1})),0},rb:function(e,t){var n=kt();k[e>>2]=n.length;var r=0;return n.forEach((function(e){r+=e.length+1})),k[t>>2]=r,0},u:function(e){return 0},pb:function(e,t){var n=1==e||2==e?2:Y();return P[t>>0]=n,0},lb:function(e,t,n,r,o,i){var a=ne.getStreamFromFD(e),s=ne.doReadv(a,t,n,r);return k[i>>2]=s,0},sb:function(e,t,n,r){var o=ne.getStreamFromFD(e),i=ne.doReadv(o,t,n);return k[r>>2]=i,0},kb:function(e,t,n,r,o){},E:function(e,t,n,r){for(var o=0,i=0;i<n;i++){for(var a=k[t+8*i>>2],s=k[t+(8*i+4)>>2],u=0;u<s;u++)ne.printChar(e,_[a+u]);o+=s}return k[r>>2]=o,0},a:function(){return 0|p},ib:function(e,t){Dt.bindFramebuffer(e,ct.framebuffers[t])},fb:function(e){Dt.clear(e)},hb:function(e,t,n,r){Dt.clearColor(e,t,n,r)},gb:function(e){Dt.clearStencil(e)},B:function(e,t){ht(e,t,0)},h:function(e,t){var n=Zt();try{return W.get(e)(t)}catch(e){if(zt(n),e!==e+0&&"longjmp"!==e)throw e;Kt(1,0)}},p:function(e,t,n){var r=Zt();try{return W.get(e)(t,n)}catch(e){if(zt(r),e!==e+0&&"longjmp"!==e)throw e;Kt(1,0)}},e:function(e,t,n,r){var o=Zt();try{return W.get(e)(t,n,r)}catch(e){if(zt(o),e!==e+0&&"longjmp"!==e)throw e;Kt(1,0)}},r:function(e,t,n,r,o){var i=Zt();try{return W.get(e)(t,n,r,o)}catch(e){if(zt(i),e!==e+0&&"longjmp"!==e)throw e;Kt(1,0)}},Fb:function(e,t,n,r,o,i,a){var s=Zt();try{return W.get(e)(t,n,r,o,i,a)}catch(e){if(zt(s),e!==e+0&&"longjmp"!==e)throw e;Kt(1,0)}},M:function(e,t,n,r,o,i,a,s,u,c){var l=Zt();try{return W.get(e)(t,n,r,o,i,a,s,u,c)}catch(e){if(zt(l),e!==e+0&&"longjmp"!==e)throw e;Kt(1,0)}},L:function(e){var t=Zt();try{W.get(e)()}catch(e){if(zt(t),e!==e+0&&"longjmp"!==e)throw e;Kt(1,0)}},m:function(e,t){var n=Zt();try{W.get(e)(t)}catch(e){if(zt(n),e!==e+0&&"longjmp"!==e)throw e;Kt(1,0)}},k:function(e,t,n){var r=Zt();try{W.get(e)(t,n)}catch(e){if(zt(r),e!==e+0&&"longjmp"!==e)throw e;Kt(1,0)}},i:function(e,t,n,r){var o=Zt();try{W.get(e)(t,n,r)}catch(e){if(zt(o),e!==e+0&&"longjmp"!==e)throw e;Kt(1,0)}},l:function(e,t,n,r,o){var i=Zt();try{W.get(e)(t,n,r,o)}catch(e){if(zt(i),e!==e+0&&"longjmp"!==e)throw e;Kt(1,0)}},Ib:function(e,t,n,r,o,i){var a=Zt();try{W.get(e)(t,n,r,o,i)}catch(e){if(zt(a),e!==e+0&&"longjmp"!==e)throw e;Kt(1,0)}},Gb:function(e,t,n,r,o,i,a){var s=Zt();try{W.get(e)(t,n,r,o,i,a)}catch(e){if(zt(s),e!==e+0&&"longjmp"!==e)throw e;Kt(1,0)}},Hb:function(e,t,n,r,o,i,a,s,u,c){var l=Zt();try{W.get(e)(t,n,r,o,i,a,s,u,c)}catch(e){if(zt(l),e!==e+0&&"longjmp"!==e)throw e;Kt(1,0)}},b:function(e){p=0|e},ob:function(e,t,n,r){return function(e,t,n,r){var o=k[r+40>>2],i={tm_sec:k[r>>2],tm_min:k[r+4>>2],tm_hour:k[r+8>>2],tm_mday:k[r+12>>2],tm_mon:k[r+16>>2],tm_year:k[r+20>>2],tm_wday:k[r+24>>2],tm_yday:k[r+28>>2],tm_isdst:k[r+32>>2],tm_gmtoff:k[r+36>>2],tm_zone:o?y(o):""},a=y(n),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var u in s)a=a.replace(new RegExp(u,"g"),s[u]);var c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=["January","February","March","April","May","June","July","August","September","October","November","December"];function f(e,t,n){for(var r="number"==typeof e?e.toString():e||"";r.length<t;)r=n[0]+r;return r}function d(e,t){return f(e,t,"0")}function h(e,t){function n(e){return e<0?-1:e>0?1:0}var r;return 0===(r=n(e.getFullYear()-t.getFullYear()))&&0===(r=n(e.getMonth()-t.getMonth()))&&(r=n(e.getDate()-t.getDate())),r}function p(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function v(e){var t=jt(new Date(e.tm_year+1900,0,1),e.tm_yday),n=new Date(t.getFullYear(),0,4),r=new Date(t.getFullYear()+1,0,4),o=p(n),i=p(r);return h(o,t)<=0?h(i,t)<=0?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var m={"%a":function(e){return c[e.tm_wday].substring(0,3)},"%A":function(e){return c[e.tm_wday]},"%b":function(e){return l[e.tm_mon].substring(0,3)},"%B":function(e){return l[e.tm_mon]},"%C":function(e){return d((e.tm_year+1900)/100|0,2)},"%d":function(e){return d(e.tm_mday,2)},"%e":function(e){return f(e.tm_mday,2," ")},"%g":function(e){return v(e).toString().substring(2)},"%G":function(e){return v(e)},"%H":function(e){return d(e.tm_hour,2)},"%I":function(e){var t=e.tm_hour;return 0==t?t=12:t>12&&(t-=12),d(t,2)},"%j":function(e){return d(e.tm_mday+Mt(Tt(e.tm_year+1900)?At:Lt,e.tm_mon-1),3)},"%m":function(e){return d(e.tm_mon+1,2)},"%M":function(e){return d(e.tm_min,2)},"%n":function(){return"\n"},"%p":function(e){return e.tm_hour>=0&&e.tm_hour<12?"AM":"PM"},"%S":function(e){return d(e.tm_sec,2)},"%t":function(){return"\t"},"%u":function(e){return e.tm_wday||7},"%U":function(e){var t=new Date(e.tm_year+1900,0,1),n=0===t.getDay()?t:jt(t,7-t.getDay()),r=new Date(e.tm_year+1900,e.tm_mon,e.tm_mday);if(h(n,r)<0){var o=Mt(Tt(r.getFullYear())?At:Lt,r.getMonth()-1)-31,i=31-n.getDate()+o+r.getDate();return d(Math.ceil(i/7),2)}return 0===h(n,t)?"01":"00"},"%V":function(e){var t,n=new Date(e.tm_year+1900,0,4),r=new Date(e.tm_year+1901,0,4),o=p(n),i=p(r),a=jt(new Date(e.tm_year+1900,0,1),e.tm_yday);return h(a,o)<0?"53":h(i,a)<=0?"01":(t=o.getFullYear()<e.tm_year+1900?e.tm_yday+32-o.getDate():e.tm_yday+1-o.getDate(),d(Math.ceil(t/7),2))},"%w":function(e){return e.tm_wday},"%W":function(e){var t=new Date(e.tm_year,0,1),n=1===t.getDay()?t:jt(t,0===t.getDay()?1:7-t.getDay()+1),r=new Date(e.tm_year+1900,e.tm_mon,e.tm_mday);if(h(n,r)<0){var o=Mt(Tt(r.getFullYear())?At:Lt,r.getMonth()-1)-31,i=31-n.getDate()+o+r.getDate();return d(Math.ceil(i/7),2)}return 0===h(n,t)?"01":"00"},"%y":function(e){return(e.tm_year+1900).toString().substring(2)},"%Y":function(e){return e.tm_year+1900},"%z":function(e){var t=e.tm_gmtoff,n=t>=0;return t=(t=Math.abs(t)/60)/60*100+t%60,(n?"+":"-")+String("0000"+t).slice(-4)},"%Z":function(e){return e.tm_zone},"%%":function(){return"%"}};for(var u in m)a.indexOf(u)>=0&&(a=a.replace(new RegExp(u,"g"),m[u](i)));var g,w,x,_=(w=C(g=a)+1,b(g,x=new Array(w),0,x.length),x);return _.length>t?0:(function(e,t){P.set(e,t)}(_,e),_.length-1)}(e,t,n,r)}},Wt=(function(){var e={a:$t};function t(e,t){var n,r=e.exports;o.asm=r,$((h=o.asm.ad).buffer),W=o.asm.dd,n=o.asm.bd,G.unshift(n),H()}function n(e){t(e.instance)}function i(t){return(d||"function"!=typeof fetch?Promise.resolve().then((function(){return Q(J)})):fetch(J,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+J+"'";return e.arrayBuffer()})).catch((function(){return Q(J)}))).then((function(t){return WebAssembly.instantiate(t,e)})).then(t,(function(e){f("failed to asynchronously prepare wasm: "+e),Y(e)}))}if(V(),o.instantiateWasm)try{return o.instantiateWasm(e,t)}catch(e){return f("Module.instantiateWasm callback failed with error: "+e),!1}(d||"function"!=typeof WebAssembly.instantiateStreaming||q(J)||"function"!=typeof fetch?i(n):fetch(J,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,e).then(n,(function(e){return f("wasm streaming compile failed: "+e),f("falling back to ArrayBuffer instantiation"),i(n)}))}))).catch(r)}(),o.___wasm_call_ctors=function(){return(o.___wasm_call_ctors=o.asm.bd).apply(null,arguments)},o._malloc=function(){return(Wt=o._malloc=o.asm.cd).apply(null,arguments)}),Bt=o._memset=function(){return(Bt=o._memset=o.asm.ed).apply(null,arguments)},Gt=o._free=function(){return(Gt=o._free=o.asm.fd).apply(null,arguments)},Ut=o.___errno_location=function(){return(Ut=o.___errno_location=o.asm.gd).apply(null,arguments)},Nt=o.___getTypeName=function(){return(Nt=o.___getTypeName=o.asm.hd).apply(null,arguments)},Zt=(o.___embind_register_native_and_builtin_types=function(){return(o.___embind_register_native_and_builtin_types=o.asm.id).apply(null,arguments)},o.stackSave=function(){return(Zt=o.stackSave=o.asm.jd).apply(null,arguments)}),zt=o.stackRestore=function(){return(zt=o.stackRestore=o.asm.kd).apply(null,arguments)},Kt=o._setThrew=function(){return(Kt=o._setThrew=o.asm.ld).apply(null,arguments)},Vt=o._memalign=function(){return(Vt=o._memalign=o.asm.md).apply(null,arguments)};function Ht(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Yt(e){function t(){Ft||(Ft=!0,o.calledRun=!0,v||(ee(G),ee(U),n(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),function(){if(o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)e=o.postRun.shift(),N.unshift(e);var e;ee(N)}()))}e=e||s,Z>0||(function(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)e=o.preRun.shift(),B.unshift(e);var e;ee(B)}(),Z>0||(o.setStatus?(o.setStatus("Running..."),setTimeout((function(){setTimeout((function(){o.setStatus("")}),1),t()}),1)):t()))}if(o.dynCall_ji=function(){return(o.dynCall_ji=o.asm.nd).apply(null,arguments)},o.dynCall_iiji=function(){return(o.dynCall_iiji=o.asm.od).apply(null,arguments)},o.dynCall_iijjiii=function(){return(o.dynCall_iijjiii=o.asm.pd).apply(null,arguments)},o.dynCall_iij=function(){return(o.dynCall_iij=o.asm.qd).apply(null,arguments)},o.dynCall_vijjjii=function(){return(o.dynCall_vijjjii=o.asm.rd).apply(null,arguments)},o.dynCall_iiiji=function(){return(o.dynCall_iiiji=o.asm.sd).apply(null,arguments)},o.dynCall_viji=function(){return(o.dynCall_viji=o.asm.td).apply(null,arguments)},o.dynCall_vijiii=function(){return(o.dynCall_vijiii=o.asm.ud).apply(null,arguments)},o.dynCall_viiiiij=function(){return(o.dynCall_viiiiij=o.asm.vd).apply(null,arguments)},o.dynCall_viijii=function(){return(o.dynCall_viijii=o.asm.wd).apply(null,arguments)},o.dynCall_jii=function(){return(o.dynCall_jii=o.asm.xd).apply(null,arguments)},o.dynCall_iiij=function(){return(o.dynCall_iiij=o.asm.yd).apply(null,arguments)},o.dynCall_iiiij=function(){return(o.dynCall_iiiij=o.asm.zd).apply(null,arguments)},o.dynCall_viij=function(){return(o.dynCall_viij=o.asm.Ad).apply(null,arguments)},o.dynCall_viiij=function(){return(o.dynCall_viiij=o.asm.Bd).apply(null,arguments)},o.dynCall_vij=function(){return(o.dynCall_vij=o.asm.Cd).apply(null,arguments)},o.dynCall_jiiiiji=function(){return(o.dynCall_jiiiiji=o.asm.Dd).apply(null,arguments)},o.dynCall_jiiiiii=function(){return(o.dynCall_jiiiiii=o.asm.Ed).apply(null,arguments)},o.dynCall_iijj=function(){return(o.dynCall_iijj=o.asm.Fd).apply(null,arguments)},o.dynCall_jiji=function(){return(o.dynCall_jiji=o.asm.Gd).apply(null,arguments)},o.dynCall_iiiiij=function(){return(o.dynCall_iiiiij=o.asm.Hd).apply(null,arguments)},o.dynCall_iiiiijj=function(){return(o.dynCall_iiiiijj=o.asm.Id).apply(null,arguments)},o.dynCall_iiiiiijj=function(){return(o.dynCall_iiiiiijj=o.asm.Jd).apply(null,arguments)},o.GL=ct,K=function e(){Ft||Yt(),Ft||(K=e)},o.run=Yt,o.preInit)for("function"==typeof o.preInit&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();return Yt(),e.ready});e.exports=n}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return o[e](n,n.exports,a),n.exports}a.m=o,a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var o=Object.create(null);a.r(o);var i={};e=e||[null,t({}),t([]),t(t)];for(var s=2&r&&n;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((e=>i[e]=()=>n[e]));return i.default=()=>n,a.d(o,i),o},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((t,n)=>(a.f[n](e,t),t)),[])),a.u=e=>"static/js/web-renderer-"+{83:"07635504672b8c4bd252",427:"9b37447975c587246e2d",522:"e4d33468cc166de5734d"}[e]+".chunk.js",a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},r="@sketch-hq/sketch-web-renderer:",a.l=(e,t,o,i)=>{if(n[e])n[e].push(t);else{var s,u;if(void 0!==o)for(var c=document.getElementsByTagName("script"),l=0;l<c.length;l++){var f=c[l];if(f.getAttribute("src")==e||f.getAttribute("data-webpack")==r+o){s=f;break}}s||(u=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",r+o),s.src=e),n[e]=[t];var d=(t,r)=>{s.onerror=s.onload=null,clearTimeout(h);var o=n[e];if(delete n[e],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach((e=>e(r))),t)return t(r)},h=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),u&&document.head.appendChild(s)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.p="/",(()=>{a.b=document.baseURI||self.location.href;var e={826:0,427:0};a.f.j=(t,n)=>{var r=a.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise(((n,o)=>r=e[t]=[n,o]));n.push(r[2]=o);var i=a.p+a.u(t),s=new Error;a.l(i,(n=>{if(a.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;s.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",s.name="ChunkLoadError",s.type=o,s.request=i,r[1](s)}}),"chunk-"+t,t)}};var t=(t,n)=>{var r,o,[i,s,u]=n,c=0;if(i.some((t=>0!==e[t]))){for(r in s)a.o(s,r)&&(a.m[r]=s[r]);u&&u(a)}for(t&&t(n);c<i.length;c++)o=i[c],a.o(e,o)&&e[o]&&e[o][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 s={};return(()=>{"use strict";a.r(s),a.d(s,{default:()=>f,RendererGL:()=>t.p,RendererMode:()=>o.b,RendererError:()=>u.f,RendererRaster:()=>l.t});var e=a(871),t=a(94),n=a(847),r={};for(const e in n)["default","RendererGL"].indexOf(e)<0&&(r[e]=()=>n[e]);a.d(s,r);var o=a(194),i=a(632);r={};for(const e in i)["default","RendererGL","RendererMode"].indexOf(e)<0&&(r[e]=()=>i[e]);a.d(s,r);var u=a(99),c=a(783);r={};for(const e in c)["default","RendererGL","RendererMode","RendererError"].indexOf(e)<0&&(r[e]=()=>c[e]);a.d(s,r);var l=a(65);const f=e.d})(),s})()}));
|
|
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={519:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});const o={delayedDraw:!0,offscreenCanvas:!1,safariWebGL2:!1,pageBoundariesLimit:!1}},933:(e,t,n)=>{"use strict";n.d(t,{d:()=>j});var o,r=n(480),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,lastPan:{x:0,y:0},zoomCenter:{x:0,y:0},lastGestureScale:1,mouse:{x:0,y:0},isWaitingForSecondClick:!1,lastMouseClickPosition:{x:0,y:0}},o.handleGestureStart=function(e){e.preventDefault(),o.state.lastGestureScale=e.scale},o.handleGestureChange=function(e){e.preventDefault(),o.state.zoomCenter=o.getCorrectPointerPosition(e);var t=e.scale/o.state.lastGestureScale;o.state.lastGestureScale=e.scale,o.emit("zoomChange",t,o.state.zoomCenter),o.cameraMoveTracker.handleCameraMoveEvent()},o.handleGestureEnd=function(e){e.preventDefault()},o.handlePointerDown=function(e){var t=e instanceof MouseEvent&&0===e.button,n="undefined"!=typeof TouchEvent&&e instanceof TouchEvent;(t||n)&&(e.preventDefault(),o.updateMousePosition(e),o.state.panning=!0,o.state.lastPan.x=o.state.mouse.x,o.state.lastPan.y=o.state.mouse.y,o.emit("mousedown"))},o.handlePointerMove=function(e){o.state.panning||o.updateMousePosition(e)},o.handlePanMove=function(e){if(o.state.panning){e.preventDefault();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){"undefined"!=typeof TouchEvent&&e instanceof TouchEvent&&e.touches.length>0||o.emit("mouseup")},o.handleMouseWheel=function(e){e.preventDefault();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.emit("zoomChange",r,o.state.zoomCenter)}else o.emit("panChange",-e.deltaX,-e.deltaY);o.cameraMoveTracker.handleCameraMoveEvent()},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.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),this.listenersCollector.add(this.target,"touchstart",this.handlePointerDown),this.listenersCollector.add(document,"touchmove",this.handlePanMove),this.listenersCollector.add(this.target,"touchmove",this.handlePointerMove),this.listenersCollector.add(this.target,"touchend",this.handlePointerUp),this.listenersCollector.add(document,"touchend",this.handlePanEnd),this.listenersCollector.add(this.target,"touchend",this.handleDoubleClick),this.listenersCollector.add(this.target,"gesturestart",this.handleGestureStart),this.listenersCollector.add(this.target,"gesturechange",this.handleGestureChange),this.listenersCollector.add(this.target,"gestureend",this.handleGestureEnd)},t.prototype.getCorrectPointerPosition=function(e){var t=(0,a.MP)(e),n={x:0,y:0};return n.x=(0,a.uZ)(t.x-this.targetBounds.x,0,this.target.clientWidth),n.y=(0,a.uZ)(t.y-this.targetBounds.y,0,this.target.clientHeight),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.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.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),h=n(475),d=n(419);const f=Symbol("Comlink.proxy"),v=Symbol("Comlink.endpoint"),p=Symbol("Comlink.releaseProxy"),m=Symbol("Comlink.thrown"),b=e=>"object"==typeof e&&null!==e||"function"==typeof e,g=new Map([["proxy",{canHandle:e=>b(e)&&e[f],serialize(e){const{port1:t,port2:n}=new MessageChannel;return y(e,t),[n,[n]]},deserialize:e=>(e.start(),k(e))}],["throw",{canHandle:e=>b(e)&&m 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(D);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]]=D(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;y(e,n),u=M(t,[t])}break;case"RELEASE":u=void 0;break;default:return}}catch(e){u={value:e,[m]:0}}Promise.resolve(u).catch((e=>({value:e,[m]: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 k(e,t){return P(e,[],t)}function C(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(C(o),i===p)return()=>L(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=L(e,{type:"GET",path:t.map((e=>e.toString()))}).then(D);return n.then.bind(n)}return P(e,[...t,i])},set(n,r,i){C(o);const[a,s]=x(i);return L(e,{type:"SET",path:[...t,r].map((e=>e.toString())),value:a},s).then(D)},apply(n,r,i){C(o);const a=t[t.length-1];if(a===v)return L(e,{type:"ENDPOINT"}).then(D);if("bind"===a)return P(e,t.slice(0,-1));const[s,u]=W(i);return L(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:s},u).then(D)},construct(n,r){C(o);const[i,a]=W(r);return L(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:i},a).then(D)}});return r}function W(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 S=new WeakMap;function M(e,t){return S.set(e,t),e}function E(e){return Object.assign(e,{[f]:!0})}function x(e){for(const[t,n]of g)if(n.canHandle(e)){const[o,r]=n.serialize(e);return[{type:"HANDLER",name:t,value:o},r]}return[{type:"RAW",value:e},S.get(e)||[]]}function D(e){switch(e.type){case"HANDLER":return g.get(e.name).deserialize(e.value);case"RAW":return e.value}}function L(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 R,A=n(849),U=n(519),Z=n(332),_=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)}}(),O=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 _(t,e),t.prototype.addListeners=function(){this.listenersCollector.add(this.target,"keyup",this.handleKeyUp)},t.prototype.dispose=function(){this.listenersCollector.dispose()},t}(r.v),T=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)}}(),z=function(){return(z=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)},I=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"}(R||(R={}));var j=function(e){function t(t){var n=e.call(this)||this;return n.handleKeyUp=function(e){var t;null===(t=n.sketchWeb)||void 0===t||t.keyUp(e)},n.handleMouseDoubleClick=function(){var e;null===(e=n.sketchWeb)||void 0===e||e.mouseDoubleClick()},n.handleCameraMoveStart=function(){var e;null===(e=n.sketchWeb)||void 0===e||e.setIsCameraMoving(!0)},n.handleCameraMoveEnd=function(){var e;null===(e=n.sketchWeb)||void 0===e||e.setIsCameraMoving(!1)},n.handleMouseChange=function(e,t){var o;null===(o=n.sketchWeb)||void 0===o||o.setMouse(e,t)},n.handlePanChange=function(e,t){return I(n,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]}))}))},n.handleZoomChange=function(e,t){return I(n,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]}))}))},n.handleMouseDown=function(){var e;null===(e=n.sketchWeb)||void 0===e||e.mouseDown()},n.handleMouseUp=function(){var e;null===(e=n.sketchWeb)||void 0===e||e.mouseUp()},n.handleCanvasResize=function(e){window.requestAnimationFrame((function(){var t,o,r=e[0].contentRect,i=r.width,a=r.height;n.setCanvasSize(i,a),n.gestureManager.updateTargetBounds(),null===(t=n.sketchWeb)||void 0===t||t.setPixelRatio(n.getDevicePixelRatio()),null===(o=n.sketchWeb)||void 0===o||o.setSize(i*n.getDevicePixelRatio(),a*n.getDevicePixelRatio())}))},n.settings=t,n.canvas=t.canvas,n.gestureManager=new l(n.canvas,{minimumZoomLevel:t.minimumZoomLevel,maximumZoomLevel:t.maximumZoomLevel}),n.keyboardManager=new O(document.body),A.Z.active=t.mode===Z.p.debug,n.init(),n}return T(t,e),t.prototype.init=function(){var e;return I(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 I(this,void 0,void 0,(function(){var e,t,o,r,i;return G(this,(function(a){switch(a.label){case 0:return e=U.Z.offscreenCanvas&&"function"==typeof this.canvas.transferControlToOffscreen,t=z(z({},this.settings),{size:{width:this.canvas.width,height:this.canvas.height},pixelRatio:this.getDevicePixelRatio()}),e?(this.environment=R.worker,A.Z.debug("Using offscreen canvas"),this.offscreenCanvas=this.canvas.transferControlToOffscreen(),this.worker=new Worker(new URL(n.p+n.u(509),n.b),{type:void 0}),o=k(this.worker),r=this,[4,new o(M(z(z({},t),{canvas:this.offscreenCanvas}),[this.offscreenCanvas]))]):[3,2];case 1:return r.sketchWeb=a.sent(),[3,3];case 2:this.environment=R.browser,A.Z.debug("Using normal canvas"),this.sketchWeb=new h.U(t),a.label=3;case 3:return(i=this.sketchWeb).on("status",this.forwardEvent("status")),i.on("metric",this.forwardEvent("metric")),i.on("warnings",this.forwardEvent("warnings")),i.on("artboardSelected",this.forwardEvent("artboardSelected")),i.on("artboardDeselected",this.forwardEvent("artboardDeselected")),i.on("artboardMouseEnter",this.forwardEvent("artboardMouseEnter")),i.on("artboardMouseLeave",this.forwardEvent("artboardMouseLeave")),i.on("goToArtboard",this.forwardEvent("goToArtboard")),[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===R.worker?E(n):n},t.prototype.isRunningInsideWorker=function(){return this.environment===R.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.handleCanvasResize),this.canvasResizeObserver.observe(this.settings.container),this.gestureManager.on("panChange",this.handlePanChange),this.gestureManager.on("mousemove",this.handleMouseChange),this.gestureManager.on("mousedown",this.handleMouseDown),this.gestureManager.on("mouseup",this.handleMouseUp),this.gestureManager.on("doubleClick",this.handleMouseDoubleClick),this.gestureManager.on("zoomChange",this.handleZoomChange),this.gestureManager.on("cameraMoveStart",this.handleCameraMoveStart),this.gestureManager.on("cameraMoveEnd",this.handleCameraMoveEnd),this.keyboardManager.on("keyUp",this.handleKeyUp)},t.prototype.emitPanEvent=function(){var e;return I(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 I(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"undefined"===(t=n.sent())||this.emit("zoom",t),[2]}}))}))},t.prototype.getDevicePixelRatio=function(){return(0,d.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.zoomToFit=function(){return I(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 I(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 I(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.getArtboardAtPosition=function(e,t){var n;return I(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 I(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 I(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 I(this,void 0,void 0,(function(){return G(this,(function(r){switch(r.label){case 0:return this.gestureManager.dispose(),this.keyboardManager.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:()=>v});var o,r=n(419),i=n(519),a=n(480),s=n(108),u=n(849),c=n(758),l=n(332),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)}),d=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())}))},f=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])}}},v=(globalThis.indexedDB,function(e){function t(t){var n=t.canvas,o=t.locateFile,i=t.filePath,a=t.imagesURLFormat,c=t.imagesURLMap,h=t.backgroundColor,d=void 0===h?{r:1,g:1,b:1,a:1}:h,f=t.highlightColor,v=void 0===f?{r:0,g:0,b:0,a:1}:f,p=t.size,m=t.pixelRatio,b=t.mode,g=t.showTilesBorders,y=void 0!==g&&g,w=t.minimumZoomLevel,k=t.maximumZoomLevel,C=t.preserveDrawingBuffer,P=void 0!==C&&C,W=t.panBoundariesPadding,S=void 0===W?40:W,M=e.call(this)||this;return M.status={type:"INIT"},M.handleWebGLContextLost=function(){M.setStatus({type:"WEBGL_CONTEXT_LOST"})},M.debouncedFullDraw=(0,r.Ds)((function(){return M.draw(!0)}),200),M.canvas=n,M.locateFile=o,M.filePath=i,M.imagesURLFormat=a,M.imagesURLMap=c,M.backgroundColor=d,M.highlightColor=v,M.size=p,M.pixelRatio=m,M.mode=b,M.showTilesBorders=y,M.currentWebGLVersion=(0,r.wX)(),M.zoomLevels={min:w,max:k},M.preserveDrawingBuffer=P,M.panBoundariesPadding=S,u.Z.active=b===l.p.debug,M.traceFirstPaint=new s.S("FirstPaint"),M}return h(t,e),t.prototype.init=function(){return d(this,void 0,void 0,(function(){var e;return f(this,(function(t){switch(t.label){case 0:this.setStatus({type:"INIT"}),t.label=1;case 1:return t.trys.push([1,4,,5]),[4,this.initSketchWebWasm()];case 2:return t.sent(),[4,this.setFile(this.filePath)];case 3:return t.sent(),[3,5];case 4:return e=t.sent(),[2,this.fail(e instanceof c.k?e:new c.k("ERROR","Unexpected exception initializing the web renderer",e))];case 5:return[2]}}))}))},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),onArtboardMouseEnter:function(t){e.emit("artboardMouseEnter",t)},onArtboardMouseLeave:function(t){e.emit("artboardMouseLeave",t)},onArtboardSelected:function(t){e.emit("artboardSelected",t)},onArtboardDeselected:function(t){e.emit("artboardDeselected",t)},onGoToArtboard:function(t,n){e.emit("goToArtboard",t,n)}}},t.prototype.downloadImages=function(){var e=this;return new Promise((function(t){var n=new s.S("ImagesDownload");e.sketchWebWasm.downloadImages((function(){n.printMeasurement(),e.emit("metric",n.measure()),u.Z.debug("Images downloaded"),t()}))}))},t.prototype.initSketchWebWasm=function(){return d(this,void 0,void 0,(function(){var e,t,o,r,a,h,d,v=this;return f(this,(function(f){switch(f.label){case 0:return e=new s.S("WasmModuleDownload"),this.mode!==l.p.debug?[3,2]:[4,n.e(425).then(n.t.bind(n,425,23))];case 1:return o=f.sent(),[3,4];case 2:return[4,n.e(816).then(n.t.bind(n,816,23))];case 3:o=f.sent(),f.label=4;case 4:t=o.default,f.label=5;case 5:return f.trys.push([5,7,,8]),r=this,[4,t({FeatureFlags:i.Z,currentWebGLVersion:this.currentWebGLVersion,locateFile:function(e){return v.locateFile.replace("{file}",e)},bridge:this.createJSBridge()})];case 6:return r.wasmModule=f.sent(),[3,8];case 7:throw a=f.sent(),new c.k("WASM_ERROR","An error occurred while trying to create the wasm module.",a);case 8:if(e.printMeasurement(),this.emit("metric",e.measure()),h={antialias:!1,majorVersion:this.currentWebGLVersion,alpha:!0,powerPreference:"high-performance",preserveDrawingBuffer:this.preserveDrawingBuffer},u.Z.debug("Using WebGL "+h.majorVersion),!(d=this.wasmModule.GL.createContext(this.canvas,h)))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)}catch(e){throw new c.k("WASM_ERROR","An error occurred while trying to create the SketchWebWasm object.",e)}return this.sketchWebWasm.setPixelRatio(this.pixelRatio),this.sketchWebWasm.setBackgroundColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),this.sketchWebWasm.setHighlightColor(this.highlightColor.r,this.highlightColor.g,this.highlightColor.b,this.highlightColor.a),this.sketchWebWasm.setRendererConfiguration({showTilesBorders:this.showTilesBorders}),this.sketchWebWasm.setZoomLevels(this.zoomLevels.min,this.zoomLevels.max),this.sketchWebWasm.setPanBoundariesPadding(this.panBoundariesPadding),this.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost),[2]}}))}))},t.prototype.generateDocumentPNG=function(){var e;return d(this,void 0,void 0,(function(){return f(this,(function(t){switch(t.label){case 0:return[4,this.downloadImages()];case 1:return t.sent(),[2,null===(e=this.sketchWebWasm)||void 0===e?void 0:e.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 d(this,void 0,void 0,(function(){var t=this;return f(this,(function(n){return this.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,o){t.sketchWebWasm.setFile(e,(function(e){if(void 0===e&&(e=[]),e.length){u.Z.debug("Parser warnings: "+e);var o=e.map((function(e){return{key:e}}));t.emit("warnings",o)}t.setStatus({type:"FILE_READY"}),n()}),(function(){return o(new c.k("FILE_ERROR","Error encountered while fetching and parsing the file"))}))}))]}))}))},t.prototype.delayedDraw=function(){if(!i.Z.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){var t;this.pixelRatio=e,null===(t=this.sketchWebWasm)||void 0===t||t.setPixelRatio(e),this.delayedDraw()},t.prototype.setSize=function(e,t){var n;this.size.width=e,this.size.height=t,this.canvas.width=e,this.canvas.height=t,null===(n=this.sketchWebWasm)||void 0===n||n.resize(e,t)},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.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;null===(n=this.sketchWebWasm)||void 0===n||n.setZoomCenter(t.x,t.y),null===(o=this.sketchWebWasm)||void 0===o||o.addZoom(e),this.delayedDraw()},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.mouseDown=function(){var e;null===(e=this.sketchWebWasm)||void 0===e||e.mouseDown()},t.prototype.mouseUp=function(){var e;null===(e=this.sketchWebWasm)||void 0===e||e.mouseUp()},t.prototype.mouseDoubleClick=function(){var e;null===(e=this.sketchWebWasm)||void 0===e||e.mouseDoubleClick()},t.prototype.keyUp=function(e){var t;null===(t=this.sketchWebWasm)||void 0===t||t.keyUp(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()}catch(e){this.fail(new c.k("ERROR","Unexpected exception while disposing the SketchWebWasm object",e))}this.sketchWebWasm=null},t}(a.v))},948:(e,t,n)=>{"use strict";n.d(t,{z0:()=>U,oW:()=>Z,JB:()=>m,SC:()=>x,zB:()=>L,GC:()=>W,xH:()=>v,z7:()=>R,rR:()=>C,JU:()=>M,vN:()=>g,Y6:()=>D,$5:()=>w});var o,r=n(297),i=n.n(r),a=n(933),s=n(849),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)},c=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())}))},l=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])}}},h=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,h(["SketchWebContext"],e))};!function(e){e.Draggable="grab",e.Dragging="grabbing",e.Hover="pointer",e.Default="auto"}(o||(o={}));var f=(0,r.createContext)(void 0),v=function(){var e=(0,r.useContext)(f);if(void 0===e)throw Error("useSketchWebManager must be used within a SketchWebProvider");return e},p=(0,r.createContext)(void 0),m=function(){var e=(0,r.useContext)(p);if(void 0===e)throw Error("useSketchWebActions must be used within a SketchWebProvider");return e},b=(0,r.createContext)(void 0),g=function(){var e=(0,r.useContext)(b);if(void 0===e)throw Error("useSketchWebStatus must be used within a SketchWebProvider");return e},y=(0,r.createContext)(void 0),w=function(){var e=(0,r.useContext)(y);if(void 0===e)throw Error("useSketchWebZoom must be used within a SketchWebProvider");return e},k=(0,r.createContext)(void 0),C=function(){var e=(0,r.useContext)(k);if(void 0===e)throw Error("useSketchWebPan must be used within a SketchWebProvider");return e},P=(0,r.createContext)(void 0),W=function(){var e=(0,r.useContext)(P);if(void 0===e)throw Error("useSketchWebHoveredArtboardUUID must be used within a SketchWebProvider");return e},S=(0,r.createContext)(void 0),M=function(){var e=(0,r.useContext)(S);if(void 0===e)throw Error("useSketchWebSelectedArtboardUUID must be used within a SketchWebProvider");return e},E=(0,r.createContext)(void 0),x=function(){var e=(0,r.useContext)(E);if(void 0===e)throw Error("useSketchWebCursor must be used within a SketchWebProvider");return e},D=function(e){var t=v();(0,r.useEffect)((function(){return null==t||t.on("warnings",e),function(){null==t||t.off("warnings",e)}}),[t,e])},L=function(e){var t=v();(0,r.useEffect)((function(){return null==t||t.on("goToArtboard",e),function(){null==t||t.off("goToArtboard",e)}}),[t,e])},R=function(e){var t=v();(0,r.useEffect)((function(){return null==t||t.on("metric",e),function(){null==t||t.off("metric",e)}}),[t,e])},A=function(e,t){switch(d('dispatched: "'+t.type+'"',t),t.type){case"on-status":return u(u({},e),{status:t.status});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,filePath:null,selectedArtboardUUID:null,hoveredArtboardUUID:null,zoom:null,pan:null,cursor:o.Default});case"post-init":return u(u({},e),{status:t.status,zoom:t.zoom});case"set-file-path":return u(u({},e),{filePath:t.filePath});case"on-artboard-mouse-enter":return u(u({},e),{hoveredArtboardUUID:t.uuid,cursor:o.Hover});case"on-artboard-mouse-leave":return u(u({},e),{hoveredArtboardUUID:null,cursor:e.isMouseDown?o.Dragging:o.Draggable});case"on-artboard-selected":return u(u({},e),{selectedArtboardUUID:t.uuid});case"on-artboard-deselected":return u(u({},e),{selectedArtboardUUID:null});case"on-mouse-down":return u(u({},e),{cursor:o.Dragging,isMouseDown:!0});case"on-mouse-up":return u(u({},e),{cursor:e.hoveredArtboardUUID?o.Hover:o.Draggable,isMouseDown:!1});default:return e}},U=function(e){var t=e.children,n=(0,r.useRef)(null),s=(0,r.useRef)(null),h=(0,r.useReducer)(A,{pan:null,zoom:null,status:null,filePath:null,hoveredArtboardUUID:null,selectedArtboardUUID:null,cursor:o.Default,isMouseDown:!1}),v=h[0],m=v.status,g=v.zoom,w=v.pan,C=v.hoveredArtboardUUID,W=v.selectedArtboardUUID,M=v.cursor,x=h[1],D=(0,r.useCallback)((function(e){return x({type:"on-zoom",zoom:e})}),[]),L=(0,r.useCallback)((function(e,t){return x({type:"on-pan",pan:{x:e,y:t}})}),[]),R=(0,r.useCallback)((function(e){x({type:"on-status",status:e})}),[]),U=(0,r.useCallback)((function(e){return x({type:"on-artboard-mouse-enter",uuid:e})}),[]),Z=(0,r.useCallback)((function(){return x({type:"on-artboard-mouse-leave"})}),[]),_=(0,r.useCallback)((function(e){x({type:"on-artboard-selected",uuid:e})}),[]),O=(0,r.useCallback)((function(){return x({type:"on-artboard-deselected"})}),[]),T=(0,r.useCallback)((function(){return x({type:"on-mouse-down"})}),[]),z=(0,r.useCallback)((function(){return x({type:"on-mouse-up"})}),[]),I=(0,r.useCallback)((function(){n.current&&(d("dispose"),n.current.off("status",R),n.current.off("artboardMouseEnter",U),n.current.off("artboardMouseLeave",Z),n.current.off("artboardSelected",_),n.current.off("artboardDeselected",O),n.current.off("zoom",D),n.current.off("pan",L),n.current.gestureManager.off("mousedown",T),n.current.gestureManager.off("mouseup",z),n.current.dispose(),n.current=null,x({type:"dispose"}))}),[R,L,D,U,Z,_,O,z,T]),G=(0,r.useCallback)((function(e){e&&!n.current&&s.current&&(d("init"),x({type:"set-file-path",filePath:e}),n.current=new a.d(u(u({},s.current),{filePath:e})),n.current.on("status",R),n.current.on("artboardMouseEnter",U),n.current.on("artboardMouseLeave",Z),n.current.on("artboardSelected",_),n.current.on("artboardDeselected",O),n.current.on("zoom",D),n.current.on("pan",L),n.current.gestureManager.on("mousedown",T),n.current.gestureManager.on("mouseup",z),c(void 0,void 0,void 0,(function(){var e,t,o,r,i,a;return l(this,(function(s){switch(s.label){case 0:return[4,null===(r=n.current)||void 0===r?void 0:r.getPan()];case 1:return e=s.sent()||null,t=x,o={type:"post-init",zoom:(null===(i=n.current)||void 0===i?void 0:i.getZoom())||null},[4,null===(a=n.current)||void 0===a?void 0:a.getStatus()];case 2:return t.apply(void 0,[(o.status=s.sent()||null,o.pan=null!=e?e:null,o)]),[2]}}))})))}),[R,D,L,U,Z,_,O,T,z]),F=(0,r.useCallback)((function(e){d("setSettings",e),s.current=e}),[]),j=(0,r.useCallback)((function(e){var t;d("setZoom",e),null===(t=n.current)||void 0===t||t.setZoom(e)}),[]),B=(0,r.useCallback)((function(){var e,t;d("incrementZoom"),"number"==typeof g&&(t=g>=1?Math.round(2*g):g>.5?1:2*g,null===(e=n.current)||void 0===e||e.setZoom(t))}),[g]),N=(0,r.useCallback)((function(){var e;d("decrementZoom"),"number"==typeof g&&(null===(e=n.current)||void 0===e||e.setZoom(g/2))}),[g]),H=(0,r.useCallback)((function(e){var t,o=e.x,r=e.y,i=e.centerPointInViewport;d("setPan",o,r,"centerPointInViewport",i),null===(t=n.current)||void 0===t||t.setPan(o,r,i)}),[]),Y=(0,r.useCallback)((function(){var e;d("zoomToFit"),null===(e=n.current)||void 0===e||e.zoomToFit()}),[]),V=(0,r.useCallback)((function(){var e;d("looseWebGLContext"),null===(e=n.current)||void 0===e||e.looseWebGLContext()}),[]),X=(0,r.useCallback)((function(){return c(void 0,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:return d("generateDocumentPNG"),[4,null===(e=n.current)||void 0===e?void 0:e.generateDocumentPNG()];case 1:return[2,t.sent()]}}))}))}),[]),q=(0,r.useCallback)((function(e,t){return c(void 0,void 0,void 0,(function(){var o;return l(this,(function(r){switch(r.label){case 0:return d("getArtboardAtPosition",e,t),[4,null===(o=n.current)||void 0===o?void 0:o.getArtboardAtPosition(e,t)];case 1:return[2,r.sent()||null]}}))}))}),[]),K=(0,r.useCallback)((function(e,t){return c(void 0,void 0,void 0,(function(){var o;return l(this,(function(r){switch(r.label){case 0:return d("invoked: getPanAtPosition",e,t),[4,null===(o=n.current)||void 0===o?void 0:o.getPanAtPosition(e,t)];case 1:return[2,r.sent()||null]}}))}))}),[]),J=(0,r.useMemo)((function(){return{setSettings:F,init:G,dispose:I,setZoom:j,incrementZoom:B,decrementZoom:N,setPan:H,zoomToFit:Y,looseWebGLContext:V,generateDocumentPNG:X,getArtboardAtPosition:q,getPanAtPosition:K}}),[F,G,I,j,B,N,H,Y,V,X,q,K]);return i().createElement(f.Provider,{value:n.current},i().createElement(p.Provider,{value:J},i().createElement(b.Provider,{value:m},i().createElement(y.Provider,{value:g},i().createElement(k.Provider,{value:w},i().createElement(S.Provider,{value:W},i().createElement(P.Provider,{value:C},i().createElement(E.Provider,{value:M},t))))))))},Z=function(e){var t=e.filePath,n=e.locateFile,o=e.imagesURLFormat,a=e.imagesURLMap,s=e.backgroundColor,u=e.highlightColor,c=e.mode,l=e.showTilesBorders,h=e.minimumZoomLevel,d=e.maximumZoomLevel,f=e.preserveDrawingBuffer,v=e.panBoundariesPadding,p=e.initialPan,b=e.initialZoom,y=e.onCanvasClick,w=e.onCanvasContextMenu,k=(0,r.useState)(null),C=k[0],P=k[1],W=(0,r.useState)(null),S=W[0],M=W[1],E=m(),D=E.dispose,L=E.setSettings,R=E.init,A=x(),U=g();return(0,r.useEffect)((function(){S&&C&&L({locateFile:n,imagesURLFormat:o,imagesURLMap:a,backgroundColor:s,highlightColor:u,mode:c,showTilesBorders:l,minimumZoomLevel:h,maximumZoomLevel:d,preserveDrawingBuffer:f,panBoundariesPadding:v,initialPan:p,initialZoom:b,container:S,canvas:C})}),[L,n,o,a,s,u,c,l,h,d,f,v,p,b,S,C]),(0,r.useEffect)((function(){if(t&&C&&S)return R(t),function(){return D()}}),[D,R,t,C,S]),i().createElement("div",{ref:function(e){return M(e)},style:{position:"relative",width:"100%",height:"100%"}},i().createElement("canvas",{onClick:y,onContextMenu:w,ref:function(e){return P(e)},"data-testid":"sketchweb-canvas","data-sketchweb-status":"sketchweb-status-"+((null==U?void 0:U.type.toLowerCase())||"null"),style:{position:"absolute",inset:"0",cursor:A}}))}},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:()=>{},312:()=>{},480:(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}()},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(){var e=performance.now()-this.startTime;return{duration:e,end:this.startTimestamp+e,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,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});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;return{x:null!==(t=e.pageX)&&void 0!==t?t:e.clientX,y:null!==(n=e.pageY)&&void 0!==n?n: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}},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-"+{425:"370688708cb08dced537",509:"ce56606bbb268b01c7c9",816:"5f40dbb4c3823984584b"}[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:()=>d,SketchWeb:()=>t.U,SketchWebMode:()=>i.p,SketchWebError:()=>c.k,SketchWebProvider:()=>h.z0,SketchWebReact:()=>h.oW,useSketchWebActions:()=>h.JB,useSketchWebCursor:()=>h.SC,useSketchWebGoToArtboardEvent:()=>h.zB,useSketchWebHoveredArtboardUUID:()=>h.GC,useSketchWebManager:()=>h.xH,useSketchWebMetricEvent:()=>h.z7,useSketchWebPan:()=>h.rR,useSketchWebSelectedArtboardUUID:()=>h.JU,useSketchWebStatus:()=>h.vN,useSketchWebWarningsEvent:()=>h.Y6,useSketchWebZoom:()=>h.$5});var e=s(933),t=s(475),n=s(18),o={};for(const e in n)["default","SketchWeb"].indexOf(e)<0&&(o[e]=()=>n[e]);s.d(u,o);var r=s(119);o={};for(const e in r)["default","SketchWeb"].indexOf(e)<0&&(o[e]=()=>r[e]);s.d(u,o);var i=s(332),a=s(312);o={};for(const e in a)["default","SketchWeb","SketchWebMode"].indexOf(e)<0&&(o[e]=()=>a[e]);s.d(u,o);var c=s(758),l=s(689);o={};for(const e in l)["default","SketchWeb","SketchWebMode","SketchWebError"].indexOf(e)<0&&(o[e]=()=>l[e]);s.d(u,o);var h=s(948);const d=e.d})(),u})()}));
|
package/dist/module-debug.wasm
CHANGED
|
Binary file
|
package/dist/module-release.wasm
CHANGED
|
Binary file
|