@antv/g-webgpu 1.7.19 → 1.7.21

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.
@@ -1,13 +1,13 @@
1
1
  !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).G=e.G||{},e.G.WebGPU={}),e.window.G)}(this,(function(e,t){"use strict";function r(){
2
2
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
3
- r=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i=Object.create((t&&t.prototype instanceof h?t:h).prototype),o=new S(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return O()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=y(a,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f={};function h(){}function d(){}function p(){}var _={};u(_,o,(function(){return this}));var v=Object.getPrototypeOf,E=v&&v(v(C([])));E&&E!==t&&n.call(E,o)&&(_=E);var g=p.prototype=h.prototype=Object.create(_);function m(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function R(e,t){function r(i,o,a,s){var u=l(e[i],e,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return r("throw",e,a,s)}))}s(u.arg)}var i;this._invoke=function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}}function y(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,y(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,f;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return d.prototype=p,u(g,"constructor",p),u(p,"constructor",d),d.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},m(R.prototype),u(R.prototype,a,(function(){return this})),e.AsyncIterator=R,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new R(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(g),u(g,s,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=C,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(this.prev>=o.tryLoc){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(o.catchLoc>this.prev)return r(o.catchLoc,!0);if(o.finallyLoc>this.prev)return r(o.finallyLoc)}else if(s){if(o.catchLoc>this.prev)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(this.prev>=i.tryLoc&&n.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:C(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function n(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var a=e.apply(t,r);function s(e){n(a,i,o,s,u,"next",e)}function u(e){n(a,i,o,s,u,"throw",e)}s(void 0)}))}}function o(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,a(e,t)}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}function s(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},r.exports),r.exports}s((function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i=Object.create((t&&t.prototype instanceof v?t:v).prototype),o=new N(n||[]);return i._invoke=function(e,t,r){var n=f;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===p){if("throw"===i)throw o;return P()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=C(a,r);if(s){if(s===_)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=l(e,t,r);if("normal"===u.type){if(n=r.done?p:h,u.arg===_)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=p,r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f="suspendedStart",h="suspendedYield",d="executing",p="completed",_={};function v(){}function E(){}function g(){}var m={};u(m,o,(function(){return this}));var R=Object.getPrototypeOf,y=R&&R(R(x([])));y&&y!==r&&n.call(y,o)&&(m=y);var T=g.prototype=v.prototype=Object.create(m);function A(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function r(i,o,a,s){var u=l(e[i],e,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return r("throw",e,a,s)}))}s(u.arg)}var i;this._invoke=function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}}function C(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,C(e,r),"throw"===r.method))return _;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return _}var i=l(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,_;var o=i.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,_):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,_)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function x(e){if(e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:P}}function P(){return{value:t,done:!0}}return E.prototype=g,u(T,"constructor",g),u(g,"constructor",E),E.displayName=u(g,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===E||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,u(e,s,"GeneratorFunction")),e.prototype=Object.create(T),e},e.awrap=function(e){return{__await:e}},A(S.prototype),u(S.prototype,a,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new S(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},A(T),u(T,s,"Generator"),u(T,o,(function(){return this})),u(T,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=x,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(this.prev>=a.tryLoc){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(a.catchLoc>this.prev)return i(a.catchLoc,!0);if(a.finallyLoc>this.prev)return i(a.finallyLoc)}else if(u){if(a.catchLoc>this.prev)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(a.finallyLoc>this.prev)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(this.prev>=i.tryLoc&&n.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}!o||"break"!==e&&"continue"!==e||o.tryLoc>t||t>o.finallyLoc||(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,_):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),_},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:x(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),_}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}));function u(e,t,r,n){var i,o=arguments.length,a=3>o?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(3>o?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t){return function(r,n){t(r,n,e)}}function l(){for(var e=0,t=0,r=arguments.length;r>t;t++)e+=arguments[t].length;var n=Array(e),i=0;for(t=0;r>t;t++)for(var o=arguments[t],a=0,s=o.length;s>a;a++,i++)n[i]=o[a];return n}var f=s((function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=this._events[r?r+e:e];if(!t)return[];if(t.fn)return[t.fn];for(var n=0,i=t.length,o=new Array(i);i>n;n++)o[n]=t[n].fn;return o},s.prototype.listenerCount=function(e){var t=this._events[r?r+e:e];return t?t.fn?1:t.length:0},s.prototype.emit=function(e,t,n,i,o,a){var s=r?r+e:e;if(!this._events[s])return!1;var u,c,l=this._events[s],f=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),f){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,i),!0;case 5:return l.fn.call(l.context,t,n,i,o),!0;case 6:return l.fn.call(l.context,t,n,i,o,a),!0}for(c=1,u=new Array(f-1);f>c;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var h,d=l.length;for(c=0;d>c;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),f){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,n);break;case 4:l[c].fn.call(l[c].context,t,n,i);break;default:if(!u)for(h=1,u=new Array(f-1);f>h;h++)u[h-1]=arguments[h];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var u=0,c=[],l=s.length;l>u;u++)(s[u].fn!==t||i&&!s[u].once||n&&s[u].context!==n)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?this._events[t=r?r+e:e]&&a(this,t):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s})),h={}.toString,d=function(e,t){return h.call(e)==="[object "+t+"]"},p=function(e){return null==e},_=function(e){return d(e,"String")},v=function(e,t,r){return t>e?t:e>r?r:e},E=function(e){return d(e,"Number")};function g(){
3
+ r=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i=Object.create((t&&t.prototype instanceof h?t:h).prototype),o=new S(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return O()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=y(a,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f={};function h(){}function d(){}function p(){}var _={};u(_,o,(function(){return this}));var E=Object.getPrototypeOf,v=E&&E(E(C([])));v&&v!==t&&n.call(v,o)&&(_=v);var g=p.prototype=h.prototype=Object.create(_);function m(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function R(e,t){function r(i,o,a,s){var u=l(e[i],e,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return r("throw",e,a,s)}))}s(u.arg)}var i;this._invoke=function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}}function y(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,y(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,f;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return d.prototype=p,u(g,"constructor",p),u(p,"constructor",d),d.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},m(R.prototype),u(R.prototype,a,(function(){return this})),e.AsyncIterator=R,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new R(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(g),u(g,s,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=C,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(this.prev>=o.tryLoc){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(o.catchLoc>this.prev)return r(o.catchLoc,!0);if(o.finallyLoc>this.prev)return r(o.finallyLoc)}else if(s){if(o.catchLoc>this.prev)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(this.prev>=i.tryLoc&&n.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:C(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function n(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var a=e.apply(t,r);function s(e){n(a,i,o,s,u,"next",e)}function u(e){n(a,i,o,s,u,"throw",e)}s(void 0)}))}}function o(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,a(e,t)}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}function s(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},r.exports),r.exports}s((function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i=Object.create((t&&t.prototype instanceof E?t:E).prototype),o=new N(n||[]);return i._invoke=function(e,t,r){var n=f;return function(i,o){if(n===d)throw new Error("Generator is already running");if(n===p){if("throw"===i)throw o;return P()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=C(a,r);if(s){if(s===_)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=l(e,t,r);if("normal"===u.type){if(n=r.done?p:h,u.arg===_)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=p,r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f="suspendedStart",h="suspendedYield",d="executing",p="completed",_={};function E(){}function v(){}function g(){}var m={};u(m,o,(function(){return this}));var R=Object.getPrototypeOf,y=R&&R(R(x([])));y&&y!==r&&n.call(y,o)&&(m=y);var T=g.prototype=E.prototype=Object.create(m);function A(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function r(i,o,a,s){var u=l(e[i],e,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return r("throw",e,a,s)}))}s(u.arg)}var i;this._invoke=function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}}function C(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,C(e,r),"throw"===r.method))return _;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return _}var i=l(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,_;var o=i.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,_):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,_)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function x(e){if(e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:P}}function P(){return{value:t,done:!0}}return v.prototype=g,u(T,"constructor",g),u(g,"constructor",v),v.displayName=u(g,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,u(e,s,"GeneratorFunction")),e.prototype=Object.create(T),e},e.awrap=function(e){return{__await:e}},A(S.prototype),u(S.prototype,a,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new S(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},A(T),u(T,s,"Generator"),u(T,o,(function(){return this})),u(T,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=x,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(this.prev>=a.tryLoc){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(a.catchLoc>this.prev)return i(a.catchLoc,!0);if(a.finallyLoc>this.prev)return i(a.finallyLoc)}else if(u){if(a.catchLoc>this.prev)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(a.finallyLoc>this.prev)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(this.prev>=i.tryLoc&&n.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}!o||"break"!==e&&"continue"!==e||o.tryLoc>t||t>o.finallyLoc||(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,_):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),_},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:x(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),_}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}));function u(e,t,r,n){var i,o=arguments.length,a=3>o?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(3>o?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t){return function(r,n){t(r,n,e)}}var l=s((function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=this._events[r?r+e:e];if(!t)return[];if(t.fn)return[t.fn];for(var n=0,i=t.length,o=new Array(i);i>n;n++)o[n]=t[n].fn;return o},s.prototype.listenerCount=function(e){var t=this._events[r?r+e:e];return t?t.fn?1:t.length:0},s.prototype.emit=function(e,t,n,i,o,a){var s=r?r+e:e;if(!this._events[s])return!1;var u,c,l=this._events[s],f=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),f){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,i),!0;case 5:return l.fn.call(l.context,t,n,i,o),!0;case 6:return l.fn.call(l.context,t,n,i,o,a),!0}for(c=1,u=new Array(f-1);f>c;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var h,d=l.length;for(c=0;d>c;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),f){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,n);break;case 4:l[c].fn.call(l[c].context,t,n,i);break;default:if(!u)for(h=1,u=new Array(f-1);f>h;h++)u[h-1]=arguments[h];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var u=0,c=[],l=s.length;l>u;u++)(s[u].fn!==t||i&&!s[u].once||n&&s[u].context!==n)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?this._events[t=r?r+e:e]&&a(this,t):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s})),f={}.toString,h=function(e,t){return f.call(e)==="[object "+t+"]"},d=function(e){return null==e},p=function(e){return h(e,"String")},_=function(e,t,r){return t>e?t:e>r?r:e},E=function(e){return h(e,"Number")};function v(){
4
4
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
5
- g=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=Object.create((t&&t.prototype instanceof f?t:f).prototype),o=new S(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return O()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=y(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function h(){}function d(){}var p={};s(p,i,(function(){return this}));var _=Object.getPrototypeOf,v=_&&_(_(C([])));v&&v!==t&&r.call(v,i)&&(p=v);var E=d.prototype=f.prototype=Object.create(p);function m(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function R(e,t){function n(i,o,a,s){var u=c(e[i],e,o);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function y(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,y(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function C(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=d,s(E,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(E),e},e.awrap=function(e){return{__await:e}},m(R.prototype),s(R.prototype,o,(function(){return this})),e.AsyncIterator=R,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new R(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(E),s(E,a,"Generator"),s(E,i,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=C,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(this.prev>=o.tryLoc){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(o.catchLoc>this.prev)return n(o.catchLoc,!0);if(o.finallyLoc>this.prev)return n(o.finallyLoc)}else if(s){if(o.catchLoc>this.prev)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(this.prev>=i.tryLoc&&r.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:C(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function m(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function R(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){m(o,n,i,a,s,"next",e)}function s(e){m(o,n,i,a,s,"throw",e)}a(void 0)}))}}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}var T={}.toString,A=function(e,t){return T.call(e)==="[object "+t+"]"},S=function(e){return A(e,"Function")};function C(e,t){var r;if(e)if(r=e,Array.isArray?Array.isArray(r):A(r,"Array"))for(var n=0,i=e.length;i>n&&!1!==t(e[n],n);n++);else if(function(e){var t=typeof e;return null!==e&&"object"===t||"function"===t}(e))for(var o in e)if(e.hasOwnProperty(o)&&!1===t(e[o],o))break}var O,I=function(e){return A(e,"String")},N=Object.values?function(e){return Object.values(e)}:function(e){var t=[];return C(e,(function(r,n){S(e)&&"prototype"===n||t.push(r)})),t};!function(e,t){if(!S(e))throw new TypeError("Expected a function");var r=function r(){for(var n=[],i=0;arguments.length>i;i++)n[i]=arguments[i];var o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var s=e.apply(this,n);return a.set(o,s),s};r.cache=new Map}((function(e,t){void 0===t&&(t={});var r=t.fontSize,n=t.fontFamily,i=t.fontWeight,o=t.fontStyle,a=t.fontVariant;return O||(O=document.createElement("canvas").getContext("2d")),O.font=[o,a,i,r+"px",n].join(" "),O.measureText(I(e)?e:"").width}),(function(e,t){return void 0===t&&(t={}),l([e],N(t)).join("")}));var x,P,M=function(){function e(e){this.canvasConfig=void 0,this.imageCache={},this.gradientCache={},this.patternCache={},this.canvasConfig=e}var r=e.prototype;return r.getImageSync=function(e,t){return this.imageCache[e]?t&&t():this.getOrCreateImage(e).then((function(){t&&t()})),this.imageCache[e]},r.getOrCreateImage=function(e){var r=this;if(this.imageCache[e])return Promise.resolve(this.imageCache[e]);var n=this.canvasConfig.createImage;return new Promise((function(i,o){var a;n?a=n(e):t.isBrowser&&(a=new window.Image),a&&(a.onload=function(){i(a)},a.onerror=function(e){o(e)},a.crossOrigin="Anonymous",a.src=e,r.imageCache[e]=a)}))},r.getOrCreatePatternSync=function(e,t,r){var n=this.generatePatternKey(e);if(n&&this.patternCache[n])return this.patternCache[n];var i,o=e.image,a=e.repetition,s=(i=I(o)?this.getImageSync(o,r):o)&&t.createPattern(i,a);return n&&s&&(this.patternCache[n]=s),s},r.getOrCreateGradient=function(e,r){var n=this.generateGradientKey(e),i=e.type,o=e.steps,a=e.width,s=e.height,u=e.cx,c=e.cy;if(this.gradientCache[n])return this.gradientCache[n];var l=null;if(i===t.GradientType.LinearGradient){var f=t.computeLinearGradient(a,s,e.angle);l=r.createLinearGradient(f.x1,f.y1,f.x2,f.y2)}else if(i===t.GradientType.RadialGradient){var h=t.computeRadialGradient(a,s,u,c),d=h.x,p=h.y;l=r.createRadialGradient(d,p,0,d,p,h.r)}return l&&(o.forEach((function(e){var t;null===(t=l)||void 0===t||t.addColorStop(e[0],e[1])})),this.gradientCache[n]=l),this.gradientCache[n]},r.generateGradientKey=function(e){return"gradient-"+e.type+"-"+(e.angle||0)+"-"+(e.cx||0)+"-"+(e.cy||0)+"-"+e.width+"-"+e.height+"-"+e.steps.map((function(e){return e.join("")})).join("-")},r.generatePatternKey=function(e){var t=e.image,r=e.repetition;if(I(t))return"pattern-"+t+"-"+r},e}();M=u([t.singleton(),c(0,t.inject(t.CanvasConfig))],M);var D=(x=function(){function e(e,t){this.imagePool=void 0,this.renderingContext=void 0,this.imagePool=e,this.renderingContext=t}return e.prototype.apply=function(e){var r=this,n=function(n){var i=n.target;if(i.nodeName===t.Shape.IMAGE){var o=i.attributes.img;I(o)&&r.imagePool.getImageSync(o,(function(){i.renderable.dirty=!0,e.dirtify()}))}},i=function(n){var i=n.target,o=n.newValue;i.nodeName===t.Shape.IMAGE&&"img"===n.attrName&&I(o)&&r.imagePool.getOrCreateImage(o).then((function(){i.renderable.dirty=!0,e.dirtify()}))};e.hooks.init.tapPromise(P.tag,R(g().mark((function e(){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.renderingContext.root.addEventListener(t.ElementEvent.MOUNTED,n),r.renderingContext.root.addEventListener(t.ElementEvent.ATTR_MODIFIED,i);case 2:case"end":return e.stop()}}),e)})))),e.hooks.destroy.tap(P.tag,(function(){r.renderingContext.root.removeEventListener(t.ElementEvent.MOUNTED,n),r.renderingContext.root.removeEventListener(t.ElementEvent.ATTR_MODIFIED,i)}))},e}(),x.tag="LoadImage",P=x);D=P=u([t.singleton({contrib:t.RenderingPluginContribution}),c(0,t.inject(M)),c(1,t.inject(t.RenderingContext))],D);var B=t.Module((function(e){e(M),e(D)})),L=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).name="image-loader",t}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,y(t,r);var i=n.prototype;return i.init=function(){this.container.load(B,!0)},i.destroy=function(){this.container.unload(B)},n}(t.AbstractRendererPlugin),b=U,F=U;function U(e,t,r){r=r||2;var n,i,o,a,s,u,c,l=t&&t.length,f=l?t[0]*r:e.length,h=w(e,0,f,r,!0),d=[];if(!h||h.next===h.prev)return d;if(l&&(h=function(e,t,r,n){var i,o,a,s=[];for(i=0,o=t.length;o>i;i++)(a=w(e,t[i]*n,o-1>i?t[i+1]*n:e.length,n,!1))===a.next&&(a.steiner=!0),s.push(q(a));for(s.sort(j),i=0;s.length>i;i++)r=Y(s[i],r);return r}(e,t,h,r)),e.length>80*r){n=o=e[0],i=a=e[1];for(var p=r;f>p;p+=r)n>(s=e[p])&&(n=s),i>(u=e[p+1])&&(i=u),s>o&&(o=s),u>a&&(a=u);c=0!==(c=Math.max(o-n,a-i))?32767/c:0}return k(h,d,r,n,i,c,0),d}function w(e,t,r,n,i){var o,a;if(i===ue(e,t,r,n)>0)for(o=t;r>o;o+=n)a=oe(o,e[o],e[o+1],a);else for(o=r-n;o>=t;o-=n)a=oe(o,e[o],e[o+1],a);return a&&$(a,a.next)&&(ae(a),a=a.next),a}function G(e,t){if(!e)return e;t||(t=e);var r,n=e;do{if(r=!1,n.steiner||!$(n,n.next)&&0!==J(n.prev,n,n.next))n=n.next;else{if(ae(n),(n=t=n.prev)===n.next)break;r=!0}}while(r||n!==t);return t}function k(e,t,r,n,i,o,a){if(e){!a&&o&&function(e,t,r,n){var i=e;do{0===i.z&&(i.z=z(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,r,n,i,o,a,s,u,c=1;do{for(r=e,e=null,o=null,a=0;r;){for(a++,n=r,s=0,t=0;c>t&&(s++,n=n.nextZ);t++);for(u=c;s>0||u>0&&n;)0===s||0!==u&&n&&r.z>n.z?(i=n,n=n.nextZ,u--):(i=r,r=r.nextZ,s--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;r=n}o.nextZ=null,c*=2}while(a>1)}(i)}(e,n,i,o);for(var s,u,c=e;e.prev!==e.next;)if(s=e.prev,u=e.next,o?W(e,n,i,o):V(e))t.push(s.i/r|0),t.push(e.i/r|0),t.push(u.i/r|0),ae(e),e=u.next,c=u.next;else if((e=u)===c){a?1===a?k(e=X(G(e),t,r),t,r,n,i,o,2):2===a&&H(e,t,r,n,i,o):k(G(e),t,r,n,i,o,1);break}}}function V(e){var t=e.prev,r=e,n=e.next;if(J(t,r,n)>=0)return!1;for(var i=t.x,o=r.x,a=n.x,s=t.y,u=r.y,c=n.y,l=o>i?a>i?i:a:a>o?o:a,f=u>s?c>s?s:c:c>u?u:c,h=i>o?i>a?i:a:o>a?o:a,d=s>u?s>c?s:c:u>c?u:c,p=n.next;p!==t;){if(p.x>=l&&h>=p.x&&p.y>=f&&d>=p.y&&Z(i,s,o,u,a,c,p.x,p.y)&&J(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function W(e,t,r,n){var i=e.prev,o=e,a=e.next;if(J(i,o,a)>=0)return!1;for(var s=i.x,u=o.x,c=a.x,l=i.y,f=o.y,h=a.y,d=u>s?c>s?s:c:c>u?u:c,p=f>l?h>l?l:h:h>f?f:h,_=s>u?s>c?s:c:u>c?u:c,v=l>f?l>h?l:h:f>h?f:h,E=z(d,p,t,r,n),g=z(_,v,t,r,n),m=e.prevZ,R=e.nextZ;m&&m.z>=E&&R&&g>=R.z;){if(m.x>=d&&_>=m.x&&m.y>=p&&v>=m.y&&m!==i&&m!==a&&Z(s,l,u,f,c,h,m.x,m.y)&&J(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,R.x>=d&&_>=R.x&&R.y>=p&&v>=R.y&&R!==i&&R!==a&&Z(s,l,u,f,c,h,R.x,R.y)&&J(R.prev,R,R.next)>=0)return!1;R=R.nextZ}for(;m&&m.z>=E;){if(m.x>=d&&_>=m.x&&m.y>=p&&v>=m.y&&m!==i&&m!==a&&Z(s,l,u,f,c,h,m.x,m.y)&&J(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;R&&g>=R.z;){if(R.x>=d&&_>=R.x&&R.y>=p&&v>=R.y&&R!==i&&R!==a&&Z(s,l,u,f,c,h,R.x,R.y)&&J(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function X(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!$(i,o)&&ee(i,n,n.next,o)&&ne(i,o)&&ne(o,i)&&(t.push(i.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),ae(n),ae(n.next),n=e=o),n=n.next}while(n!==e);return G(n)}function H(e,t,r,n,i,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Q(a,s)){var u=ie(a,s);return a=G(a,a.next),u=G(u,u.next),k(a,t,r,n,i,o,0),void k(u,t,r,n,i,o,0)}s=s.next}a=a.next}while(a!==e)}function j(e,t){return e.x-t.x}function Y(e,t){var r=function(e,t){var r,n=t,i=e.x,o=e.y,a=-1/0;do{if(n.y>=o&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(i>=s&&s>a&&(a=s,r=n.next.x>n.x?n:n.next,s===i))return r}n=n.next}while(n!==t);if(!r)return null;var u,c=r,l=r.x,f=r.y,h=1/0;n=r;do{n.x>i||l>n.x||i===n.x||!Z(f>o?i:a,o,l,f,f>o?a:i,o,n.x,n.y)||(u=Math.abs(o-n.y)/(i-n.x),ne(n,e)&&(h>u||u===h&&(n.x>r.x||n.x===r.x&&K(r,n)))&&(r=n,h=u)),n=n.next}while(n!==c);return r}(e,t);if(!r)return t;var n=ie(r,e);return G(n,n.next),G(r,r.next)}function K(e,t){return 0>J(e.prev,e,t.prev)&&0>J(t.next,e,e.next)}function z(e,t,r,n,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function q(e){var t=e,r=e;do{(r.x>t.x||t.x===r.x&&r.y>t.y)&&(r=t),t=t.next}while(t!==e);return r}function Z(e,t,r,n,i,o,a,s){return(i-a)*(t-s)>=(e-a)*(o-s)&&(e-a)*(n-s)>=(r-a)*(t-s)&&(r-a)*(o-s)>=(i-a)*(n-s)}function Q(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&ee(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(ne(e,t)&&ne(t,e)&&function(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x>i&&(n=!n),r=r.next}while(r!==e);return n}(e,t)&&(J(e.prev,e,t.prev)||J(e,t.prev,t))||$(e,t)&&J(e.prev,e,e.next)>0&&J(t.prev,t,t.next)>0)}function J(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function $(e,t){return e.x===t.x&&e.y===t.y}function ee(e,t,r,n){var i=re(J(e,t,r)),o=re(J(e,t,n)),a=re(J(r,n,e)),s=re(J(r,n,t));return i!==o&&a!==s||(!(0!==i||!te(e,r,t))||(!(0!==o||!te(e,n,t))||(!(0!==a||!te(r,e,n))||!(0!==s||!te(r,t,n)))))}function te(e,t,r){return!(t.x>Math.max(e.x,r.x)||t.x<Math.min(e.x,r.x)||t.y>Math.max(e.y,r.y)||t.y<Math.min(e.y,r.y))}function re(e){return e>0?1:0>e?-1:0}function ne(e,t){return 0>J(e.prev,e,e.next)?J(e,t,e.next)>=0&&J(e,e.prev,t)>=0:0>J(e,t,e.prev)||0>J(e,e.next,t)}function ie(e,t){var r=new se(e.i,e.x,e.y),n=new se(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function oe(e,t,r,n){var i=new se(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ae(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function se(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ue(e,t,r,n){for(var i=0,o=t,a=r-n;r>o;o+=n)i+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return i}U.deviation=function(e,t,r,n){var i=t&&t.length,o=Math.abs(ue(e,0,i?t[0]*r:e.length,r));if(i)for(var a=0,s=t.length;s>a;a++){o-=Math.abs(ue(e,t[a]*r,s-1>a?t[a+1]*r:e.length,r))}var u=0;for(a=0;n.length>a;a+=3){var c=n[a]*r,l=n[a+1]*r,f=n[a+2]*r;u+=Math.abs((e[c]-e[f])*(e[l+1]-e[c+1])-(e[c]-e[l])*(e[f+1]-e[c+1]))}return 0===o&&0===u?0:Math.abs((u-o)/o)},U.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,i=0;e.length>i;i++){for(var o=0;e[i].length>o;o++)for(var a=0;t>a;a++)r.vertices.push(e[i][o][a]);i>0&&r.holes.push(n+=e[i-1].length)}return r},b.default=F;const ce=1e20;class le{constructor({fontSize:e=24,buffer:t=3,radius:r=8,cutoff:n=.25,fontFamily:i="sans-serif",fontWeight:o="normal",fontStyle:a="normal"}={}){this.buffer=t,this.cutoff=n,this.radius=r;const s=this.size=e+4*t,u=this._createCanvas(s),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font=`${a} ${o} ${e}px ${i}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:r,actualBoundingBoxDescent:n,actualBoundingBoxLeft:i,actualBoundingBoxRight:o}=this.ctx.measureText(e),a=Math.ceil(r),s=Math.min(this.size-this.buffer,Math.ceil(o-i)),u=Math.min(this.size-this.buffer,a+Math.ceil(n)),c=s+2*this.buffer,l=u+2*this.buffer,f=Math.max(c*l,0),h=new Uint8ClampedArray(f),d={data:h,width:c,height:l,glyphWidth:s,glyphHeight:u,glyphTop:a,glyphLeft:0,glyphAdvance:t};if(0===s||0===u)return d;const{ctx:p,buffer:_,gridInner:v,gridOuter:E}=this;p.clearRect(_,_,s,u),p.fillText(e,_,_+a);const g=p.getImageData(_,_,s,u);E.fill(ce,0,f),v.fill(0,0,f);for(let e=0;u>e;e++)for(let t=0;s>t;t++){const r=g.data[4*(e*s+t)+3]/255;if(0===r)continue;const n=(e+_)*c+t+_;if(1===r)E[n]=0,v[n]=ce;else{const e=.5-r;E[n]=e>0?e*e:0,v[n]=0>e?e*e:0}}fe(E,0,0,c,l,c,this.f,this.v,this.z),fe(v,_,_,s,u,c,this.f,this.v,this.z);for(let e=0;f>e;e++){const t=Math.sqrt(E[e])-Math.sqrt(v[e]);h[e]=Math.round(255-255*(t/this.radius+this.cutoff))}return d}}function fe(e,t,r,n,i,o,a,s,u){for(let c=t;t+n>c;c++)he(e,r*o+c,o,i,a,s,u);for(let c=r;r+i>c;c++)he(e,c*o+t,1,n,a,s,u)}function he(e,t,r,n,i,o,a){o[0]=0,a[0]=-ce,a[1]=ce,i[0]=e[t];for(let s=1,u=0,c=0;n>s;s++){i[s]=e[t+s*r];const n=s*s;do{const e=o[u];c=(i[s]-i[e]+n-e*e)/(s-e)/2}while(a[u]>=c&&--u>-1);u++,o[u]=s,a[u]=c,a[u+1]=ce}for(let s=0,u=0;n>s;s++){for(;s>a[u+1];)u++;const n=o[u],c=s-n;e[t+s*r]=i[n]+c*c}}function de(){
5
+ v=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=Object.create((t&&t.prototype instanceof f?t:f).prototype),o=new S(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return O()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=y(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function h(){}function d(){}var p={};s(p,i,(function(){return this}));var _=Object.getPrototypeOf,E=_&&_(_(C([])));E&&E!==t&&r.call(E,i)&&(p=E);var g=d.prototype=f.prototype=Object.create(p);function m(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function R(e,t){function n(i,o,a,s){var u=c(e[i],e,o);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function y(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,y(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function C(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=d,s(g,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},m(R.prototype),s(R.prototype,o,(function(){return this})),e.AsyncIterator=R,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new R(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(g),s(g,a,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=C,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(this.prev>=o.tryLoc){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(o.catchLoc>this.prev)return n(o.catchLoc,!0);if(o.finallyLoc>this.prev)return n(o.finallyLoc)}else if(s){if(o.catchLoc>this.prev)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(this.prev>=i.tryLoc&&r.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:C(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function g(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function m(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){g(o,n,i,a,s,"next",e)}function s(e){g(o,n,i,a,s,"throw",e)}a(void 0)}))}}function R(e,t){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},R(e,t)}var y,T,A=function(){function e(e){this.canvasConfig=void 0,this.imageCache={},this.gradientCache={},this.patternCache={},this.canvasConfig=e}var r=e.prototype;return r.getImageSync=function(e,t){return this.imageCache[e]?t&&t():this.getOrCreateImage(e).then((function(){t&&t()})),this.imageCache[e]},r.getOrCreateImage=function(e){var r=this;if(this.imageCache[e])return Promise.resolve(this.imageCache[e]);var n=this.canvasConfig.createImage;return new Promise((function(i,o){var a;n?a=n(e):t.isBrowser&&(a=new window.Image),a&&(a.onload=function(){i(a)},a.onerror=function(e){o(e)},a.crossOrigin="Anonymous",a.src=e,r.imageCache[e]=a)}))},r.getOrCreatePatternSync=function(e,t,r){var n=this.generatePatternKey(e);if(n&&this.patternCache[n])return this.patternCache[n];var i,o=e.image,a=e.repetition,s=(i=p(o)?this.getImageSync(o,r):o)&&t.createPattern(i,a);return n&&s&&(this.patternCache[n]=s),s},r.getOrCreateGradient=function(e,r){var n=this.generateGradientKey(e),i=e.type,o=e.steps,a=e.width,s=e.height,u=e.cx,c=e.cy,l=e.size;if(this.gradientCache[n])return this.gradientCache[n];var f=null;if(i===t.GradientType.LinearGradient){var h=t.computeLinearGradient(a,s,e.angle);f=r.createLinearGradient(h.x1,h.y1,h.x2,h.y2)}else if(i===t.GradientType.RadialGradient){var d=t.computeRadialGradient(a,s,u,c,l),p=d.x,_=d.y;f=r.createRadialGradient(p,_,0,p,_,d.r)}return f&&(o.forEach((function(e){var r,n=e.offset;n.unit===t.UnitType.kPercentage&&(null===(r=f)||void 0===r||r.addColorStop(n.value/100,e.color.toString()))})),this.gradientCache[n]=f),this.gradientCache[n]},r.generateGradientKey=function(e){var t=e.width,r=e.height,n=e.steps,i=e.angle,o=e.cx,a=e.cy,s=e.size;return"gradient-"+e.type+"-"+((null==i?void 0:i.toString())||0)+"-"+((null==o?void 0:o.toString())||0)+"-"+((null==a?void 0:a.toString())||0)+"-"+((null==s?void 0:s.toString())||0)+"-"+t+"-"+r+"-"+n.map((function(e){return""+e.offset+e.color})).join("-")},r.generatePatternKey=function(e){var t=e.image,r=e.repetition;if(p(t))return"pattern-"+t+"-"+r},e}();A=u([t.singleton(),c(0,t.inject(t.CanvasConfig))],A);var S=(y=function(){function e(e,t){this.imagePool=void 0,this.renderingContext=void 0,this.imagePool=e,this.renderingContext=t}return e.prototype.apply=function(e){var r=this,n=function(n){var i=n.target;if(i.nodeName===t.Shape.IMAGE){var o=i.attributes.img;p(o)&&r.imagePool.getImageSync(o,(function(){i.renderable.dirty=!0,e.dirtify()}))}},i=function(n){var i=n.target,o=n.newValue;i.nodeName===t.Shape.IMAGE&&"img"===n.attrName&&p(o)&&r.imagePool.getOrCreateImage(o).then((function(){i.renderable.dirty=!0,e.dirtify()}))};e.hooks.init.tapPromise(T.tag,m(v().mark((function e(){return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.renderingContext.root.addEventListener(t.ElementEvent.MOUNTED,n),r.renderingContext.root.addEventListener(t.ElementEvent.ATTR_MODIFIED,i);case 2:case"end":return e.stop()}}),e)})))),e.hooks.destroy.tap(T.tag,(function(){r.renderingContext.root.removeEventListener(t.ElementEvent.MOUNTED,n),r.renderingContext.root.removeEventListener(t.ElementEvent.ATTR_MODIFIED,i)}))},e}(),y.tag="LoadImage",T=y);S=T=u([t.singleton({contrib:t.RenderingPluginContribution}),c(0,t.inject(A)),c(1,t.inject(t.RenderingContext))],S);var C=t.Module((function(e){e(A),e(S)})),O=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).name="image-loader",t}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,R(t,r);var i=n.prototype;return i.init=function(){this.container.load(C,!0)},i.destroy=function(){this.container.unload(C)},n}(t.AbstractRendererPlugin),I=x,N=x;function x(e,t,r){r=r||2;var n,i,o,a,s,u,c,l=t&&t.length,f=l?t[0]*r:e.length,h=P(e,0,f,r,!0),d=[];if(!h||h.next===h.prev)return d;if(l&&(h=function(e,t,r,n){var i,o,a,s=[];for(i=0,o=t.length;o>i;i++)(a=P(e,t[i]*n,o-1>i?t[i+1]*n:e.length,n,!1))===a.next&&(a.steiner=!0),s.push(V(a));for(s.sort(U),i=0;s.length>i;i++)r=w(s[i],r);return r}(e,t,h,r)),e.length>80*r){n=o=e[0],i=a=e[1];for(var p=r;f>p;p+=r)n>(s=e[p])&&(n=s),i>(u=e[p+1])&&(i=u),s>o&&(o=s),u>a&&(a=u);c=0!==(c=Math.max(o-n,a-i))?32767/c:0}return D(h,d,r,n,i,c,0),d}function P(e,t,r,n,i){var o,a;if(i===ee(e,t,r,n)>0)for(o=t;r>o;o+=n)a=Q(o,e[o],e[o+1],a);else for(o=r-n;o>=t;o-=n)a=Q(o,e[o],e[o+1],a);return a&&Y(a,a.next)&&(J(a),a=a.next),a}function M(e,t){if(!e)return e;t||(t=e);var r,n=e;do{if(r=!1,n.steiner||!Y(n,n.next)&&0!==H(n.prev,n,n.next))n=n.next;else{if(J(n),(n=t=n.prev)===n.next)break;r=!0}}while(r||n!==t);return t}function D(e,t,r,n,i,o,a){if(e){!a&&o&&function(e,t,r,n){var i=e;do{0===i.z&&(i.z=k(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,r,n,i,o,a,s,u,c=1;do{for(r=e,e=null,o=null,a=0;r;){for(a++,n=r,s=0,t=0;c>t&&(s++,n=n.nextZ);t++);for(u=c;s>0||u>0&&n;)0===s||0!==u&&n&&r.z>n.z?(i=n,n=n.nextZ,u--):(i=r,r=r.nextZ,s--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;r=n}o.nextZ=null,c*=2}while(a>1)}(i)}(e,n,i,o);for(var s,u,c=e;e.prev!==e.next;)if(s=e.prev,u=e.next,o?L(e,n,i,o):B(e))t.push(s.i/r|0),t.push(e.i/r|0),t.push(u.i/r|0),J(e),e=u.next,c=u.next;else if((e=u)===c){a?1===a?D(e=b(M(e),t,r),t,r,n,i,o,2):2===a&&F(e,t,r,n,i,o):D(M(e),t,r,n,i,o,1);break}}}function B(e){var t=e.prev,r=e,n=e.next;if(H(t,r,n)>=0)return!1;for(var i=t.x,o=r.x,a=n.x,s=t.y,u=r.y,c=n.y,l=o>i?a>i?i:a:a>o?o:a,f=u>s?c>s?s:c:c>u?u:c,h=i>o?i>a?i:a:o>a?o:a,d=s>u?s>c?s:c:u>c?u:c,p=n.next;p!==t;){if(p.x>=l&&h>=p.x&&p.y>=f&&d>=p.y&&W(i,s,o,u,a,c,p.x,p.y)&&H(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function L(e,t,r,n){var i=e.prev,o=e,a=e.next;if(H(i,o,a)>=0)return!1;for(var s=i.x,u=o.x,c=a.x,l=i.y,f=o.y,h=a.y,d=u>s?c>s?s:c:c>u?u:c,p=f>l?h>l?l:h:h>f?f:h,_=s>u?s>c?s:c:u>c?u:c,E=l>f?l>h?l:h:f>h?f:h,v=k(d,p,t,r,n),g=k(_,E,t,r,n),m=e.prevZ,R=e.nextZ;m&&m.z>=v&&R&&g>=R.z;){if(m.x>=d&&_>=m.x&&m.y>=p&&E>=m.y&&m!==i&&m!==a&&W(s,l,u,f,c,h,m.x,m.y)&&H(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,R.x>=d&&_>=R.x&&R.y>=p&&E>=R.y&&R!==i&&R!==a&&W(s,l,u,f,c,h,R.x,R.y)&&H(R.prev,R,R.next)>=0)return!1;R=R.nextZ}for(;m&&m.z>=v;){if(m.x>=d&&_>=m.x&&m.y>=p&&E>=m.y&&m!==i&&m!==a&&W(s,l,u,f,c,h,m.x,m.y)&&H(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;R&&g>=R.z;){if(R.x>=d&&_>=R.x&&R.y>=p&&E>=R.y&&R!==i&&R!==a&&W(s,l,u,f,c,h,R.x,R.y)&&H(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function b(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!Y(i,o)&&j(i,n,n.next,o)&&q(i,o)&&q(o,i)&&(t.push(i.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),J(n),J(n.next),n=e=o),n=n.next}while(n!==e);return M(n)}function F(e,t,r,n,i,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&X(a,s)){var u=Z(a,s);return a=M(a,a.next),u=M(u,u.next),D(a,t,r,n,i,o,0),void D(u,t,r,n,i,o,0)}s=s.next}a=a.next}while(a!==e)}function U(e,t){return e.x-t.x}function w(e,t){var r=function(e,t){var r,n=t,i=e.x,o=e.y,a=-1/0;do{if(n.y>=o&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(i>=s&&s>a&&(a=s,r=n.next.x>n.x?n:n.next,s===i))return r}n=n.next}while(n!==t);if(!r)return null;var u,c=r,l=r.x,f=r.y,h=1/0;n=r;do{n.x>i||l>n.x||i===n.x||!W(f>o?i:a,o,l,f,f>o?a:i,o,n.x,n.y)||(u=Math.abs(o-n.y)/(i-n.x),q(n,e)&&(h>u||u===h&&(n.x>r.x||n.x===r.x&&G(r,n)))&&(r=n,h=u)),n=n.next}while(n!==c);return r}(e,t);if(!r)return t;var n=Z(r,e);return M(n,n.next),M(r,r.next)}function G(e,t){return 0>H(e.prev,e,t.prev)&&0>H(t.next,e,e.next)}function k(e,t,r,n,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function V(e){var t=e,r=e;do{(r.x>t.x||t.x===r.x&&r.y>t.y)&&(r=t),t=t.next}while(t!==e);return r}function W(e,t,r,n,i,o,a,s){return(i-a)*(t-s)>=(e-a)*(o-s)&&(e-a)*(n-s)>=(r-a)*(t-s)&&(r-a)*(o-s)>=(i-a)*(n-s)}function X(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&j(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(q(e,t)&&q(t,e)&&function(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x>i&&(n=!n),r=r.next}while(r!==e);return n}(e,t)&&(H(e.prev,e,t.prev)||H(e,t.prev,t))||Y(e,t)&&H(e.prev,e,e.next)>0&&H(t.prev,t,t.next)>0)}function H(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Y(e,t){return e.x===t.x&&e.y===t.y}function j(e,t,r,n){var i=z(H(e,t,r)),o=z(H(e,t,n)),a=z(H(r,n,e)),s=z(H(r,n,t));return i!==o&&a!==s||(!(0!==i||!K(e,r,t))||(!(0!==o||!K(e,n,t))||(!(0!==a||!K(r,e,n))||!(0!==s||!K(r,t,n)))))}function K(e,t,r){return!(t.x>Math.max(e.x,r.x)||t.x<Math.min(e.x,r.x)||t.y>Math.max(e.y,r.y)||t.y<Math.min(e.y,r.y))}function z(e){return e>0?1:0>e?-1:0}function q(e,t){return 0>H(e.prev,e,e.next)?H(e,t,e.next)>=0&&H(e,e.prev,t)>=0:0>H(e,t,e.prev)||0>H(e,e.next,t)}function Z(e,t){var r=new $(e.i,e.x,e.y),n=new $(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Q(e,t,r,n){var i=new $(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function J(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function $(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ee(e,t,r,n){for(var i=0,o=t,a=r-n;r>o;o+=n)i+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return i}x.deviation=function(e,t,r,n){var i=t&&t.length,o=Math.abs(ee(e,0,i?t[0]*r:e.length,r));if(i)for(var a=0,s=t.length;s>a;a++){o-=Math.abs(ee(e,t[a]*r,s-1>a?t[a+1]*r:e.length,r))}var u=0;for(a=0;n.length>a;a+=3){var c=n[a]*r,l=n[a+1]*r,f=n[a+2]*r;u+=Math.abs((e[c]-e[f])*(e[l+1]-e[c+1])-(e[c]-e[l])*(e[f+1]-e[c+1]))}return 0===o&&0===u?0:Math.abs((u-o)/o)},x.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,i=0;e.length>i;i++){for(var o=0;e[i].length>o;o++)for(var a=0;t>a;a++)r.vertices.push(e[i][o][a]);i>0&&r.holes.push(n+=e[i-1].length)}return r},I.default=N;const te=1e20;class re{constructor({fontSize:e=24,buffer:t=3,radius:r=8,cutoff:n=.25,fontFamily:i="sans-serif",fontWeight:o="normal",fontStyle:a="normal"}={}){this.buffer=t,this.cutoff=n,this.radius=r;const s=this.size=e+4*t,u=this._createCanvas(s),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font=`${a} ${o} ${e}px ${i}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:r,actualBoundingBoxDescent:n,actualBoundingBoxLeft:i,actualBoundingBoxRight:o}=this.ctx.measureText(e),a=Math.ceil(r),s=Math.min(this.size-this.buffer,Math.ceil(o-i)),u=Math.min(this.size-this.buffer,a+Math.ceil(n)),c=s+2*this.buffer,l=u+2*this.buffer,f=Math.max(c*l,0),h=new Uint8ClampedArray(f),d={data:h,width:c,height:l,glyphWidth:s,glyphHeight:u,glyphTop:a,glyphLeft:0,glyphAdvance:t};if(0===s||0===u)return d;const{ctx:p,buffer:_,gridInner:E,gridOuter:v}=this;p.clearRect(_,_,s,u),p.fillText(e,_,_+a);const g=p.getImageData(_,_,s,u);v.fill(te,0,f),E.fill(0,0,f);for(let e=0;u>e;e++)for(let t=0;s>t;t++){const r=g.data[4*(e*s+t)+3]/255;if(0===r)continue;const n=(e+_)*c+t+_;if(1===r)v[n]=0,E[n]=te;else{const e=.5-r;v[n]=e>0?e*e:0,E[n]=0>e?e*e:0}}ne(v,0,0,c,l,c,this.f,this.v,this.z),ne(E,_,_,s,u,c,this.f,this.v,this.z);for(let e=0;f>e;e++){const t=Math.sqrt(v[e])-Math.sqrt(E[e]);h[e]=Math.round(255-255*(t/this.radius+this.cutoff))}return d}}function ne(e,t,r,n,i,o,a,s,u){for(let c=t;t+n>c;c++)ie(e,r*o+c,o,i,a,s,u);for(let c=r;r+i>c;c++)ie(e,c*o+t,1,n,a,s,u)}function ie(e,t,r,n,i,o,a){o[0]=0,a[0]=-te,a[1]=te,i[0]=e[t];for(let s=1,u=0,c=0;n>s;s++){i[s]=e[t+s*r];const n=s*s;do{const e=o[u];c=(i[s]-i[e]+n-e*e)/(s-e)/2}while(a[u]>=c&&--u>-1);u++,o[u]=s,a[u]=c,a[u+1]=te}for(let s=0,u=0;n>s;s++){for(;s>a[u+1];)u++;const n=o[u],c=s-n;e[t+s*r]=i[n]+c*c}}function oe(){
6
6
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
7
- de=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=Object.create((t&&t.prototype instanceof f?t:f).prototype),o=new A(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return C()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=R(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function h(){}function d(){}var p={};s(p,i,(function(){return this}));var _=Object.getPrototypeOf,v=_&&_(_(S([])));v&&v!==t&&r.call(v,i)&&(p=v);var E=d.prototype=f.prototype=Object.create(p);function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){function n(i,o,a,s){var u=c(e[i],e,o);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function R(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return h.prototype=d,s(E,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(E),e},e.awrap=function(e){return{__await:e}},g(m.prototype),s(m.prototype,o,(function(){return this})),e.AsyncIterator=m,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new m(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(E),s(E,a,"Generator"),s(E,i,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=S,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(this.prev>=o.tryLoc){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(o.catchLoc>this.prev)return n(o.catchLoc,!0);if(o.finallyLoc>this.prev)return n(o.finallyLoc)}else if(s){if(o.catchLoc>this.prev)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(this.prev>=i.tryLoc&&r.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function pe(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function _e(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){pe(o,n,i,a,s,"next",e)}function s(e){pe(o,n,i,a,s,"throw",e)}a(void 0)}))}}function ve(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ee(e,t,r){return t&&ve(e.prototype,t),r&&ve(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ge(){return ge=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ge.apply(this,arguments)}function me(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Re(e,t)}function Re(e,t){return Re=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Re(e,t)}function ye(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;o.length>n;n++)0>t.indexOf(r=o[n])&&(i[r]=e[r]);return i}function Te(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);t>r;r++)n[r]=e[r];return n}function Se(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Ae(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ae(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return e.length>n?{done:!1,value:e[n++]}:{done:!0}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Ce=function(){this.pickingId=void 0,this.encodedPickingColor=void 0,this.meshes=[]};Ce.tag="c-renderable-3d";var Oe=function(){function e(){this.lights=[],this.fog=void 0}var t=e.prototype;return t.addLight=function(e){this.lights.push(e),this.sortLights()},t.removeLight=function(e){var t=this.lights.indexOf(e);this.lights.splice(t,1),this.sortLights()},t.addFog=function(e){this.fog=e},t.removeFog=function(e){this.fog=null},t.getFog=function(){return this.fog},t.getAllLights=function(){return this.lights},t.getDefines=function(){var e={USE_LIGHT:!!this.lights.length};return this.lights.forEach((function(t){e[t.define]||(e[t.define]=0),e[t.define]++})),e},t.sortLights=function(){this.lights.sort((function(e,t){return e.order-t.order}))},e}();Oe=u([t.singleton()],Oe);var Ie=["style"],Ne=function(e){function r(r){var n,i=r.style,o=ye(r,Ie);return(n=e.call(this,ge({type:t.Shape.MESH,style:ge({x:"",y:"",z:"",lineWidth:0},i)},o))||this).cullable.enable=!1,n.style.geometry.meshes.push(Te(n)),n.style.material.meshes.push(Te(n)),n}return me(r,e),r.prototype.destroy=function(){e.prototype.destroy.call(this);var t=this.style.geometry.meshes,r=t.indexOf(this);t.splice(r,1),r=(t=this.style.material.meshes).indexOf(this),t.splice(r,1)},r}(t.DisplayObject),xe="undefined"!=typeof Float32Array?Float32Array:Array;function Pe(){var e=new xe(16);return xe!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Me(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function De(e,t,r,n,i,o,a,s,u,c,l,f,h,d,p,_){var v=new xe(16);return v[0]=e,v[1]=t,v[2]=r,v[3]=n,v[4]=i,v[5]=o,v[6]=a,v[7]=s,v[8]=u,v[9]=c,v[10]=l,v[11]=f,v[12]=h,v[13]=d,v[14]=p,v[15]=_,v}function Be(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Le=function(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],h=t[9],d=t[10],p=t[11],_=t[12],v=t[13],E=t[14],g=t[15],m=r[0],R=r[1],y=r[2],T=r[3];return e[0]=m*n+R*s+y*f+T*_,e[1]=m*i+R*u+y*h+T*v,e[2]=m*o+R*c+y*d+T*E,e[3]=m*a+R*l+y*p+T*g,e[4]=(m=r[4])*n+(R=r[5])*s+(y=r[6])*f+(T=r[7])*_,e[5]=m*i+R*u+y*h+T*v,e[6]=m*o+R*c+y*d+T*E,e[7]=m*a+R*l+y*p+T*g,e[8]=(m=r[8])*n+(R=r[9])*s+(y=r[10])*f+(T=r[11])*_,e[9]=m*i+R*u+y*h+T*v,e[10]=m*o+R*c+y*d+T*E,e[11]=m*a+R*l+y*p+T*g,e[12]=(m=r[12])*n+(R=r[13])*s+(y=r[14])*f+(T=r[15])*_,e[13]=m*i+R*u+y*h+T*v,e[14]=m*o+R*c+y*d+T*E,e[15]=m*a+R*l+y*p+T*g,e};function be(e,t,r){var n=new xe(3);return n[0]=e,n[1]=t,n[2]=r,n}var Fe,Ue;Fe=new xe(3),xe!=Float32Array&&(Fe[0]=0,Fe[1]=0,Fe[2]=0),Ue=Fe;var we,Ge,ke,Ve,We,Xe,He,je,Ye,Ke,ze,qe,Ze,Qe,Je,$e,et,tt,rt,nt,it,ot,at,st,ut,ct,lt;!function(){var e=function(){var e=new xe(2);return xe!=Float32Array&&(e[0]=0,e[1]=0),e}()}();function ft(e,t,r,n){return{dimension:Je.n2D,pixelFormat:e,width:t,height:r,depth:1,numLevels:n,usage:$e.Sampled}}function ht(e){return e}function dt(e,t,r){return e<<16|t<<8|r}function pt(e){return e>>>8&255}function _t(e){return e>>>16&255}function vt(e){return 255&e}function Et(e){switch(e){case at.F32:case at.U32:case at.S32:return 4;case at.U16:case at.S16:case at.F16:return 2;case at.U8:case at.S8:return 1;default:throw new Error("whoops")}}function gt(e){return Et(_t(e))}function mt(e){var t=vt(e);if(t&ut.Depth)return rt.Depth;if(t&ut.Normalized)return rt.Float;var r=_t(e);if(r===at.F16||r===at.F32)return rt.Float;if(r===at.U8||r===at.U16||r===at.U32)return rt.Uint;if(r===at.S8||r===at.S16||r===at.S32)return rt.Sint;throw new Error("whoops")}function Rt(e,t){if(void 0===t&&(t=""),!e)throw console.error((new Error).stack),new Error("Assert fail: "+t)}function yt(e){if(null!=e)return e;throw new Error("Missing object")}function Tt(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a}function At(e,t){e.r=t.r,e.g=t.g,e.b=t.b,e.a=t.a}function St(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}function Ct(e,t,r,n){return void 0===n&&(n=1),{r:e,g:t,b:r,a:n}}!function(e){e[e.Buffer=0]="Buffer",e[e.Texture=1]="Texture",e[e.RenderTarget=2]="RenderTarget",e[e.Sampler=3]="Sampler",e[e.Program=4]="Program",e[e.Bindings=5]="Bindings",e[e.InputLayout=6]="InputLayout",e[e.InputState=7]="InputState",e[e.RenderPipeline=8]="RenderPipeline",e[e.ComputePipeline=9]="ComputePipeline",e[e.Readback=10]="Readback",e[e.QueryPool=11]="QueryPool"}(we||(we={})),function(e){e[e.Never=512]="Never",e[e.Less=513]="Less",e[e.Equal=514]="Equal",e[e.LessEqual=515]="LessEqual",e[e.Greater=516]="Greater",e[e.NotEqual=517]="NotEqual",e[e.GreaterEqual=518]="GreaterEqual",e[e.Always=519]="Always"}(Ge||(Ge={})),function(e){e[e.CCW=2305]="CCW",e[e.CW=2304]="CW"}(ke||(ke={})),function(e){e[e.None=0]="None",e[e.Front=1]="Front",e[e.Back=2]="Back",e[e.FrontAndBack=3]="FrontAndBack"}(Ve||(Ve={})),function(e){e[e.Zero=0]="Zero",e[e.One=1]="One",e[e.Src=768]="Src",e[e.OneMinusSrc=769]="OneMinusSrc",e[e.Dst=774]="Dst",e[e.OneMinusDst=775]="OneMinusDst",e[e.SrcAlpha=770]="SrcAlpha",e[e.OneMinusSrcAlpha=771]="OneMinusSrcAlpha",e[e.DstAlpha=772]="DstAlpha",e[e.OneMinusDstAlpha=773]="OneMinusDstAlpha"}(We||(We={})),function(e){e[e.Add=32774]="Add",e[e.Subtract=32778]="Subtract",e[e.ReverseSubtract=32779]="ReverseSubtract"}(Xe||(Xe={})),function(e){e[e.Clamp=0]="Clamp",e[e.Repeat=1]="Repeat",e[e.Mirror=2]="Mirror"}(He||(He={})),function(e){e[e.Point=0]="Point",e[e.Bilinear=1]="Bilinear"}(je||(je={})),function(e){e[e.NoMip=0]="NoMip",e[e.Nearest=1]="Nearest",e[e.Linear=2]="Linear"}(Ye||(Ye={})),function(e){e[e.Points=0]="Points",e[e.Triangles=1]="Triangles",e[e.TriangleStrip=2]="TriangleStrip",e[e.Lines=3]="Lines",e[e.LineStrip=4]="LineStrip"}(Ke||(Ke={})),function(e){e[e.MAP_READ=1]="MAP_READ",e[e.MAP_WRITE=2]="MAP_WRITE",e[e.COPY_SRC=4]="COPY_SRC",e[e.COPY_DST=8]="COPY_DST",e[e.INDEX=16]="INDEX",e[e.VERTEX=32]="VERTEX",e[e.UNIFORM=64]="UNIFORM",e[e.STORAGE=128]="STORAGE",e[e.INDIRECT=256]="INDIRECT",e[e.QUERY_RESOLVE=512]="QUERY_RESOLVE"}(ze||(ze={})),function(e){e[e.Static=1]="Static",e[e.Dynamic=2]="Dynamic"}(qe||(qe={})),function(e){e[e.PerVertex=1]="PerVertex",e[e.PerInstance=2]="PerInstance"}(Ze||(Ze={})),function(e){e.LOADED="loaded"}(Qe||(Qe={})),function(e){e[e.n2D=0]="n2D",e[e.n2DArray=1]="n2DArray",e[e.n3D=2]="n3D",e[e.Cube=3]="Cube"}(Je||(Je={})),function(e){e[e.Sampled=1]="Sampled",e[e.RenderTarget=2]="RenderTarget"}($e||($e={})),function(e){e[e.None=0]="None",e[e.Red=1]="Red",e[e.Green=2]="Green",e[e.Blue=4]="Blue",e[e.Alpha=8]="Alpha",e[e.RGB=7]="RGB",e[e.AllChannels=15]="AllChannels"}(et||(et={})),function(e){e[e.Keep=7680]="Keep",e[e.Zero=0]="Zero",e[e.Replace=7681]="Replace",e[e.Invert=5386]="Invert",e[e.IncrementClamp=7682]="IncrementClamp",e[e.DecrementClamp=7683]="DecrementClamp",e[e.IncrementWrap=34055]="IncrementWrap",e[e.DecrementWrap=34056]="DecrementWrap"}(tt||(tt={})),function(e){e[e.Float=0]="Float",e[e.Uint=1]="Uint",e[e.Sint=2]="Sint",e[e.Depth=3]="Depth"}(rt||(rt={})),function(e){e[e.LowerLeft=0]="LowerLeft",e[e.UpperLeft=1]="UpperLeft"}(nt||(nt={})),function(e){e[e.NegativeOne=0]="NegativeOne",e[e.Zero=1]="Zero"}(it||(it={})),function(e){e[e.OcclusionConservative=0]="OcclusionConservative"}(ot||(ot={})),function(e){e[e.U8=1]="U8",e[e.U16=2]="U16",e[e.U32=3]="U32",e[e.S8=4]="S8",e[e.S16=5]="S16",e[e.S32=6]="S32",e[e.F16=7]="F16",e[e.F32=8]="F32",e[e.BC1=65]="BC1",e[e.BC2=66]="BC2",e[e.BC3=67]="BC3",e[e.BC4_UNORM=68]="BC4_UNORM",e[e.BC4_SNORM=69]="BC4_SNORM",e[e.BC5_UNORM=70]="BC5_UNORM",e[e.BC5_SNORM=71]="BC5_SNORM",e[e.U16_PACKED_5551=97]="U16_PACKED_5551",e[e.D24=129]="D24",e[e.D32F=130]="D32F",e[e.D24S8=131]="D24S8",e[e.D32FS8=132]="D32FS8"}(at||(at={})),function(e){e[e.R=1]="R",e[e.RG=2]="RG",e[e.RGB=3]="RGB",e[e.RGBA=4]="RGBA",e[e.A=5]="A"}(st||(st={})),function(e){e[e.None=0]="None",e[e.Normalized=1]="Normalized",e[e.sRGB=2]="sRGB",e[e.Depth=4]="Depth",e[e.Stencil=8]="Stencil",e[e.RenderTarget=16]="RenderTarget"}(ut||(ut={})),function(e){e[e.ALPHA=dt(at.U8,st.A,ut.None)]="ALPHA",e[e.F16_R=dt(at.F16,st.R,ut.None)]="F16_R",e[e.F16_RG=dt(at.F16,st.RG,ut.None)]="F16_RG",e[e.F16_RGB=dt(at.F16,st.RGB,ut.None)]="F16_RGB",e[e.F16_RGBA=dt(at.F16,st.RGBA,ut.None)]="F16_RGBA",e[e.F32_R=dt(at.F32,st.R,ut.None)]="F32_R",e[e.F32_RG=dt(at.F32,st.RG,ut.None)]="F32_RG",e[e.F32_RGB=dt(at.F32,st.RGB,ut.None)]="F32_RGB",e[e.F32_RGBA=dt(at.F32,st.RGBA,ut.None)]="F32_RGBA",e[e.U8_R=dt(at.U8,st.R,ut.None)]="U8_R",e[e.U8_R_NORM=dt(at.U8,st.R,ut.Normalized)]="U8_R_NORM",e[e.U8_RG=dt(at.U8,st.RG,ut.None)]="U8_RG",e[e.U8_RG_NORM=dt(at.U8,st.RG,ut.Normalized)]="U8_RG_NORM",e[e.U8_RGB=dt(at.U8,st.RGB,ut.None)]="U8_RGB",e[e.U8_RGB_NORM=dt(at.U8,st.RGB,ut.Normalized)]="U8_RGB_NORM",e[e.U8_RGB_SRGB=dt(at.U8,st.RGB,ut.sRGB|ut.Normalized)]="U8_RGB_SRGB",e[e.U8_RGBA=dt(at.U8,st.RGBA,ut.None)]="U8_RGBA",e[e.U8_RGBA_NORM=dt(at.U8,st.RGBA,ut.Normalized)]="U8_RGBA_NORM",e[e.U8_RGBA_SRGB=dt(at.U8,st.RGBA,ut.sRGB|ut.Normalized)]="U8_RGBA_SRGB",e[e.U16_R=dt(at.U16,st.R,ut.None)]="U16_R",e[e.U16_R_NORM=dt(at.U16,st.R,ut.Normalized)]="U16_R_NORM",e[e.U16_RG_NORM=dt(at.U16,st.RG,ut.Normalized)]="U16_RG_NORM",e[e.U16_RGBA_NORM=dt(at.U16,st.RGBA,ut.Normalized)]="U16_RGBA_NORM",e[e.U16_RGB=dt(at.U16,st.RGB,ut.None)]="U16_RGB",e[e.U32_R=dt(at.U32,st.R,ut.None)]="U32_R",e[e.U32_RG=dt(at.U32,st.RG,ut.None)]="U32_RG",e[e.S8_R=dt(at.S8,st.R,ut.None)]="S8_R",e[e.S8_R_NORM=dt(at.S8,st.R,ut.Normalized)]="S8_R_NORM",e[e.S8_RG_NORM=dt(at.S8,st.RG,ut.Normalized)]="S8_RG_NORM",e[e.S8_RGB_NORM=dt(at.S8,st.RGB,ut.Normalized)]="S8_RGB_NORM",e[e.S8_RGBA_NORM=dt(at.S8,st.RGBA,ut.Normalized)]="S8_RGBA_NORM",e[e.S16_R=dt(at.S16,st.R,ut.None)]="S16_R",e[e.S16_RG=dt(at.S16,st.RG,ut.None)]="S16_RG",e[e.S16_RG_NORM=dt(at.S16,st.RG,ut.Normalized)]="S16_RG_NORM",e[e.S16_RGB_NORM=dt(at.S16,st.RGB,ut.Normalized)]="S16_RGB_NORM",e[e.S16_RGBA=dt(at.S16,st.RGBA,ut.None)]="S16_RGBA",e[e.S16_RGBA_NORM=dt(at.S16,st.RGBA,ut.Normalized)]="S16_RGBA_NORM",e[e.S32_R=dt(at.S32,st.R,ut.None)]="S32_R",e[e.U16_RGBA_5551=dt(at.U16_PACKED_5551,st.RGBA,ut.Normalized)]="U16_RGBA_5551",e[e.BC1=dt(at.BC1,st.RGBA,ut.Normalized)]="BC1",e[e.BC1_SRGB=dt(at.BC1,st.RGBA,ut.Normalized|ut.sRGB)]="BC1_SRGB",e[e.BC2=dt(at.BC2,st.RGBA,ut.Normalized)]="BC2",e[e.BC2_SRGB=dt(at.BC2,st.RGBA,ut.Normalized|ut.sRGB)]="BC2_SRGB",e[e.BC3=dt(at.BC3,st.RGBA,ut.Normalized)]="BC3",e[e.BC3_SRGB=dt(at.BC3,st.RGBA,ut.Normalized|ut.sRGB)]="BC3_SRGB",e[e.BC4_UNORM=dt(at.BC4_UNORM,st.R,ut.Normalized)]="BC4_UNORM",e[e.BC4_SNORM=dt(at.BC4_SNORM,st.R,ut.Normalized)]="BC4_SNORM",e[e.BC5_UNORM=dt(at.BC5_UNORM,st.RG,ut.Normalized)]="BC5_UNORM",e[e.BC5_SNORM=dt(at.BC5_SNORM,st.RG,ut.Normalized)]="BC5_SNORM",e[e.D24=dt(at.D24,st.R,ut.Depth)]="D24",e[e.D24_S8=dt(at.D24S8,st.RG,ut.Depth|ut.Stencil)]="D24_S8",e[e.D32F=dt(at.D32F,st.R,ut.Depth)]="D32F",e[e.D32F_S8=dt(at.D32FS8,st.RG,ut.Depth|ut.Stencil)]="D32F_S8",e[e.U8_RGB_RT=dt(at.U8,st.RGB,ut.RenderTarget|ut.Normalized)]="U8_RGB_RT",e[e.U8_RGBA_RT=dt(at.U8,st.RGBA,ut.RenderTarget|ut.Normalized)]="U8_RGBA_RT",e[e.U8_RGBA_RT_SRGB=dt(at.U8,st.RGBA,ut.RenderTarget|ut.Normalized|ut.sRGB)]="U8_RGBA_RT_SRGB"}(ct||(ct={})),function(e){e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",e[e.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",e[e.BLEND_EQUATION=32777]="BLEND_EQUATION",e[e.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",e[e.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",e[e.BLEND_DST_RGB=32968]="BLEND_DST_RGB",e[e.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",e[e.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",e[e.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",e[e.BLEND_COLOR=32773]="BLEND_COLOR",e[e.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",e[e.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",e[e.LINE_WIDTH=2849]="LINE_WIDTH",e[e.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",e[e.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",e[e.CULL_FACE_MODE=2885]="CULL_FACE_MODE",e[e.FRONT_FACE=2886]="FRONT_FACE",e[e.DEPTH_RANGE=2928]="DEPTH_RANGE",e[e.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",e[e.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",e[e.DEPTH_FUNC=2932]="DEPTH_FUNC",e[e.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",e[e.STENCIL_FUNC=2962]="STENCIL_FUNC",e[e.STENCIL_FAIL=2964]="STENCIL_FAIL",e[e.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",e[e.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",e[e.STENCIL_REF=2967]="STENCIL_REF",e[e.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",e[e.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",e[e.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",e[e.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",e[e.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",e[e.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",e[e.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",e[e.VIEWPORT=2978]="VIEWPORT",e[e.SCISSOR_BOX=3088]="SCISSOR_BOX",e[e.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",e[e.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",e[e.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",e[e.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",e[e.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",e[e.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",e[e.RED_BITS=3410]="RED_BITS",e[e.GREEN_BITS=3411]="GREEN_BITS",e[e.BLUE_BITS=3412]="BLUE_BITS",e[e.ALPHA_BITS=3413]="ALPHA_BITS",e[e.DEPTH_BITS=3414]="DEPTH_BITS",e[e.STENCIL_BITS=3415]="STENCIL_BITS",e[e.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",e[e.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",e[e.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",e[e.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",e[e.SAMPLES=32937]="SAMPLES",e[e.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",e[e.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",e[e.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",e[e.VENDOR=7936]="VENDOR",e[e.RENDERER=7937]="RENDERER",e[e.VERSION=7938]="VERSION",e[e.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",e[e.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",e[e.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.BUFFER_SIZE=34660]="BUFFER_SIZE",e[e.BUFFER_USAGE=34661]="BUFFER_USAGE",e[e.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",e[e.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",e[e.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",e[e.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",e[e.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",e[e.CULL_FACE=2884]="CULL_FACE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK",e[e.BLEND=3042]="BLEND",e[e.DEPTH_TEST=2929]="DEPTH_TEST",e[e.DITHER=3024]="DITHER",e[e.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",e[e.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",e[e.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",e[e.SCISSOR_TEST=3089]="SCISSOR_TEST",e[e.STENCIL_TEST=2960]="STENCIL_TEST",e[e.NO_ERROR=0]="NO_ERROR",e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",e[e.CW=2304]="CW",e[e.CCW=2305]="CCW",e[e.DONT_CARE=4352]="DONT_CARE",e[e.FASTEST=4353]="FASTEST",e[e.NICEST=4354]="NICEST",e[e.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DOUBLE=5130]="DOUBLE",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER",e[e.COMPILE_STATUS=35713]="COMPILE_STATUS",e[e.DELETE_STATUS=35712]="DELETE_STATUS",e[e.LINK_STATUS=35714]="LINK_STATUS",e[e.VALIDATE_STATUS=35715]="VALIDATE_STATUS",e[e.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",e[e.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",e[e.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",e[e.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",e[e.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",e[e.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",e[e.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",e[e.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",e[e.SHADER_TYPE=35663]="SHADER_TYPE",e[e.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",e[e.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",e[e.NEVER=512]="NEVER",e[e.ALWAYS=519]="ALWAYS",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.GEQUAL=518]="GEQUAL",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP",e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",e[e.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",e[e.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE=5890]="TEXTURE",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",e[e.TEXTURE0=33984]="TEXTURE0",e[e.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",e[e.REPEAT=10497]="REPEAT",e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",e[e.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.LOW_FLOAT=36336]="LOW_FLOAT",e[e.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",e[e.HIGH_FLOAT=36338]="HIGH_FLOAT",e[e.LOW_INT=36339]="LOW_INT",e[e.MEDIUM_INT=36340]="MEDIUM_INT",e[e.HIGH_INT=36341]="HIGH_INT",e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.RENDERBUFFER=36161]="RENDERBUFFER",e[e.RGBA4=32854]="RGBA4",e[e.RGB5_A1=32855]="RGB5_A1",e[e.RGB565=36194]="RGB565",e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX=6401]="STENCIL_INDEX",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",e[e.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",e[e.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",e[e.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",e[e.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",e[e.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",e[e.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",e[e.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",e[e.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",e[e.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",e[e.NONE=0]="NONE",e[e.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",e[e.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",e[e.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",e[e.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",e[e.READ_BUFFER=3074]="READ_BUFFER",e[e.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",e[e.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",e[e.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",e[e.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",e[e.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",e[e.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",e[e.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",e[e.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",e[e.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",e[e.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",e[e.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",e[e.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",e[e.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",e[e.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",e[e.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",e[e.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",e[e.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",e[e.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",e[e.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",e[e.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",e[e.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",e[e.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",e[e.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",e[e.RED=6403]="RED",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB10_A2=32857]="RGB10_A2",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",e[e.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",e[e.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",e[e.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",e[e.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",e[e.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",e[e.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",e[e.SRGB=35904]="SRGB",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",e[e.RGBA32F=34836]="RGBA32F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.RGB16F=34843]="RGB16F",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R16F=33325]="R16F",e[e.R32F=33326]="R32F",e[e.RG16F=33327]="RG16F",e[e.RG32F=33328]="RG32F",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2UI=36975]="RGB10_A2UI",e[e.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",e[e.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.RG=33319]="RG",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",e[e.CURRENT_QUERY=34917]="CURRENT_QUERY",e[e.QUERY_RESULT=34918]="QUERY_RESULT",e[e.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",e[e.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",e[e.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",e[e.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",e[e.DRAW_BUFFER0=34853]="DRAW_BUFFER0",e[e.DRAW_BUFFER1=34854]="DRAW_BUFFER1",e[e.DRAW_BUFFER2=34855]="DRAW_BUFFER2",e[e.DRAW_BUFFER3=34856]="DRAW_BUFFER3",e[e.DRAW_BUFFER4=34857]="DRAW_BUFFER4",e[e.DRAW_BUFFER5=34858]="DRAW_BUFFER5",e[e.DRAW_BUFFER6=34859]="DRAW_BUFFER6",e[e.DRAW_BUFFER7=34860]="DRAW_BUFFER7",e[e.DRAW_BUFFER8=34861]="DRAW_BUFFER8",e[e.DRAW_BUFFER9=34862]="DRAW_BUFFER9",e[e.DRAW_BUFFER10=34863]="DRAW_BUFFER10",e[e.DRAW_BUFFER11=34864]="DRAW_BUFFER11",e[e.DRAW_BUFFER12=34865]="DRAW_BUFFER12",e[e.DRAW_BUFFER13=34866]="DRAW_BUFFER13",e[e.DRAW_BUFFER14=34867]="DRAW_BUFFER14",e[e.DRAW_BUFFER15=34868]="DRAW_BUFFER15",e[e.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",e[e.MAX_SAMPLES=36183]="MAX_SAMPLES",e[e.SAMPLER_BINDING=35097]="SAMPLER_BINDING",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",e[e.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",e[e.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",e[e.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",e[e.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",e[e.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",e[e.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",e[e.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",e[e.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",e[e.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",e[e.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",e[e.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",e[e.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",e[e.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",e[e.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",e[e.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",e[e.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",e[e.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",e[e.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",e[e.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",e[e.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",e[e.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",e[e.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",e[e.UNIFORM_TYPE=35383]="UNIFORM_TYPE",e[e.UNIFORM_SIZE=35384]="UNIFORM_SIZE",e[e.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",e[e.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",e[e.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",e[e.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",e[e.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",e[e.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",e[e.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS",e[e.SYNC_FENCE=37142]="SYNC_FENCE",e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED",e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED",e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",e[e.COLOR=6144]="COLOR",e[e.DEPTH=6145]="DEPTH",e[e.STENCIL=6146]="STENCIL",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STREAM_COPY=35042]="STREAM_COPY",e[e.STATIC_READ=35045]="STATIC_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",e[e.INVALID_INDEX=4294967295]="INVALID_INDEX",e[e.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",e[e.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",e[e.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",e[e.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.UNSIGNED_INT_24_8_WEBGL=34042]="UNSIGNED_INT_24_8_WEBGL",e[e.HALF_FLOAT_OES=36193]="HALF_FLOAT_OES",e[e.RGBA32F_EXT=34836]="RGBA32F_EXT",e[e.RGB32F_EXT=34837]="RGB32F_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT",e[e.UNSIGNED_NORMALIZED_EXT=35863]="UNSIGNED_NORMALIZED_EXT",e[e.MIN_EXT=32775]="MIN_EXT",e[e.MAX_EXT=32776]="MAX_EXT",e[e.SRGB_EXT=35904]="SRGB_EXT",e[e.SRGB_ALPHA_EXT=35906]="SRGB_ALPHA_EXT",e[e.SRGB8_ALPHA8_EXT=35907]="SRGB8_ALPHA8_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT_OES=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT_OES",e[e.COLOR_ATTACHMENT0_WEBGL=36064]="COLOR_ATTACHMENT0_WEBGL",e[e.COLOR_ATTACHMENT1_WEBGL=36065]="COLOR_ATTACHMENT1_WEBGL",e[e.COLOR_ATTACHMENT2_WEBGL=36066]="COLOR_ATTACHMENT2_WEBGL",e[e.COLOR_ATTACHMENT3_WEBGL=36067]="COLOR_ATTACHMENT3_WEBGL",e[e.COLOR_ATTACHMENT4_WEBGL=36068]="COLOR_ATTACHMENT4_WEBGL",e[e.COLOR_ATTACHMENT5_WEBGL=36069]="COLOR_ATTACHMENT5_WEBGL",e[e.COLOR_ATTACHMENT6_WEBGL=36070]="COLOR_ATTACHMENT6_WEBGL",e[e.COLOR_ATTACHMENT7_WEBGL=36071]="COLOR_ATTACHMENT7_WEBGL",e[e.COLOR_ATTACHMENT8_WEBGL=36072]="COLOR_ATTACHMENT8_WEBGL",e[e.COLOR_ATTACHMENT9_WEBGL=36073]="COLOR_ATTACHMENT9_WEBGL",e[e.COLOR_ATTACHMENT10_WEBGL=36074]="COLOR_ATTACHMENT10_WEBGL",e[e.COLOR_ATTACHMENT11_WEBGL=36075]="COLOR_ATTACHMENT11_WEBGL",e[e.COLOR_ATTACHMENT12_WEBGL=36076]="COLOR_ATTACHMENT12_WEBGL",e[e.COLOR_ATTACHMENT13_WEBGL=36077]="COLOR_ATTACHMENT13_WEBGL",e[e.COLOR_ATTACHMENT14_WEBGL=36078]="COLOR_ATTACHMENT14_WEBGL",e[e.COLOR_ATTACHMENT15_WEBGL=36079]="COLOR_ATTACHMENT15_WEBGL",e[e.DRAW_BUFFER0_WEBGL=34853]="DRAW_BUFFER0_WEBGL",e[e.DRAW_BUFFER1_WEBGL=34854]="DRAW_BUFFER1_WEBGL",e[e.DRAW_BUFFER2_WEBGL=34855]="DRAW_BUFFER2_WEBGL",e[e.DRAW_BUFFER3_WEBGL=34856]="DRAW_BUFFER3_WEBGL",e[e.DRAW_BUFFER4_WEBGL=34857]="DRAW_BUFFER4_WEBGL",e[e.DRAW_BUFFER5_WEBGL=34858]="DRAW_BUFFER5_WEBGL",e[e.DRAW_BUFFER6_WEBGL=34859]="DRAW_BUFFER6_WEBGL",e[e.DRAW_BUFFER7_WEBGL=34860]="DRAW_BUFFER7_WEBGL",e[e.DRAW_BUFFER8_WEBGL=34861]="DRAW_BUFFER8_WEBGL",e[e.DRAW_BUFFER9_WEBGL=34862]="DRAW_BUFFER9_WEBGL",e[e.DRAW_BUFFER10_WEBGL=34863]="DRAW_BUFFER10_WEBGL",e[e.DRAW_BUFFER11_WEBGL=34864]="DRAW_BUFFER11_WEBGL",e[e.DRAW_BUFFER12_WEBGL=34865]="DRAW_BUFFER12_WEBGL",e[e.DRAW_BUFFER13_WEBGL=34866]="DRAW_BUFFER13_WEBGL",e[e.DRAW_BUFFER14_WEBGL=34867]="DRAW_BUFFER14_WEBGL",e[e.DRAW_BUFFER15_WEBGL=34868]="DRAW_BUFFER15_WEBGL",e[e.MAX_COLOR_ATTACHMENTS_WEBGL=36063]="MAX_COLOR_ATTACHMENTS_WEBGL",e[e.MAX_DRAW_BUFFERS_WEBGL=34852]="MAX_DRAW_BUFFERS_WEBGL",e[e.VERTEX_ARRAY_BINDING_OES=34229]="VERTEX_ARRAY_BINDING_OES",e[e.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",e[e.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",e[e.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",e[e.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",e[e.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",e[e.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",e[e.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT"}(lt||(lt={}));var Ot=Ct(0,0,0,0),It=Ct(0,0,0,1),Nt=Ct(1,1,1,0),xt=Ct(1,1,1,1),Pt=!0;function Mt(e,t){if(void 0===t&&(t=Pt),!t)return e;switch(e){case Ge.Less:return Ge.Greater;case Ge.LessEqual:return Ge.GreaterEqual;case Ge.GreaterEqual:return Ge.LessEqual;case Ge.Greater:return Ge.Less;default:return e}}function Dt(e,t){return null!=e?e:t}function Bt(e){return void 0===e?null:e}function Lt(e,t,r){e.length=t,e.fill(r)}function bt(e,t){var r=t-1;return e+r&~r}function Ft(e,t){return((e+t-1)/t|0)*t}function Ut(e,t,r){for(var n=0,i=e.length;i>n;){var o=n+(i-n>>>1);0>r(t,e[o])?i=o:n=o+1}return n}function wt(e,t,r){var n=Ut(e,t,r);e.splice(n,0,t)}function Gt(e,t,r){return r?e|=t:e&=~t,e}function kt(e,t){for(var r=new Array(e),n=0;e>n;n++)r[n]=t();return r}function Vt(e,t,r){for(void 0===r&&(r="0");t>e.length;)e=""+r+e;return e}function Wt(e,t){e.blendDstFactor=t.blendDstFactor,e.blendSrcFactor=t.blendSrcFactor,e.blendMode=t.blendMode}function Xt(e,t){return void 0===e&&(e={rgbBlendState:{},alphaBlendState:{},channelWriteMask:0}),Wt(e.rgbBlendState,t.rgbBlendState),Wt(e.alphaBlendState,t.alphaBlendState),e.channelWriteMask=t.channelWriteMask,e}function Ht(e,t){e.length!==t.length&&(e.length=t.length);for(var r=0;t.length>r;r++)e[r]=Xt(e[r],t[r])}function jt(e,t){void 0!==t.attachmentsState&&Ht(e.attachmentsState,t.attachmentsState),void 0!==t.blendConstant&&At(e.blendConstant,t.blendConstant),e.depthCompare=Dt(t.depthCompare,e.depthCompare),e.depthWrite=Dt(t.depthWrite,e.depthWrite),e.stencilCompare=Dt(t.stencilCompare,e.stencilCompare),e.stencilWrite=Dt(t.stencilWrite,e.stencilWrite),e.stencilPassOp=Dt(t.stencilPassOp,e.stencilPassOp),e.stencilRef=Dt(t.stencilRef,e.stencilRef),e.cullMode=Dt(t.cullMode,e.cullMode),e.frontFace=Dt(t.frontFace,e.frontFace),e.polygonOffset=Dt(t.polygonOffset,e.polygonOffset)}function Yt(e){var t=Object.assign({},e);return t.attachmentsState=[],Ht(t.attachmentsState,e.attachmentsState),t.blendConstant=St(t.blendConstant),t}function Kt(e,t){void 0!==t.channelWriteMask&&(e.channelWriteMask=t.channelWriteMask),void 0!==t.rgbBlendMode&&(e.rgbBlendState.blendMode=t.rgbBlendMode),void 0!==t.alphaBlendMode&&(e.alphaBlendState.blendMode=t.alphaBlendMode),void 0!==t.rgbBlendSrcFactor&&(e.rgbBlendState.blendSrcFactor=t.rgbBlendSrcFactor),void 0!==t.alphaBlendSrcFactor&&(e.alphaBlendState.blendSrcFactor=t.alphaBlendSrcFactor),void 0!==t.rgbBlendDstFactor&&(e.rgbBlendState.blendDstFactor=t.rgbBlendDstFactor),void 0!==t.alphaBlendDstFactor&&(e.alphaBlendState.blendDstFactor=t.alphaBlendDstFactor)}var zt={blendMode:Xe.Add,blendSrcFactor:We.One,blendDstFactor:We.Zero},qt={attachmentsState:[{channelWriteMask:et.RGB,rgbBlendState:zt,alphaBlendState:zt}],blendConstant:St(Ot),depthWrite:!0,depthCompare:Ge.LessEqual,stencilCompare:Ge.Always,stencilWrite:!1,stencilPassOp:tt.Keep,stencilRef:0,cullMode:Ve.None,frontFace:ke.CCW,polygonOffset:!1};function Zt(e,t){void 0===e&&(e=null),void 0===t&&(t=qt);var r=Yt(t);return null!==e&&jt(r,e),r}var Qt=Zt({depthCompare:Ge.Always,depthWrite:!1},qt);function Jt(e,t){return void 0===e.attachmentsState&&(e.attachmentsState=[],Ht(e.attachmentsState,qt.attachmentsState)),Kt(e.attachmentsState[0],t),e}var $t,er={formatKind:rt.Float,dimension:Je.n2D};function tr(e,t,r){if(e.length!==t.length)return!1;for(var n=0;e.length>n;n++)if(!r(e[n],t[n]))return!1;return!0}function rr(e,t){for(var r=Array(e.length),n=0;e.length>n;n++)r[n]=t(e[n]);return r}function nr(e,t){return e.buffer===t.buffer&&e.wordCount===t.wordCount}function ir(e,t){return null===e?null===t:null!==t&&(e.sampler===t.sampler&&e.texture===t.texture)}function or(e,t){return e.numSamplers===t.numSamplers&&e.numUniformBuffers===t.numUniformBuffers}function ar(e,t){return e.samplerBindings.length===t.samplerBindings.length&&(!!tr(e.samplerBindings,t.samplerBindings,ir)&&(!!tr(e.uniformBufferBindings,t.uniformBufferBindings,nr)&&!!cr(e.bindingLayout,t.bindingLayout)))}function sr(e,t){return e.blendMode==t.blendMode&&e.blendSrcFactor===t.blendSrcFactor&&e.blendDstFactor===t.blendDstFactor}function ur(e,t){return!!sr(e.rgbBlendState,t.rgbBlendState)&&(!!sr(e.alphaBlendState,t.alphaBlendState)&&e.channelWriteMask===t.channelWriteMask)}function cr(e,t){return e.numSamplers===t.numSamplers&&e.numUniformBuffers===t.numUniformBuffers}function lr(e,t){return e===t}function fr(e,t){return e.topology===t.topology&&(e.inputLayout===t.inputLayout&&(e.sampleCount===t.sampleCount&&(!!function(e,t){return!!tr(e.attachmentsState,t.attachmentsState,ur)&&!!Tt(e.blendConstant,t.blendConstant)&&e.depthCompare===t.depthCompare&&e.depthWrite===t.depthWrite&&e.stencilCompare===t.stencilCompare&&e.stencilWrite===t.stencilWrite&&e.stencilPassOp===t.stencilPassOp&&e.stencilRef===t.stencilRef&&e.cullMode===t.cullMode&&e.frontFace===t.frontFace&&e.polygonOffset===t.polygonOffset}(e.megaStateDescriptor,t.megaStateDescriptor)&&(!!function(e,t){return e.id===t.id}(e.program,t.program)&&(!!tr(e.bindingLayouts,t.bindingLayouts,cr)&&(!!tr(e.colorAttachmentFormats,t.colorAttachmentFormats,lr)&&e.depthStencilAttachmentFormat===t.depthStencilAttachmentFormat))))))}function hr(e,t){return e.bufferIndex===t.bufferIndex&&e.bufferByteOffset===t.bufferByteOffset&&e.location===t.location&&e.format===t.format}function dr(e,t){return p(e)?p(t):!p(t)&&(e.byteStride===t.byteStride&&e.frequency===t.frequency)}function pr(e,t){return e.indexBufferFormat===t.indexBufferFormat&&(!!tr(e.vertexBufferDescriptors,t.vertexBufferDescriptors,dr)&&!!tr(e.vertexAttributeDescriptors,t.vertexAttributeDescriptors,hr))}function _r(e,t){return e.wrapS===t.wrapS&&e.wrapT===t.wrapT&&e.minFilter===t.minFilter&&e.magFilter===t.magFilter&&e.mipFilter===t.mipFilter&&e.minLOD===t.minLOD&&e.maxLOD===t.maxLOD&&e.maxAnisotropy===t.maxAnisotropy&&e.compareMode===t.compareMode}function vr(e){return{sampler:e.sampler,texture:e.texture,lateBinding:e.lateBinding}}function Er(e){return{buffer:e.buffer,wordCount:e.wordCount}}function gr(e){return{bindingLayout:e.bindingLayout,samplerBindings:rr(e.samplerBindings,vr),uniformBufferBindings:rr(e.uniformBufferBindings,Er),pipeline:e.pipeline}}function mr(e){return{dimension:e.dimension,formatKind:e.formatKind}}function Rr(e){return{numSamplers:e.numSamplers,numUniformBuffers:e.numUniformBuffers,samplerEntries:void 0!==e.samplerEntries?rr(e.samplerEntries,mr):void 0}}function yr(e){var t=rr(e.bindingLayouts,Rr),r=e.program,n=e.topology;return{bindingLayouts:t,inputLayout:e.inputLayout,megaStateDescriptor:Yt(e.megaStateDescriptor),program:r,topology:n,colorAttachmentFormats:e.colorAttachmentFormats.slice(),depthStencilAttachmentFormat:e.depthStencilAttachmentFormat,sampleCount:e.sampleCount}}function Tr(e){return{location:e.location,format:e.format,bufferIndex:e.bufferIndex,bufferByteOffset:e.bufferByteOffset,byteStride:e.byteStride,divisor:e.divisor}}function Ar(e){return p(e)?e:{byteStride:e.byteStride,frequency:e.frequency}}function Sr(e){return{vertexAttributeDescriptors:rr(e.vertexAttributeDescriptors,Tr),vertexBufferDescriptors:rr(e.vertexBufferDescriptors,Ar),indexBufferFormat:e.indexBufferFormat}}!function(e){e[e.LITTLE_ENDIAN=0]="LITTLE_ENDIAN",e[e.BIG_ENDIAN=1]="BIG_ENDIAN"}($t||($t={}));var Cr,Or=new Uint16Array([65279]),Ir=255==new DataView(Or.buffer).getUint8(0)?$t.LITTLE_ENDIAN:$t.BIG_ENDIAN;var Nr=/([^[]*)(\[[0-9]+\])?/;function xr(){var e=null;return function(t,r,n){var i=e!==n;return i&&(t.uniform1i(r,n),e=n),i}}function Pr(e,t,r,n){var i=null,o=null;return function(a,s,u){var c=t(u,r),l=c.length,f=!1;if(null===i)i=new Float32Array(l),o=l,f=!0;else{Rt(o===l,"Uniform length cannot change.");for(var h=0;l>h;++h)if(c[h]!==i[h]){f=!0;break}}return f&&(n(a,e,s,c),i.set(c)),f}}function Mr(e,t,r,n){e[t](r,n)}function Dr(e,t,r,n){e[t](r,!1,n)}var Br={},Lr={},br={},Fr=[0];function Ur(e,t,r,n){1===t&&"boolean"==typeof e&&(e=e?1:0),Number.isFinite(e)&&(Fr[0]=e,e=Fr);var i=e.length;if(e instanceof r)return e;var o=n[i];o||(o=new r(i),n[i]=o);for(var a=0;i>a;a++)o[a]=e[a];return o}function wr(e,t){return Ur(e,t,Float32Array,Br)}function Gr(e,t){return Ur(e,t,Int32Array,Lr)}function kr(e,t){return Ur(e,t,Uint32Array,br)}var Vr,Wr=((Cr={})[lt.FLOAT]=Pr.bind(null,"uniform1fv",wr,1,Mr),Cr[lt.FLOAT_VEC2]=Pr.bind(null,"uniform2fv",wr,2,Mr),Cr[lt.FLOAT_VEC3]=Pr.bind(null,"uniform3fv",wr,3,Mr),Cr[lt.FLOAT_VEC4]=Pr.bind(null,"uniform4fv",wr,4,Mr),Cr[lt.INT]=Pr.bind(null,"uniform1iv",Gr,1,Mr),Cr[lt.INT_VEC2]=Pr.bind(null,"uniform2iv",Gr,2,Mr),Cr[lt.INT_VEC3]=Pr.bind(null,"uniform3iv",Gr,3,Mr),Cr[lt.INT_VEC4]=Pr.bind(null,"uniform4iv",Gr,4,Mr),Cr[lt.BOOL]=Pr.bind(null,"uniform1iv",Gr,1,Mr),Cr[lt.BOOL_VEC2]=Pr.bind(null,"uniform2iv",Gr,2,Mr),Cr[lt.BOOL_VEC3]=Pr.bind(null,"uniform3iv",Gr,3,Mr),Cr[lt.BOOL_VEC4]=Pr.bind(null,"uniform4iv",Gr,4,Mr),Cr[lt.FLOAT_MAT2]=Pr.bind(null,"uniformMatrix2fv",wr,4,Dr),Cr[lt.FLOAT_MAT3]=Pr.bind(null,"uniformMatrix3fv",wr,9,Dr),Cr[lt.FLOAT_MAT4]=Pr.bind(null,"uniformMatrix4fv",wr,16,Dr),Cr[lt.SAMPLER_2D]=xr,Cr[lt.SAMPLER_CUBE]=xr,Cr[lt.UNSIGNED_INT]=Pr.bind(null,"uniform1uiv",kr,1,Mr),Cr[lt.UNSIGNED_INT_VEC2]=Pr.bind(null,"uniform2uiv",kr,2,Mr),Cr[lt.UNSIGNED_INT_VEC3]=Pr.bind(null,"uniform3uiv",kr,3,Mr),Cr[lt.UNSIGNED_INT_VEC4]=Pr.bind(null,"uniform4uiv",kr,4,Mr),Cr[lt.FLOAT_MAT2x3]=Pr.bind(null,"uniformMatrix2x3fv",wr,6,Dr),Cr[lt.FLOAT_MAT2x4]=Pr.bind(null,"uniformMatrix2x4fv",wr,8,Dr),Cr[lt.FLOAT_MAT3x2]=Pr.bind(null,"uniformMatrix3x2fv",wr,6,Dr),Cr[lt.FLOAT_MAT3x4]=Pr.bind(null,"uniformMatrix3x4fv",wr,12,Dr),Cr[lt.FLOAT_MAT4x2]=Pr.bind(null,"uniformMatrix4x2fv",wr,8,Dr),Cr[lt.FLOAT_MAT4x3]=Pr.bind(null,"uniformMatrix4x3fv",wr,12,Dr),Cr[lt.SAMPLER_2D]=xr,Cr[lt.SAMPLER_CUBE]=xr,Cr[lt.SAMPLER_3D]=xr,Cr[lt.SAMPLER_2D_SHADOW]=xr,Cr[lt.SAMPLER_2D_ARRAY]=xr,Cr[lt.SAMPLER_2D_ARRAY_SHADOW]=xr,Cr[lt.SAMPLER_CUBE_SHADOW]=xr,Cr[lt.INT_SAMPLER_2D]=xr,Cr[lt.INT_SAMPLER_3D]=xr,Cr[lt.INT_SAMPLER_CUBE]=xr,Cr[lt.INT_SAMPLER_2D_ARRAY]=xr,Cr[lt.UNSIGNED_INT_SAMPLER_2D]=xr,Cr[lt.UNSIGNED_INT_SAMPLER_3D]=xr,Cr[lt.UNSIGNED_INT_SAMPLER_CUBE]=xr,Cr[lt.UNSIGNED_INT_SAMPLER_2D_ARRAY]=xr,Cr);function Xr(e,t,r){var n=e.createBuffer({viewOrSize:bt(r.byteLength,4)/4,usage:t,hint:qe.Static});return n.setSubData(0,new Uint8Array(r)),n}!function(e){e.CHANGED="changed"}(Vr||(Vr={}));var Hr,jr=function(e){function r(t,r){var n;return void 0===r&&(r={}),(n=e.call(this)||this).device=void 0,n.props=void 0,n.drawMode=Ke.Triangles,n.vertexBuffers=[],n.vertices=[],n.indexBuffer=void 0,n.indices=void 0,n.inputLayoutDescriptor={vertexBufferDescriptors:[],vertexAttributeDescriptors:[],indexBufferFormat:ct.U32_R},n.vertexCount=0,n.instancedCount=0,n.indexStart=0,n.primitiveStart=0,n.dirty=!0,n.meshes=[],n.device=t,n.props=r,n}me(r,e);var n=r.prototype;return n.validate=function(e){return!0},n.build=function(e){},n.computeBoundingBox=function(){return new t.AABB},n.setIndexBuffer=function(e){return this.indexBuffer&&this.indexBuffer.destroy(),this.indexBuffer=Xr(this.device,ze.INDEX|ze.COPY_DST,new Uint32Array(ArrayBuffer.isView(e)?e.buffer:e).buffer),this.indices=e,this},n.setVertexBuffer=function(e){var t=this,r=e.bufferIndex,n=e.attributes,i=e.data;this.inputLayoutDescriptor.vertexBufferDescriptors[r]={byteStride:e.byteStride,frequency:e.frequency},this.vertices[r]=i,n.forEach((function(e){var n=e.format,i=e.bufferByteOffset,o=e.location,a=e.divisor,s=e.byteStride,u=t.inputLayoutDescriptor.vertexAttributeDescriptors.find((function(e){return e.bufferIndex===r&&e.location===o}));u?(u.format=n,u.bufferByteOffset=i,u.byteStride=s,u.divisor=a):t.inputLayoutDescriptor.vertexAttributeDescriptors.push({format:n,bufferIndex:r,bufferByteOffset:i,location:o,byteStride:s,divisor:a})})),this.vertexBuffers[r]&&this.vertexBuffers[r].destroy();var o=Xr(this.device,ze.VERTEX|ze.COPY_DST,i.buffer);return this.vertexBuffers[r]=o,this},n.getVertexBuffer=function(e){return this.vertexBuffers[e]},n.updateVertexBuffer=function(e,t,r,n){var i=this.inputLayoutDescriptor.vertexBufferDescriptors[e].byteStride,o=this.inputLayoutDescriptor.vertexAttributeDescriptors.find((function(e){return e.location===t}));o&&this.getVertexBuffer(e).setSubData(o.bufferByteOffset+r*i,n);this.emit(Vr.CHANGED)},n.updateIndices=function(e,t){return void 0===t&&(t=0),this.indexBuffer&&this.indexBuffer.setSubData(t,ArrayBuffer.isView(e)?e:new Uint32Array(e)),this},n.destroy=function(){this.vertexBuffers.forEach((function(e){e&&e.destroy()})),this.indexBuffer&&this.indexBuffer.destroy(),this.inputLayoutDescriptor.vertexAttributeDescriptors=[],this.inputLayoutDescriptor.vertexBufferDescriptors=[],this.indexBuffer=void 0,this.vertexBuffers=[],this.indices=void 0,this.vertices=[],this.vertexCount=0,this.instancedCount=0},r}(f.EventEmitter),Yr=[[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]];function Kr(e,t){return"#define "+e+" "+t}function zr(e){var t=[],r=[];return e.replace(/\s*struct\s*(.*)\s*{((?:\s*.*\s*)*?)};/g,(function(e,t,n){var i=[];return n.trim().split("\n").forEach((function(e){var t=e.trim().split(/\s+/),r=t[1];i.push({type:t[0].trim(),name:r.replace(";","").trim()})})),r.push({type:t.trim(),uniforms:i}),""})),e.replace(/\s*uniform\s*.*\s*{((?:\s*.*\s*)*?)};/g,(function(e,n){return n.trim().split("\n").forEach((function(e){var n=e.trim().split(" "),i=n[0]||"",o=n[1]||"",a=o.indexOf("[")>-1;if(o=o.replace(";","").replace("[","").trim(),!i.startsWith("#")){if(i){var s=r.find((function(e){return i===e.type}));if(s)if(a)for(var u=function(e){s.uniforms.forEach((function(r){t.push(o+"["+e+"]."+r.name)}))},c=0;5>c;c++)u(c);else s.uniforms.forEach((function(e){t.push(o+"."+e.name)}))}o&&t.push(o)}})),""})),t}function qr(e,t,r,n,i){void 0===n&&(n=null);var o="#version 100"===e.glslVersion,a=r.split("\n").map((function(e){return e.replace(/[/][/].*$/,"")})).filter((function(e){return!(!e||/^\s+$/.test(e))})),s="";null!==n&&(s=Object.keys(n).map((function(e){return Kr(e,n[e])})).join("\n"));var u=a.find((function(e){return e.startsWith("precision")}))||"precision mediump float;",c=a.filter((function(e){return!e.startsWith("precision")})).join("\n"),l="";if(e.viewportOrigin===nt.UpperLeft&&(l+=Kr("VIEWPORT_ORIGIN_TL","1")+"\n"),e.clipSpaceNearZ===it.Zero&&(l+=Kr("CLIPSPACE_NEAR_ZERO","1")+"\n"),e.explicitBindingLocations){var f=0,h=0,d=0;c=c.replace(/^(layout\((.*)\))?\s*uniform(.+{)$/gm,(function(e,t,r,n){return"layout("+(r?r+", ":"")+"set = "+f+", binding = "+h+++") uniform "+n})),f++,h=0,Rt(e.separateSamplerTextures),c=(c=c.replace(/uniform sampler2D (.*);/g,(function(e,r){return"frag"===t?"\nlayout(set = "+f+", binding = "+h+++") uniform texture2D T_"+r+";\nlayout(set = "+f+", binding = "+h+++") uniform sampler S_"+r+";\n":""}))).replace("frag"===t?/^\b(varying|in)\b/gm:/^\b(varying|out)\b/gm,(function(e,t){return"layout(location = "+d+++") "+t})),l+=Kr("gl_VertexID","gl_VertexIndex")+"\n"}c=e.separateSamplerTextures?(c=(c=(c=c.replace(/\bPD_SAMPLER_2D\((.*?)\)/g,(function(e,t){return"texture2D T_P_"+t+", sampler S_P_"+t}))).replace(/\bPU_SAMPLER_2D\((.*?)\)/g,(function(e,t){return"SAMPLER_2D(P_"+t+")"}))).replace(/\bPP_SAMPLER_2D\((.*?)\)/g,(function(e,t){return"T_"+t+", S_"+t}))).replace(/\bSAMPLER_2D\((.*?)\)/g,(function(e,t){return"sampler2D(T_"+t+", S_"+t+")"})):(c=(c=(c=c.replace(/\bPD_SAMPLER_2D\((.*?)\)/g,(function(e,t){return"sampler2D P_"+t}))).replace(/\bPU_SAMPLER_2D\((.*?)\)/g,(function(e,t){return"SAMPLER_2D(P_"+t+")"}))).replace(/\bPP_SAMPLER_2D\((.*?)\)/g,(function(e,t){return t}))).replace(/\bSAMPLER_2D\((.*?)\)/g,(function(e,t){return t}));var p=((o?"":e.glslVersion)+"\n\n"+(o&&"frag"===t?"#extension GL_OES_standard_derivatives : enable":"")+"\n"+u+"\n"+l+"\n"+s+"\n"+c+"\n").trim();if(e.explicitBindingLocations&&"frag"===t&&(p=p.replace(/^\b(out)\b/gm,(function(e,t){return"layout(location = 0) "+t}))),o){if("frag"===t&&(p=p.replace(/^\s*in\s+(\S+)\s*(.*);$/gm,(function(e,t,r){return"varying "+t+" "+r+";\n"}))),"vert"===t&&(p=(p=p.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,(function(e,t,r){return"varying "+t+" "+r+";\n"}))).replace(/^\s*layout\(location\s*=\s*\S*\)\s*in\s+(\S+)\s*(.*);$/gm,(function(e,t,r){return"attribute "+t+" "+r+";\n"}))),p=p.replace(/\s*uniform\s*.*\s*{((?:\s*.*\s*)*?)};/g,(function(e,t){return t.trim().replace(/^.*$/gm,(function(e){var t=e.trim();return t.startsWith("#")?t:e?"uniform "+t:""}))})),"frag"===t){var _,v=(p=p.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,(function(e,t,r){return _=r,t+" "+r+";\n"}))).lastIndexOf("}");p=p.substring(0,v)+"\n gl_FragColor = vec4("+_+");\n"+p.substring(v)}p=p.replace(/^\s*layout\((.*)\)/gm,"");for(var E,g=Se(Yr);!(E=g()).done;){var m=E.value;p=p.replace(m[0],m[1])}}return p}function Zr(e,t,r,n,i){return void 0===n&&(n=null),{vert:t,frag:r,preprocessedVert:qr(e,"vert",t,n),preprocessedFrag:qr(e,"frag",r,n)}}function Qr(e,t){var r=void 0!==t.defines?t.defines:null,n=void 0!==t.both?t.both+t.vert:t.vert,i=void 0!==t.both?t.both+t.frag:t.frag;return Zr(e.queryVendorInfo(),n,i,r)}!function(e){e.CHANGED="changed"}(Hr||(Hr={}));var Jr=function(e){function t(t,r){var n;(n=e.call(this)||this).device=void 0,n.props={},n.meshes=[],n.defines={},n.uniforms={},n.uniformNames=void 0,n.uboBuffer=[],n.textures={},n.samplers=[],n.programDirty=!0,n.textureDirty=!0,n.geometryDirty=!0;var i=Yt(qt),o=i.cullMode,a=i.depthCompare,s=i.depthWrite,u=i.stencilCompare,c=i.stencilWrite,l=i.stencilPassOp,f=i.frontFace,h=i.polygonOffset,d=i.attachmentsState;return n.device=t,n.props=ge({cullMode:o,depthTest:!0,depthCompare:a,depthWrite:s,stencilCompare:u,stencilWrite:c,stencilPassOp:l,frontFace:f,polygonOffset:h,attachmentsState:d,dithering:!1,wireframe:!1,wireframeColor:"black",wireframeLineWidth:1,vertexShader:"",fragmentShader:""},r),n.compile(),n}me(t,e);var r=t.prototype;return r.compile=function(){var e=this;this.props.fragmentShader.replace(/^\s*uniform\s*sampler2D\s*(.*)\s*;$/gm,(function(t,r){return e.samplers.push(r),""})),this.uniformNames=zr(this.props.fragmentShader)},r.setUniforms=function(e){var t=this,r=!1;Object.keys(e).forEach((function(n){var i,o=e[n],a=t.textures[n];a&&a!==o&&(t.textureDirty=!0),(i=o)&&i.type?(t.textures[n]=o,t.textureDirty=!0,o.on(Qe.LOADED,(function(){t.dispatchMutationEvent()}))):(t.uniforms[n]=o,r=!0),p(e[n])&&(delete t.textures[n],delete t.uniforms[n])})),r&&this.dispatchMutationEvent()},r.dispatchMutationEvent=function(){this.emit(Hr.CHANGED)},Ee(t,[{key:"cullMode",get:function(){return this.props.cullMode},set:function(e){this.props.cullMode=e}},{key:"frontFace",get:function(){return this.props.frontFace},set:function(e){this.props.frontFace=e}},{key:"blendConstant",get:function(){return this.props.blendConstant},set:function(e){this.props.blendConstant=e}},{key:"blendEquation",get:function(){return this.props.blendEquation},set:function(e){this.props.blendEquation=e}},{key:"blendEquationAlpha",get:function(){return this.props.blendEquationAlpha},set:function(e){this.props.blendEquationAlpha=e}},{key:"blendSrc",get:function(){return this.props.blendSrc},set:function(e){this.props.blendSrc=e}},{key:"blendDst",get:function(){return this.props.blendDst},set:function(e){this.props.blendDst=e}},{key:"blendSrcAlpha",get:function(){return this.props.blendSrcAlpha},set:function(e){this.props.blendSrcAlpha=e}},{key:"blendDstAlpha",get:function(){return this.props.blendDstAlpha},set:function(e){this.props.blendDstAlpha=e}},{key:"depthCompare",get:function(){return this.props.depthCompare},set:function(e){this.props.depthCompare=e}},{key:"depthTest",get:function(){return this.props.depthTest},set:function(e){this.props.depthTest=e}},{key:"depthWrite",get:function(){return this.props.depthWrite},set:function(e){this.props.depthWrite=e}},{key:"stencilCompare",get:function(){return this.props.stencilCompare},set:function(e){this.props.stencilCompare=e}},{key:"stencilWrite",get:function(){return this.props.stencilWrite},set:function(e){this.props.stencilWrite=e}},{key:"stencilPassOp",get:function(){return this.props.stencilPassOp},set:function(e){this.props.stencilPassOp=e}},{key:"stencilRef",get:function(){return this.props.stencilRef},set:function(e){this.props.stencilRef=e}},{key:"polygonOffset",get:function(){return this.props.polygonOffset},set:function(e){this.props.polygonOffset=e}},{key:"dithering",get:function(){return this.props.dithering},set:function(e){this.props.dithering=e}},{key:"wireframe",get:function(){return this.props.wireframe},set:function(e){this.props.wireframe!==e&&(this.geometryDirty=!0,this.programDirty=!0,this.props.wireframe=e,this.dispatchMutationEvent()),this.defines.USE_WIREFRAME=!!e}},{key:"wireframeColor",get:function(){return this.props.wireframeColor},set:function(e){this.props.wireframeColor=e}},{key:"wireframeLineWidth",get:function(){return this.props.wireframeLineWidth},set:function(e){this.props.wireframeLineWidth=e}},{key:"vertexShader",get:function(){return this.props.vertexShader},set:function(e){this.props.vertexShader!==e&&(this.programDirty=!0,this.props.vertexShader=e,this.compile())}},{key:"fragmentShader",get:function(){return this.props.fragmentShader},set:function(e){this.props.fragmentShader!==e&&(this.programDirty=!0,this.props.fragmentShader=e,this.compile())}}]),t}(f.EventEmitter),$r=function(e){function t(t,r){var n;return(n=e.call(this,t,ge({},r))||this).defines=ge({},n.defines,{USE_UV:!1,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1,USE_LIGHT:!1}),n}return me(t,e),t}(Jr),en=function(){function e(){this.name="(unnamed)",this.preprocessedVert="",this.preprocessedFrag="",this.both="",this.vert="",this.frag="",this.defines={},this.features={MRT:!0}}var t=e.prototype;return t.definesChanged=function(){this.preprocessedVert="",this.preprocessedFrag=""},t.setDefineString=function(e,t){if(null!==t){if(this.defines[e]===t)return!1;this.defines[e]=t}else{if(p(this.defines[e]))return!1;delete this.defines[e]}return this.definesChanged(),!0},t.setDefineBool=function(e,t){return this.setDefineString(e,t?"1":null)},t.getDefineString=function(e){return Bt(this.defines[e])},t.getDefineBool=function(e){var t=this.getDefineString(e);return null!==t&&Rt("1"===t),null!==t},t.ensurePreprocessed=function(e){""===this.preprocessedVert&&(this.preprocessedVert=qr(e,"vert",this.both+this.vert,this.defines),this.preprocessedFrag=qr(e,"frag",this.both+this.frag,this.defines))},e}(),tn=function(){function e(e){this.device=void 0,this.uniformBufferWordAlignment=void 0,this.uniformBufferMaxPageWordSize=void 0,this.currentBufferWordSize=-1,this.currentWordOffset=0,this.buffer=null,this.shadowBufferF32=null,this.shadowBufferU8=null,this.device=e;var t=e.queryLimits();this.uniformBufferWordAlignment=t.uniformBufferWordAlignment,this.uniformBufferMaxPageWordSize=t.uniformBufferMaxPageWordSize}var t=e.prototype;return t.isSupportedUBO=function(){return"WebGL1"!==this.device.queryVendorInfo().platformString},t.findPageIndex=function(e){return e/this.uniformBufferMaxPageWordSize|0},t.allocateChunk=function(e){e=Ft(e,this.uniformBufferWordAlignment),Rt(this.uniformBufferMaxPageWordSize>e);var t=this.currentWordOffset;return this.findPageIndex(t)!==this.findPageIndex(t+e-1)&&(t=Ft(t,this.uniformBufferMaxPageWordSize)),this.currentWordOffset=t+e,this.ensureShadowBuffer(t,e),t},t.ensureShadowBuffer=function(e,t){if(null===this.shadowBufferU8||null===this.shadowBufferF32){var r=Ft(this.currentWordOffset,this.uniformBufferMaxPageWordSize);this.shadowBufferU8=new Uint8Array(4*r),this.shadowBufferF32=new Float32Array(this.shadowBufferU8.buffer)}else if(e+t>=this.shadowBufferF32.length){Rt(this.currentWordOffset>e&&this.currentWordOffset>=e+t);var n=Ft(Math.max(this.currentWordOffset,2*this.shadowBufferF32.length),this.uniformBufferMaxPageWordSize),i=new Uint8Array(4*n);if(i.set(this.shadowBufferU8,0),this.shadowBufferU8=i,this.shadowBufferF32=new Float32Array(this.shadowBufferU8.buffer),n<this.currentWordOffset)throw new Error("Assert fail: this.currentWordOffset ["+this.currentWordOffset+"] <= newWordCount ["+n+"]")}},t.mapBufferF32=function(){return yt(this.shadowBufferF32)},t.prepareToRender=function(){if(null!==this.shadowBufferF32){var e=yt(this.shadowBufferF32);e.length!==this.currentBufferWordSize&&(this.currentBufferWordSize=e.length,null!==this.buffer&&this.buffer.destroy(),this.buffer=this.device.createBuffer({viewOrSize:this.currentBufferWordSize,usage:ze.UNIFORM|ze.COPY_DST,hint:qe.Dynamic}));var t=Ft(this.currentWordOffset,this.uniformBufferMaxPageWordSize);if(this.currentBufferWordSize<t)throw new Error("Assert fail: wordCount ["+t+"] ("+this.currentWordOffset+" aligned "+this.uniformBufferMaxPageWordSize+") <= this.currentBufferWordSize ["+this.currentBufferWordSize+"]");if(this.isSupportedUBO())yt(this.buffer).setSubData(0,this.shadowBufferU8,0,4*t);this.currentWordOffset=0}},t.destroy=function(){null!==this.buffer&&this.buffer.destroy(),this.shadowBufferF32=null,this.shadowBufferU8=null},e}();function rn(e,t){return e+=t,e+=e<<10,(e+=e>>>6)>>>0}function nn(e){return e+=e<<3,e^=e>>>11,(e+=e<<15)>>>0}function on(e){return 0}var an=function(){this.keys=[],this.values=[]},sn=function(){function e(e,t){this.keyEqualFunc=void 0,this.keyHashFunc=void 0,this.buckets=new Map,this.keyEqualFunc=e,this.keyHashFunc=t}var t=e.prototype;return t.findBucketIndex=function(e,t){for(var r=0;e.keys.length>r;r++)if(this.keyEqualFunc(t,e.keys[r]))return r;return-1},t.findBucket=function(e){var t=this.keyHashFunc(e);return this.buckets.get(t)},t.get=function(e){var t=this.findBucket(e);if(void 0===t)return null;var r=this.findBucketIndex(t,e);return 0>r?null:t.values[r]},t.add=function(e,t){var r=this.keyHashFunc(e);void 0===this.buckets.get(r)&&this.buckets.set(r,new an);var n=this.buckets.get(r);n.keys.push(e),n.values.push(t)},t.delete=function(e){var t=this.findBucket(e);if(void 0!==t){var r=this.findBucketIndex(t,e);-1!==r&&(t.keys.splice(r,1),t.values.splice(r,1))}},t.clear=function(){this.buckets.clear()},t.size=function(){for(var e,t=0,r=Se(this.buckets.values());!(e=r()).done;){t+=e.value.values.length}return t},t.values=de().mark((function e(){var t,r,n,i;return de().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=Se(this.buckets.values());case 1:if((r=t()).done){e.next=12;break}i=(n=r.value).values.length-1;case 4:if(i<0){e.next=10;break}return e.next=7,n.values[i];case 7:i--,e.next=4;break;case 10:e.next=1;break;case 12:case"end":return e.stop()}}),e,this)})),e}();function un(e,t){return Rt(""!==e.preprocessedVert&&""!==t.preprocessedVert),Rt(""!==e.preprocessedFrag&&""!==t.preprocessedFrag),e.preprocessedVert===t.preprocessedVert&&e.preprocessedFrag===t.preprocessedFrag}function cn(e,t){return e=rn(e,t.numUniformBuffers),e=rn(e,t.numSamplers)}function ln(e,t){return e=rn(e,t.blendMode),e=rn(e,t.blendSrcFactor),e=rn(e,t.blendDstFactor)}function fn(e,t){return e=ln(e,t.rgbBlendState),e=rn(e=ln(e,t.alphaBlendState),t.channelWriteMask)}function hn(e,t){for(var r=0;t.attachmentsState.length>r;r++)e=fn(e,t.attachmentsState[r]);return e=function(e,t){return rn(e,t.r<<24|t.g<<16|t.b<<8|t.a)}(e,t.blendConstant),e=rn(e,t.depthCompare),e=rn(e,t.depthWrite?1:0),e=rn(e,t.stencilCompare),e=rn(e,t.stencilPassOp),e=rn(e,t.stencilWrite?1:0),e=rn(e,t.cullMode),e=rn(e,t.frontFace?1:0),e=rn(e,t.polygonOffset?1:0)}function dn(e){var t=0;t=rn(t,e.program.id),null!==e.inputLayout&&(t=rn(t,e.inputLayout.id));for(var r=0;e.bindingLayouts.length>r;r++)t=cn(t,e.bindingLayouts[r]);t=hn(t,e.megaStateDescriptor);for(var n=0;e.colorAttachmentFormats.length>n;n++)t=rn(t,e.colorAttachmentFormats[n]||0);return nn(t=rn(t,e.depthStencilAttachmentFormat||0))}function pn(e){for(var t=0,r=0;e.samplerBindings.length>r;r++){var n=e.samplerBindings[r];null!==n&&null!==n.texture&&(t=rn(t,n.texture.id))}for(var i=0;e.uniformBufferBindings.length>i;i++){var o=e.uniformBufferBindings[i];null!==o&&null!==o.buffer&&(t=rn(t,o.buffer.id),t=rn(t,o.wordCount))}return nn(t)}var _n,vn=function(){function e(e){this.device=void 0,this.bindingsCache=new sn(ar,pn),this.renderPipelinesCache=new sn(fr,dn),this.inputLayoutsCache=new sn(pr,on),this.programCache=new sn(un,on),this.samplerCache=new sn(_r,on),this.device=e}var t=e.prototype;return t.createBindings=function(e){var t=this.bindingsCache.get(e);if(null===t){var r=gr(e);t=this.device.createBindings(r),this.bindingsCache.add(r,t)}return t},t.createRenderPipeline=function(e){var t=this.renderPipelinesCache.get(e);if(null===t){var r=yr(e);t=this.device.createRenderPipeline(r),this.renderPipelinesCache.add(r,t)}return t},t.createInputLayout=function(e){var t=this.inputLayoutsCache.get(e);if(null===t){var r=Sr(e);t=this.device.createInputLayout(r),this.inputLayoutsCache.add(r,t)}return t},t.createProgramSimple=function(e){var t,r=this.programCache.get(e);if(null===r){var n={preprocessedVert:(t=e).preprocessedVert,preprocessedFrag:t.preprocessedFrag,vert:t.vert,frag:t.frag};r=this.device.createProgramSimple(n),this.programCache.add(n,r)}return r},t.createProgram=function(e){return e.ensurePreprocessed(this.device.queryVendorInfo()),this.createProgramSimple(e)},t.createSampler=function(e){var t=this.samplerCache.get(e);return null===t&&(t=this.device.createSampler(e),this.samplerCache.add(e,t)),t},t.destroy=function(){for(var e,t=Se(this.bindingsCache.values());!(e=t()).done;){e.value.destroy()}for(var r,n=Se(this.renderPipelinesCache.values());!(r=n()).done;){r.value.destroy()}for(var i,o=Se(this.inputLayoutsCache.values());!(i=o()).done;){i.value.destroy()}for(var a,s=Se(this.programCache.values());!(a=s()).done;){a.value.destroy()}for(var u,c=Se(this.samplerCache.values());!(u=c()).done;){u.value.destroy()}this.bindingsCache.clear(),this.renderPipelinesCache.clear(),this.inputLayoutsCache.clear(),this.programCache.clear(),this.samplerCache.clear()},e}();!function(e){e[e.Color0=0]="Color0",e[e.Color1=1]="Color1",e[e.Color2=2]="Color2",e[e.Color3=3]="Color3",e[e.ColorMax=3]="ColorMax",e[e.DepthStencil=4]="DepthStencil"}(_n||(_n={}));var En,gn={x:0,y:0,w:1,h:1},mn=function(){function e(){this.renderTargetIDs=[],this.resolveTextureOutputIDs=[],this.resolveTextureOutputExternalTextures=[],this.resolveTextureInputIDs=[],this.renderTargetExtraRefs=[],this.viewport=gn,this.resolveTextureInputTextures=[],this.renderTargets=[],this.descriptor={colorAttachment:[],colorResolveTo:[],colorStore:[],depthStencilAttachment:null,depthStencilResolveTo:null,depthStencilStore:!0,colorClearColor:["load"],depthClearValue:"load",stencilClearValue:"load",occlusionQueryPool:null},this.viewportX=0,this.viewportY=0,this.viewportW=0,this.viewportH=0,this.execFunc=null,this.postFunc=null,this.debugName=void 0,this.debugThumbnails=[]}var t=e.prototype;return t.setDebugName=function(e){this.debugName=e},t.pushDebugThumbnail=function(e){this.debugThumbnails[e]=!0},t.setViewport=function(e){this.viewport=e},t.attachRenderTargetID=function(e,t){Rt(void 0===this.renderTargetIDs[e]),this.renderTargetIDs[e]=t},t.attachResolveTexture=function(e){this.resolveTextureInputIDs.push(e)},t.attachOcclusionQueryPool=function(e){this.descriptor.occlusionQueryPool=e},t.resolveToExternalTexture=function(e,t){this.resolveTextureOutputExternalTextures[e]=t},t.exec=function(e){Rt(null===this.execFunc),this.execFunc=e},t.post=function(e){Rt(null===this.postFunc),this.postFunc=e},t.addExtraRef=function(e){this.renderTargetExtraRefs[e]=!0},e}(),Rn=function(){function e(e,t){this.debugName=void 0,this.dimension=Je.n2D,this.depth=1,this.numLevels=1,this.pixelFormat=void 0,this.width=0,this.height=0,this.sampleCount=0,this.usage=$e.RenderTarget,this.immutable=!0,this.needsClear=!0,this.texture=null,this.attachment=void 0,this.age=0,this.pixelFormat=t.pixelFormat,this.width=t.width,this.height=t.height,this.sampleCount=t.sampleCount,Rt(this.sampleCount>=1),this.sampleCount>1?this.attachment=e.createRenderTarget(this):(this.texture=e.createTexture(this),this.attachment=e.createRenderTargetFromTexture(this.texture))}var t=e.prototype;return t.setDebugName=function(e,t){this.debugName=t,null!==this.texture&&e.setResourceName(this.texture,this.debugName),e.setResourceName(this.attachment,this.debugName)},t.matchesDescription=function(e){return this.pixelFormat===e.pixelFormat&&this.width===e.width&&this.height===e.height&&this.sampleCount===e.sampleCount},t.reset=function(e){Rt(this.matchesDescription(e)),this.age=0},t.destroy=function(){null!==this.texture&&this.texture.destroy(),this.attachment.destroy()},e}(),yn=function(){function e(e,t){this.dimension=Je.n2D,this.depth=1,this.numLevels=1,this.usage=$e.RenderTarget,this.pixelFormat=void 0,this.width=0,this.height=0,this.texture=void 0,this.age=0,this.immutable=!0,this.pixelFormat=t.pixelFormat,this.width=t.width,this.height=t.height,this.texture=e.createTexture(this)}var t=e.prototype;return t.matchesDescription=function(e){return this.pixelFormat===e.pixelFormat&&this.width===e.width&&this.height===e.height},t.reset=function(e){Rt(this.matchesDescription(e)),this.age=0},t.destroy=function(){this.texture.destroy()},e}();En=Symbol.species;var Tn,An=function(){this[En]=void 0,this.renderTargetDescriptions=[],this.resolveTextureRenderTargetIDs=[],this.passes=[],this.renderTargetDebugNames=[]},Sn=function(){function e(e){this.device=void 0,this.currentPass=null,this.renderTargetDeadPool=[],this.singleSampledTextureDeadPool=[],this.currentGraph=null,this.renderTargetOutputCount=[],this.renderTargetResolveCount=[],this.resolveTextureUseCount=[],this.renderTargetAliveForID=[],this.singleSampledTextureForResolveTextureID=[],this.device=e}var t=e.prototype;return t.acquireRenderTargetForDescription=function(e){for(var t=0;this.renderTargetDeadPool.length>t;t++){var r=this.renderTargetDeadPool[t];if(r.matchesDescription(e))return r.reset(e),this.renderTargetDeadPool.splice(t--,1),r}return new Rn(this.device,e)},t.acquireSingleSampledTextureForDescription=function(e){for(var t=0;this.singleSampledTextureDeadPool.length>t;t++){var r=this.singleSampledTextureDeadPool[t];if(r.matchesDescription(e))return r.reset(e),this.singleSampledTextureDeadPool.splice(t--,1),r}return new yn(this.device,e)},t.beginGraphBuilder=function(){Rt(null===this.currentGraph),this.currentGraph=new An},t.pushPass=function(e){var t=new mn;e(t),this.currentGraph.passes.push(t)},t.createRenderTargetID=function(e,t){return this.currentGraph.renderTargetDebugNames.push(t),this.currentGraph.renderTargetDescriptions.push(e)-1},t.createResolveTextureID=function(e){return this.currentGraph.resolveTextureRenderTargetIDs.push(e)-1},t.findMostRecentPassThatAttachedRenderTarget=function(e){for(var t=this.currentGraph.passes.length-1;t>=0;t--){var r=this.currentGraph.passes[t];if(r.renderTargetIDs.includes(e))return r}return null},t.resolveRenderTargetPassAttachmentSlot=function(e,t){var r=e;if(void 0===r.resolveTextureOutputIDs[t]){var n=this.createResolveTextureID(r.renderTargetIDs[t]);r.resolveTextureOutputIDs[t]=n}return r.resolveTextureOutputIDs[t]},t.findPassForResolveRenderTarget=function(e){var t=yt(this.findMostRecentPassThatAttachedRenderTarget(e)),r=t.renderTargetIDs.indexOf(e);return Rt(void 0===t.resolveTextureOutputExternalTextures[r]),t},t.resolveRenderTarget=function(e){var t=this.findPassForResolveRenderTarget(e),r=t.renderTargetIDs.indexOf(e);return this.resolveRenderTargetPassAttachmentSlot(t,r)},t.resolveRenderTargetToExternalTexture=function(e,t){var r=this.findPassForResolveRenderTarget(e),n=r.renderTargetIDs.indexOf(e);Rt(void 0===r.resolveTextureOutputIDs[n]),r.resolveTextureOutputExternalTextures[n]=t},t.getRenderTargetDescription=function(e){return yt(this.currentGraph.renderTargetDescriptions[e])},t.scheduleAddUseCount=function(e,t){for(var r=0;t.renderTargetIDs.length>r;r++){var n=t.renderTargetIDs[r];void 0!==n&&(this.renderTargetOutputCount[n]++,t.renderTargetExtraRefs[r]&&this.renderTargetOutputCount[n]++)}for(var i=0;t.resolveTextureInputIDs.length>i;i++){var o=t.resolveTextureInputIDs[i];if(void 0!==o)this.resolveTextureUseCount[o]++,this.renderTargetResolveCount[e.resolveTextureRenderTargetIDs[o]]++}},t.acquireRenderTargetForID=function(e,t){if(void 0===t)return null;if(Rt(this.renderTargetOutputCount[t]>0),!this.renderTargetAliveForID[t]){var r=this.acquireRenderTargetForDescription(e.renderTargetDescriptions[t]);r.setDebugName(this.device,e.renderTargetDebugNames[t]),this.renderTargetAliveForID[t]=r}return this.renderTargetAliveForID[t]},t.releaseRenderTargetForID=function(e,t){if(void 0===e)return null;var r=yt(this.renderTargetAliveForID[e]);return t?(Rt(this.renderTargetOutputCount[e]>0),this.renderTargetOutputCount[e]--):(Rt(this.renderTargetResolveCount[e]>0),this.renderTargetResolveCount[e]--),0===this.renderTargetOutputCount[e]&&0===this.renderTargetResolveCount[e]&&(r.needsClear=!0,delete this.renderTargetAliveForID[e],this.renderTargetDeadPool.push(r)),r},t.acquireResolveTextureInputTextureForID=function(e,t){var r=e.resolveTextureRenderTargetIDs[t];Rt(this.resolveTextureUseCount[t]>0),this.resolveTextureUseCount[t]--;var n=yt(this.releaseRenderTargetForID(r,!1));if(void 0!==this.singleSampledTextureForResolveTextureID[t]){var i=this.singleSampledTextureForResolveTextureID[t];return 0===this.resolveTextureUseCount[t]&&this.singleSampledTextureDeadPool.push(i),i.texture}return yt(n.texture)},t.determineResolveParam=function(e,t,r){var n=t.renderTargetIDs[r],i=t.resolveTextureOutputIDs[r],o=t.resolveTextureOutputExternalTextures[r],a=void 0!==i,s=void 0!==o;Rt(!(a&&s));var u=null,c=!1;if(this.renderTargetOutputCount[n]>1&&(c=!0),a){Rt(e.resolveTextureRenderTargetIDs[i]===n),Rt(this.resolveTextureUseCount[i]>0),Rt(this.renderTargetOutputCount[n]>0);var l=yt(this.renderTargetAliveForID[n]);if(null!==l.texture&&1===this.renderTargetOutputCount[n])u=null,c=!0;else{if(!this.singleSampledTextureForResolveTextureID[i]){var f=yt(e.renderTargetDescriptions[n]);this.singleSampledTextureForResolveTextureID[i]=this.acquireSingleSampledTextureForDescription(f),this.device.setResourceName(this.singleSampledTextureForResolveTextureID[i].texture,l.debugName+" (Resolve "+i+")")}u=this.singleSampledTextureForResolveTextureID[i].texture}}else u=s?o:null;return{resolveTo:u,store:c}},t.schedulePass=function(e,t){for(var r=t.renderTargetIDs[_n.DepthStencil],n=_n.Color0;_n.ColorMax>=n;n++){var i=t.renderTargetIDs[n],o=this.acquireRenderTargetForID(e,i);t.renderTargets[n]=o,t.descriptor.colorAttachment[n]=null!==o?o.attachment:null;var a=this.determineResolveParam(e,t,n),s=a.store;t.descriptor.colorResolveTo[n]=a.resolveTo,t.descriptor.colorStore[n]=s,t.descriptor.colorClearColor[n]=null!==o&&o.needsClear?e.renderTargetDescriptions[i].colorClearColor:"load"}var u=this.acquireRenderTargetForID(e,r);t.renderTargets[_n.DepthStencil]=u,t.descriptor.depthStencilAttachment=null!==u?u.attachment:null;var c=this.determineResolveParam(e,t,_n.DepthStencil),l=c.store;t.descriptor.depthStencilResolveTo=c.resolveTo,t.descriptor.depthStencilStore=l,t.descriptor.depthClearValue=null!==u&&u.needsClear?e.renderTargetDescriptions[r].depthClearValue:"load",t.descriptor.stencilClearValue=null!==u&&u.needsClear?e.renderTargetDescriptions[r].stencilClearValue:"load";for(var f=0,h=0,d=0,p=0;t.renderTargets.length>p;p++){var _=t.renderTargets[p];_&&(0===f&&(f=_.width,h=_.height,d=_.sampleCount),Rt(_.width===f),Rt(_.height===h),Rt(_.sampleCount===d),_.needsClear=!1)}if(f>0&&h>0){var v=h*t.viewport.y,E=f*t.viewport.w,g=h*t.viewport.h;t.viewportX=f*t.viewport.x,t.viewportY=v,t.viewportW=E,t.viewportH=g}for(var m=0;t.resolveTextureInputIDs.length>m;m++){t.resolveTextureInputTextures[m]=this.acquireResolveTextureInputTextureForID(e,t.resolveTextureInputIDs[m])}for(var R=0;t.renderTargetIDs.length>R;R++)this.releaseRenderTargetForID(t.renderTargetIDs[R],!0);for(n=0;t.renderTargetExtraRefs.length>n;n++)t.renderTargetExtraRefs[n]&&this.releaseRenderTargetForID(t.renderTargetIDs[n],!0)},t.scheduleGraph=function(e){Rt(0===this.renderTargetOutputCount.length),Rt(0===this.renderTargetResolveCount.length),Rt(0===this.resolveTextureUseCount.length);for(var t=0;this.renderTargetDeadPool.length>t;t++)this.renderTargetDeadPool[t].age++;for(var r=0;this.singleSampledTextureDeadPool.length>r;r++)this.singleSampledTextureDeadPool[r].age++;Lt(this.renderTargetOutputCount,e.renderTargetDescriptions.length,0),Lt(this.renderTargetResolveCount,e.renderTargetDescriptions.length,0),Lt(this.resolveTextureUseCount,e.resolveTextureRenderTargetIDs.length,0);for(var n=0;e.passes.length>n;n++)this.scheduleAddUseCount(e,e.passes[n]);for(var i=0;e.passes.length>i;i++)this.schedulePass(e,e.passes[i]);for(var o=0;this.renderTargetOutputCount.length>o;o++)Rt(0===this.renderTargetOutputCount[o]);for(var a=0;this.renderTargetResolveCount.length>a;a++)Rt(0===this.renderTargetResolveCount[a]);for(var s=0;this.resolveTextureUseCount.length>s;s++)Rt(0===this.resolveTextureUseCount[s]);for(var u=0;this.renderTargetAliveForID.length>u;u++)Rt(void 0===this.renderTargetAliveForID[u]);for(var c=0;this.renderTargetDeadPool.length>c;c++)1>this.renderTargetDeadPool[c].age||(this.renderTargetDeadPool[c].destroy(),this.renderTargetDeadPool.splice(c--,1));for(var l=0;this.singleSampledTextureDeadPool.length>l;l++)1>this.singleSampledTextureDeadPool[l].age||(this.singleSampledTextureDeadPool[l].destroy(),this.singleSampledTextureDeadPool.splice(l--,1));this.renderTargetResolveCount.length=0,this.renderTargetOutputCount.length=0,this.resolveTextureUseCount.length=0},t.execPass=function(e){Rt(null===this.currentPass),this.currentPass=e;var t=this.device.createRenderPass(e.descriptor);t.beginDebugGroup(e.debugName),t.setViewport(e.viewportX,e.viewportY,e.viewportW,e.viewportH),null!==e.execFunc&&e.execFunc(t,this),t.endDebugGroup(),this.device.submitPass(t),null!==e.postFunc&&e.postFunc(this),this.currentPass=null},t.execGraph=function(e){var t=this;this.scheduleGraph(e),e.passes.forEach((function(e){t.execPass(e)})),this.singleSampledTextureForResolveTextureID.length=0},t.execute=function(){var e=yt(this.currentGraph);this.execGraph(e),this.currentGraph=null},t.getDebug=function(){return this},t.getPasses=function(){return this.currentGraph.passes},t.getPassDebugThumbnails=function(e){return e.debugThumbnails},t.getPassRenderTargetID=function(e,t){return e.renderTargetIDs[t]},t.getRenderTargetIDDebugName=function(e){return this.currentGraph.renderTargetDebugNames[e]},t.getResolveTextureForID=function(e){var t=this.currentPass,r=t.resolveTextureInputIDs.indexOf(e);return Rt(r>=0),yt(t.resolveTextureInputTextures[r])},t.getRenderTargetAttachment=function(e){var t=this.currentPass.renderTargets[e];return t?t.attachment:null},t.getRenderTargetTexture=function(e){var t=this.currentPass.renderTargets[e];return t?t.texture:null},t.newGraphBuilder=function(){return this.beginGraphBuilder(),this},t.destroy=function(){for(var e=0;this.renderTargetAliveForID.length>e;e++)Rt(void 0===this.renderTargetAliveForID[e]);for(var t=0;this.singleSampledTextureForResolveTextureID.length>t;t++)Rt(void 0===this.singleSampledTextureForResolveTextureID[t]);for(var r=0;this.renderTargetDeadPool.length>r;r++)this.renderTargetDeadPool[r].destroy();for(var n=0;this.singleSampledTextureDeadPool.length>n;n++)this.singleSampledTextureDeadPool[n].destroy()},e}();!function(e){e[e.BACKGROUND=0]="BACKGROUND",e[e.ALPHA_TEST=16]="ALPHA_TEST",e[e.OPAQUE=32]="OPAQUE",e[e.TRANSLUCENT=128]="TRANSLUCENT"}(Tn||(Tn={}));function Cn(e,t,r){void 0===r&&(r=65536);var n=v(e,0,r)/r;return t&&(n=1-n),65535&65535*n}function On(e,t){return(16777215&e|(255&t)<<24)>>>0}function In(e,t){return!!(e>>>31&1)?e:(4278190335&e|(65535&t)<<8)>>>0}function Nn(e,t){return On(In(0,t),e)}function xn(e,t){return Rt(t>=0),(4294967040&e|t>>>8&255)>>>0}function Pn(e){return On(0,e)}function Mn(e,t){return Rt(t>=0),(4278190335&e|t<<8)>>>0}var Dn=De(1,0,0,0,0,1,0,0,0,0,2,0,0,0,-1,1);var Bn,Ln=De(1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1);function bn(e,t,r,n,i,o){return void 0===n&&(n=0),void 0===i&&(i=0),void 0===o&&(o=0),e[t+0]=r,e[t+1]=n,e[t+2]=i,e[t+3]=o,4}!function(e){e[e.Indexed=1]="Indexed",e[e.AllowSkippingIfPipelineNotReady=2]="AllowSkippingIfPipelineNotReady",e[e.Template=4]="Template",e[e.Draw=8]="Draw",e[e.InheritedFlags=3]="InheritedFlags"}(Bn||(Bn={}));var Fn,Un=function(){function e(){this.sortKey=0,this.debug=null,this.renderPipelineDescriptor=void 0,this.uniformBuffer=void 0,this.uniforms=[],this.bindingDescriptors=kt(1,(function(){return{bindingLayout:null,samplerBindings:[],uniformBufferBindings:[]}})),this.dynamicUniformBufferByteOffsets=kt(4,(function(){return 0})),this.flags=0,this.inputState=null,this.drawStart=0,this.drawCount=0,this.drawInstanceCount=0,this.renderPipelineDescriptor={bindingLayouts:[],inputLayout:null,megaStateDescriptor:Yt(qt),program:null,topology:Ke.Triangles,colorAttachmentFormats:[],depthStencilAttachmentFormat:null,sampleCount:1},this.reset()}var t=e.prototype;return t.reset=function(){this.sortKey=0,this.flags=Bn.AllowSkippingIfPipelineNotReady,this.inputState=null,this.renderPipelineDescriptor.inputLayout=null},t.setFromTemplate=function(e){jt(this.renderPipelineDescriptor.megaStateDescriptor,e.renderPipelineDescriptor.megaStateDescriptor),this.renderPipelineDescriptor.program=e.renderPipelineDescriptor.program,this.renderPipelineDescriptor.inputLayout=e.renderPipelineDescriptor.inputLayout,this.renderPipelineDescriptor.topology=e.renderPipelineDescriptor.topology,this.renderPipelineDescriptor.colorAttachmentFormats.length=Math.max(this.renderPipelineDescriptor.colorAttachmentFormats.length,e.renderPipelineDescriptor.colorAttachmentFormats.length);for(var t=0;e.renderPipelineDescriptor.colorAttachmentFormats.length>t;t++)this.renderPipelineDescriptor.colorAttachmentFormats[t]=e.renderPipelineDescriptor.colorAttachmentFormats[t];this.renderPipelineDescriptor.depthStencilAttachmentFormat=e.renderPipelineDescriptor.depthStencilAttachmentFormat,this.renderPipelineDescriptor.sampleCount=e.renderPipelineDescriptor.sampleCount,this.inputState=e.inputState,this.uniformBuffer=e.uniformBuffer,this.uniforms=[].concat(e.uniforms),this.drawCount=e.drawCount,this.drawStart=e.drawStart,this.drawInstanceCount=e.drawInstanceCount,this.flags=this.flags&~Bn.InheritedFlags|e.flags&Bn.InheritedFlags,this.sortKey=e.sortKey;var r=this.bindingDescriptors[0],n=e.bindingDescriptors[0];null!==n.bindingLayout&&this.setBindingLayout(n.bindingLayout);for(var i=0;i<Math.min(r.uniformBufferBindings.length,n.uniformBufferBindings.length);i++)r.uniformBufferBindings[i].wordCount=e.bindingDescriptors[0].uniformBufferBindings[i].wordCount;this.setSamplerBindingsFromTextureMappings(n.samplerBindings);for(var o=0;e.dynamicUniformBufferByteOffsets.length>o;o++)this.dynamicUniformBufferByteOffsets[o]=e.dynamicUniformBufferByteOffsets[o]},t.setProgram=function(e){this.renderPipelineDescriptor.program=e},t.setMegaStateFlags=function(e){return jt(this.renderPipelineDescriptor.megaStateDescriptor,e),this.renderPipelineDescriptor.megaStateDescriptor},t.getMegaStateFlags=function(){return this.renderPipelineDescriptor.megaStateDescriptor},t.setInputLayoutAndState=function(e,t){this.inputState=t,this.renderPipelineDescriptor.inputLayout=e},t.setBindingLayout=function(e){Rt(this.dynamicUniformBufferByteOffsets.length>e.numUniformBuffers),this.renderPipelineDescriptor.bindingLayouts[0]=e,this.bindingDescriptors[0].bindingLayout=e;for(var t=this.bindingDescriptors[0].uniformBufferBindings.length;e.numUniformBuffers>t;t++)this.bindingDescriptors[0].uniformBufferBindings.push({buffer:null,wordCount:0});for(var r=this.bindingDescriptors[0].samplerBindings.length;e.numSamplers>r;r++)this.bindingDescriptors[0].samplerBindings.push({sampler:null,texture:null,lateBinding:null})},t.setBindingLayouts=function(e){Rt(this.bindingDescriptors.length>=e.length),Rt(1===e.length),this.setBindingLayout(e[0])},t.drawIndexes=function(e,t){void 0===t&&(t=0),this.flags=Gt(this.flags,Bn.Indexed,!0),this.drawCount=e,this.drawStart=t,this.drawInstanceCount=1},t.drawIndexesInstanced=function(e,t,r){void 0===r&&(r=0),this.flags=Gt(this.flags,Bn.Indexed,!0),this.drawCount=e,this.drawStart=r,this.drawInstanceCount=t},t.drawPrimitives=function(e,t){void 0===t&&(t=0),this.flags=Gt(this.flags,Bn.Indexed,!1),this.drawCount=e,this.drawStart=t,this.drawInstanceCount=1},t.setUniforms=function(e,t){if(0!==t.length){this.uniforms[e]=t;var r=0,n=[];t.forEach((function(e){var t=e.value;if(E(t)||Array.isArray(t)||t instanceof Float32Array){var i=E(t)?[t]:t,o=4-r%4;if(4!==o)if(o<(i.length>4?4:i.length)){r+=o;for(var a=0;o>a;a++)n.push(0)}else;r+=i.length,n.push.apply(n,i)}}));var i=4-n.length%4;if(4!==i)for(var o=0;i>o;o++)n.push(0);for(var a=this.allocateUniformBuffer(e,n.length),s=this.mapUniformBufferF32(e),u=0;n.length>u;u+=4)a+=bn(s,a,n[u],n[u+1],n[u+2],n[u+3])}},t.setUniformBuffer=function(e){this.uniformBuffer=e},t.allocateUniformBuffer=function(e,t){return Rt(this.dynamicUniformBufferByteOffsets.length>this.bindingDescriptors[0].bindingLayout.numUniformBuffers),this.dynamicUniformBufferByteOffsets[e]=this.uniformBuffer.allocateChunk(t)<<2,this.bindingDescriptors[0].uniformBufferBindings[e].wordCount=t,this.getUniformBufferOffset(e)},t.getUniformBufferOffset=function(e){return this.dynamicUniformBufferByteOffsets[e]>>>2},t.setUniformBufferOffset=function(e,t,r){this.dynamicUniformBufferByteOffsets[e]=t<<2,this.bindingDescriptors[0].uniformBufferBindings[e].wordCount=r},t.mapUniformBufferF32=function(e){return this.uniformBuffer.mapBufferF32()},t.getUniformBuffer=function(){return this.uniformBuffer},t.setSamplerBindingsFromTextureMappings=function(e){e=e.filter((function(e){return e}));for(var t=0;this.bindingDescriptors[0].samplerBindings.length>t;t++){var r=this.bindingDescriptors[0].samplerBindings[t],n=e[t];null!=n?(r.texture=n.texture,r.sampler=n.sampler,r.lateBinding=n.lateBinding):(r.texture=null,r.sampler=null,r.lateBinding=null)}},t.hasLateSamplerBinding=function(e){for(var t=0;this.bindingDescriptors[0].samplerBindings.length>t;t++){if(this.bindingDescriptors[0].samplerBindings[t].lateBinding===e)return!0}return!1},t.resolveLateSamplerBinding=function(e,t){for(var r=0;this.bindingDescriptors[0].samplerBindings.length>r;r++){var n=this.bindingDescriptors[0].samplerBindings[r];n.lateBinding===e&&(null===t?(n.texture=null,n.sampler=null):(Rt(null===t.lateBinding),n.texture=t.texture,null!==t.sampler&&(n.sampler=t.sampler)),n.lateBinding=null)}},t.setAllowSkippingIfPipelineNotReady=function(e){this.flags=Gt(this.flags,Bn.AllowSkippingIfPipelineNotReady,e)},t.setAttachmentFormatsFromRenderPass=function(e,t){for(var r=e.queryRenderPass(t),n=-1,i=0;r.colorAttachment.length>i;i++){var o=null!==r.colorAttachment[i]?e.queryRenderTarget(r.colorAttachment[i]):null;this.renderPipelineDescriptor.colorAttachmentFormats[i]=null!==o?o.pixelFormat:null,null!==o&&(-1===n?n=o.sampleCount:Rt(n===o.sampleCount))}var a=null!==r.depthStencilAttachment?e.queryRenderTarget(r.depthStencilAttachment):null;this.renderPipelineDescriptor.depthStencilAttachmentFormat=null!==a?a.pixelFormat:null,null!==a&&(-1===n?n=a.sampleCount:Rt(n==a.sampleCount)),Rt(n>0),this.renderPipelineDescriptor.sampleCount=n},t.drawOnPass=function(e,t){var r=this,n=e.device;this.setAttachmentFormatsFromRenderPass(n,t);var i=e.createRenderPipeline(this.renderPipelineDescriptor);if(!n.pipelineQueryReady(i)){if(this.flags&Bn.AllowSkippingIfPipelineNotReady)return!1;n.pipelineForceReady(i)}t.setPipeline(i),t.setInputState(this.inputState);for(var o=0;this.bindingDescriptors[0].uniformBufferBindings.length>o;o++)this.bindingDescriptors[0].uniformBufferBindings[o].buffer=yt(this.uniformBuffer.buffer);this.renderPipelineDescriptor.program.gl_program&&this.uniforms.forEach((function(e){var t={};e.forEach((function(e){t[e.name]=e.value})),r.renderPipelineDescriptor.program.setUniforms(t)}));var a=e.createBindings(ge({},this.bindingDescriptors[0],{pipeline:i}));return t.setBindings(0,a,this.dynamicUniformBufferByteOffsets),this.drawInstanceCount>1?(Rt(!!(this.flags&Bn.Indexed)),t.drawIndexedInstanced(this.drawCount,this.drawStart,this.drawInstanceCount)):this.flags&Bn.Indexed?t.drawIndexed(this.drawCount,this.drawStart):t.draw(this.drawCount,this.drawStart),!0},e}();function wn(e,t){return e.sortKey-t.sortKey}!function(e){e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards"}(Fn||(Fn={}));var Gn=function(){function e(e,t){void 0===e&&(e=wn),void 0===t&&(t=Fn.Forwards),this.renderInsts=[],this.compareFunction=void 0,this.executionOrder=void 0,this.usePostSort=!1,this.compareFunction=e,this.executionOrder=t}var t=e.prototype;return t.checkUsePostSort=function(){this.usePostSort=null!==this.compareFunction&&this.renderInsts.length>=500},t.insertSorted=function(e){null===this.compareFunction||this.usePostSort?this.renderInsts.push(e):wt(this.renderInsts,e,this.compareFunction),this.checkUsePostSort()},t.submitRenderInst=function(e){e.flags|=Bn.Draw,this.insertSorted(e)},t.hasLateSamplerBinding=function(e){for(var t=0;this.renderInsts.length>t;t++)if(this.renderInsts[t].hasLateSamplerBinding(e))return!0;return!1},t.resolveLateSamplerBinding=function(e,t){for(var r=0;this.renderInsts.length>r;r++)this.renderInsts[r].resolveLateSamplerBinding(e,t)},t.ensureSorted=function(){this.usePostSort&&(0!==this.renderInsts.length&&this.renderInsts.sort(this.compareFunction),this.usePostSort=!1)},t.drawOnPassRendererNoReset=function(e,t){this.ensureSorted();var r=0;if(this.executionOrder===Fn.Forwards)for(var n=0;this.renderInsts.length>n;n++)this.renderInsts[n].drawOnPass(e,t)&&r++;else for(var i=this.renderInsts.length-1;i>=0;i--)this.renderInsts[i].drawOnPass(e,t)&&r++;return r},t.reset=function(){this.renderInsts.length=0},t.drawOnPassRenderer=function(e,t){this.drawOnPassRendererNoReset(e,t),this.reset()},e}(),kn=function(){function e(){this.pool=[],this.allocCount=0}var t=e.prototype;return t.allocRenderInstIndex=function(){return this.allocCount++,this.allocCount>this.pool.length&&this.pool.push(new Un),this.allocCount-1},t.popRenderInst=function(){this.allocCount--},t.reset=function(){for(var e=0;this.pool.length>e;e++)this.pool[e].reset();this.allocCount=0},t.destroy=function(){this.pool.length=0,this.allocCount=0},e}(),Vn=function(){function e(e){this.renderCache=void 0,this.instPool=new kn,this.templatePool=new kn,this.simpleRenderInstList=new Gn,this.currentRenderInstList=this.simpleRenderInstList,this.renderCache=e}var t=e.prototype;return t.newRenderInst=function(){var e=this.templatePool.allocCount-1,t=this.instPool.allocRenderInstIndex(),r=this.instPool.pool[t];return r.debug=null,0>e||r.setFromTemplate(this.templatePool.pool[e]),r},t.submitRenderInst=function(e,t){void 0===t&&(t=this.currentRenderInstList),t.submitRenderInst(e)},t.setCurrentRenderInstList=function(e){Rt(null===this.simpleRenderInstList),this.currentRenderInstList=e},t.pushTemplateRenderInst=function(){var e=this.templatePool.allocCount-1,t=this.templatePool.allocRenderInstIndex(),r=this.templatePool.pool[t];return 0>e||r.setFromTemplate(this.templatePool.pool[e]),r.flags|=Bn.Template,r},t.popTemplateRenderInst=function(){this.templatePool.popRenderInst()},t.getTemplateRenderInst=function(){return this.templatePool.pool[this.templatePool.allocCount-1]},t.resetRenderInsts=function(){this.instPool.reset(),null!==this.simpleRenderInstList&&this.simpleRenderInstList.reset(),Rt(0===this.templatePool.allocCount)},t.destroy=function(){this.instPool.destroy(),this.renderCache.destroy()},t.disableSimpleMode=function(){this.simpleRenderInstList=null},t.drawOnPassRenderer=function(e){yt(this.simpleRenderInstList).drawOnPassRenderer(this.renderCache,e)},t.drawOnPassRendererNoReset=function(e){yt(this.simpleRenderInstList).drawOnPassRendererNoReset(this.renderCache,e)},e}(),Wn=function(){function e(){this.renderCache=void 0,this.renderGraph=void 0,this.renderInstManager=void 0,this.uniformBuffer=void 0,this.device=void 0}var t=e.prototype;return t.getDevice=function(){return this.device},t.setDevice=function(e){this.device=e,this.renderCache=new vn(e),this.renderGraph=new Sn(this.device),this.renderInstManager=new Vn(this.renderCache),this.uniformBuffer=new tn(this.device)},t.pushTemplateRenderInst=function(){var e=this.renderInstManager.pushTemplateRenderInst();return e.setUniformBuffer(this.uniformBuffer),e},t.prepareToRender=function(){this.uniformBuffer.prepareToRender()},t.destroy=function(){this.uniformBuffer&&this.uniformBuffer.destroy(),this.renderInstManager&&this.renderInstManager.destroy(),this.renderCache.destroy(),this.renderGraph.destroy()},t.getCache=function(){return this.renderCache},e}();Wn=u([t.singleton()],Wn);var Xn=function(){function e(e){this.pixelFormat=void 0,this.width=0,this.height=0,this.sampleCount=0,this.colorClearColor="load",this.depthClearValue="load",this.stencilClearValue="load",this.pixelFormat=e}var t=e.prototype;return t.setDimensions=function(e,t,r){this.width=e,this.height=t,this.sampleCount=r},t.copyDimensions=function(e){this.width=e.width,this.height=e.height,this.sampleCount=e.sampleCount},e}();function Hn(e){return{colorClearColor:e,depthClearValue:1,stencilClearValue:0}}var jn,Yn=Hn(Ct(.88,.88,.88,1)),Kn=Hn(It),zn=Hn(xt);function qn(e,t){var r=function(e){return e.antialiasingMode===jn.MSAAx4?4:1}(t);e.setDimensions(t.backbufferWidth,t.backbufferHeight,r)}function Zn(e,t,r){var n=function(e){if(e===_n.Color0)return ct.U8_RGBA_RT;if(e===_n.DepthStencil)return ct.D24_S8;throw new Error("whoops")}(e),i=new Xn(n);return qn(i,t),null!==r&&(i.colorClearColor=r.colorClearColor,i.depthClearValue=r.depthClearValue,i.stencilClearValue=r.stencilClearValue),i}!function(e){e[e.None=0]="None",e[e.FXAA=1]="FXAA",e[e.MSAAx4=2]="MSAAx4"}(jn||(jn={}));var Qn=function(){function e(){this.name=void 0,this.texture=null,this.sampler=null,this.lateBinding=null,this.width=0,this.height=0,this.lodBias=0}var t=e.prototype;return t.reset=function(){this.texture=null,this.sampler=null,this.lateBinding=null,this.width=0,this.height=0,this.lodBias=0},t.copy=function(e){this.texture=e.texture,this.sampler=e.sampler,this.lateBinding=e.lateBinding,this.width=e.width,this.height=e.height,this.lodBias=e.lodBias},e}(),Jn=function(){function e(){this.inputTexture=null,this.outputTexture=null}var t=e.prototype;return t.setDescription=function(e,t){this.inputTexture!==this.outputTexture&&(null!==this.inputTexture&&this.inputTexture.destroy(),this.inputTexture=this.outputTexture),Rt(this.inputTexture===this.outputTexture),null!==this.outputTexture&&this.outputTexture.matchesDescription(t)||(this.outputTexture=new yn(e,t),null===this.inputTexture&&(this.inputTexture=this.outputTexture))},t.getTextureForSampling=function(){return null!==this.inputTexture?this.inputTexture.texture:null},t.getTextureForResolving=function(){var e;return null===(e=this.outputTexture)||void 0===e?void 0:e.texture},t.destroy=function(){null!==this.outputTexture&&this.outputTexture!==this.inputTexture&&(this.outputTexture.destroy(),this.outputTexture=null),null!==this.inputTexture&&(this.inputTexture.destroy(),this.inputTexture=null)},e}(),$n=function(){function e(e,t,r,n){this.imagePool=void 0,this.offscreenCanvas=void 0,this.renderingService=void 0,this.canvasConfig=void 0,this.textureCache={},this.imagePool=e,this.offscreenCanvas=t,this.renderingService=r,this.canvasConfig=n}var r=e.prototype;return r.getOrCreateTexture=function(e,r,n,i){var o,a=this,s="string"==typeof r?r:r.src||"";if(s&&this.textureCache[s])(o=this.textureCache[s]).emit(Qe.LOADED);else if(o=e.createTexture(ge({pixelFormat:ct.U8_RGBA_NORM,width:1,height:1,depth:1,numLevels:1,dimension:Je.n2D,usage:$e.Sampled,pixelStore:{unpackFlipY:!1},immutable:!1},n)),s&&(this.textureCache[s]=o),_(r)){var u,c=this.canvasConfig.createImage;c?u=c(r):t.isBrowser&&(u=new window.Image),u&&(u.onload=function(){a.textureCache[s].setImageData(u),a.textureCache[s].emit(Qe.LOADED),a.renderingService.dirtify(),i&&i(a.textureCache[s])},u.onerror=function(){},u.crossOrigin="Anonymous",u.src=r)}else o.setImageData(r),o.emit(Qe.LOADED),this.renderingService.dirtify();return o},r.getOrCreateCanvas=function(){return this.offscreenCanvas.getOrCreateCanvas(this.canvasConfig.offscreenCanvas)},r.getOrCreateGradient=function(e){var t=this,r=e.gradients,n=e.instance.getGeometryBounds().halfExtents,i=2*n[0]||1,o=2*n[1]||1,a=this.offscreenCanvas.getOrCreateCanvas(this.canvasConfig.offscreenCanvas),s=this.offscreenCanvas.getOrCreateContext(this.canvasConfig.offscreenCanvas);a.width=i,a.height=o,r.forEach((function(e){var r=t.imagePool.getOrCreateGradient(ge({type:e.type},e.value,{width:i,height:o}),s);s.fillStyle=r,s.fillRect(0,0,i,o)}))},r.getOrCreatePattern=function(e,t,r){var n,i=e.image,o=e.repetition,a=t.getGeometryBounds().halfExtents,s=2*a[0]||1,u=2*a[1]||1,c=this.offscreenCanvas.getOrCreateCanvas(this.canvasConfig.offscreenCanvas),l=this.offscreenCanvas.getOrCreateContext(this.canvasConfig.offscreenCanvas);c.width=s,c.height=u;var f=(n=_(i)?this.imagePool.getImageSync(i,r):i)&&l.createPattern(n,o);l.fillStyle=f,l.fillRect(0,0,s,u)},r.destroy=function(){for(var e in this.textureCache)this.textureCache[e].destroy();this.textureCache={}},e}();$n=u([t.singleton(),c(0,t.inject(M)),c(1,t.inject(t.OffscreenCanvasCreator)),c(2,t.inject(t.RenderingService)),c(3,t.inject(t.CanvasConfig))],$n);var ei=t.Syringe.defineToken(""),ti=t.Syringe.defineToken(""),ri=t.Syringe.defineToken(""),ni=1,ii=function(){function e(e,t,r){this.renderHelper=void 0,this.rendererFactory=void 0,this.meshFactory=void 0,this.device=void 0,this.renderingService=void 0,this.meshes=[],this.pendingUpdatePatches={},this.stencilRefCache={},this.renderHelper=e,this.rendererFactory=t,this.meshFactory=r}var t=e.prototype;return t.render=function(e,t){var r=this;void 0===t&&(t=!1),t||this.updatePendingPatches(),this.meshes.forEach((function(n){n.init(r.device,r.renderingService);var i=n.objects;n.clipPathTarget&&(i=[n.clipPath]);var o=r.renderHelper.renderInstManager.newRenderInst();o.setAllowSkippingIfPipelineNotReady(!1),n.applyRenderInst(o,i),r.renderHelper.renderInstManager.submitRenderInst(o,e),t||n.objects.forEach((function(e){e.renderable.dirty=!1}))}))},t.attach=function(e,t){this.device=e,this.renderingService=t},t.add=function(e){var t=this,r=e.renderable3D;if(r&&!r.meshes.length){var n=this.rendererFactory(e.nodeName);n&&n.meshes.forEach((function(i,o){if(r.meshes[o]=void 0,n.shouldSubmitRenderInst(e,o)){var a=t.meshes.find((function(t){return i===t.constructor&&t.index===o&&t.shouldMerge(e,o)}));a||((a=t.meshFactory(i)).renderer=n,a.index=o,t.meshes.push(a)),a&&(a.objects.push(e),r.meshes[o]=a,a.geometryDirty=!0)}}))}},t.remove=function(e){var t=this,r=e.renderable3D;r&&(r.meshes.forEach((function(r){if(r){var n=r.objects.indexOf(e);n>-1&&(r.objects.splice(n,1),r.geometryDirty=!0),0===r.objects.length&&t.meshes.splice(t.meshes.indexOf(r),1)}})),r.meshes=[])},t.updateAttribute=function(e,t,r,n){var i=this;void 0===n&&(n=!1);var o=e.renderable3D,a=this.rendererFactory(e.nodeName);a&&a.meshes.forEach((function(s,u){var c=a.shouldSubmitRenderInst(e,u),l=o.meshes.find((function(e){return e&&e.index===u&&e.constructor===s}));if(c!==!!l&&(l&&(l.objects.splice(l.objects.indexOf(e),1),l.geometryDirty=!0,0===l.objects.length&&i.meshes.splice(i.meshes.indexOf(l),1),o.meshes[o.meshes.indexOf(l)]=void 0),c&&((l=i.meshes.find((function(t){return s===t.constructor&&t.index===u&&t.shouldMerge(e,u)})))||((l=i.meshFactory(s)).renderer=a,l.index=u,l.init(i.device,i.renderingService),i.meshes.push(l)),l&&(l.objects.push(e),o.meshes[u]=l))),c&&l&&l.inited&&!l.geometryDirty){var f=l.objects.indexOf(e);if(n)e.parsedStyle[t]=r,l.updateAttribute([e],f,t,r);else{var h=l.id+t;i.pendingUpdatePatches[h]||(i.pendingUpdatePatches[h]={instance:l,objectIndices:[],name:t,value:r}),-1===i.pendingUpdatePatches[h].objectIndices.indexOf(f)&&i.pendingUpdatePatches[h].objectIndices.push(f)}}}))},t.changeRenderOrder=function(e,t){var r=e.renderable3D;r&&r.meshes.length&&r.meshes.forEach((function(r){r&&r.inited&&!r.geometryDirty&&(r.renderer.shouldSubmitRenderInst(e,r.index)&&r.inited&&r.changeRenderOrder(e,t))}))},t.getStencilRef=function(e){return this.stencilRefCache[e.entity]||(this.stencilRefCache[e.entity]=ni++),this.stencilRefCache[e.entity]},t.updatePendingPatches=function(){var e=this;Object.keys(this.pendingUpdatePatches).forEach((function(t){var r=e.pendingUpdatePatches[t],n=r.instance,i=r.objectIndices,o=r.name,a=r.value;i.sort((function(e,t){return e-t}));var s=[];i.forEach((function(e){var t=s[s.length-1];t&&e===t[t.length-1]+1?t.push(e):s.push([e])})),s.forEach((function(e){n.updateAttribute(n.objects.slice(e[0],e[0]+e.length),e[0],o,a)}))})),this.pendingUpdatePatches={}},e}();ii=u([t.singleton(),c(0,t.inject(Wn)),c(1,t.inject(ei)),c(2,t.inject(ri))],ii);var oi=.005,ai=1,si=function(){function e(){this.renderHelper=void 0,this.texturePool=void 0,this.camera=void 0,this.lightPool=void 0,this.batchManager=void 0,this.device=void 0,this.renderingService=void 0,this.id=ai++,this.meshes=[],this.clipPathMeshCreated=!1}var t=e.prototype;return t.shouldSubmitRenderInst=function(e,t){return!0},t.beforeUploadUBO=function(e,t,r){},t.beforeInitMesh=function(e){},t.afterInitMesh=function(e){},e}();function ui(e){var t={};return Object.keys(e).forEach((function(r){"number"==typeof e[r]&&(t[r]=e[r])})),t}function ci(e,t){var r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every((function(r){return e[r]===t[r]}))}u([t.inject(Wn)],si.prototype,"renderHelper",void 0),u([t.inject($n)],si.prototype,"texturePool",void 0),u([t.inject(t.DefaultCamera)],si.prototype,"camera",void 0),u([t.inject(Oe)],si.prototype,"lightPool",void 0),u([t.inject(ii)],si.prototype,"batchManager",void 0),si=u([t.injectable()],si);var li,fi,hi=function(e){return Object.fromEntries(Object.entries(e).filter((function(e){return void 0!==e[1]})))},di=1,pi="FillTextureMapping";!function(e){e[e.MODEL_MATRIX=0]="MODEL_MATRIX",e[e.FILL_STROKE=1]="FILL_STROKE",e[e.PACKED_STYLE=2]="PACKED_STYLE",e[e.PICKING_COLOR=3]="PICKING_COLOR",e[e.POSITION=4]="POSITION",e[e.NORMAL=5]="NORMAL",e[e.UV=6]="UV",e[e.BARYCENTRIC=7]="BARYCENTRIC",e[e.MAX=8]="MAX"}(li||(li={})),function(e){e[e.MODEL_MATRIX0=0]="MODEL_MATRIX0",e[e.MODEL_MATRIX1=1]="MODEL_MATRIX1",e[e.MODEL_MATRIX2=2]="MODEL_MATRIX2",e[e.MODEL_MATRIX3=3]="MODEL_MATRIX3",e[e.COLOR=4]="COLOR",e[e.STROKE_COLOR=5]="STROKE_COLOR",e[e.PACKED_STYLE1=6]="PACKED_STYLE1",e[e.PACKED_STYLE2=7]="PACKED_STYLE2",e[e.PICKING_COLOR=8]="PICKING_COLOR",e[e.POSITION=9]="POSITION",e[e.NORMAL=10]="NORMAL",e[e.UV=11]="UV",e[e.BARYCENTRIC=12]="BARYCENTRIC",e[e.MAX=13]="MAX"}(fi||(fi={}));var _i=function(){function e(){this.id=di++,this.renderer=void 0,this.index=-1,this.renderHelper=void 0,this.texturePool=void 0,this.camera=void 0,this.lightPool=void 0,this.device=void 0,this.renderingService=void 0,this.objects=[],this.material=void 0,this.geometry=void 0,this.clipPath=void 0,this.clipPathTarget=void 0,this.inputState=void 0,this.program=new en,this.programDescriptorSimpleWithOrig=void 0,this.geometryDirty=!0,this.materialDirty=!0,this.inputStateDirty=!0,this.textureMappings=[],this.samplerEntries=void 0,this.inited=!1}var r=e.prototype;return r.init=function(e,t){this.inited||(this.renderer.beforeInitMesh(this),this.device=e,this.renderingService=t,this.material=new $r(this.device),this.material.defines=ge({},ui(fi),this.material.defines),this.geometry=new jr(this.device),this.geometry.meshes=this.objects,this.material.meshes=this.objects,this.observeGeometryChanged(),this.observeMaterialChanged(),this.inited=!0,this.renderer.afterInitMesh(this))},r.observeGeometryChanged=function(){var e=this;this.geometry.on(Vr.CHANGED,(function(){e.geometry.meshes.forEach((function(e){e.renderable.dirty=!0})),e.renderingService.dirtify()}))},r.observeMaterialChanged=function(){var e=this;this.material.on(Hr.CHANGED,(function(){e.material.meshes.forEach((function(e){e.renderable.dirty=!0})),e.renderingService.dirtify()}))},r.shouldMergeColor=function(e,r,n){var i=e.parsedStyle[n],o=r.parsedStyle[n];return i instanceof t.CSSRGB&&o instanceof t.CSSRGB||(!(!t.isPattern(i)||!t.isPattern(o)||i.image!==o.image)||!(!Array.isArray(i)||!Array.isArray(o)||e.style[n]!==r.style[n]))},r.shouldMerge=function(e,t){return!this.instance||(this.instance.nodeName===e.nodeName||this.instance.nodeName===e.renderable.proxyNodeName||this.instance.renderable.proxyNodeName===e.nodeName||this.instance.renderable.proxyNodeName===e.renderable.proxyNodeName)&&(!e.parsedStyle.clipPath&&!(!this.shouldMergeColor(this.instance,e,"fill")||!this.shouldMergeColor(this.instance,e,"stroke")))},r.createGeometry=function(e){var r=this,n=Pe(),i=Pe(),o=[],a=[],s=[],u=[];e.forEach((function(e){var c,l=e.parsedStyle,f=l.fill,h=l.stroke,d=l.opacity,p=l.fillOpacity,_=l.strokeOpacity,v=l.lineWidth,E=l.anchor,g=l.visibility,m=l.increasedLineWidthForHitTesting,R=[0,0,0,0];f instanceof t.CSSRGB&&(R=[Number(f.r)/255,Number(f.g)/255,Number(f.b)/255,Number(f.alpha)]);var y=[0,0,0,0];h instanceof t.CSSRGB&&(y=[Number(h.r)/255,Number(h.g)/255,Number(h.b)/255,Number(h.alpha)]),r.clipPathTarget?(Me(n,e.getLocalTransform()),R=[1,1,1,1],Le(n,r.clipPathTarget.getWorldTransform(),n)):Me(n,e.getWorldTransform()),Le(i,r.camera.getViewTransform(),n);var T=e.isInteractive()&&(null===(c=e.renderable3D)||void 0===c?void 0:c.encodedPickingColor)||[0,0,0];o.push.apply(o,n),a.push.apply(a,R.concat(y)),s.push(d,p,_,v,"visible"===g?1:0,E[0],E[1],m||0),u.push.apply(u,T.concat([e.sortable.renderOrder*oi]))})),this.geometry.instancedCount=e.length,this.geometry.setVertexBuffer({bufferIndex:li.MODEL_MATRIX,byteStride:64,frequency:Ze.PerInstance,attributes:[{format:ct.F32_RGBA,bufferByteOffset:0,location:fi.MODEL_MATRIX0,divisor:1},{format:ct.F32_RGBA,bufferByteOffset:16,location:fi.MODEL_MATRIX1,divisor:1},{format:ct.F32_RGBA,bufferByteOffset:32,location:fi.MODEL_MATRIX2,divisor:1},{format:ct.F32_RGBA,bufferByteOffset:48,location:fi.MODEL_MATRIX3,divisor:1}],data:new Float32Array(o)}),this.geometry.setVertexBuffer({bufferIndex:li.FILL_STROKE,byteStride:32,frequency:Ze.PerInstance,attributes:[{format:ct.F32_RGBA,bufferByteOffset:0,location:fi.COLOR,divisor:1},{format:ct.F32_RGBA,bufferByteOffset:16,location:fi.STROKE_COLOR,divisor:1}],data:new Float32Array(a)}),this.geometry.setVertexBuffer({bufferIndex:li.PACKED_STYLE,byteStride:32,frequency:Ze.PerInstance,attributes:[{format:ct.F32_RGBA,bufferByteOffset:0,location:fi.PACKED_STYLE1,divisor:1},{format:ct.F32_RGBA,bufferByteOffset:16,location:fi.PACKED_STYLE2,divisor:1}],data:new Float32Array(s)}),this.geometry.setVertexBuffer({bufferIndex:li.PICKING_COLOR,byteStride:16,frequency:Ze.PerInstance,attributes:[{format:ct.F32_RGBA,bufferByteOffset:0,location:fi.PICKING_COLOR,divisor:1}],data:new Float32Array(u)})},r.destroy=function(){this.geometry&&this.geometry.destroy(),this.inputState&&this.inputState.destroy()},r.applyRenderInst=function(e,t){var r=this,n=this.lightPool.getAllLights(),i=!!this.lightPool.getFog(),o=!!n.length,a=ge({},this.material.defines);if(this.material.defines.USE_FOG=i,this.material.defines.USE_LIGHT=o,this.material.defines=ge({},this.material.defines,this.lightPool.getDefines()),this.clipPathTarget||this.clipPath?this.clipPathTarget?(this.material.stencilWrite=!0,this.material.depthWrite=!1,this.material.stencilCompare=Ge.Always,this.material.stencilPassOp=tt.Replace):(this.material.stencilWrite=!1,this.material.depthWrite=!0,this.material.stencilCompare=Ge.Equal,this.material.stencilPassOp=tt.Keep):this.material.stencilWrite=!1,(this.materialDirty||this.material.programDirty)&&this.createMaterial(t),this.material.textureDirty){this.textureMappings=[];var s=this.createFillGradientTextureMapping(t);s&&this.textureMappings.push(s),Object.keys(this.material.textures).sort((function(e,t){return r.material.samplers.indexOf(e)-r.material.samplers.indexOf(t)})).forEach((function(e){var t=new Qn;t.name=e,t.texture=r.material.textures[e],r.device.setResourceName(t.texture,"Material Texture "+e),t.sampler=r.renderHelper.getCache().createSampler({wrapS:He.Clamp,wrapT:He.Clamp,minFilter:je.Point,magFilter:je.Bilinear,mipFilter:Ye.Linear,minLOD:0,maxLOD:0}),r.textureMappings.push(t)})),this.textureMappings.length?(this.material.defines.USE_UV=!0,this.material.defines.USE_MAP=!0):(this.material.defines.USE_UV=!1,this.material.defines.USE_MAP=!1),this.material.textureDirty=!1}(ci(a,this.material.defines)||this.material.programDirty||this.materialDirty)&&(this.material.defines=ge({},this.material.defines,ui(fi)),Object.keys(this.material.defines).forEach((function(e){var t=r.material.defines[e];"number"==typeof t?r.program.setDefineString(e,""+t):r.program.setDefineBool(e,t)})),this.program.vert=this.material.vertexShader,this.program.frag=this.material.fragmentShader,this.programDescriptorSimpleWithOrig=Qr(this.device,this.program),this.material.programDirty=!1,this.materialDirty=!1),this.material.geometryDirty&&(this.geometryDirty=!0,this.inputStateDirty=!0,this.material.geometryDirty=!1),(this.geometryDirty||this.geometry.dirty)&&(this.geometry&&this.geometry.destroy(),this.createGeometry(t),this.material.wireframe&&this.generateWireframe(this.geometry),this.geometryDirty=!1,this.geometry.dirty=!1,this.inputStateDirty=!0);var u=this.renderHelper.getCache().createInputLayout(this.geometry.inputLayoutDescriptor),c=this.renderHelper.getCache().createProgramSimple(this.programDescriptorSimpleWithOrig),l=!!this.geometry.indexBuffer;this.inputStateDirty&&(this.inputState&&this.inputState.destroy(),this.inputState=this.device.createInputState(u,this.geometry.vertexBuffers.map((function(e){return{buffer:e,byteOffset:0}})),l?{buffer:this.geometry.indexBuffer,byteOffset:0}:null,c),this.inputStateDirty=!1),e.renderPipelineDescriptor.topology=this.geometry.drawMode,e.setProgram(c),e.setInputLayoutAndState(u,this.inputState),this.renderer.beforeUploadUBO(e,this,this.index),this.uploadUBO(e),l?e.drawIndexesInstanced(this.geometry.vertexCount,this.geometry.instancedCount,this.geometry.indexStart):e.drawPrimitives(this.geometry.vertexCount,this.geometry.primitiveStart),e.sortKey=Nn(Tn.OPAQUE,t[0].sortable.renderOrder)},r.updateBatchedAttribute=function(e,r,n,i){if("fill"===n||"stroke"===n){var o=[];e.forEach((function(e){var r=e.parsedStyle,n=r.fill,i=r.stroke,a=[0,0,0,0];n instanceof t.CSSRGB&&(a=[Number(n.r)/255,Number(n.g)/255,Number(n.b)/255,Number(n.alpha)]);var s=[0,0,0,0];i instanceof t.CSSRGB&&(s=[Number(i.r)/255,Number(i.g)/255,Number(i.b)/255,Number(i.alpha)]),o.push.apply(o,a.concat(s))})),this.geometry.updateVertexBuffer(li.FILL_STROKE,fi.COLOR,r,new Uint8Array(new Float32Array(o).buffer));var a=this.instance.parsedStyle.fill,s=this.textureMappings.findIndex((function(e){return e.name===pi}));if(a instanceof t.CSSRGB)0>s||(this.textureMappings.splice(s,-1),this.material.textureDirty=!0);else{var u=this.createFillGradientTextureMapping([this.instance]);0>s||this.textureMappings.splice(s,1,u),this.material.textureDirty=!0}}else if(["opacity","fillOpacity","strokeOpacity","lineWidth","visibility","anchor","increasedLineWidthForHitTesting"].indexOf(n)>-1){var c=[];e.forEach((function(e){var t=e.parsedStyle,r=t.anchor;c.push(t.opacity,t.fillOpacity,t.strokeOpacity,t.lineWidth,"visible"===t.visibility?1:0,r[0],r[1],t.increasedLineWidthForHitTesting||0)})),this.geometry.updateVertexBuffer(li.PACKED_STYLE,fi.PACKED_STYLE1,r,new Uint8Array(new Float32Array(c).buffer))}else if("modelMatrix"===n){var l=[];e.forEach((function(e){var t=Me(Pe(),e.getWorldTransform());l.push.apply(l,t)})),this.geometry.updateVertexBuffer(li.MODEL_MATRIX,fi.MODEL_MATRIX0,r,new Uint8Array(new Float32Array(l).buffer))}else if("pointerEvents"===n){var f=[];e.forEach((function(e){var t,r=i&&e.isInteractive()&&(null===(t=e.renderable3D)||void 0===t?void 0:t.encodedPickingColor)||[0,0,0];f.push.apply(f,r.concat([e.sortable.renderOrder*oi]))})),this.geometry.updateVertexBuffer(li.PICKING_COLOR,fi.PICKING_COLOR,r,new Uint8Array(new Float32Array(f).buffer))}},r.updateAttribute=function(e,t,r,n){"clipPath"===r&&this.clipPath&&(this.geometryDirty=!0)},r.changeRenderOrder=function(e,t){var r,n=this.objects.indexOf(e),i=e.isInteractive()&&(null===(r=e.renderable3D)||void 0===r?void 0:r.encodedPickingColor)||[0,0,0];this.geometry.updateVertexBuffer(li.PICKING_COLOR,fi.PICKING_COLOR,n,new Uint8Array(new Float32Array([].concat(i,[t*oi])).buffer))},r.generateWireframe=function(e){for(var t=e.indices,r=e.indices.length,n=e.vertices.map((function(e){return e.slice()})),i=li.PICKING_COLOR;e.vertexBuffers.length>i;i++){e.vertices[i]=new Float32Array(e.inputLayoutDescriptor.vertexBufferDescriptors[i].byteStride/4*r)}for(var o=0,a=new Uint32Array(r),s=0;r>s;s++){for(var u=t[s],c=1;e.vertices.length>c;c++)for(var l=e.inputLayoutDescriptor.vertexBufferDescriptors[c].byteStride/4,f=0;l>f;f++)e.vertices[c][o*l+f]=n[c][u*l+f];a[s]=o,o++}for(var h=function(t){var r=e.inputLayoutDescriptor.vertexBufferDescriptors[t],n=r.frequency,i=r.byteStride,o=e.inputLayoutDescriptor.vertexAttributeDescriptors.find((function(e){return e.bufferIndex===t}));o&&e.setVertexBuffer({bufferIndex:o.bufferIndex,byteStride:i,frequency:n,attributes:[{format:o.format,bufferByteOffset:o.bufferByteOffset,location:o.location,divisor:o.divisor}],data:e.vertices[t]})},d=li.PICKING_COLOR+1;e.vertexBuffers.length>d;d++)h(d);for(var p=new Float32Array(3*r),_=0;r>_;)for(var v=0;3>v;v++){p[3*a[_++]+v]=1}e.setVertexBuffer({bufferIndex:li.BARYCENTRIC,byteStride:12,frequency:Ze.PerVertex,attributes:[{format:ct.F32_RGB,bufferByteOffset:0,location:Number(fi.BARYCENTRIC)}],data:p}),e.setIndexBuffer(a)},r.beforeUploadUBO=function(e,t,r){},r.uploadUBO=function(e){var r=this,n=this.material,i=this.lightPool.getAllLights(),o=this.lightPool.getFog(),a=!!o,s=!!i.length,u=[];if(n.defines.USE_WIREFRAME){var c=t.parseColor(n.wireframeColor);u.push({name:"u_WireframeLineColor",value:[Number(c.r)/255,Number(c.g)/255,Number(c.b)/255]}),u.push({name:"u_WireframeLineWidth",value:n.wireframeLineWidth})}if(a&&this.uploadFog(u,o),this.uploadMaterial(u,n),s){var l={};i.forEach((function(e){l[e.define]||(l[e.define]=-1),l[e.define]++,e.uploadUBO(u,l[e.define])}))}u.sort((function(e,t){return r.material.uniformNames.indexOf(e.name)-r.material.uniformNames.indexOf(t.name)})),e.setUniforms(1,u);var f=n.blendEquation,h=n.blendEquationAlpha,d=n.blendSrc,p=n.blendDst,_=n.blendSrcAlpha,v=n.blendDstAlpha,E=hi({blendConstant:n.blendConstant,depthCompare:n.depthCompare,depthWrite:n.depthWrite,stencilCompare:n.stencilCompare,stencilWrite:n.stencilWrite,stencilPassOp:n.stencilPassOp,stencilRef:n.stencilRef,cullMode:n.cullMode,frontFace:n.frontFace,polygonOffset:n.polygonOffset}),g=e.getMegaStateFlags().attachmentsState[0];e.setMegaStateFlags(ge({attachmentsState:[{channelWriteMask:this.material.stencilWrite?et.None:et.AllChannels,rgbBlendState:ge({},g.rgbBlendState,hi({blendMode:f,blendSrcFactor:d,blendDstFactor:p})),alphaBlendState:ge({},g.alphaBlendState,hi({blendMode:h,blendSrcFactor:_,blendDstFactor:v}))}]},E)),e.setBindingLayouts([{numUniformBuffers:1,numSamplers:this.textureMappings.length,samplerEntries:this.samplerEntries}]),e.setSamplerBindingsFromTextureMappings(this.textureMappings)},r.uploadFog=function(e,r){var n=r.parsedStyle,i=n.type,o=n.fill,a=n.start,s=n.end,u=n.density;if(o instanceof t.CSSRGB){var c=[Number(o.r)/255,Number(o.g)/255,Number(o.b)/255,Number(o.alpha)];e.push({name:"u_FogInfos",value:[i,a,s,u]}),e.push({name:"u_FogColor",value:c})}},r.uploadMaterial=function(e,t){var r=Object.keys(t.uniforms).map((function(e){return{name:e,value:t.uniforms[e]}}));e.push.apply(e,r)},r.createFillGradientTextureMapping=function(e){var r,n=this,i=e[0],o=i.nodeName===t.Shape.LINE?i.parsedStyle.stroke:i.parsedStyle.fill;if(o&&(t.isPattern(o)||Array.isArray(o))){Array.isArray(o)?(this.program.setDefineBool("USE_PATTERN",!1),this.texturePool.getOrCreateGradient({gradients:o,width:128,height:128,instance:i})):t.isPattern(o)&&(this.program.setDefineBool("USE_PATTERN",!0),this.texturePool.getOrCreatePattern(o,i,(function(){e.forEach((function(e){e.renderable.dirty=!0})),n.material.textureDirty=!0}))),r=this.texturePool.getOrCreateCanvas();var a=this.texturePool.getOrCreateTexture(this.device,r,ft(ct.U8_RGBA_NORM,1,1,1));if(a){var s=new Qn;return s.name=pi,s.texture=a,s.texture.on("loaded",(function(){e.forEach((function(e){e.renderable.dirty=!0})),n.material.textureDirty=!0})),this.device.setResourceName(s.texture,"Fill Texture"+this.id),s.sampler=this.renderHelper.getCache().createSampler({wrapS:He.Repeat,wrapT:He.Repeat,minFilter:je.Point,magFilter:je.Bilinear,mipFilter:Ye.Linear,minLOD:0,maxLOD:0}),s}}return null},Ee(e,[{key:"instance",get:function(){return this.objects[0]}}]),e}();u([t.inject(Wn)],_i.prototype,"renderHelper",void 0),u([t.inject($n)],_i.prototype,"texturePool",void 0),u([t.inject(t.DefaultCamera)],_i.prototype,"camera",void 0),u([t.inject(Oe)],_i.prototype,"lightPool",void 0),_i=u([t.injectable()],_i);var vi,Ei;!function(e){e[e.PACKED_STYLE=5]="PACKED_STYLE"}(vi||(vi={})),function(e){e[e.PACKED_STYLE3=13]="PACKED_STYLE3",e[e.SIZE=14]="SIZE"}(Ei||(Ei={}));var gi=[t.Shape.CIRCLE,t.Shape.ELLIPSE],mi=function(e){function r(){return e.apply(this,arguments)||this}me(r,e);var n=r.prototype;return n.shouldMerge=function(t,r){var n=e.prototype.shouldMerge.call(this,t,r);return!!n&&(!this.needDrawStrokeSeparately(t.parsedStyle)&&!this.needDrawStrokeSeparately(this.instance.parsedStyle)&&this.instance.parsedStyle.fill.isNone===t.parsedStyle.fill.isNone)},n.createMaterial=function(e){this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec2 a_Extrude;\nlayout(location = PACKED_STYLE3) in vec4 a_StylePacked3;\nlayout(location = SIZE) in vec2 a_Size;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nout vec4 v_Data;\nout vec2 v_Radius;\nout vec4 v_StylePacked3;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n float strokeWidth;\n if (u_IsPicking > 0.5) {\n strokeWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n strokeWidth = u_StrokeWidth;\n }\n\n float antialiasblur = 1.0 / (a_Size.x + strokeWidth);\n\n bool omitStroke = a_StylePacked3.z == 1.0;\n vec2 radius = a_Size + vec2(omitStroke ? 0.0 : strokeWidth / 2.0);\n vec2 offset = (a_Extrude + vec2(1.0) - 2.0 * u_Anchor.xy) * radius;\n\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n \n v_Radius = radius;\n v_Data = vec4(a_Extrude, antialiasblur, a_StylePacked3.x);\n v_StylePacked3 = a_StylePacked3;\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nin vec4 v_Data;\nin vec2 v_Radius;\nin vec4 v_StylePacked3;\n\nout vec4 outputColor;\n\n/**\n * 2D signed distance field functions\n * @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\n */\n\nfloat sdCircle(vec2 p, float r) {\n return length(p) - r;\n}\n\n// @see http://www.iquilezles.org/www/articles/ellipsoids/ellipsoids.htm\nfloat sdEllipsoidApproximated(vec2 p, vec2 r) {\n float k0 = length(p / r);\n float k1 = length(p / (r * r));\n return k0 * (k0 - 1.0) / k1;\n}\n\nvoid main() {\n int shape = int(floor(v_Data.w + 0.5));\n float epsilon = 0.000001;\n\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n bool omitStroke = v_StylePacked3.z == 1.0;\n\n float antialiasblur = v_Data.z;\n float antialiased_blur = -max(0.0, antialiasblur);\n vec2 r = (v_Radius - (omitStroke ? 0.0 : u_StrokeWidth)) / v_Radius;\n\n float outer_df;\n float inner_df;\n // 'circle', 'ellipse', 'rect'\n if (shape == 0) {\n outer_df = sdCircle(v_Data.xy, 1.0);\n inner_df = sdCircle(v_Data.xy, r.x);\n } else if (shape == 1) {\n outer_df = sdEllipsoidApproximated(v_Data.xy, vec2(1.0));\n inner_df = sdEllipsoidApproximated(v_Data.xy, r);\n }\n\n float opacity_t = smoothstep(0.0, antialiased_blur, outer_df);\n\n float color_t = u_StrokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiased_blur,\n 0.0,\n inner_df\n );\n\n // vec2 imagecoord = mod(v_Uv, 0.1);\n // vec4 texel = texture(SAMPLER_2D(u_Map), imagecoord);\n // u_Color = texel;\n\n vec4 diffuseColor;\n vec4 strokeColor;\n if (u_IsPicking > 0.5) {\n diffuseColor = vec4(u_PickingColor, 1.0);\n strokeColor = vec4(u_PickingColor, 1.0);\n } else {\n diffuseColor = u_Color;\n strokeColor = (u_StrokeColor == vec4(0) || omitStroke) ? vec4(0.0) : u_StrokeColor;\n }\n\n outputColor = mix(vec4(diffuseColor.rgb, diffuseColor.a * u_FillOpacity), strokeColor * u_StrokeOpacity, color_t);\n outputColor.a = outputColor.a * u_Opacity * opacity_t;\n\n if (outputColor.a < epsilon)\n discard;\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n }\n}",this.material.defines=ge({},this.material.defines,ui(Ei))},n.createGeometry=function(t){var r=this;e.prototype.createGeometry.call(this,t);var n=[],i=[],o=[];t.forEach((function(e,t){var a=e,s=4*t,u=a.parsedStyle.radius,c=r.shouldOmitStroke(a.parsedStyle),l=r.getSize(e.parsedStyle,a.nodeName);i.push.apply(i,l.concat([gi.indexOf(a.nodeName),u||0,c?1:0,0])),n.push(-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1),o.push(0+s,2+s,1+s,0+s,3+s,2+s)})),this.geometry.setIndexBuffer(new Uint32Array(o)),this.geometry.vertexCount=6,this.geometry.setVertexBuffer({bufferIndex:li.POSITION,byteStride:16,frequency:Ze.PerVertex,attributes:[{format:ct.F32_RG,bufferByteOffset:0,location:fi.POSITION},{format:ct.F32_RG,bufferByteOffset:8,location:fi.UV}],data:new Float32Array(n)}),this.geometry.setVertexBuffer({bufferIndex:vi.PACKED_STYLE,byteStride:24,frequency:Ze.PerInstance,attributes:[{format:ct.F32_RG,bufferByteOffset:0,location:Ei.SIZE,divisor:1},{format:ct.F32_RGBA,bufferByteOffset:8,location:Ei.PACKED_STYLE3,divisor:1}],data:new Float32Array(i)})},n.updateAttribute=function(t,r,n,i){var o=this;if(e.prototype.updateAttribute.call(this,t,r,n,i),this.updateBatchedAttribute(t,r,n,i),"r"===n||"rx"===n||"ry"===n||"lineWidth"===n||"stroke"===n||"lineDash"===n||"strokeOpacity"===n){var a=[];t.forEach((function(e){var t=o.shouldOmitStroke(e.parsedStyle),r=o.getSize(e.parsedStyle,e.nodeName);a.push.apply(a,[r[0],r[1]].concat([gi.indexOf(e.nodeName),e.parsedStyle.radius||0,t?1:0,0]))})),this.geometry.updateVertexBuffer(vi.PACKED_STYLE,Ei.SIZE,r,new Uint8Array(new Float32Array(a).buffer))}},n.getSize=function(e,r){var n=[0,0];if(r===t.Shape.CIRCLE){var i=e.r;n=[i,i]}else if(r===t.Shape.ELLIPSE){n=[e.rx,e.ry]}return n},n.shouldOmitStroke=function(e){var t=e.lineDash,r=e.stroke,n=e.strokeOpacity,i=r&&!r.isNone,o=t&&t.length&&t.every((function(e){return 0!==e}));return!i||i&&(o||1>n)},n.needDrawStrokeSeparately=function(e){var t=e.stroke,r=e.lineDash,n=e.lineWidth,i=e.strokeOpacity,o=t&&!t.isNone,a=r&&r.length&&r.every((function(e){return 0!==e}));return o&&n>0&&(a||1>i)},r}(_i);mi=u([t.injectable()],mi);var Ri,yi,Ti=[0,-.5,0,0,0,1,-.5,1,1,0,1,.5,1,1,1,0,.5,0,0,1];!function(e){e[e.POINT=5]="POINT",e[e.CAP=6]="CAP",e[e.DASH=7]="DASH"}(Ri||(Ri={})),function(e){e[e.POSITION=9]="POSITION",e[e.UV=11]="UV",e[e.POINTA=10]="POINTA",e[e.POINTB=12]="POINTB",e[e.CAP=13]="CAP",e[e.DASH=14]="DASH"}(yi||(yi={}));var Ai={butt:1,round:2,square:3},Si=function(e){function r(){return e.apply(this,arguments)||this}me(r,e);var n=r.prototype;return n.shouldMerge=function(t,r){var n=e.prototype.shouldMerge.call(this,t,r);return!!n},n.createMaterial=function(e){this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec3 a_Position;\nlayout(location = POINTA) in vec3 a_PointA;\nlayout(location = POINTB) in vec3 a_PointB;\nlayout(location = CAP) in float a_Cap;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\nlayout(location = DASH) in vec4 a_Dash;\n\nout vec4 v_Dash;\n// out vec2 v_Normal;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n float strokeWidth;\n if (u_IsPicking > 0.5) {\n strokeWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n strokeWidth = u_StrokeWidth;\n }\n\n float isBillboard = a_Dash.w;\n if (isBillboard < 0.5) {\n vec2 xBasis = a_PointB.xy - a_PointA.xy;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n\n vec2 point = a_PointA.xy + xBasis * a_Position.x + yBasis * strokeWidth * a_Position.y;\n point = point - u_Anchor.xy * abs(xBasis);\n\n // round & square\n if (a_Cap > 1.0) {\n point += sign(a_Position.x - 0.5) * normalize(xBasis) * vec2(strokeWidth / 2.0);\n }\n\n gl_Position = project(vec4(point, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n } else {\n // clip space\n vec4 clip0 = project(vec4(a_PointA, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n vec4 clip1 = project(vec4(a_PointB, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n // screen space\n vec2 screen0 = u_Viewport * (0.5 * clip0.xy / clip0.w + 0.5);\n vec2 screen1 = u_Viewport * (0.5 * clip1.xy / clip1.w + 0.5);\n vec2 xBasis = normalize(screen1 - screen0);\n vec2 yBasis = vec2(-xBasis.y, xBasis.x);\n vec2 pt0 = screen0 + strokeWidth * (a_Position.x * xBasis + a_Position.y * yBasis);\n vec2 pt1 = screen1 + strokeWidth * (a_Position.x * xBasis + a_Position.y * yBasis);\n vec2 pt = mix(pt0, pt1, a_Position.z);\n vec4 clip = mix(clip0, clip1, a_Position.z);\n gl_Position = vec4(clip.w * (2.0 * pt / u_Viewport - 1.0), clip.z, clip.w);\n }\n\n v_Dash = vec4(a_Position.x, a_Dash.xyz);\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nin vec4 v_Dash;\n// in vec2 v_Normal;\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_StrokeColor;\n #ifdef USE_MAP\n outputColor = u_Color;\n #endif\n\n // float blur = 1. - smoothstep(0.98, 1., length(v_Normal));\n float u_dash_offset = v_Dash.y;\n float u_dash_array = v_Dash.z;\n float u_dash_ratio = v_Dash.w;\n outputColor.a = outputColor.a\n // * blur\n * u_Opacity * u_StrokeOpacity\n * ceil(mod(v_Dash.x + u_dash_offset, u_dash_array) - (u_dash_array * u_dash_ratio));\n }\n}",this.material.defines=ge({},this.material.defines,ui(yi))},n.createGeometry=function(r){var n=this;e.prototype.createGeometry.call(this,r);var i=[],o=[],a=[],s=[],u=0;r.forEach((function(e){var r,c;if(e.nodeName===t.Shape.LINE)r=e.parsedStyle,c=e.getTotalLength();else if(e.nodeName===t.Shape.POLYLINE){var l=e.parsedStyle,f=l.points.points;r={x1:f[0][0],y1:f[0][1],x2:f[f.length-1][0],y2:f[f.length-1][1],z1:0,z2:0,defX:l.defX,defY:l.defY,lineCap:l.lineCap,isBillboard:!0,markerStart:l.markerStart,markerEnd:l.markerEnd,markerStartOffset:l.markerStartOffset,markerEndOffset:l.markerEndOffset},c=e.getTotalLength()}else if(e.nodeName===t.Shape.PATH){var h=e.parsedStyle,d=h.path.curve;r={x1:d[0][1],y1:d[0][2],x2:d[1][5],y2:d[1][6],z1:0,z2:0,defX:h.defX,defY:h.defY,lineCap:h.lineCap,isBillboard:!1,markerStart:h.markerStart,markerEnd:h.markerEnd,markerStartOffset:h.markerStartOffset,markerEndOffset:h.markerEndOffset},c=e.getTotalLength()}var p=r.x1,_=r.y1,v=r.x2,E=r.y2,g=r.z1,m=r.z2,R=r.defX,y=r.defY,T=r.lineCap,A=r.isBillboard,S=n.calcOffset(r),C=S.startOffsetX,O=S.startOffsetY,I=S.endOffsetX,N=S.endOffsetY,x=n.calcDash(r,c),P=x.dashOffset,M=x.dashSegmentPercent,D=x.dashRatioInEachSegment;o.push(Ai[T]),a.push(P,M,D,A?1:0),i.push(p-R+C,_-y+O,g,v-R+I,E-y+N,m),s.push(0+u,2+u,1+u,0+u,3+u,2+u),u+=4})),this.geometry.setIndexBuffer(new Uint32Array(s)),this.geometry.vertexCount=6,this.geometry.setVertexBuffer({bufferIndex:li.POSITION,byteStride:20,frequency:Ze.PerInstance,attributes:[{format:ct.F32_RGB,bufferByteOffset:0,location:yi.POSITION,divisor:0},{format:ct.F32_RG,bufferByteOffset:12,location:yi.UV,divisor:0}],data:new Float32Array(Ti)}),this.geometry.setVertexBuffer({bufferIndex:Ri.POINT,byteStride:24,frequency:Ze.PerInstance,attributes:[{format:ct.F32_RGB,bufferByteOffset:0,location:yi.POINTA,divisor:1},{format:ct.F32_RGB,bufferByteOffset:12,location:yi.POINTB,divisor:1}],data:new Float32Array(i)}),this.geometry.setVertexBuffer({bufferIndex:Ri.CAP,byteStride:4,frequency:Ze.PerInstance,attributes:[{format:ct.F32_R,bufferByteOffset:0,location:yi.CAP,divisor:1}],data:new Float32Array(o)}),this.geometry.setVertexBuffer({bufferIndex:Ri.DASH,byteStride:16,frequency:Ze.PerInstance,attributes:[{format:ct.F32_RGBA,bufferByteOffset:0,location:yi.DASH,divisor:1}],data:new Float32Array(a)})},n.updateAttribute=function(r,n,i,o){var a=this;if(e.prototype.updateAttribute.call(this,r,n,i,o),this.updateBatchedAttribute(r,n,i,o),"x1"===i||"y1"===i||"x2"===i||"y2"===i||"z1"===i||"z2"===i||"markerStartOffset"===i||"markerEndOffset"===i||"markerStart"===i||"markerEnd"===i||"points"===i||"path"===i){var s=[];r.forEach((function(e){var r;if(e.nodeName===t.Shape.LINE)r=e.parsedStyle;else if(e.nodeName===t.Shape.POLYLINE&&e.renderable.proxyNodeName===t.Shape.LINE){var n=e.parsedStyle,i=n.points.points;r={x1:i[0][0],y1:i[0][1],x2:i[i.length-1][0],y2:i[i.length-1][1],z1:0,z2:0,defX:n.defX,defY:n.defY,lineCap:n.lineCap,isBillboard:!0,markerStart:n.markerStart,markerEnd:n.markerEnd,markerStartOffset:n.markerStartOffset,markerEndOffset:n.markerEndOffset}}else if(e.nodeName===t.Shape.PATH&&e.renderable.proxyNodeName===t.Shape.LINE){var o=e.parsedStyle,u=o.path.curve;r={x1:u[0][1],y1:u[0][2],x2:u[1][5],y2:u[1][6],z1:0,z2:0,defX:o.defX,defY:o.defY,lineCap:o.lineCap,isBillboard:!0,markerStart:o.markerStart,markerEnd:o.markerEnd,markerStartOffset:o.markerStartOffset,markerEndOffset:o.markerEndOffset}}var c=r.x1,l=r.y1,f=r.x2,h=r.y2,d=r.z1,p=r.z2,_=r.defX,v=r.defY,E=a.calcOffset(r);s.push(c-_+E.startOffsetX,l-v+E.startOffsetY,d,f-_+E.endOffsetX,h-v+E.endOffsetY,p)})),this.geometry.updateVertexBuffer(Ri.POINT,yi.POINTA,n,new Uint8Array(new Float32Array(s).buffer))}else if("lineDashOffset"===i||"lineDash"===i){var u=[];r.forEach((function(e){var t=e.getTotalLength(),r=a.calcDash(e.parsedStyle,t);u.push(r.dashOffset,r.dashSegmentPercent,r.dashRatioInEachSegment,e.parsedStyle.isBillboard?1:0)})),this.geometry.updateVertexBuffer(Ri.DASH,yi.DASH,n,new Uint8Array(new Float32Array(u).buffer))}else if("lineCap"===i){var c=[];r.forEach((function(e){c.push(Ai[e.parsedStyle.lineCap])})),this.geometry.updateVertexBuffer(Ri.CAP,yi.CAP,n,new Uint8Array(new Float32Array(c).buffer))}},n.calcOffset=function(e){var r,n,i=e.x1,o=e.y1,a=e.x2,s=e.y2,u=e.markerStart,c=e.markerEnd,l=e.markerStartOffset,f=e.markerEndOffset,h=0,d=0,p=0,_=0,v=0;return u&&u instanceof t.DisplayObject&&l&&(r=a-i,n=s-o,v=Math.atan2(n,r),h=Math.cos(v)*(l||0),d=Math.sin(v)*(l||0)),c&&c instanceof t.DisplayObject&&f&&(r=i-a,n=o-s,v=Math.atan2(n,r),p=Math.cos(v)*(f||0),_=Math.sin(v)*(f||0)),{startOffsetX:h,startOffsetY:d,endOffsetX:p,endOffsetY:_}},n.calcDash=function(e,t){var r=e.lineDash,n=0,i=1,o=0;if(r&&r.length){n=(e.lineDashOffset||0)/t;var a=r.reduce((function(e,t){return e+t}),0);0===a?(i=1,o=0):(i=a/t,o=r[1]/a)}return{dashOffset:n,dashSegmentPercent:i,dashRatioInEachSegment:o}},r}(_i);function Ci(e,t,r,n){var i=e-r,o=t-n;return Math.sqrt(i*i+o*o)}Si=u([t.injectable()],Si);var Oi=function(e,t,r,n,i){return{x:(1-i)*e+i*r,y:(1-i)*t+i*n}};function Ii(e,t,r,n,i){var o=1-i;return o*o*o*e+3*t*i*o*o+3*r*i*i*o+n*i*i*i}function Ni(e,t,r,n,i,o,a,s,u){var c=Ii(e,r,i,a,u),l=Ii(t,n,o,s,u),f=Oi(e,t,r,n,u),h=Oi(r,n,i,o,u),d=Oi(i,o,a,s,u),p=Oi(f.x,f.y,h.x,h.y,u),_=Oi(h.x,h.y,d.x,d.y,u);return[[e,t,f.x,f.y,p.x,p.y,c,l],[c,l,_.x,_.y,d.x,d.y,a,s]]}function xi(e,t,r,n,i,o,a,s,u){if(0===u)return function(e,t){for(var r=0,n=e.length,i=0;n>i;i++)r+=Ci(e[i],t[i],e[(i+1)%n],t[(i+1)%n]);return r/2}([e,r,i,a],[t,n,o,s]);var c=Ni(e,t,r,n,i,o,a,s,.5),l=[].concat(c[0],[u-1]),f=[].concat(c[1],[u-1]);return xi.apply(void 0,l)+xi.apply(void 0,f)}var Pi,Mi=function(e,t,r,n,i,o,a,s){return xi(e,t,r,n,i,o,a,s,3)};!function(e){e[e.NONE=0]="NONE",e[e.FILL=1]="FILL",e[e.JOINT_BEVEL=4]="JOINT_BEVEL",e[e.JOINT_MITER=8]="JOINT_MITER",e[e.JOINT_ROUND=12]="JOINT_ROUND",e[e.JOINT_CAP_BUTT=16]="JOINT_CAP_BUTT",e[e.JOINT_CAP_SQUARE=18]="JOINT_CAP_SQUARE",e[e.JOINT_CAP_ROUND=20]="JOINT_CAP_ROUND",e[e.FILL_EXPAND=24]="FILL_EXPAND",e[e.CAP_BUTT=32]="CAP_BUTT",e[e.CAP_SQUARE=64]="CAP_SQUARE",e[e.CAP_ROUND=96]="CAP_ROUND",e[e.CAP_BUTT2=128]="CAP_BUTT2"}(Pi||(Pi={}));var Di,Bi,Li;!function(e){e[e.PACKED=0]="PACKED",e[e.VERTEX_NUM=1]="VERTEX_NUM",e[e.TRAVEL=2]="TRAVEL"}(Di||(Di={})),function(e){e[e.PREV=0]="PREV",e[e.POINT1=1]="POINT1",e[e.POINT2=2]="POINT2",e[e.NEXT=3]="NEXT",e[e.VERTEX_JOINT=4]="VERTEX_JOINT",e[e.VERTEX_NUM=5]="VERTEX_NUM",e[e.TRAVEL=6]="TRAVEL"}(Bi||(Bi={})),function(e){e.MODEL_MATRIX="u_ModelMatrix",e.FILL_COLOR="u_FillColor",e.STROKE_COLOR="u_StrokeColor",e.STROKE_WIDTH="u_StrokeWidth",e.INCREASED_LINE_WIDTH_FOR_HIT_TESTING="u_IncreasedLineWidthForHitTesting",e.OPACITY="u_Opacity",e.FILL_OPACITY="u_FillOpacity",e.STROKE_OPACITY="u_StrokeOpacity",e.EXPAND="u_Expand",e.MITER_LIMIT="u_MiterLimit",e.SCALE_MODE="u_ScaleMode",e.ALIGNMENT="u_Alignment",e.PICKING_COLOR="u_PickingColor",e.DASH="u_Dash",e.GAP="u_Gap",e.DASH_OFFSET="u_DashOffset",e.VISIBLE="u_Visible",e.Z_INDEX="u_ZIndex"}(Li||(Li={}));var bi=function(e){function r(){return e.apply(this,arguments)||this}me(r,e);var n=r.prototype;return n.shouldMerge=function(e,t){return!1},n.updateAttribute=function(r,n,i,o){var a=this;e.prototype.updateAttribute.call(this,r,n,i,o),r.forEach((function(e){var r=e.parsedStyle,n=r.stroke,s=r.opacity,u=r.fillOpacity,c=r.strokeOpacity,l=r.lineWidth,f=r.increasedLineWidthForHitTesting,h=r.anchor,d=r.lineDash,p=r.lineDashOffset,_=r.visibility;if("lineJoin"===i||"lineCap"===i||"markerStart"===i||"markerEnd"===i||"markerStartOffset"===i||"markerEndOffset"===i||e.nodeName===t.Shape.CIRCLE&&"r"===i||e.nodeName===t.Shape.ELLIPSE&&("rx"===i||"ry"===i)||e.nodeName===t.Shape.RECT&&("width"===i||"height"===i||"radius"===i)||e.nodeName===t.Shape.LINE&&("x1"===i||"y1"===i||"x2"===i||"y2"===i)||e.nodeName===t.Shape.POLYLINE&&"points"===i||e.nodeName===t.Shape.POLYGON&&"points"===i||e.nodeName===t.Shape.PATH&&"path"===i)a.material.geometryDirty=!0,a.material.programDirty=!0;else if("stroke"===i){var v,E=[0,0,0,0];n instanceof t.CSSRGB&&(E=[Number(n.r)/255,Number(n.g)/255,Number(n.b)/255,Number(n.alpha)]),a.material.setUniforms(((v={})[Li.STROKE_COLOR]=E,v))}else if("opacity"===i){var g;a.material.setUniforms(((g={})[Li.OPACITY]=s,g))}else if("fillOpacity"===i){var m;a.material.setUniforms(((m={})[Li.FILL_OPACITY]=u,m))}else if("strokeOpacity"===i){var R;a.material.setUniforms(((R={})[Li.STROKE_OPACITY]=c,R))}else if("lineWidth"===i){var y;a.material.setUniforms(((y={})[Li.STROKE_WIDTH]=l,y))}else if("increasedLineWidthForHitTesting"===i){var T;a.material.setUniforms(((T={})[Li.INCREASED_LINE_WIDTH_FOR_HIT_TESTING]=f||0,T))}else if("anchor"===i||"modelMatrix"===i){var A,S=0,C=0,O=e.getGeometryBounds();if(O){var I=O.halfExtents;S=-I[0]*h[0]*2,C=-I[1]*h[1]*2}var N=Pe();Le(N,e.getWorldTransform(),Be(N,be(S,C,0))),a.material.setUniforms(((A={})[Li.MODEL_MATRIX]=N,A))}else if("visibility"===i){var x;a.material.setUniforms(((x={})[Li.VISIBLE]="visible"===_?1:0,x))}else if("lineDash"===i){var P;a.material.setUniforms(((P={})[Li.DASH]=d[0]||0,P[Li.GAP]=d[1]||0,P))}else if("lineDashOffset"===i){var M;a.material.setUniforms(((M={})[Li.DASH_OFFSET]=p||0,M))}else if("pointerEvents"===i){var D,B,L=o&&e.isInteractive()&&(null===(D=e.renderable3D)||void 0===D?void 0:D.encodedPickingColor)||[0,0,0];a.material.setUniforms(((B={})[Li.PICKING_COLOR]=L,B))}}))},n.changeRenderOrder=function(e,t){var r;this.material&&this.material.setUniforms(((r={})[Li.Z_INDEX]=t*oi,r))},n.createMaterial=function(e){var r,n;this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nlayout(location = PREV) in vec2 a_Prev;\nlayout(location = POINT1) in vec2 a_Point1;\nlayout(location = POINT2) in vec2 a_Point2;\nlayout(location = NEXT) in vec2 a_Next;\nlayout(location = VERTEX_JOINT) in float a_VertexJoint;\nlayout(location = VERTEX_NUM) in float a_VertexNum;\nlayout(location = TRAVEL) in float a_Travel;\n\nconst float FILL = 1.0;\nconst float BEVEL = 4.0;\nconst float MITER = 8.0;\nconst float ROUND = 12.0;\nconst float JOINT_CAP_BUTT = 16.0;\nconst float JOINT_CAP_SQUARE = 18.0;\nconst float JOINT_CAP_ROUND = 20.0;\nconst float FILL_EXPAND = 24.0;\nconst float CAP_BUTT = 1.0;\nconst float CAP_SQUARE = 2.0;\nconst float CAP_ROUND = 3.0;\nconst float CAP_BUTT2 = 4.0;\n\nout vec4 v_Distance;\nout vec4 v_Arc;\nout float v_Type;\nout float v_Travel;\n\nvec2 doBisect(\n vec2 norm, float len, vec2 norm2, float len2, float dy, float inner\n) {\n vec2 bisect = (norm + norm2) / 2.0;\n bisect /= dot(norm, bisect);\n vec2 shift = dy * bisect;\n if (inner > 0.5) {\n if (len < len2) {\n if (abs(dy * (bisect.x * norm.y - bisect.y * norm.x)) > len) {\n return dy * norm;\n }\n } else {\n if (abs(dy * (bisect.x * norm2.y - bisect.y * norm2.x)) > len2) {\n return dy * norm;\n }\n }\n }\n return dy * bisect;\n}\n\nvoid main() {\n vec2 pointA = (u_ModelMatrix * vec4(a_Point1, 0., 1.0)).xy;\n vec2 pointB = (u_ModelMatrix * vec4(a_Point2, 0., 1.0)).xy;\n\n vec2 xBasis = pointB - pointA;\n float len = length(xBasis);\n vec2 forward = xBasis / len;\n vec2 norm = vec2(forward.y, -forward.x);\n\n float type = a_VertexJoint;\n\n float lineWidth;\n if (u_IsPicking > 0.5) {\n lineWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n lineWidth = u_StrokeWidth;\n }\n\n if (u_ScaleMode > 2.5) {\n lineWidth *= length(u_ModelMatrix * vec4(1.0, 0.0, 0.0, 0.0));\n } else if (u_ScaleMode > 1.5) {\n lineWidth *= length(u_ModelMatrix * vec4(0.0, 1.0, 0.0, 0.0));\n } else if (u_ScaleMode > 0.5) {\n vec2 avgDiag = (u_ModelMatrix * vec4(1.0, 1.0, 0.0, 0.0)).xy;\n lineWidth *= sqrt(dot(avgDiag, avgDiag) * 0.5);\n }\n float capType = floor(type / 32.0);\n type -= capType * 32.0;\n v_Arc = vec4(0.0);\n lineWidth *= 0.5;\n float lineAlignment = 2.0 * u_Alignment - 1.0;\n\n vec2 pos;\n\n if (capType == CAP_ROUND) {\n if (a_VertexNum < 3.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n type = JOINT_CAP_ROUND;\n capType = 0.0;\n }\n\n if (type >= BEVEL) {\n float dy = lineWidth + u_Expand;\n float inner = 0.0;\n if (a_VertexNum >= 1.5) {\n dy = -dy;\n inner = 1.0;\n }\n\n vec2 base, next, xBasis2, bisect;\n float flag = 0.0;\n float sign2 = 1.0;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5 && a_VertexNum < 3.5) {\n next = (u_ModelMatrix * vec4(a_Prev, 0.0, 1.0)).xy;\n base = pointA;\n flag = type - floor(type / 2.0) * 2.0;\n sign2 = -1.0;\n\n } else {\n next = (u_ModelMatrix * vec4(a_Next, 0.0, 1.0)).xy;\n base = pointB;\n if (type >= MITER && type < MITER + 3.5) {\n flag = step(MITER + 1.5, type);\n // check miter limit here?\n }\n }\n xBasis2 = next - base;\n float len2 = length(xBasis2);\n vec2 norm2 = vec2(xBasis2.y, -xBasis2.x) / len2;\n float D = norm.x * norm2.y - norm.y * norm2.x;\n if (D < 0.0) {\n inner = 1.0 - inner;\n }\n norm2 *= sign2;\n\n if (abs(lineAlignment) > 0.01) {\n float shift = lineWidth * lineAlignment;\n pointA += norm * shift;\n pointB += norm * shift;\n if (abs(D) < 0.01) {\n base += norm * shift;\n } else {\n base += doBisect(norm, len, norm2, len2, shift, 0.0);\n }\n }\n\n float collinear = step(0.0, dot(norm, norm2));\n v_Type = 0.0;\n float dy2 = -1000.0;\n float dy3 = -1000.0;\n if (abs(D) < 0.01 && collinear < 0.5) {\n if (type >= ROUND && type < ROUND + 1.5) {\n type = JOINT_CAP_ROUND;\n }\n //TODO: BUTT here too\n }\n\n if (a_VertexNum < 3.5) {\n if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (flag < 0.5 && inner < 0.5) {\n pos = dy * norm;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, inner);\n }\n }\n if (capType >= CAP_BUTT && capType < CAP_ROUND) {\n float extra = step(CAP_SQUARE, capType) * lineWidth;\n vec2 back = -forward;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n pos += back * (u_Expand + extra);\n dy2 = u_Expand;\n } else {\n dy2 = dot(pos + base - pointA, back) - extra;\n }\n }\n if (type >= JOINT_CAP_BUTT && type < JOINT_CAP_SQUARE + 0.5) {\n float extra = step(JOINT_CAP_SQUARE, type) * lineWidth;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n dy3 = dot(pos + base - pointB, forward) - extra;\n } else {\n pos += forward * (u_Expand + extra);\n dy3 = u_Expand;\n if (capType >= CAP_BUTT) {\n dy2 -= u_Expand + extra;\n }\n }\n }\n } else if (type >= JOINT_CAP_ROUND && type < JOINT_CAP_ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n vec2 d2 = abs(dy) * forward;\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = dy * norm;\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum < 6.5) {\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n } else {\n dy = -dy;\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n }\n dy2 = 0.0;\n v_Arc.y = dy;\n v_Arc.z = 0.0;\n v_Arc.w = lineWidth;\n v_Type = 3.0;\n } else if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (type >= ROUND && type < ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n float d2 = abs(dy);\n if (length(pos) > abs(dy) * 1.5) {\n if (a_VertexNum < 6.5) {\n pos.x = dy * norm.x - d2 * norm.y;\n pos.y = dy * norm.y + d2 * norm.x;\n } else {\n pos.x = dy * norm2.x + d2 * norm2.y;\n pos.y = dy * norm2.y - d2 * norm2.x;\n }\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n v_Arc.x = sign * dot(pos, norm3);\n v_Arc.y = pos.x * norm3.y - pos.y * norm3.x;\n v_Arc.z = dot(norm, norm3) * lineWidth;\n v_Arc.w = lineWidth;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = v_Arc.z - v_Arc.x;\n v_Type = 3.0;\n } else {\n float hit = 0.0;\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (dot(norm, norm2) > 0.0) {\n type = MITER;\n }\n }\n if (type >= MITER && type < MITER + 3.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float sign = step(0.0, dy) * 2.0 - 1.0;\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n if (length(pos) > abs(dy) * u_MiterLimit) {\n type = BEVEL;\n } else {\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = doBisect(norm, len, norm2, len2, dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 6.5) {\n pos = dy * norm2;\n }\n v_Type = 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n hit = 1.0;\n }\n }\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float d2 = abs(dy);\n vec2 pos3 = vec2(dy * norm.x - d2 * norm.y, dy * norm.y + d2 * norm.x);\n vec2 pos4 = vec2(dy * norm2.x + d2 * norm2.y, dy * norm2.y - d2 * norm2.x);\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n if (a_VertexNum < 6.5) {\n pos = pos3;\n } else {\n pos = pos4;\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = (-sign * dot(pos, norm3)) + lineWidth;\n v_Type = 4.0;\n hit = 1.0;\n }\n if (hit < 0.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n }\n }\n pos += base;\n v_Distance = vec4(dy, dy2, dy3, lineWidth) * u_DevicePixelRatio;\n v_Arc = v_Arc * u_DevicePixelRatio;\n v_Travel = a_Travel + dot(pos - pointA, vec2(-norm.y, norm.x));\n }\n\n gl_Position = u_ProjectionMatrix * u_ViewMatrix * vec4(pos, u_ZIndex, 1.0);\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nin vec4 v_Distance;\nin vec4 v_Arc;\nin float v_Type;\nin float v_Travel;\n\nout vec4 outputColor;\n\n#define COLOR_SCALE 1. / 255.\n\nvoid main(){\n if (u_Visible < 0.5) {\n discard;\n }\n\n float alpha = 1.0;\n float lineWidth = v_Distance.w;\n if (v_Type < 0.5) {\n float left = max(v_Distance.x - 0.5, -v_Distance.w);\n float right = min(v_Distance.x + 0.5, v_Distance.w);\n float near = v_Distance.y - 0.5;\n float far = min(v_Distance.y + 0.5, 0.0);\n float top = v_Distance.z - 0.5;\n float bottom = min(v_Distance.z + 0.5, 0.0);\n alpha = max(right - left, 0.0) * max(bottom - top, 0.0) * max(far - near, 0.0);\n } else if (v_Type < 1.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n } else if (v_Type < 2.5) {\n alpha *= max(min(v_Distance.x + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.y + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n } else if (v_Type < 3.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n float alpha_miter = a2 * b2 - a1 * b1;\n float alpha_plane = max(min(v_Distance.z + 0.5, 1.0), 0.0);\n float d = length(v_Arc.xy);\n float circle_hor = max(min(v_Arc.w, d + 0.5) - max(-v_Arc.w, d - 0.5), 0.0);\n float circle_vert = min(v_Arc.w * 2.0, 1.0);\n float alpha_circle = circle_hor * circle_vert;\n alpha = min(alpha_miter, max(alpha_circle, alpha_plane));\n } else {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n }\n\n if (u_Dash + u_Gap > 1.0) {\n float scalingFactor = sqrt(u_ModelMatrix[0][0] * u_ModelMatrix[0][0] + u_ModelMatrix[0][1] * u_ModelMatrix[0][1] + u_ModelMatrix[0][2] * u_ModelMatrix[0][2]);\n float travel = mod(v_Travel + u_Gap * scalingFactor * 0.5 + u_DashOffset, u_Dash * scalingFactor + u_Gap * scalingFactor) - (u_Gap * scalingFactor * 0.5);\n float left = max(travel - 0.5, -0.5);\n float right = min(travel + 0.5, u_Gap * scalingFactor + 0.5);\n alpha *= max(0.0, right - left);\n }\n\n if (u_IsPicking > 0.5) {\n vec3 pickingColor = COLOR_SCALE * u_PickingColor;\n if (pickingColor.x == 0.0 && pickingColor.y == 0.0 && pickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(pickingColor, 1.0);\n } else {\n outputColor = u_StrokeColor;\n outputColor.a *= alpha * u_Opacity * u_StrokeOpacity;\n }\n}",this.material.defines=ge({},this.material.defines,ui(Bi));var i=e[0],o=i.parsedStyle,a=o.fill,s=o.stroke,u=o.opacity,c=o.fillOpacity,l=o.strokeOpacity,f=o.lineWidth,h=o.increasedLineWidthForHitTesting,d=o.anchor,p=o.lineDash,_=o.lineDashOffset,v=o.visibility,E=[0,0,0,0];a instanceof t.CSSRGB&&(E=[Number(a.r)/255,Number(a.g)/255,Number(a.b)/255,Number(a.alpha)]);var g=[0,0,0,0];s instanceof t.CSSRGB&&(g=[Number(s.r)/255,Number(s.g)/255,Number(s.b)/255,Number(s.alpha)]);var m=i.isInteractive()&&(null===(r=i.renderable3D)||void 0===r?void 0:r.encodedPickingColor)||[0,0,0],R=0,y=0,T=i.getGeometryBounds();if(T){var A=T.halfExtents;R=-A[0]*d[0]*2,y=-A[1]*d[1]*2}var S=Pe();Le(S,i.getWorldTransform(),Be(S,be(R,y,0))),this.material.setUniforms(((n={})[Li.MODEL_MATRIX]=S,n[Li.FILL_COLOR]=E,n[Li.STROKE_COLOR]=g,n[Li.STROKE_WIDTH]=f,n[Li.INCREASED_LINE_WIDTH_FOR_HIT_TESTING]=h||0,n[Li.OPACITY]=u,n[Li.FILL_OPACITY]=c,n[Li.STROKE_OPACITY]=l,n[Li.EXPAND]=1,n[Li.MITER_LIMIT]=5,n[Li.SCALE_MODE]=1,n[Li.ALIGNMENT]=.5,n[Li.PICKING_COLOR]=m,n[Li.DASH]=p&&p[0]||0,n[Li.GAP]=p&&p[1]||0,n[Li.DASH_OFFSET]=_||0,n[Li.VISIBLE]="visible"===v?1:0,n[Li.Z_INDEX]=i.sortable.renderOrder*oi,n)),this.material.cullMode=Ve.None},n.createGeometry=function(e){var t=wi(e[0]),r=t.travelBuffer,n=t.instancedCount;this.geometry.setVertexBuffer({bufferIndex:Di.PACKED,byteStride:48,frequency:Ze.PerInstance,attributes:[{format:ct.F32_RG,bufferByteOffset:0,byteStride:12,location:Bi.PREV,divisor:1},{format:ct.F32_RG,bufferByteOffset:12,byteStride:12,location:Bi.POINT1,divisor:1},{format:ct.F32_R,bufferByteOffset:20,byteStride:12,location:Bi.VERTEX_JOINT,divisor:1},{format:ct.F32_RG,bufferByteOffset:24,byteStride:12,location:Bi.POINT2,divisor:1},{format:ct.F32_RG,bufferByteOffset:36,byteStride:12,location:Bi.NEXT,divisor:1}],data:new Float32Array(t.pointsBuffer)}),this.geometry.setVertexBuffer({bufferIndex:Di.VERTEX_NUM,byteStride:4,frequency:Ze.PerInstance,attributes:[{format:ct.F32_R,bufferByteOffset:0,byteStride:4,location:Bi.VERTEX_NUM,divisor:0}],data:new Float32Array([0,1,2,3,4,5,6,7,8])}),this.geometry.setVertexBuffer({bufferIndex:Di.TRAVEL,byteStride:4,frequency:Ze.PerInstance,attributes:[{format:ct.F32_R,bufferByteOffset:0,byteStride:4,location:Bi.TRAVEL,divisor:1}],data:new Float32Array(r)}),this.geometry.vertexCount=15,this.geometry.instancedCount=n,this.geometry.setIndexBuffer(new Uint32Array([0,2,1,0,3,2,4,6,5,4,7,6,4,7,8]))},r}(_i);function Fi(e,t,r,n,i,o,a){var s=a[a.length-2],u=a[a.length-1];a.length-=2;var c=function(e,t){var r=Math.ceil(e/10);8>r?r=8:r>Ui&&(r=Ui);return r}(Mi(s,u,e,t,r,n,i,o)),l=0,f=0,h=0,d=0,p=0;a.push(s,u);for(var _=1,v=0;c>=_;++_)a.push((h=(f=(l=1-(v=_/c))*l)*l)*s+3*f*v*e+3*l*(d=v*v)*r+(p=d*v)*i,h*u+3*f*v*t+3*l*d*n+p*o)}bi=u([t.injectable()],bi);var Ui=2048;function wi(e,r){void 0===r&&(r=!1);var n=e.parsedStyle,i=n.lineCap,o=n.lineJoin,a=e.parsedStyle,s=a.defX,u=a.defY,c=e.parsedStyle,l=c.markerStart,f=c.markerEnd,h=c.markerStartOffset,d=c.markerEndOffset,p=[],_=[];if(e.nodeName===t.Shape.POLYLINE||e.nodeName===t.Shape.POLYGON){var v,E,g=e.parsedStyle.points.points,m=g.length,R=0,y=0,T=0,A=0,S=0;if(l&&l instanceof t.DisplayObject&&h&&(v=g[1][0]-g[0][0],E=g[1][1]-g[0][1],S=Math.atan2(E,v),R=Math.cos(S)*(h||0),y=Math.sin(S)*(h||0)),f&&f instanceof t.DisplayObject&&d&&(v=g[m-2][0]-g[m-1][0],E=g[m-2][1]-g[m-1][1],S=Math.atan2(E,v),T=Math.cos(S)*(d||0),A=Math.sin(S)*(d||0)),p[0]=g.reduce((function(e,t,r){var n=0,i=0;return 0===r?(n=R,i=y):r===m-1&&(n=T,i=A),e.push(t[0]-s+n,t[1]-u+i),e}),[]),e.nodeName===t.Shape.POLYGON){if(r)return _=b(p[0],[],2),{pointsBuffer:p[0],travelBuffer:[],triangles:_,instancedCount:Math.round(p[0].length/2)};var C;p[0].push(p[0][0],p[0][1]),(C=p[0]).push.apply(C,Gi(p[0][0],p[0][1],p[0][2],p[0][3]))}}else if(e.nodeName===t.Shape.PATH||e.nodeName===t.Shape.CIRCLE||e.nodeName===t.Shape.ELLIPSE||e.nodeName===t.Shape.RECT){var O;if(e.nodeName!==t.Shape.PATH){if(O=t.parsePath(t.convertToPath(e,!1),e),s=O.rect.x,u=O.rect.y,e.nodeName===t.Shape.RECT){var I=e.parsedStyle;0>I.width&&(s+=O.rect.width),0>I.height&&(u+=O.rect.height)}}else O=e.parsedStyle.path;var N,x,P=O.zCommandIndexes,M=[].concat(O.curve).map((function(e,t){return P.includes(t)?["Z"]:e})),D=M.length&&"Z"===M[M.length-1][0],B=0,L=0,F=0,U=0,w=0;if(l&&l instanceof t.DisplayObject&&h){var G=l.parentNode.getStartTangent(),k=G[0],V=G[1];N=k[0]-V[0],x=k[1]-V[1],w=Math.atan2(x,N),B=Math.cos(w)*(h||0),L=Math.sin(w)*(h||0)}if(f&&f instanceof t.DisplayObject&&d){var W=f.parentNode.getEndTangent(),X=W[0],H=W[1];N=X[0]-H[0],x=X[1]-H[1],w=Math.atan2(x,N),F=Math.cos(w)*(d||0),U=Math.sin(w)*(d||0)}var j=-1,Y=-1;if(M.forEach((function(r,n){var i=r[0],o=r.slice(1);if("M"===i)Y++,p[Y]=[],j=p[Y].length,p[Y].push(o[0]-s+B,o[1]-u+L);else if("C"===i){Fi(o[0]-s,o[1]-u,o[2]-s,o[3]-u,o[4]-s+(n===M.length-(D?2:1)?F:0),o[5]-u+(n===M.length-(D?2:1)?U:0),p[Y])}else if("Z"===i&&(e.nodeName===t.Shape.PATH||e.nodeName===t.Shape.RECT)){var a,c=1e-4;(Math.abs(p[Y][p[Y].length-2]-p[Y][j])>c||Math.abs(p[Y][p[Y].length-1]-p[Y][j+1])>c)&&p[Y].push(p[Y][j],p[Y][j+1]),(a=p[Y]).push.apply(a,Gi(p[Y][j],p[Y][j+1],p[Y][j+2],p[Y][j+3]))}})),r){var K=p.reduce((function(e,t){return e.push.apply(e,t),e}),[]);return{pointsBuffer:K,travelBuffer:[],triangles:_=b(K,[],2),instancedCount:Math.round(K.length/2)}}}var z=function(e){var t;switch(e){case"bevel":t=Pi.JOINT_BEVEL;break;case"round":t=Pi.JOINT_ROUND;break;default:t=Pi.JOINT_MITER}return t}(o),q=function(e){var t;switch(e){case"square":t=Pi.CAP_SQUARE;break;case"round":t=Pi.CAP_ROUND;break;default:t=Pi.CAP_BUTT}return t}(i),Z=q;return q===Pi.CAP_ROUND&&(Z=Pi.JOINT_CAP_ROUND),q===Pi.CAP_BUTT&&(Z=Pi.JOINT_CAP_BUTT),q===Pi.CAP_SQUARE&&(Z=Pi.JOINT_CAP_SQUARE),p.map((function(e){for(var t=3*(Math.round(0)+2),r=0,n=[],i=[],o=0;e.length>o;o+=2)o>1&&(r+=Math.sqrt(Math.pow(e[o]-e[o-2],2)+Math.pow(e[o+1]-e[o+1-2],2))),i.push(r),n[t++]=e[o],n[t++]=e[o+1],n[t]=z,0==o&&q!==Pi.CAP_ROUND&&(n[t]+=q),e.length>o+4?e.length>o+2||(n[t]=0):n[t]+=Z-z,t++;n[t++]=e[e.length-4],n[t++]=e[e.length-3],n[t++]=0,n[0]=e[0],n[1]=e[1],n[2]=0,n[3]=e[2],n[4]=e[3],n[5]=q===Pi.CAP_ROUND?q:0;var a=Math.round(e.length/2);return{pointsBuffer:n,travelBuffer:i,triangles:_,instancedCount:a}})).reduce((function(e,t){var r,n;return(r=e.pointsBuffer).push.apply(r,t.pointsBuffer),(n=e.travelBuffer).push.apply(n,t.travelBuffer),e.instancedCount+=t.instancedCount,e}),{pointsBuffer:[],travelBuffer:[],triangles:_,instancedCount:0})}function Gi(e,t,r,n){void 0===r&&(r=e),void 0===n&&(n=t);var i=[r-e,n-t];return[e+.01*i[0],t+.01*i[1]]}var ki=function(e){function r(){return e.apply(this,arguments)||this}me(r,e);var n=r.prototype;return n.shouldMerge=function(e,t){return!1},n.createGeometry=function(e){var t=e[0],r=wi(t,!0),n=r.triangles,i=r.pointsBuffer;this.geometry.setVertexBuffer({bufferIndex:li.POSITION,byteStride:8,frequency:Ze.PerVertex,attributes:[{format:ct.F32_RG,bufferByteOffset:0,location:fi.POSITION}],data:new Float32Array(i)});var o=t.getGeometryBounds().halfExtents,a=i.map((function(e,t){return e/o[t%2]/2}));this.geometry.setVertexBuffer({bufferIndex:li.UV,byteStride:8,frequency:Ze.PerVertex,attributes:[{format:ct.F32_RG,bufferByteOffset:0,location:fi.UV}],data:new Float32Array(a)}),this.geometry.vertexCount=n.length,this.geometry.setIndexBuffer(new Uint32Array(n))},n.createMaterial=function(e){var r,n;this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec3 u_PickingColor;\n float u_Opacity;\n float u_FillOpacity;\n float u_Visible;\n float u_ZIndex;\n};\n\nlayout(location = POSITION) in vec2 a_Position;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nvoid main() {\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n gl_Position = u_ProjectionMatrix * u_ViewMatrix * u_ModelMatrix * vec4(a_Position, u_ZIndex, 1.0);\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec3 u_PickingColor;\n float u_Opacity;\n float u_FillOpacity;\n float u_Visible;\n float u_ZIndex;\n};\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nout vec4 outputColor;\n\n#define COLOR_SCALE 1. / 255.\n\nvoid main(){\n if (u_Visible < 0.5) {\n discard;\n }\n\n if (u_IsPicking > 0.5) {\n vec3 pickingColor = COLOR_SCALE * u_PickingColor;\n if (pickingColor.x == 0.0 && pickingColor.y == 0.0 && pickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(pickingColor, 1.0);\n } else {\n\n vec4 u_Color = u_FillColor;\n\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity * u_FillOpacity;\n }\n}";var i=e[0],o=i.parsedStyle,a=o.fill,s=o.opacity,u=o.fillOpacity,c=o.anchor,l=o.visibility,f=[0,0,0,0];a instanceof t.CSSRGB&&(f=[Number(a.r)/255,Number(a.g)/255,Number(a.b)/255,Number(a.alpha)]);var h=i.isInteractive()&&(null===(r=i.renderable3D)||void 0===r?void 0:r.encodedPickingColor)||[0,0,0],d=0,p=0,_=i.getGeometryBounds();if(_){var v=_.halfExtents;d=-v[0]*c[0]*2,p=-v[1]*c[1]*2}var E=Pe();Le(E,i.getWorldTransform(),Be(E,be(d,p,0))),this.material.setUniforms(((n={})[Li.MODEL_MATRIX]=E,n[Li.FILL_COLOR]=f,n[Li.PICKING_COLOR]=h,n[Li.OPACITY]=s,n[Li.FILL_OPACITY]=u,n[Li.VISIBLE]="visible"===l?1:0,n[Li.Z_INDEX]=i.sortable.renderOrder*oi,n))},n.updateAttribute=function(r,n,i,o){var a=this;e.prototype.updateAttribute.call(this,r,n,i,o),r.forEach((function(e){var r=e.parsedStyle,n=r.fill,s=r.opacity,u=r.fillOpacity,c=r.anchor,l=r.visibility;if("lineJoin"===i||"lineCap"===i||"markerStart"===i||"markerEnd"===i||"markerStartOffset"===i||"markerEndOffset"===i||e.nodeName===t.Shape.RECT&&("width"===i||"height"===i||"radius"===i)||e.nodeName===t.Shape.LINE&&("x1"===i||"y1"===i||"x2"===i||"y2"===i)||e.nodeName===t.Shape.POLYLINE&&"points"===i||e.nodeName===t.Shape.POLYGON&&"points"===i||e.nodeName===t.Shape.PATH&&"path"===i)a.material.geometryDirty=!0,a.material.programDirty=!0;else if("fill"===i)if(n instanceof t.CSSRGB){var f,h=[Number(n.r)/255,Number(n.g)/255,Number(n.b)/255,Number(n.alpha)];a.material.setUniforms(((f={})[Li.FILL_COLOR]=h,f))}else{var d=a.textureMappings.findIndex((function(e){return e.name===pi})),p=a.createFillGradientTextureMapping([a.instance]);0>d||a.textureMappings.splice(d,1,p),a.material.textureDirty=!0}else if("opacity"===i){var _;a.material.setUniforms(((_={})[Li.OPACITY]=s,_))}else if("fillOpacity"===i){var v;a.material.setUniforms(((v={})[Li.FILL_OPACITY]=u,v))}else if("anchor"===i||"modelMatrix"===i){var E,g=0,m=0,R=e.getGeometryBounds();if(R){var y=R.halfExtents;g=-y[0]*c[0]*2,m=-y[1]*c[1]*2}var T=Pe();Le(T,e.getWorldTransform(),Be(T,be(g,m,0))),a.material.setUniforms(((E={})[Li.MODEL_MATRIX]=T,E))}else if("visibility"===i){var A;a.material.setUniforms(((A={})[Li.VISIBLE]="visible"===l?1:0,A))}else if("pointerEvents"===i){var S,C,O=o&&e.isInteractive()&&(null===(S=e.renderable3D)||void 0===S?void 0:S.encodedPickingColor)||[0,0,0];a.material.setUniforms(((C={})[Li.PICKING_COLOR]=O,C))}}))},n.changeRenderOrder=function(e,t){var r;this.material&&this.material.setUniforms(((r={})[Li.Z_INDEX]=t*oi,r))},r}(_i);ki=u([t.injectable()],ki);var Vi=function(e){function t(){return e.apply(this,arguments)||this}me(t,e);var r=t.prototype;return r.shouldMerge=function(t,r){var n=e.prototype.shouldMerge.call(this,t,r);return!!n&&this.instance.parsedStyle.img===t.parsedStyle.img},r.createMaterial=function(e){var t=e[0].parsedStyle.img;this.material.defines=ge({},this.material.defines),this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec2 a_Size;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n vec2 offset = (a_Uv - u_Anchor.xy) * a_Size;\n\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n }\n}";var r=this.texturePool.getOrCreateTexture(this.device,t);this.material.setUniforms({u_Map:r})},r.createGeometry=function(t){e.prototype.createGeometry.call(this,t);var r=[],n=[],i=[];t.forEach((function(e,t){var o=4*t,a=e.parsedStyle;r.push(a.width,a.height),n.push(0,0,1,0,1,1,0,1),i.push(0+o,2+o,1+o,0+o,3+o,2+o)})),this.geometry.setIndexBuffer(new Uint32Array(i)),this.geometry.vertexCount=6,this.geometry.setVertexBuffer({bufferIndex:li.POSITION,byteStride:8,frequency:Ze.PerInstance,attributes:[{format:ct.F32_RG,bufferByteOffset:0,location:fi.POSITION}],data:new Float32Array(r)}),this.geometry.setVertexBuffer({bufferIndex:li.UV,byteStride:8,frequency:Ze.PerVertex,attributes:[{format:ct.F32_RG,bufferByteOffset:0,location:fi.UV}],data:new Float32Array(n)})},r.updateAttribute=function(t,r,n,i){if(e.prototype.updateAttribute.call(this,t,r,n,i),this.updateBatchedAttribute(t,r,n,i),"width"===n||"height"===n){var o=[];t.forEach((function(e){var t=e.parsedStyle;o.push(t.width,t.height)})),this.geometry.updateVertexBuffer(li.POSITION,fi.POSITION,r,new Uint8Array(new Float32Array(o).buffer))}else if("img"===n){var a=this.texturePool.getOrCreateTexture(this.device,i);this.material.setUniforms({u_Map:a})}},t}(_i);Vi=u([t.injectable()],Vi);function Wi(e,t,r,n){var i=t.width,o=t.height;if(n){if(n.length!==i*o*r)throw new RangeError("mismatched image size")}else n=new Uint8Array(i*o*r);return e.width=i,e.height=o,e.data=n,e}function Xi(e,t,r,n,i,o){if(0===i.width||0===i.height)return t;if(i.width>e.width||i.height>e.height||r.x>e.width-i.width||r.y>e.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>t.width||i.height>t.height||n.x>t.width-i.width||n.y>t.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var a=e.data,s=t.data,u=0;i.height>u;u++)for(var c=((r.y+u)*e.width+r.x)*o,l=((n.y+u)*t.width+n.x)*o,f=0;i.width*o>f;f++)s[l+f]=a[c+f];return t}var Hi=function(){function e(e,t){this.width=void 0,this.height=void 0,this.data=void 0,Wi(this,e,1,t)}var t=e.prototype;return t.resize=function(e){!function(e,t,r){var n=t.width,i=t.height;if(n!==e.width||i!==e.height){var o=Wi({},{width:n,height:i},r);Xi(e,o,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,n),height:Math.min(e.height,i)},r),e.width=n,e.height=i,e.data=o.data}}(this,e,1)},t.clone=function(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))},e.copy=function(e,t,r,n,i){Xi(e,t,r,n,i,1)},e}();var ji=function(e){this.image=void 0,this.positions=void 0;var t={},r=[];for(var n in e){var i=e[n],o=t[n]={};for(var a in i){if((c=i[+a])&&0!==c.bitmap.width&&0!==c.bitmap.height)r.push(l={x:0,y:0,w:c.bitmap.width+2,h:c.bitmap.height+2}),o[a]={rect:l,metrics:c.metrics}}}var s=function(e){for(var t,r=0,n=0,i=Se(e);!(t=i()).done;){var o=t.value;r+=o.w*o.h,n=Math.max(n,o.w)}e.sort((function(e,t){return t.h-e.h}));for(var a,s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),n),h:1/0}],u=0,c=0,l=Se(e);!(a=l()).done;)for(var f=a.value,h=s.length-1;h>=0;h--){var d=s[h];if(d.w>=f.w&&d.h>=f.h){if(f.x=d.x,f.y=d.y,c=Math.max(c,f.y+f.h),u=Math.max(u,f.x+f.w),f.w===d.w&&f.h===d.h){var p=s.pop();s.length>h&&(s[h]=p)}else f.h===d.h?(d.x+=f.w,d.w-=f.w):f.w===d.w?(d.y+=f.h,d.h-=f.h):(s.push({x:d.x+f.w,y:d.y,w:d.w-f.w,h:f.h}),d.y+=f.h,d.h-=f.h);break}}return{w:u,h:c,fill:r/(u*c)||0}}(r),u=new Hi({width:s.w||1,height:s.h||1});for(var n in e){i=e[n];for(var a in i){var c,l;if((c=i[+a])&&0!==c.bitmap.width&&0!==c.bitmap.height)Hi.copy(c.bitmap,u,{x:0,y:0},{x:(l=t[n][a].rect).x+1,y:l.y+1},c.bitmap)}}this.image=u,this.positions=t};var Yi,Ki,zi,qi=function(){function e(){this.sdfGeneratorCache={},this.textMetricsCache={},this.glyphAtlas=void 0,this.glyphMap={},this.glyphAtlasTexture=void 0}var t=e.prototype;return t.getMap=function(){return this.glyphMap},t.getAtlas=function(){return this.glyphAtlas},t.getAtlasTexture=function(){return this.glyphAtlasTexture},t.layout=function(e,t,r,n,i,o,a){var s=this,u=[],c=o,l=a,f="right"===n||"end"===n?1:"left"===n||"start"===n?0:.5;return e.forEach((function(e){var n=u.length;Array.from(e).forEach((function(e){var r=s.glyphMap[t],n=e.charCodeAt(0),o=r&&r[n];o&&(u.push({glyph:n,x:c,y:l,scale:1,fontStack:t}),c+=o.metrics.advance+i)}));for(var o=c-i,a=n;u.length>a;a++)u[a].x=u[a].x-f*o;c=0,l+=r})),u},t.generateAtlas=function(e,t,r,n,i,o){var a=this;void 0===e&&(e=""),void 0===n&&(n="");var s=[];this.glyphMap[e]||(s=function(){for(var e=[],t=32;128>t;t++)e.push(String.fromCharCode(t));return e}());var u=Object.keys(this.glyphMap[e]||{});if(Array.from(new Set(i.split(""))).forEach((function(e){-1===u.indexOf(e.charCodeAt(0).toString())&&s.push(e)})),s.length){var c=s.map((function(i){return a.generateSDF(e,t,r,n,i)})).reduce((function(e,t){return e[t.id]=t,e}),{});this.glyphMap[e]=ge({},this.glyphMap[e],c),this.glyphAtlas=new ji(this.glyphMap);var l=this.glyphAtlas.image,f=l.width,h=l.height,d=l.data;this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.glyphAtlasTexture=o.createTexture(ge({},ft(ct.ALPHA,f,h,1),{pixelStore:{unpackFlipY:!1,unpackAlignment:1},immutable:!1})),this.glyphAtlasTexture.setImageData([d],0)}},t.generateSDF=function(e,t,r,n,i){void 0===e&&(e="");var o=i.charCodeAt(0),a=this.sdfGeneratorCache[e];a||(a=this.sdfGeneratorCache[e]=new le({fontSize:24,fontFamily:t,fontWeight:r,fontStyle:n,buffer:3,radius:8,cutoff:.25})),this.textMetricsCache[e]||(this.textMetricsCache[e]={}),this.textMetricsCache[e][i]||(this.textMetricsCache[e][i]=a.ctx.measureText(i).width);var s=a.draw(i),u=s.glyphWidth,c=s.glyphHeight,l=s.glyphLeft,f=s.glyphTop,h=s.glyphAdvance;return{id:o,bitmap:new Hi({width:s.width,height:s.height},s.data),metrics:{width:u,height:c,left:l,top:f-24+3,advance:h}}},e}();qi=u([t.injectable()],qi),function(e){e[e.INSTANCED=5]="INSTANCED",e[e.TEX=6]="TEX"}(Yi||(Yi={})),function(e){e[e.TEX=13]="TEX",e[e.OFFSET=14]="OFFSET"}(Ki||(Ki={})),function(e){e.SDF_MAP="u_SDFMap",e.SDF_MAP_SIZE="u_SDFMapSize",e.FONT_SIZE="u_FontSize",e.GAMMA_SCALE="u_GammaScale",e.STROKE_BLUR="u_StrokeBlur",e.HAS_STROKE="u_HasStroke"}(zi||(zi={}));var Zi=function(e){function r(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).glyphManager=void 0,t}me(r,e);var n=r.prototype;return n.shouldMerge=function(t,r){var n=e.prototype.shouldMerge.call(this,t,r);if(!n)return!1;if(this.index!==r)return!1;var i=this.instance;return i.parsedStyle.metrics.font===t.parsedStyle.metrics.font&&!["fontSize","fontFamily","fontWeight","textBaseline","letterSpacing"].some((function(e){return i.parsedStyle[e].value!==t.parsedStyle[e].value}))},n.createGeometry=function(e){var t=this,r=this.instance.parsedStyle,n=r.textBaseline,i=r.letterSpacing,o=24/r.fontSize,a=[],s=[],u=[],c=0;e.forEach((function(e){var r=e.parsedStyle,l=r.metrics,f=l.font,h=l.lines,d=l.height,p=l.lineHeight,_=r.dx||0,v=r.dy||0,E=0;"middle"===n?E=-d/2:"bottom"===n?E=-d:"top"===n||"hanging"===n?E=0:"alphabetic"===n?E=.25*p-d:"ideographic"===n&&(E=-d);var g=t.glyphManager.getAtlas(),m=t.buildTextBuffers({object:e,lines:h,fontStack:f,lineHeight:o*p,offsetX:o*_,offsetY:o*(E+v),letterSpacing:o*i,glyphAtlas:g,indicesOffset:c}),R=m.indexBuffer,y=m.charUVOffsetBuffer;c=m.indicesOffset,u.push.apply(u,m.charPackedBuffer),s.push.apply(s,y),a.push.apply(a,R)})),this.geometry.vertexCount=a.length,this.geometry.setIndexBuffer(new Uint32Array(a)),this.geometry.setVertexBuffer({bufferIndex:Yi.INSTANCED,byteStride:144,frequency:Ze.PerVertex,attributes:[{format:ct.F32_RGBA,bufferByteOffset:0,location:fi.MODEL_MATRIX0},{format:ct.F32_RGBA,bufferByteOffset:16,location:fi.MODEL_MATRIX1},{format:ct.F32_RGBA,bufferByteOffset:32,location:fi.MODEL_MATRIX2},{format:ct.F32_RGBA,bufferByteOffset:48,location:fi.MODEL_MATRIX3},{format:ct.F32_RGBA,bufferByteOffset:64,location:fi.COLOR},{format:ct.F32_RGBA,bufferByteOffset:80,location:fi.STROKE_COLOR},{format:ct.F32_RGBA,bufferByteOffset:96,location:fi.PACKED_STYLE1},{format:ct.F32_RGBA,bufferByteOffset:112,location:fi.PACKED_STYLE2},{format:ct.F32_RGBA,bufferByteOffset:128,location:fi.PICKING_COLOR}],data:new Float32Array(u)}),this.geometry.setVertexBuffer({bufferIndex:Yi.TEX,byteStride:16,frequency:Ze.PerVertex,attributes:[{format:ct.F32_RG,bufferByteOffset:0,location:Ki.TEX},{format:ct.F32_RG,bufferByteOffset:8,location:Ki.OFFSET}],data:new Float32Array(s)})},n.createMaterial=function(e){var t;this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n vec2 u_SDFMapSize;\n float u_FontSize;\n float u_GammaScale;\n float u_StrokeBlur;\n float u_HasStroke;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = TEX) in vec2 a_Tex;\nlayout(location = OFFSET) in vec2 a_Offset;\n\nout vec2 v_UV;\nout float v_GammaScale;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n v_UV = a_Tex / u_SDFMapSize;\n\n float fontScale = u_FontSize / 24.;\n\n gl_Position = project(vec4(a_Offset * fontScale, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n v_GammaScale = gl_Position.w;\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n vec2 u_SDFMapSize;\n float u_FontSize;\n float u_GammaScale;\n float u_StrokeBlur;\n float u_HasStroke;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n\nuniform sampler2D u_SDFMap;\n\n#define SDF_PX 8.0\n\nin vec2 v_UV;\nin float v_GammaScale;\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n\n float dist = texture(SAMPLER_2D(u_SDFMap), v_UV).a;\n\n float EDGE_GAMMA = 0.105 / u_DevicePixelRatio;\n float fontScale = u_FontSize / 24.0;\n highp float gamma = EDGE_GAMMA / (fontScale * u_GammaScale);\n lowp vec4 color = u_Color;\n lowp float buff = (256.0 - 64.0) / 256.0;\n float opacity = u_FillOpacity;\n if (u_HasStroke > 0.5 && u_StrokeWidth > 0.0) {\n color = u_StrokeColor;\n gamma = (u_StrokeBlur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_GammaScale);\n buff = (6.0 - u_StrokeWidth / fontScale / 2.0) / SDF_PX;\n opacity = u_StrokeOpacity;\n }\n\n highp float gamma_scaled = gamma * v_GammaScale;\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n opacity *= alpha * u_Opacity;\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n\n if (opacity < 0.001) {\n discard;\n }\n\n outputColor = color;\n outputColor.a *= opacity;\n }\n}",this.material.cullMode=Ve.Back,this.material.defines=ge({},this.material.defines,ui(Ki));var r=this.instance.parsedStyle,n=r.fontSize,i=r.fontFamily,o=void 0===i?"":i,a=r.fontWeight,s=void 0===a?"":a,u=r.fontStyle,c=r.metrics.font,l=e.map((function(e){return e.parsedStyle.text})).join("");this.glyphManager.generateAtlas(c,o,s.toString(),u,l,this.device);var f=this.glyphManager.getAtlasTexture(),h=this.glyphManager.getAtlas();this.device.setResourceName(f,"TextSDF Texture");var d=h.image,p=d.width,_=d.height;this.material.setUniforms(((t={})[zi.SDF_MAP]=f,t[zi.SDF_MAP_SIZE]=[p,_],t[zi.FONT_SIZE]=n,t[zi.GAMMA_SCALE]=1,t[zi.STROKE_BLUR]=.2,t[zi.HAS_STROKE]=this.index,t))},n.changeRenderOrder=function(e,t){this.material&&(this.material.programDirty=!0,this.material.geometryDirty=!0)},n.updateAttribute=function(e,t,r,n){"text"===r||"fontFamily"===r||"fontSize"===r||"fontWeight"===r||"fontStyle"===r||"fontVariant"===r||"textBaseline"===r||"letterSpacing"===r||"wordWrapWidth"===r||"lineHeight"===r||"wordWrap"===r||"textAlign"===r||"modelMatrix"===r||"visibility"===r||"dx"===r||"dy"===r?(this.material.programDirty=!0,this.material.geometryDirty=!0,this.material.textureDirty=!0):"fill"!==r&&"fillOpacity"!==r&&"stroke"!==r&&"strokeOpacity"!==r&&"opacity"!==r&&"lineWidth"!==r&&"visibility"!==r&&"pointerEvents"!==r||(this.material.geometryDirty=!0)},n.buildTextBuffers=function(e){var r,n=e.object,i=e.lines,o=e.fontStack,a=e.lineHeight,s=e.letterSpacing,u=e.offsetX,c=e.offsetY,l=e.glyphAtlas,f=e.indicesOffset,h=n.parsedStyle,d=h.textAlign,p=h.fill,_=h.stroke,v=h.opacity,E=h.fillOpacity,g=h.strokeOpacity,m=h.lineWidth,R=h.visibility,y=[0,0,0,0];p instanceof t.CSSRGB&&(y=[Number(p.r)/255,Number(p.g)/255,Number(p.b)/255,Number(p.alpha)]);var T=[0,0,0,0];_ instanceof t.CSSRGB&&(T=[Number(_.r)/255,Number(_.g)/255,Number(_.b)/255,Number(_.alpha)]);var A=n.isInteractive()&&(null===(r=n.renderable3D)||void 0===r?void 0:r.encodedPickingColor)||[0,0,0],S=Me(Pe(),n.getWorldTransform()),C=[],O=[],I=[],N=f,x=function(e,t){for(var r=[],n=0;e.length>n;n++){var i=e[n],o=t[i.fontStack],a=o&&o[i.glyph];if(a){var s=a.rect;if(s){var u=a.metrics.advance*i.scale/2,c=[i.x+u,i.y],l=(a.metrics.left-4)*i.scale-u+c[0],f=(-a.metrics.top-4)*i.scale+c[1],h=l+s.w*i.scale,d=f+s.h*i.scale;r.push({tl:{x:l,y:f},tr:{x:h,y:f},bl:{x:l,y:d},br:{x:h,y:d},tex:s,glyphOffset:[0,0]})}}}return r}(this.glyphManager.layout(i,o,a,d,s,u,c),l.positions);return x.forEach((function(e){var t=[];t.push.apply(t,S);var r=[].concat(t,y,T,[v,E,g,m,"visible"===R?1:0,0,0,0],A,[n.sortable.renderOrder*oi]);C.push.apply(C,r.concat(r,r,r)),O.push(e.tex.x,e.tex.y,e.tl.x,e.tl.y),O.push(e.tex.x+e.tex.w,e.tex.y,e.tr.x,e.tr.y),O.push(e.tex.x+e.tex.w,e.tex.y+e.tex.h,e.br.x,e.br.y),O.push(e.tex.x,e.tex.y+e.tex.h,e.bl.x,e.bl.y),I.push(0+N,2+N,1+N),I.push(2+N,0+N,3+N),N+=4})),{indexBuffer:I,charUVOffsetBuffer:O,charPackedBuffer:C,indicesOffset:N}},r}(_i);u([t.inject(qi)],Zi.prototype,"glyphManager",void 0),Zi=u([t.injectable()],Zi);var Qi=function(e){function r(){return e.apply(this,arguments)||this}me(r,e);var n=r.prototype;return n.shouldMerge=function(r,n){var i=e.prototype.shouldMerge.call(this,r,n);return!!i&&(this.instance.nodeName!==t.Shape.MESH||this.instance.parsedStyle.material===r.parsedStyle.material&&this.instance.parsedStyle.geometry===r.parsedStyle.geometry)},n.updateAttribute=function(t,r,n,i){e.prototype.updateAttribute.call(this,t,r,n,i),this.updateBatchedAttribute(t,r,n,i)},n.createMaterial=function(e){this.material=this.instance.parsedStyle.material,this.observeMaterialChanged()},n.createGeometry=function(t){this.geometry=this.instance.parsedStyle.geometry,e.prototype.createGeometry.call(this,t),this.geometry.build(t),this.observeGeometryChanged()},r}(_i);Qi=u([t.injectable()],Qi);var Ji=function(){function e(){}return e.prototype.update=function(e){return e.geometry.computeBoundingBox(),{width:0,height:0,depth:0}},e}();Ji=u([t.singleton({token:{token:t.GeometryAABBUpdater,named:t.Shape.MESH}})],Ji);var $i=function(){function e(){this.counter=0,this.id2DisplayObjectMap={}}var t=e.prototype;return t.getId=function(e){var t=this.counter++;return this.id2DisplayObjectMap[t]=e,t},t.getById=function(e){return this.id2DisplayObjectMap[e]},t.reset=function(){this.counter=0,this.id2DisplayObjectMap={}},t.decodePickingColor=function(e){return e[0]+256*e[1]+65536*e[2]-1},t.encodePickingColor=function(e){return[e+1&255,e+1>>8&255,e+1>>8>>8&255]},e}();$i=u([t.singleton()],$i);var eo=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).meshes=[mi,bi],t}me(t,e);var r=t.prototype;return r.shouldSubmitRenderInst=function(e,t){if(0===t&&e.parsedStyle.fill.isNone)return!1;return 1!==t||this.needDrawStrokeSeparately(e)},r.needDrawStrokeSeparately=function(e){var t=e.parsedStyle,r=t.fill,n=t.stroke,i=t.lineDash,o=t.lineWidth,a=t.strokeOpacity,s=r&&!r.isNone,u=n&&!n.isNone,c=i&&i.length&&i.every((function(e){return 0!==e}));return!s||u&&o>0&&(1>a||c)},t}(si);eo=u([t.injectable({token:[{token:ti,named:t.Shape.CIRCLE},{token:ti,named:t.Shape.ELLIPSE}]})],eo);var to=function(e){function r(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).meshes=[ki,bi,Si],t}me(r,e);var n=r.prototype;return n.shouldSubmitRenderInst=function(e,r){var n=e.parsedStyle,i=n.fill,o=n.stroke,a=n.opacity,s=n.strokeOpacity,u=n.lineDash,c=n.lineWidth,l=e.nodeName,f=o&&!o.isNone,h=u&&u.length&&u.every((function(e){return 0!==e})),d=this.isLine(e);if(e.renderable.proxyNodeName=d?t.Shape.LINE:null,0===r&&(e.nodeName===t.Shape.POLYLINE||i.isNone))return!1;if(1===r){if(d||0===s||0===a||0===c||!f)return!1;if(l===t.Shape.CIRCLE||l===t.Shape.ELLIPSE)return h}return 2!==r||d},n.isLine=function(e){if(e.nodeName===t.Shape.PATH){var r=e.parsedStyle.path.curve;if(2===r.length&&"M"===r[0][0]&&"C"===r[1][0]){var n=r[0],i=n[1],o=n[2],a=r[1],s=a[5],u=a[6],c=(i-s)/(o-u);return.01>(i-a[1])/(o-a[2])-c&&.01>(a[3]-s)/(a[4]-u)-c}}else if(e.nodeName===t.Shape.POLYLINE){for(var l=e.parsedStyle.points.points,f=(l[1][0]-l[1][1])/(l[0][0]-l[0][1]),h=1;l.length-1>h;h++)if((l[h+1][0]-l[h+1][1])/(l[h][0]-l[h][1])!==f)return!1;return!0}return!1},r}(si);to=u([t.injectable({token:[{token:ti,named:t.Shape.POLYLINE},{token:ti,named:t.Shape.PATH},{token:ti,named:t.Shape.POLYGON},{token:ti,named:t.Shape.RECT}]})],to);var ro=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).meshes=[],t}return me(t,e),t.prototype.shouldSubmitRenderInst=function(e,t){return!0},t}(si);ro=u([t.injectable({token:[{token:ti,named:t.Shape.GROUP}]})],ro);var no=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).meshes=[Vi],t}return me(t,e),t.prototype.shouldSubmitRenderInst=function(e,t){return!0},t}(si);no=u([t.injectable({token:[{token:ti,named:t.Shape.IMAGE}]})],no);var io=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).meshes=[Zi,Zi],t}me(t,e);var r=t.prototype;return r.shouldSubmitRenderInst=function(e,t){var r=e.parsedStyle;return!!(r.stroke&&r.lineWidth||0!==t)},r.beforeUploadUBO=function(e,t,r){var n;t.material.setUniforms(((n={})[zi.HAS_STROKE]=1-t.index,n))},t}(si);io=u([t.injectable({token:[{token:ti,named:t.Shape.TEXT}]})],io);var oo=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).meshes=[Si],t}return me(t,e),t.prototype.shouldSubmitRenderInst=function(e,t){return!0},t}(si);oo=u([t.injectable({token:{token:ti,named:t.Shape.LINE}})],oo);var ao=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).meshes=[Qi],t}return me(t,e),t}(si);ao=u([t.injectable({token:[{token:ti,named:t.Shape.MESH}]})],ao);var so=t.Syringe.defineToken(""),uo=["style"],co=function(e){function t(r){var n=void 0===r?{}:r,i=n.style,o=ye(n,uo);return e.call(this,ge({type:t.tag,style:ge({intensity:Math.PI},i)},o))||this}return me(t,e),t}(t.DisplayObject);co.tag="light";var lo,fo=["style"];!function(e){e[e.NONE=0]="NONE",e[e.EXP=1]="EXP",e[e.EXP2=2]="EXP2",e[e.LINEAR=3]="LINEAR"}(lo||(lo={}));var ho,po,_o=function(e){function t(r){var n=void 0===r?{}:r,i=n.style,o=ye(n,fo);return e.call(this,ge({type:t.tag,style:ge({type:lo.NONE,fill:"black",start:1,end:1e3,density:0},i)},o))||this}return me(t,e),t}(t.DisplayObject);_o.tag="fog";var vo;!function(e){e.PROJECTION_MATRIX="u_ProjectionMatrix",e.VIEW_MATRIX="u_ViewMatrix",e.CAMERA_POSITION="u_CameraPosition",e.DEVICE_PIXEL_RATIO="u_DevicePixelRatio",e.VIEWPORT="u_Viewport",e.IS_ORTHO="u_IsOrtho",e.IS_PICKING="u_IsPicking"}(vo||(vo={}));var Eo,go,mo=(ho=function(){function e(e,t,r,n,i,o,a,s,u){this.canvasConfig=void 0,this.contextService=void 0,this.renderingContext=void 0,this.camera=void 0,this.renderHelper=void 0,this.lightPool=void 0,this.texturePool=void 0,this.batchManager=void 0,this.deviceContribution=void 0,this.device=void 0,this.swapChain=void 0,this.renderLists={world:new Gn,picking:new Gn},this.builder=void 0,this.enableCapture=void 0,this.captureOptions=void 0,this.capturePromise=void 0,this.resolveCapturePromise=void 0,this.canvasConfig=e,this.contextService=t,this.renderingContext=r,this.camera=n,this.renderHelper=i,this.lightPool=o,this.texturePool=a,this.batchManager=s,this.deviceContribution=u}var r=e.prototype;return r.getDevice=function(){return this.device},r.getSwapChain=function(){return this.swapChain},r.getRenderLists=function(){return this.renderLists},r.apply=function(e){var r=this,n=function(e){var t=e.target;if(t.nodeName!==co.tag)if(t.nodeName!==_o.tag){var n=new Ce;t.renderable3D=n,r.batchManager.add(t)}else r.lightPool.addFog(t);else r.lightPool.addLight(t)},i=function(e){var t=e.target;t.nodeName!==co.tag?t.nodeName!==_o.tag?(r.batchManager.remove(t),delete t.renderable3D):r.lightPool.removeFog(t):r.lightPool.removeLight(t)},o=function(e){r.batchManager.updateAttribute(e.target,e.attrName,e.newValue)},a=function(e){r.batchManager.updateAttribute(e.target,"modelMatrix",null)},s=function(e){r.batchManager.changeRenderOrder(e.target,e.detail.renderOrder)};e.hooks.init.tapPromise(po.tag,_e(de().mark((function u(){var c,l;return de().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return r.renderingContext.root.addEventListener(t.ElementEvent.MOUNTED,n),r.renderingContext.root.addEventListener(t.ElementEvent.UNMOUNTED,i),r.renderingContext.root.addEventListener(t.ElementEvent.ATTR_MODIFIED,o),r.renderingContext.root.addEventListener(t.ElementEvent.BOUNDS_CHANGED,a),r.renderingContext.root.addEventListener(t.ElementEvent.RENDER_ORDER_CHANGED,s),r.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering=!1,c=r.contextService.getDomElement(),r.contextService.resize((l=r.canvasConfig).width,l.height),u.next=11,r.deviceContribution.createSwapChain(c);case 11:r.swapChain=u.sent,r.device=r.swapChain.getDevice(),r.renderHelper.setDevice(r.device),r.renderHelper.renderInstManager.disableSimpleMode(),r.swapChain.configureSwapChain(c.width,c.height),r.renderingContext.root.ownerDocument.defaultView.addEventListener(t.CanvasEvent.RESIZE,(function(){r.swapChain.configureSwapChain(c.width,c.height)})),r.batchManager.attach(r.device,e);case 18:case"end":return u.stop()}}),u)})))),e.hooks.destroy.tap(po.tag,(function(){r.renderHelper.destroy(),r.renderingContext.root.removeEventListener(t.ElementEvent.MOUNTED,n),r.renderingContext.root.removeEventListener(t.ElementEvent.UNMOUNTED,i),r.renderingContext.root.removeEventListener(t.ElementEvent.ATTR_MODIFIED,o),r.renderingContext.root.removeEventListener(t.ElementEvent.BOUNDS_CHANGED,a),r.renderingContext.root.removeEventListener(t.ElementEvent.RENDER_ORDER_CHANGED,s)})),e.hooks.beginFrame.tap(po.tag,(function(){var e=r.swapChain.getCanvas(),n=r.renderHelper.renderInstManager;r.builder=r.renderHelper.renderGraph.newGraphBuilder();var i=t.parseColor(r.canvasConfig.background),o=r.canvasConfig.background?Ct(Number(i.r)/255*Number(i.alpha),Number(i.g)/255*Number(i.alpha),Number(i.b)/255*Number(i.alpha),Number(i.alpha)):Ot,a={backbufferWidth:e.width,backbufferHeight:e.height,antialiasingMode:jn.None},s=Zn(_n.Color0,a,Hn(o)),u=Zn(_n.DepthStencil,a,zn),c=r.builder.createRenderTargetID(s,"Main Color"),l=r.builder.createRenderTargetID(u,"Main Depth");r.builder.pushPass((function(e){e.setDebugName("Main Render Pass"),e.attachRenderTargetID(_n.Color0,c),e.attachRenderTargetID(_n.DepthStencil,l),e.exec((function(e){r.renderLists.world.drawOnPassRenderer(n.renderCache,e)}))})),r.builder.resolveRenderTargetToExternalTexture(c,r.swapChain.getOnscreenTexture())})),e.hooks.endFrame.tap(po.tag,(function(){var e=r.renderHelper.renderInstManager,t=r.renderHelper.pushTemplateRenderInst();t.setBindingLayouts([{numUniformBuffers:2,numSamplers:0}]),t.setMegaStateFlags(Jt({depthWrite:!0,blendConstant:Ot},{rgbBlendMode:Xe.Add,alphaBlendMode:Xe.Add,rgbBlendSrcFactor:We.SrcAlpha,alphaBlendSrcFactor:We.One,rgbBlendDstFactor:We.OneMinusSrcAlpha,alphaBlendDstFactor:We.OneMinusSrcAlpha}));var n=r.canvasConfig,i=n.width,o=n.height;if(t.setUniforms(0,[{name:vo.PROJECTION_MATRIX,value:r.camera.getPerspective()},{name:vo.VIEW_MATRIX,value:r.camera.getViewTransform()},{name:vo.CAMERA_POSITION,value:r.camera.getPosition()},{name:vo.DEVICE_PIXEL_RATIO,value:r.contextService.getDPR()},{name:vo.VIEWPORT,value:[i,o]},{name:vo.IS_ORTHO,value:r.camera.isOrtho()?1:0},{name:vo.IS_PICKING,value:0}]),r.batchManager.render(r.renderLists.world),e.popTemplateRenderInst(),r.renderHelper.prepareToRender(),r.renderHelper.renderGraph.execute(),e.resetRenderInsts(),r.swapChain.present(),r.enableCapture&&r.resolveCapturePromise){var a=r.captureOptions,s=a.type,u=a.encoderOptions,c=r.contextService.getDomElement().toDataURL(s,u);r.resolveCapturePromise(c),r.enableCapture=!1,r.captureOptions=void 0,r.resolveCapturePromise=void 0}}))},r.loadTexture=function(e,t,r){return this.texturePool.getOrCreateTexture(this.device,e,t,(function(e){r&&r(e)}))},r.toDataURL=function(){var e=_e(de().mark((function e(t){var r=this;return de().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.enableCapture=!0,this.captureOptions=t,this.capturePromise=new Promise((function(e){r.resolveCapturePromise=function(t){e(t)}})),e.abrupt("return",this.capturePromise);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),e}(),ho.tag="RenderGraph",po=ho);mo=po=u([t.singleton({contrib:t.RenderingPluginContribution}),c(0,t.inject(t.CanvasConfig)),c(1,t.inject(t.ContextService)),c(2,t.inject(t.RenderingContext)),c(3,t.inject(t.DefaultCamera)),c(4,t.inject(Wn)),c(5,t.inject(Oe)),c(6,t.inject($n)),c(7,t.inject(ii)),c(8,t.inject(so))],mo);var Ro=(Eo=function(){function e(e,t,r,n,i,o,a,s,u){this.canvasConfig=void 0,this.sceneGraphService=void 0,this.contextService=void 0,this.renderingContext=void 0,this.renderHelper=void 0,this.renderGraphPlugin=void 0,this.pickingIdGenerator=void 0,this.camera=void 0,this.batchManager=void 0,this.canvasConfig=e,this.sceneGraphService=t,this.contextService=r,this.renderingContext=n,this.renderHelper=i,this.renderGraphPlugin=o,this.pickingIdGenerator=a,this.camera=s,this.batchManager=u}var r=e.prototype;return r.apply=function(e){var r=this,n=function(e){var t=e.target,n=t.renderable3D;if(n){var i=r.pickingIdGenerator.getId(t);n.pickingId=i,n.encodedPickingColor=r.pickingIdGenerator.encodePickingColor(i)}};e.hooks.init.tapPromise(go.tag,_e(de().mark((function e(){return de().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.renderingContext.root.addEventListener(t.ElementEvent.MOUNTED,n);case 1:case"end":return e.stop()}}),e)})))),e.hooks.destroy.tap(go.tag,(function(){r.renderingContext.root.removeEventListener(t.ElementEvent.MOUNTED,n)})),e.hooks.pickSync.tap(go.tag,(function(e){return e})),e.hooks.pick.tapPromise(go.tag,function(){var e=_e(de().mark((function e(n){var i,o,a,s,u,c,l,f,h;return de().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.topmost,a=(o=n.position).viewportX,s=o.viewportY,u=r.contextService.getDPR(),l=r.canvasConfig.height*u,h=s*u,!((f=a*u)>(c=r.canvasConfig.width*u)||0>f||h>l||0>h)){e.next=10;break}return n.picked=[],e.abrupt("return",n);case 10:return e.next=12,r.pickByRectangleInDepth(new t.Rectangle(v(Math.round(f),0,c-1),v(Math.round(h),0,l-1),1,1),i?1:100);case 12:return n.picked=e.sent,e.abrupt("return",n);case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())},r.pickByRectangleInDepth=function(){var e=_e(de().mark((function e(t,r){var n,i,o;return de().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:void 0===r&&(r=100),n=null,i=1,o=[];case 4:return e.next=6,this.pickByRectangle(t,n);case 6:if(!(n=e.sent)){e.next=12;break}i++,o.push(n),e.next=13;break;case 12:return e.abrupt("break",14);case 13:if(n&&r>=i){e.next=4;break}case 14:return r>1&&this.restorePickingColor(o),e.abrupt("return",o);case 16:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.restorePickingColor=function(e){var t=this;e.forEach((function(e){t.batchManager.updateAttribute(e,"pointerEvents",!0,!0)}))},r.pickByRectangle=function(e,t){var r=this,n=this.renderGraphPlugin.getDevice(),i=this.renderGraphPlugin.getRenderLists(),o=this.renderHelper.renderInstManager,a=this.renderHelper.renderGraph.newGraphBuilder(),s=e.x,u=e.y,c=e.width,l=e.height,f={backbufferWidth:c,backbufferHeight:l,antialiasingMode:jn.None},h=Zn(_n.Color0,f,Hn(Ot)),d=a.createRenderTargetID(h,"Picking Color"),p=Zn(_n.DepthStencil,f,zn),_=a.createRenderTargetID(p,"Picking Depth"),v=ge({},this.camera.getView());return new Promise((function(e){r.renderHelper.renderGraph.renderTargetDeadPool.forEach((function(e){e.age=-1})),a.pushPass((function(t){t.setDebugName("Picking Pass"),t.attachRenderTargetID(_n.Color0,d),t.attachRenderTargetID(_n.DepthStencil,_),t.exec((function(e){i.picking.drawOnPassRenderer(o.renderCache,e)})),t.post((function(t){var i=t.getRenderTargetTexture(_n.Color0),o=n.createReadback();v&&v.enabled?r.camera.setViewOffset(v.fullWidth,v.fullHeight,v.offsetX,v.offsetY,v.width,v.height):r.camera.clearViewOffset(),r.camera.setEnableUpdate(!0),o.readTexture(i,0,0,c,l,new Uint8Array(c*l*4)).then((function(t){var n,i=-1;if(!t||0===t[0]&&0===t[1]&&0===t[2]||(i=r.pickingIdGenerator.decodePickingColor(t)),i>-1){var a=r.pickingIdGenerator.getById(i);a&&a.isVisible()&&a.isInteractive()&&(n=a)}o.destroy(),e(n)}))}))}));var f=r.renderHelper.pushTemplateRenderInst();f.setBindingLayouts([{numUniformBuffers:2,numSamplers:0}]),f.setMegaStateFlags(Jt({depthWrite:!0},{rgbBlendMode:Xe.Add,rgbBlendSrcFactor:We.One,rgbBlendDstFactor:We.Zero,alphaBlendMode:Xe.Add,alphaBlendSrcFactor:We.One,alphaBlendDstFactor:We.Zero}));var h=r.canvasConfig,p=h.width,E=h.height,g=r.contextService.getDPR();r.camera.setEnableUpdate(!1),r.camera.setViewOffset(p*g,E*g,s,u,c,l),f.setUniforms(0,[{name:vo.PROJECTION_MATRIX,value:r.camera.getPerspective()},{name:vo.VIEW_MATRIX,value:r.camera.getViewTransform()},{name:vo.CAMERA_POSITION,value:r.camera.getPosition()},{name:vo.DEVICE_PIXEL_RATIO,value:r.contextService.getDPR()},{name:vo.VIEWPORT,value:[p,E]},{name:vo.IS_ORTHO,value:r.camera.isOrtho()?1:0},{name:vo.IS_PICKING,value:1}]),t&&r.batchManager.updateAttribute(t,"pointerEvents",!1,!0),r.batchManager.render(i.picking,!0),o.popTemplateRenderInst(),r.renderHelper.prepareToRender(),r.renderHelper.renderGraph.execute(),o.resetRenderInsts()}))},e}(),Eo.tag="WebGLPicker",go=Eo);Ro=go=u([t.singleton({contrib:t.RenderingPluginContribution}),c(0,t.inject(t.CanvasConfig)),c(1,t.inject(t.SceneGraphService)),c(2,t.inject(t.ContextService)),c(3,t.inject(t.RenderingContext)),c(4,t.inject(Wn)),c(5,t.inject(mo)),c(6,t.inject($i)),c(7,t.inject(t.DefaultCamera)),c(8,t.inject(ii))],Ro);var yo,To,Ao,So="#define GLSLIFY 1\nlayout(location = 0) in vec2 a_Position;\n\nout vec2 v_TexCoord;\n\nvoid main() {\n v_TexCoord = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n\n #ifdef VIEWPORT_ORIGIN_TL\n v_TexCoord.y = 1.0 - v_TexCoord.y;\n #endif\n}",Co="#define GLSLIFY 1\nuniform sampler2D u_Texture;\nin vec2 v_TexCoord;\n\nout vec4 outputColor;\n\nvoid main() {\n outputColor = texture(SAMPLER_2D(u_Texture), v_TexCoord);\n}",Oo=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).vert=So,t.frag=Co,t.features={},t}return me(t,e),t}(en),Io="#define GLSLIFY 1\nuniform sampler2D u_Texture;\nin vec2 v_TexCoord;\n\nout vec4 outputColor;\n\nfloat MonochromeNTSC(vec3 t_Color) {\n // NTSC primaries.\n return dot(t_Color.rgb, vec3(0.299, 0.587, 0.114));\n}\n\nvec4 FXAA(PD_SAMPLER_2D(t_Texture), in vec2 t_PixelCenter, in vec2 t_InvResolution) {\n // FXAA v2, based on implementations:\n // http://www.geeks3d.com/20110405/fxaa-fast-approximate-anti-aliasing-demo-glsl-opengl-test-radeon-geforce/\n // https://github.com/mitsuhiko/webgl-meincraft\n\n float lumaMM = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy).rgb);\n\n #if 1\n vec2 t_PixelTopLeft = t_PixelCenter.xy - t_InvResolution.xy * 0.5;\n float lumaNW = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelTopLeft.xy) .rgb);\n float lumaNE = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelTopLeft.xy + vec2(1.0, 0.0)).rgb);\n float lumaSW = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelTopLeft.xy + vec2(0.0, 1.0)).rgb);\n float lumaSE = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelTopLeft.xy + vec2(1.0, 1.0)).rgb);\n #else\n // We're at the pixel center -- pixel edges are 0.5 units away.\n // NOTE(jstpierre): mitsuhiko's port seems to get this wrong?\n vec2 t_PixelSize = t_InvResolution.xy * 0.5;\n\n float lumaNW = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + t_PixelSize * vec2(-1.0, -1.0)).rgb);\n float lumaNE = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + t_PixelSize * vec2( 1.0, -1.0)).rgb);\n float lumaSW = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + t_PixelSize * vec2(-1.0, 1.0)).rgb);\n float lumaSE = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + t_PixelSize * vec2( 1.0, 1.0)).rgb);\n #endif\n\n vec2 dir; \n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n const float FXAA_REDUCE_MIN = 1.0/128.0;\n const float FXAA_REDUCE_MUL = 1.0/8.0;\n const float FXAA_SPAN_MAX = 8.0;\n\n float dirReduce = max(\n (lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL),\n FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * u_InvResolution.xy;\n\n float lumaMin = min(lumaMM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaMM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n vec4 rgbA = (1.0/2.0) * (\n texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + dir * (1.0/3.0 - 0.5)) +\n texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + dir * (2.0/3.0 - 0.5)));\n vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (\n texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + dir * (0.0/3.0 - 0.5)) +\n texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + dir * (3.0/3.0 - 0.5)));\n float lumaB = MonochromeNTSC(rgbB.rgb);\n\n vec4 rgbOutput = ((lumaB < lumaMin) || (lumaB > lumaMax)) ? rgbA : rgbB;\n return rgbOutput;\n}\n\nvoid main() {\n outputColor = FXAA(PP_SAMPLER_2D(u_Texture), v_TexCoord.xy, u_InvResolution.xy);\n}",No=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).features={},t.both="\nlayout(std140) uniform ub_Params {\n vec4 u_Misc[1];\n};\n#define u_InvResolution (u_Misc[0].xy)\n",t.vert=So,t.frag=Io,t}return me(t,e),t}(en),xo=kt(1,(function(){return new Qn}));var Po,Mo,Do=t.Module((function(e){e(Wn),e($n),e(Oe),e(qi),e($i),e(ii),e(mo),e(Ro),e(mi),e(Si),e(bi),e(ki),e(Vi),e(Zi),e(Qi),e({token:ri,useFactory:function(e){return function(t){return e.container.isBound(t)&&e.container.get(t)||null}}}),e(eo),e(to),e(no),e(oo),e(io),e(ao),e({token:ei,useFactory:function(e){var t={};return function(r){return t[r]||e.container.isBoundNamed(ti,r)&&(t[r]=e.container.getNamed(ti,r)),t[r]||null}}})})),Bo=function(e){function r(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).name="device-renderer",t}me(r,e);var n=r.prototype;return n.init=function(){t.GlobalContainer.isBound(Ji)||t.GlobalContainer.register(Ji),this.container.load(Do,!0)},n.destroy=function(){t.GlobalContainer.isBound(Ji)&&t.GlobalContainer.remove(Ji),this.container.unload(Do)},n.getDevice=function(){return this.container.get(mo).getDevice()},n.loadTexture=function(e,t,r){return this.container.get(mo).loadTexture(e,t,r)},n.toDataURL=function(e){return this.container.get(mo).toDataURL(e)},r}(t.AbstractRendererPlugin),Lo=Object.freeze({__proto__:null,get AntialiasingMode(){return jn},get Batch(){return si},get BlendFactor(){return We},get BlendMode(){return Xe},get BufferFrequencyHint(){return qe},BufferGeometry:jr,get BufferUsage(){return ze},get ChannelWriteMask(){return et},get ClipSpaceNearZ(){return it},get CompareMode(){return Ge},CopyProgram:Oo,get CullMode(){return Ve},DeviceContribution:so,DeviceProgram:en,DynamicUniformBuffer:tn,get Endianness(){return $t},FILL_TEXTURE_MAPPING:pi,get FillMesh(){return ki},Fog:_o,get FogType(){return lo},get Format(){return ct},get FormatCompFlags(){return st},get FormatFlags(){return ut},get FormatTypeFlags(){return at},get FrontFaceMode(){return ke},get GL(){return lt},get GeometryEvent(){return Vr},HashMap:sn,IdentityViewportCoords:gn,get ImageMesh(){return Vi},get Instanced(){return _i},get InstancedLineMesh(){return Si},IsDepthReversed:Pt,get JOINT_TYPE(){return Pi},Light:co,get LineMesh(){return bi},Material:Jr,get MaterialEvent(){return Hr},Mesh:Ne,get MeshMesh(){return Qi},get MipFilterMode(){return Ye},OpaqueBlack:It,OpaqueWhite:xt,Plugin:Bo,get PrimitiveTopology(){return Ke},get QueryPoolType(){return ot},get RGAttachmentSlot(){return _n},RenderCache:vn,get RenderGraphPlugin(){return mo},get RenderHelper(){return Wn},RenderInst:Un,get RenderInstExecutionOrder(){return Fn},get RenderInstFlags(){return Bn},RenderInstList:Gn,RenderInstManager:Vn,Renderable3D:Ce,get RendererLayer(){return Tn},get ResourceType(){return we},get SDFMesh(){return mi},get SamplerFormatKind(){return rt},ShaderMaterial:$r,SingleSampledTexture:yn,get StencilOp(){return tt},TemporalTexture:Jn,get TexFilterMode(){return je},get TextMesh(){return Zi},get TextUniform(){return zi},get TextureDimension(){return Je},get TextureEvent(){return Qe},TextureMapping:Qn,get TexturePool(){return $n},get TextureUsage(){return $e},TransparentBlack:Ot,TransparentWhite:Nt,UNIFORM_SETTERS:Wr,get Uniform(){return Li},get VertexAttributeBufferIndex(){return li},get VertexAttributeLocation(){return fi},get VertexBufferFrequency(){return Ze},get ViewportOrigin(){return nt},get WrapMode(){return He},align:bt,alignNonPowerOfTwo:Ft,arrayCopy:rr,arrayEqual:tr,assert:Rt,assertExists:yt,bindingLayoutDescriptorCopy:Rr,bindingLayoutDescriptorEqual:or,bindingLayoutSamplerDescriptorCopy:mr,bindingsDescriptorCopy:gr,bindingsDescriptorEquals:ar,bisectRight:Ut,bufferBindingCopy:Er,colorCopy:At,colorEqual:Tt,colorNewCopy:St,colorNewFromRGBA:Ct,compareDefines:ci,compareDepthValues:function(e,t,r,n){if(void 0===n&&(n=Pt),(r=Mt(r,n))===Ge.Less)return t>e;if(r===Ge.LessEqual)return t>=e;if(r===Ge.Greater)return e>t;if(r===Ge.GreaterEqual)return e>=t;throw new Error("whoops")},containerModule:Do,copyAttachmentState:Xt,copyAttachmentStateFromSimple:Kt,copyMegaState:Yt,defaultBindingLayoutSamplerDescriptor:er,defaultMegaState:qt,definedProps:hi,enumToObject:ui,fallbackUndefined:Dt,fillArray:Lt,fillColor:function(e,t,r,n){return void 0===n&&(n=r.a),e[t+0]=r.r,e[t+1]=r.g,e[t+2]=r.b,e[t+3]=n,4},fillMatrix4x4:function(e,t,r){return e[t+0]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],16},fillVec3v:function(e,t,r,n){return void 0===n&&(n=0),e[t+0]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=n,4},fillVec4:bn,fillVec4v:function(e,t,r){return e[t+0]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],4},fullscreenMegaState:Qt,getAttributeLocations:function(e,t){var r=[];return e.replace(/^\s*layout\(location\s*=\s*(\S*)\)\s*in\s+\S+\s*(.*);$/gm,(function(e,n,i){var o=Number(n);return r.push({location:isNaN(o)?t[n]:o,name:i}),""})),r},getDefines:function(e){var t={};return e.replace(/^\s*#define\s*(\S*)\s*(\S*)\s*$/gm,(function(e,r,n){var i=Number(n);return t[r]=isNaN(i)?n:i,""})),t},getFormatByteSize:function(e){return Et(_t(e))*pt(e)},getFormatCompByteSize:gt,getFormatCompFlags:pt,getFormatCompFlagsComponentCount:ht,getFormatComponentCount:function(e){return pt(e)},getFormatFlags:vt,getFormatSamplerKind:mt,getFormatTypeFlags:_t,getFormatTypeFlagsByteSize:Et,getSortKeyDepth:function(e){return!!(e>>>31&1)?e>>>8&65535:e>>>8&65532|3&e},getSortKeyLayer:function(e){return e>>>24&255},getSystemEndianness:function(){return Ir},getUniformSetter:function(e,t,r){var n=Wr[r.type];if(!n)throw new Error("Unknown GLSL uniform type "+r.type);return n().bind(null,e,t)},getUniforms:zr,hashCodeNumberFinish:nn,hashCodeNumberUpdate:rn,inputLayoutBufferDescriptorCopy:Ar,inputLayoutBufferDescriptorEquals:dr,inputLayoutDescriptorCopy:Sr,inputLayoutDescriptorEquals:pr,isPowerOfTwo:function(e){return e&&0==(e&e-1)},leftPad:Vt,makeAttachmentClearDescriptor:Hn,makeBackbufferDescSimple:Zn,makeDepthKey:Cn,makeFormat:dt,makeMegaState:Zt,makeSortKey:function(e,t){return void 0===t&&(t=0),e&Tn.TRANSLUCENT?Pn(e):Nn(e,t)},makeSortKeyOpaque:Nn,makeSortKeyTranslucent:Pn,makeStaticDataBuffer:Xr,makeTextureDescriptor2D:ft,nArray:kt,nullHashFunc:on,nullify:Bt,opaqueBlackFullClearRenderPassDescriptor:Kn,opaqueWhiteFullClearRenderPassDescriptor:zn,parseUniformName:function(e){if("]"!==e[e.length-1])return{name:e,length:1,isArray:!1};var t=e.match(Nr);if(!t||2>t.length)throw new Error("Failed to parse GLSL uniform name "+e);return{name:t[1],length:Number(t[2])||1,isArray:Boolean(t[2])}},prependLineNo:function(e,t){return void 0===t&&(t=1),e.split("\n").map((function(e,r){return Vt(""+(t+r),4," ")+" "+e})).join("\n")},preprocessProgramObj_GLSL:Qr,preprocessProgram_GLSL:Zr,preprocessShader_GLSL:qr,projectionMatrixConvertClipSpaceNearZ:function(e,t,r){t!==r&&(t===it.NegativeOne?function(e){Le(e,Dn,e)}(e):t===it.Zero&&function(e){Le(e,Ln,e)}(e))},pushFXAAPass:function(e,t,r,n){e.pushPass((function(i){i.setDebugName("FXAA"),i.attachRenderTargetID(_n.Color0,n);var o=e.resolveRenderTarget(n);i.attachResolveTexture(o);var a=t.renderInstManager.newRenderInst();a.setUniformBuffer(t.uniformBuffer),a.setAllowSkippingIfPipelineNotReady(!1),a.setMegaStateFlags(Qt),a.setBindingLayouts([{numUniformBuffers:1,numSamplers:1}]),a.drawPrimitives(3);var s=a.allocateUniformBuffer(0,4);bn(a.mapUniformBufferF32(0),s,1/r.backbufferWidth,1/r.backbufferHeight);var u=new No,c=t.renderCache.createProgram(u);a.setProgram(c),yo||((yo=new jr(t.getDevice())).setVertexBuffer({bufferIndex:0,byteStride:8,frequency:Ze.PerVertex,attributes:[{format:ct.F32_RG,bufferByteOffset:0,location:0}],data:new Float32Array([-4,-4,4,-4,0,4])}),yo.vertexCount=3,Ao=t.getCache().createInputLayout(yo.inputLayoutDescriptor),To=t.getDevice().createInputState(Ao,yo.vertexBuffers.map((function(e){return{buffer:e,byteOffset:0}})),null,c)),i.exec((function(e,r){xo[0].texture=r.getResolveTextureForID(o),a.setSamplerBindingsFromTextureMappings(xo),a.setInputLayoutAndState(Ao,To),a.drawOnPass(t.renderCache,e)}))}))},range:function(e,t){for(var r=[],n=e;e+t>n;n++)r.push(n);return r},renderInstCompareNone:null,renderInstCompareSortKey:wn,renderPipelineDescriptorCopy:yr,renderPipelineDescriptorEquals:fr,reverseDepthForClearValue:function(e,t){return void 0===t&&(t=Pt),t?1-e:e},reverseDepthForCompareMode:Mt,reverseDepthForDepthOffset:function(e,t){return void 0===t&&(t=Pt),t?-e:e},reverseDepthForOrthographicProjectionMatrix:function(e,t){void 0===t&&(t=Pt),t&&(e[10]=-e[10],e[14]=1-e[14])},reverseDepthForPerspectiveProjectionMatrix:function(e,t){void 0===t&&(t=Pt),t&&(e[10]=-e[10],e[14]=-e[14])},samplerBindingCopy:vr,samplerBindingNew:function(){return{sampler:null,texture:null,lateBinding:null}},samplerDescriptorEquals:_r,segmentInstanceGeometry:Ti,setAttachmentStateSimple:Jt,setBackbufferDescSimple:qn,setBitFlagEnabled:Gt,setFormatComponentCount:function(e,t){return 4294902015&e|t<<8},setFormatFlags:function(e,t){return 4294967040&e|t},setMegaStateFlags:jt,setSortKeyBias:function(e,t){return!!(e>>>31&1)?(4294967040&e|255&t)>>>0:e},setSortKeyDepth:function(e,t,r){void 0===r&&(r=65536);var n=!!(e>>>31&1),i=Cn(t,n,r);return n?Mn(e,i):xn(e,i)},setSortKeyDepthKey:function(e,t){return!!(e>>>31&1)?Mn(e,t):xn(e,t)},setSortKeyLayer:On,setSortKeyOpaqueDepth:xn,setSortKeyProgramKey:In,setSortKeyTranslucentDepth:Mn,spliceBisectRight:wt,standardFullClearRenderPassDescriptor:Yn,updateBuffer:wi,vertexAttributeDescriptorCopy:Tr,vertexAttributeDescriptorEquals:hr});function bo(){
7
+ oe=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=Object.create((t&&t.prototype instanceof f?t:f).prototype),o=new A(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return C()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=R(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function h(){}function d(){}var p={};s(p,i,(function(){return this}));var _=Object.getPrototypeOf,E=_&&_(_(S([])));E&&E!==t&&r.call(E,i)&&(p=E);var v=d.prototype=f.prototype=Object.create(p);function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){function n(i,o,a,s){var u=c(e[i],e,o);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function R(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return h.prototype=d,s(v,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(m.prototype),s(m.prototype,o,(function(){return this})),e.AsyncIterator=m,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new m(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(v),s(v,a,"Generator"),s(v,i,(function(){return this})),s(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=S,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(this.prev>=o.tryLoc){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(o.catchLoc>this.prev)return n(o.catchLoc,!0);if(o.finallyLoc>this.prev)return n(o.finallyLoc)}else if(s){if(o.catchLoc>this.prev)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(this.prev>=i.tryLoc&&r.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function ae(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function se(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){ae(o,n,i,a,s,"next",e)}function s(e){ae(o,n,i,a,s,"throw",e)}a(void 0)}))}}function ue(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ce(e,t,r){return t&&ue(e.prototype,t),r&&ue(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function le(){return le=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},le.apply(this,arguments)}function fe(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,he(e,t)}function he(e,t){return he=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},he(e,t)}function de(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;o.length>n;n++)0>t.indexOf(r=o[n])&&(i[r]=e[r]);return i}function pe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _e(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);t>r;r++)n[r]=e[r];return n}function Ee(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return _e(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_e(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return e.length>n?{done:!1,value:e[n++]}:{done:!0}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var ve=function(){this.pickingId=void 0,this.encodedPickingColor=void 0,this.meshes=[]};ve.tag="c-renderable-3d";var ge=function(){function e(){this.lights=[],this.fog=void 0}var t=e.prototype;return t.addLight=function(e){this.lights.push(e),this.sortLights()},t.removeLight=function(e){var t=this.lights.indexOf(e);this.lights.splice(t,1),this.sortLights()},t.addFog=function(e){this.fog=e},t.removeFog=function(e){this.fog=null},t.getFog=function(){return this.fog},t.getAllLights=function(){return this.lights},t.getDefines=function(){var e={USE_LIGHT:!!this.lights.length};return this.lights.forEach((function(t){e[t.define]||(e[t.define]=0),e[t.define]++})),e},t.sortLights=function(){this.lights.sort((function(e,t){return e.order-t.order}))},e}();ge=u([t.singleton()],ge);var me=["style"],Re=function(e){function r(r){var n,i=r.style,o=de(r,me);return(n=e.call(this,le({type:t.Shape.MESH,style:le({x:"",y:"",z:"",lineWidth:0},i)},o))||this).cullable.enable=!1,n.style.geometry.meshes.push(pe(n)),n.style.material.meshes.push(pe(n)),n}return fe(r,e),r.prototype.destroy=function(){e.prototype.destroy.call(this);var t=this.style.geometry.meshes,r=t.indexOf(this);t.splice(r,1),r=(t=this.style.material.meshes).indexOf(this),t.splice(r,1)},r}(t.DisplayObject),ye="undefined"!=typeof Float32Array?Float32Array:Array;function Te(){var e=new ye(16);return ye!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Ae(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Se(e,t,r,n,i,o,a,s,u,c,l,f,h,d,p,_){var E=new ye(16);return E[0]=e,E[1]=t,E[2]=r,E[3]=n,E[4]=i,E[5]=o,E[6]=a,E[7]=s,E[8]=u,E[9]=c,E[10]=l,E[11]=f,E[12]=h,E[13]=d,E[14]=p,E[15]=_,E}function Ce(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Oe=function(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],h=t[9],d=t[10],p=t[11],_=t[12],E=t[13],v=t[14],g=t[15],m=r[0],R=r[1],y=r[2],T=r[3];return e[0]=m*n+R*s+y*f+T*_,e[1]=m*i+R*u+y*h+T*E,e[2]=m*o+R*c+y*d+T*v,e[3]=m*a+R*l+y*p+T*g,e[4]=(m=r[4])*n+(R=r[5])*s+(y=r[6])*f+(T=r[7])*_,e[5]=m*i+R*u+y*h+T*E,e[6]=m*o+R*c+y*d+T*v,e[7]=m*a+R*l+y*p+T*g,e[8]=(m=r[8])*n+(R=r[9])*s+(y=r[10])*f+(T=r[11])*_,e[9]=m*i+R*u+y*h+T*E,e[10]=m*o+R*c+y*d+T*v,e[11]=m*a+R*l+y*p+T*g,e[12]=(m=r[12])*n+(R=r[13])*s+(y=r[14])*f+(T=r[15])*_,e[13]=m*i+R*u+y*h+T*E,e[14]=m*o+R*c+y*d+T*v,e[15]=m*a+R*l+y*p+T*g,e};function Ie(e,t,r){var n=new ye(3);return n[0]=e,n[1]=t,n[2]=r,n}var Ne,xe;Ne=new ye(3),ye!=Float32Array&&(Ne[0]=0,Ne[1]=0,Ne[2]=0),xe=Ne;var Pe,Me,De,Be,Le,be,Fe,Ue,we,Ge,ke,Ve,We,Xe,He,Ye,je,Ke,ze,qe,Ze,Qe,Je,$e,et,tt,rt;!function(){var e=function(){var e=new ye(2);return ye!=Float32Array&&(e[0]=0,e[1]=0),e}()}();function nt(e,t,r,n){return{dimension:He.n2D,pixelFormat:e,width:t,height:r,depth:1,numLevels:n,usage:Ye.Sampled}}function it(e){return e}function ot(e,t,r){return e<<16|t<<8|r}function at(e){return e>>>8&255}function st(e){return e>>>16&255}function ut(e){return 255&e}function ct(e){switch(e){case Je.F32:case Je.U32:case Je.S32:return 4;case Je.U16:case Je.S16:case Je.F16:return 2;case Je.U8:case Je.S8:return 1;default:throw new Error("whoops")}}function lt(e){return ct(st(e))}function ft(e){var t=ut(e);if(t&et.Depth)return ze.Depth;if(t&et.Normalized)return ze.Float;var r=st(e);if(r===Je.F16||r===Je.F32)return ze.Float;if(r===Je.U8||r===Je.U16||r===Je.U32)return ze.Uint;if(r===Je.S8||r===Je.S16||r===Je.S32)return ze.Sint;throw new Error("whoops")}function ht(e,t){if(void 0===t&&(t=""),!e)throw console.error((new Error).stack),new Error("Assert fail: "+t)}function dt(e){if(null!=e)return e;throw new Error("Missing object")}function pt(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a}function _t(e,t){e.r=t.r,e.g=t.g,e.b=t.b,e.a=t.a}function Et(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}function vt(e,t,r,n){return void 0===n&&(n=1),{r:e,g:t,b:r,a:n}}!function(e){e[e.Buffer=0]="Buffer",e[e.Texture=1]="Texture",e[e.RenderTarget=2]="RenderTarget",e[e.Sampler=3]="Sampler",e[e.Program=4]="Program",e[e.Bindings=5]="Bindings",e[e.InputLayout=6]="InputLayout",e[e.InputState=7]="InputState",e[e.RenderPipeline=8]="RenderPipeline",e[e.ComputePipeline=9]="ComputePipeline",e[e.Readback=10]="Readback",e[e.QueryPool=11]="QueryPool"}(Pe||(Pe={})),function(e){e[e.Never=512]="Never",e[e.Less=513]="Less",e[e.Equal=514]="Equal",e[e.LessEqual=515]="LessEqual",e[e.Greater=516]="Greater",e[e.NotEqual=517]="NotEqual",e[e.GreaterEqual=518]="GreaterEqual",e[e.Always=519]="Always"}(Me||(Me={})),function(e){e[e.CCW=2305]="CCW",e[e.CW=2304]="CW"}(De||(De={})),function(e){e[e.None=0]="None",e[e.Front=1]="Front",e[e.Back=2]="Back",e[e.FrontAndBack=3]="FrontAndBack"}(Be||(Be={})),function(e){e[e.Zero=0]="Zero",e[e.One=1]="One",e[e.Src=768]="Src",e[e.OneMinusSrc=769]="OneMinusSrc",e[e.Dst=774]="Dst",e[e.OneMinusDst=775]="OneMinusDst",e[e.SrcAlpha=770]="SrcAlpha",e[e.OneMinusSrcAlpha=771]="OneMinusSrcAlpha",e[e.DstAlpha=772]="DstAlpha",e[e.OneMinusDstAlpha=773]="OneMinusDstAlpha"}(Le||(Le={})),function(e){e[e.Add=32774]="Add",e[e.Subtract=32778]="Subtract",e[e.ReverseSubtract=32779]="ReverseSubtract"}(be||(be={})),function(e){e[e.Clamp=0]="Clamp",e[e.Repeat=1]="Repeat",e[e.Mirror=2]="Mirror"}(Fe||(Fe={})),function(e){e[e.Point=0]="Point",e[e.Bilinear=1]="Bilinear"}(Ue||(Ue={})),function(e){e[e.NoMip=0]="NoMip",e[e.Nearest=1]="Nearest",e[e.Linear=2]="Linear"}(we||(we={})),function(e){e[e.Points=0]="Points",e[e.Triangles=1]="Triangles",e[e.TriangleStrip=2]="TriangleStrip",e[e.Lines=3]="Lines",e[e.LineStrip=4]="LineStrip"}(Ge||(Ge={})),function(e){e[e.MAP_READ=1]="MAP_READ",e[e.MAP_WRITE=2]="MAP_WRITE",e[e.COPY_SRC=4]="COPY_SRC",e[e.COPY_DST=8]="COPY_DST",e[e.INDEX=16]="INDEX",e[e.VERTEX=32]="VERTEX",e[e.UNIFORM=64]="UNIFORM",e[e.STORAGE=128]="STORAGE",e[e.INDIRECT=256]="INDIRECT",e[e.QUERY_RESOLVE=512]="QUERY_RESOLVE"}(ke||(ke={})),function(e){e[e.Static=1]="Static",e[e.Dynamic=2]="Dynamic"}(Ve||(Ve={})),function(e){e[e.PerVertex=1]="PerVertex",e[e.PerInstance=2]="PerInstance"}(We||(We={})),function(e){e.LOADED="loaded"}(Xe||(Xe={})),function(e){e[e.n2D=0]="n2D",e[e.n2DArray=1]="n2DArray",e[e.n3D=2]="n3D",e[e.Cube=3]="Cube"}(He||(He={})),function(e){e[e.Sampled=1]="Sampled",e[e.RenderTarget=2]="RenderTarget"}(Ye||(Ye={})),function(e){e[e.None=0]="None",e[e.Red=1]="Red",e[e.Green=2]="Green",e[e.Blue=4]="Blue",e[e.Alpha=8]="Alpha",e[e.RGB=7]="RGB",e[e.AllChannels=15]="AllChannels"}(je||(je={})),function(e){e[e.Keep=7680]="Keep",e[e.Zero=0]="Zero",e[e.Replace=7681]="Replace",e[e.Invert=5386]="Invert",e[e.IncrementClamp=7682]="IncrementClamp",e[e.DecrementClamp=7683]="DecrementClamp",e[e.IncrementWrap=34055]="IncrementWrap",e[e.DecrementWrap=34056]="DecrementWrap"}(Ke||(Ke={})),function(e){e[e.Float=0]="Float",e[e.Uint=1]="Uint",e[e.Sint=2]="Sint",e[e.Depth=3]="Depth"}(ze||(ze={})),function(e){e[e.LowerLeft=0]="LowerLeft",e[e.UpperLeft=1]="UpperLeft"}(qe||(qe={})),function(e){e[e.NegativeOne=0]="NegativeOne",e[e.Zero=1]="Zero"}(Ze||(Ze={})),function(e){e[e.OcclusionConservative=0]="OcclusionConservative"}(Qe||(Qe={})),function(e){e[e.U8=1]="U8",e[e.U16=2]="U16",e[e.U32=3]="U32",e[e.S8=4]="S8",e[e.S16=5]="S16",e[e.S32=6]="S32",e[e.F16=7]="F16",e[e.F32=8]="F32",e[e.BC1=65]="BC1",e[e.BC2=66]="BC2",e[e.BC3=67]="BC3",e[e.BC4_UNORM=68]="BC4_UNORM",e[e.BC4_SNORM=69]="BC4_SNORM",e[e.BC5_UNORM=70]="BC5_UNORM",e[e.BC5_SNORM=71]="BC5_SNORM",e[e.U16_PACKED_5551=97]="U16_PACKED_5551",e[e.D24=129]="D24",e[e.D32F=130]="D32F",e[e.D24S8=131]="D24S8",e[e.D32FS8=132]="D32FS8"}(Je||(Je={})),function(e){e[e.R=1]="R",e[e.RG=2]="RG",e[e.RGB=3]="RGB",e[e.RGBA=4]="RGBA",e[e.A=5]="A"}($e||($e={})),function(e){e[e.None=0]="None",e[e.Normalized=1]="Normalized",e[e.sRGB=2]="sRGB",e[e.Depth=4]="Depth",e[e.Stencil=8]="Stencil",e[e.RenderTarget=16]="RenderTarget"}(et||(et={})),function(e){e[e.ALPHA=ot(Je.U8,$e.A,et.None)]="ALPHA",e[e.F16_R=ot(Je.F16,$e.R,et.None)]="F16_R",e[e.F16_RG=ot(Je.F16,$e.RG,et.None)]="F16_RG",e[e.F16_RGB=ot(Je.F16,$e.RGB,et.None)]="F16_RGB",e[e.F16_RGBA=ot(Je.F16,$e.RGBA,et.None)]="F16_RGBA",e[e.F32_R=ot(Je.F32,$e.R,et.None)]="F32_R",e[e.F32_RG=ot(Je.F32,$e.RG,et.None)]="F32_RG",e[e.F32_RGB=ot(Je.F32,$e.RGB,et.None)]="F32_RGB",e[e.F32_RGBA=ot(Je.F32,$e.RGBA,et.None)]="F32_RGBA",e[e.U8_R=ot(Je.U8,$e.R,et.None)]="U8_R",e[e.U8_R_NORM=ot(Je.U8,$e.R,et.Normalized)]="U8_R_NORM",e[e.U8_RG=ot(Je.U8,$e.RG,et.None)]="U8_RG",e[e.U8_RG_NORM=ot(Je.U8,$e.RG,et.Normalized)]="U8_RG_NORM",e[e.U8_RGB=ot(Je.U8,$e.RGB,et.None)]="U8_RGB",e[e.U8_RGB_NORM=ot(Je.U8,$e.RGB,et.Normalized)]="U8_RGB_NORM",e[e.U8_RGB_SRGB=ot(Je.U8,$e.RGB,et.sRGB|et.Normalized)]="U8_RGB_SRGB",e[e.U8_RGBA=ot(Je.U8,$e.RGBA,et.None)]="U8_RGBA",e[e.U8_RGBA_NORM=ot(Je.U8,$e.RGBA,et.Normalized)]="U8_RGBA_NORM",e[e.U8_RGBA_SRGB=ot(Je.U8,$e.RGBA,et.sRGB|et.Normalized)]="U8_RGBA_SRGB",e[e.U16_R=ot(Je.U16,$e.R,et.None)]="U16_R",e[e.U16_R_NORM=ot(Je.U16,$e.R,et.Normalized)]="U16_R_NORM",e[e.U16_RG_NORM=ot(Je.U16,$e.RG,et.Normalized)]="U16_RG_NORM",e[e.U16_RGBA_NORM=ot(Je.U16,$e.RGBA,et.Normalized)]="U16_RGBA_NORM",e[e.U16_RGB=ot(Je.U16,$e.RGB,et.None)]="U16_RGB",e[e.U32_R=ot(Je.U32,$e.R,et.None)]="U32_R",e[e.U32_RG=ot(Je.U32,$e.RG,et.None)]="U32_RG",e[e.S8_R=ot(Je.S8,$e.R,et.None)]="S8_R",e[e.S8_R_NORM=ot(Je.S8,$e.R,et.Normalized)]="S8_R_NORM",e[e.S8_RG_NORM=ot(Je.S8,$e.RG,et.Normalized)]="S8_RG_NORM",e[e.S8_RGB_NORM=ot(Je.S8,$e.RGB,et.Normalized)]="S8_RGB_NORM",e[e.S8_RGBA_NORM=ot(Je.S8,$e.RGBA,et.Normalized)]="S8_RGBA_NORM",e[e.S16_R=ot(Je.S16,$e.R,et.None)]="S16_R",e[e.S16_RG=ot(Je.S16,$e.RG,et.None)]="S16_RG",e[e.S16_RG_NORM=ot(Je.S16,$e.RG,et.Normalized)]="S16_RG_NORM",e[e.S16_RGB_NORM=ot(Je.S16,$e.RGB,et.Normalized)]="S16_RGB_NORM",e[e.S16_RGBA=ot(Je.S16,$e.RGBA,et.None)]="S16_RGBA",e[e.S16_RGBA_NORM=ot(Je.S16,$e.RGBA,et.Normalized)]="S16_RGBA_NORM",e[e.S32_R=ot(Je.S32,$e.R,et.None)]="S32_R",e[e.U16_RGBA_5551=ot(Je.U16_PACKED_5551,$e.RGBA,et.Normalized)]="U16_RGBA_5551",e[e.BC1=ot(Je.BC1,$e.RGBA,et.Normalized)]="BC1",e[e.BC1_SRGB=ot(Je.BC1,$e.RGBA,et.Normalized|et.sRGB)]="BC1_SRGB",e[e.BC2=ot(Je.BC2,$e.RGBA,et.Normalized)]="BC2",e[e.BC2_SRGB=ot(Je.BC2,$e.RGBA,et.Normalized|et.sRGB)]="BC2_SRGB",e[e.BC3=ot(Je.BC3,$e.RGBA,et.Normalized)]="BC3",e[e.BC3_SRGB=ot(Je.BC3,$e.RGBA,et.Normalized|et.sRGB)]="BC3_SRGB",e[e.BC4_UNORM=ot(Je.BC4_UNORM,$e.R,et.Normalized)]="BC4_UNORM",e[e.BC4_SNORM=ot(Je.BC4_SNORM,$e.R,et.Normalized)]="BC4_SNORM",e[e.BC5_UNORM=ot(Je.BC5_UNORM,$e.RG,et.Normalized)]="BC5_UNORM",e[e.BC5_SNORM=ot(Je.BC5_SNORM,$e.RG,et.Normalized)]="BC5_SNORM",e[e.D24=ot(Je.D24,$e.R,et.Depth)]="D24",e[e.D24_S8=ot(Je.D24S8,$e.RG,et.Depth|et.Stencil)]="D24_S8",e[e.D32F=ot(Je.D32F,$e.R,et.Depth)]="D32F",e[e.D32F_S8=ot(Je.D32FS8,$e.RG,et.Depth|et.Stencil)]="D32F_S8",e[e.U8_RGB_RT=ot(Je.U8,$e.RGB,et.RenderTarget|et.Normalized)]="U8_RGB_RT",e[e.U8_RGBA_RT=ot(Je.U8,$e.RGBA,et.RenderTarget|et.Normalized)]="U8_RGBA_RT",e[e.U8_RGBA_RT_SRGB=ot(Je.U8,$e.RGBA,et.RenderTarget|et.Normalized|et.sRGB)]="U8_RGBA_RT_SRGB"}(tt||(tt={})),function(e){e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",e[e.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",e[e.BLEND_EQUATION=32777]="BLEND_EQUATION",e[e.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",e[e.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",e[e.BLEND_DST_RGB=32968]="BLEND_DST_RGB",e[e.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",e[e.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",e[e.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",e[e.BLEND_COLOR=32773]="BLEND_COLOR",e[e.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",e[e.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",e[e.LINE_WIDTH=2849]="LINE_WIDTH",e[e.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",e[e.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",e[e.CULL_FACE_MODE=2885]="CULL_FACE_MODE",e[e.FRONT_FACE=2886]="FRONT_FACE",e[e.DEPTH_RANGE=2928]="DEPTH_RANGE",e[e.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",e[e.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",e[e.DEPTH_FUNC=2932]="DEPTH_FUNC",e[e.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",e[e.STENCIL_FUNC=2962]="STENCIL_FUNC",e[e.STENCIL_FAIL=2964]="STENCIL_FAIL",e[e.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",e[e.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",e[e.STENCIL_REF=2967]="STENCIL_REF",e[e.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",e[e.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",e[e.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",e[e.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",e[e.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",e[e.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",e[e.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",e[e.VIEWPORT=2978]="VIEWPORT",e[e.SCISSOR_BOX=3088]="SCISSOR_BOX",e[e.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",e[e.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",e[e.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",e[e.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",e[e.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",e[e.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",e[e.RED_BITS=3410]="RED_BITS",e[e.GREEN_BITS=3411]="GREEN_BITS",e[e.BLUE_BITS=3412]="BLUE_BITS",e[e.ALPHA_BITS=3413]="ALPHA_BITS",e[e.DEPTH_BITS=3414]="DEPTH_BITS",e[e.STENCIL_BITS=3415]="STENCIL_BITS",e[e.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",e[e.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",e[e.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",e[e.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",e[e.SAMPLES=32937]="SAMPLES",e[e.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",e[e.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",e[e.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",e[e.VENDOR=7936]="VENDOR",e[e.RENDERER=7937]="RENDERER",e[e.VERSION=7938]="VERSION",e[e.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",e[e.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",e[e.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.BUFFER_SIZE=34660]="BUFFER_SIZE",e[e.BUFFER_USAGE=34661]="BUFFER_USAGE",e[e.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",e[e.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",e[e.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",e[e.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",e[e.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",e[e.CULL_FACE=2884]="CULL_FACE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK",e[e.BLEND=3042]="BLEND",e[e.DEPTH_TEST=2929]="DEPTH_TEST",e[e.DITHER=3024]="DITHER",e[e.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",e[e.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",e[e.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",e[e.SCISSOR_TEST=3089]="SCISSOR_TEST",e[e.STENCIL_TEST=2960]="STENCIL_TEST",e[e.NO_ERROR=0]="NO_ERROR",e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",e[e.CW=2304]="CW",e[e.CCW=2305]="CCW",e[e.DONT_CARE=4352]="DONT_CARE",e[e.FASTEST=4353]="FASTEST",e[e.NICEST=4354]="NICEST",e[e.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DOUBLE=5130]="DOUBLE",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER",e[e.COMPILE_STATUS=35713]="COMPILE_STATUS",e[e.DELETE_STATUS=35712]="DELETE_STATUS",e[e.LINK_STATUS=35714]="LINK_STATUS",e[e.VALIDATE_STATUS=35715]="VALIDATE_STATUS",e[e.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",e[e.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",e[e.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",e[e.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",e[e.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",e[e.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",e[e.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",e[e.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",e[e.SHADER_TYPE=35663]="SHADER_TYPE",e[e.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",e[e.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",e[e.NEVER=512]="NEVER",e[e.ALWAYS=519]="ALWAYS",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.GEQUAL=518]="GEQUAL",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP",e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",e[e.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",e[e.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE=5890]="TEXTURE",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",e[e.TEXTURE0=33984]="TEXTURE0",e[e.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",e[e.REPEAT=10497]="REPEAT",e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",e[e.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.LOW_FLOAT=36336]="LOW_FLOAT",e[e.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",e[e.HIGH_FLOAT=36338]="HIGH_FLOAT",e[e.LOW_INT=36339]="LOW_INT",e[e.MEDIUM_INT=36340]="MEDIUM_INT",e[e.HIGH_INT=36341]="HIGH_INT",e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.RENDERBUFFER=36161]="RENDERBUFFER",e[e.RGBA4=32854]="RGBA4",e[e.RGB5_A1=32855]="RGB5_A1",e[e.RGB565=36194]="RGB565",e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX=6401]="STENCIL_INDEX",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",e[e.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",e[e.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",e[e.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",e[e.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",e[e.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",e[e.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",e[e.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",e[e.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",e[e.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",e[e.NONE=0]="NONE",e[e.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",e[e.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",e[e.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",e[e.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",e[e.READ_BUFFER=3074]="READ_BUFFER",e[e.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",e[e.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",e[e.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",e[e.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",e[e.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",e[e.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",e[e.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",e[e.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",e[e.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",e[e.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",e[e.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",e[e.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",e[e.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",e[e.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",e[e.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",e[e.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",e[e.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",e[e.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",e[e.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",e[e.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",e[e.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",e[e.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",e[e.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",e[e.RED=6403]="RED",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB10_A2=32857]="RGB10_A2",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",e[e.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",e[e.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",e[e.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",e[e.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",e[e.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",e[e.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",e[e.SRGB=35904]="SRGB",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",e[e.RGBA32F=34836]="RGBA32F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.RGB16F=34843]="RGB16F",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R16F=33325]="R16F",e[e.R32F=33326]="R32F",e[e.RG16F=33327]="RG16F",e[e.RG32F=33328]="RG32F",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2UI=36975]="RGB10_A2UI",e[e.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",e[e.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.RG=33319]="RG",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",e[e.CURRENT_QUERY=34917]="CURRENT_QUERY",e[e.QUERY_RESULT=34918]="QUERY_RESULT",e[e.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",e[e.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",e[e.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",e[e.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",e[e.DRAW_BUFFER0=34853]="DRAW_BUFFER0",e[e.DRAW_BUFFER1=34854]="DRAW_BUFFER1",e[e.DRAW_BUFFER2=34855]="DRAW_BUFFER2",e[e.DRAW_BUFFER3=34856]="DRAW_BUFFER3",e[e.DRAW_BUFFER4=34857]="DRAW_BUFFER4",e[e.DRAW_BUFFER5=34858]="DRAW_BUFFER5",e[e.DRAW_BUFFER6=34859]="DRAW_BUFFER6",e[e.DRAW_BUFFER7=34860]="DRAW_BUFFER7",e[e.DRAW_BUFFER8=34861]="DRAW_BUFFER8",e[e.DRAW_BUFFER9=34862]="DRAW_BUFFER9",e[e.DRAW_BUFFER10=34863]="DRAW_BUFFER10",e[e.DRAW_BUFFER11=34864]="DRAW_BUFFER11",e[e.DRAW_BUFFER12=34865]="DRAW_BUFFER12",e[e.DRAW_BUFFER13=34866]="DRAW_BUFFER13",e[e.DRAW_BUFFER14=34867]="DRAW_BUFFER14",e[e.DRAW_BUFFER15=34868]="DRAW_BUFFER15",e[e.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",e[e.MAX_SAMPLES=36183]="MAX_SAMPLES",e[e.SAMPLER_BINDING=35097]="SAMPLER_BINDING",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",e[e.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",e[e.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",e[e.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",e[e.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",e[e.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",e[e.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",e[e.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",e[e.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",e[e.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",e[e.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",e[e.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",e[e.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",e[e.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",e[e.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",e[e.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",e[e.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",e[e.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",e[e.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",e[e.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",e[e.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",e[e.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",e[e.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",e[e.UNIFORM_TYPE=35383]="UNIFORM_TYPE",e[e.UNIFORM_SIZE=35384]="UNIFORM_SIZE",e[e.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",e[e.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",e[e.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",e[e.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",e[e.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",e[e.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",e[e.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS",e[e.SYNC_FENCE=37142]="SYNC_FENCE",e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED",e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED",e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",e[e.COLOR=6144]="COLOR",e[e.DEPTH=6145]="DEPTH",e[e.STENCIL=6146]="STENCIL",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STREAM_COPY=35042]="STREAM_COPY",e[e.STATIC_READ=35045]="STATIC_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",e[e.INVALID_INDEX=4294967295]="INVALID_INDEX",e[e.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",e[e.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",e[e.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",e[e.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.UNSIGNED_INT_24_8_WEBGL=34042]="UNSIGNED_INT_24_8_WEBGL",e[e.HALF_FLOAT_OES=36193]="HALF_FLOAT_OES",e[e.RGBA32F_EXT=34836]="RGBA32F_EXT",e[e.RGB32F_EXT=34837]="RGB32F_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT",e[e.UNSIGNED_NORMALIZED_EXT=35863]="UNSIGNED_NORMALIZED_EXT",e[e.MIN_EXT=32775]="MIN_EXT",e[e.MAX_EXT=32776]="MAX_EXT",e[e.SRGB_EXT=35904]="SRGB_EXT",e[e.SRGB_ALPHA_EXT=35906]="SRGB_ALPHA_EXT",e[e.SRGB8_ALPHA8_EXT=35907]="SRGB8_ALPHA8_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT_OES=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT_OES",e[e.COLOR_ATTACHMENT0_WEBGL=36064]="COLOR_ATTACHMENT0_WEBGL",e[e.COLOR_ATTACHMENT1_WEBGL=36065]="COLOR_ATTACHMENT1_WEBGL",e[e.COLOR_ATTACHMENT2_WEBGL=36066]="COLOR_ATTACHMENT2_WEBGL",e[e.COLOR_ATTACHMENT3_WEBGL=36067]="COLOR_ATTACHMENT3_WEBGL",e[e.COLOR_ATTACHMENT4_WEBGL=36068]="COLOR_ATTACHMENT4_WEBGL",e[e.COLOR_ATTACHMENT5_WEBGL=36069]="COLOR_ATTACHMENT5_WEBGL",e[e.COLOR_ATTACHMENT6_WEBGL=36070]="COLOR_ATTACHMENT6_WEBGL",e[e.COLOR_ATTACHMENT7_WEBGL=36071]="COLOR_ATTACHMENT7_WEBGL",e[e.COLOR_ATTACHMENT8_WEBGL=36072]="COLOR_ATTACHMENT8_WEBGL",e[e.COLOR_ATTACHMENT9_WEBGL=36073]="COLOR_ATTACHMENT9_WEBGL",e[e.COLOR_ATTACHMENT10_WEBGL=36074]="COLOR_ATTACHMENT10_WEBGL",e[e.COLOR_ATTACHMENT11_WEBGL=36075]="COLOR_ATTACHMENT11_WEBGL",e[e.COLOR_ATTACHMENT12_WEBGL=36076]="COLOR_ATTACHMENT12_WEBGL",e[e.COLOR_ATTACHMENT13_WEBGL=36077]="COLOR_ATTACHMENT13_WEBGL",e[e.COLOR_ATTACHMENT14_WEBGL=36078]="COLOR_ATTACHMENT14_WEBGL",e[e.COLOR_ATTACHMENT15_WEBGL=36079]="COLOR_ATTACHMENT15_WEBGL",e[e.DRAW_BUFFER0_WEBGL=34853]="DRAW_BUFFER0_WEBGL",e[e.DRAW_BUFFER1_WEBGL=34854]="DRAW_BUFFER1_WEBGL",e[e.DRAW_BUFFER2_WEBGL=34855]="DRAW_BUFFER2_WEBGL",e[e.DRAW_BUFFER3_WEBGL=34856]="DRAW_BUFFER3_WEBGL",e[e.DRAW_BUFFER4_WEBGL=34857]="DRAW_BUFFER4_WEBGL",e[e.DRAW_BUFFER5_WEBGL=34858]="DRAW_BUFFER5_WEBGL",e[e.DRAW_BUFFER6_WEBGL=34859]="DRAW_BUFFER6_WEBGL",e[e.DRAW_BUFFER7_WEBGL=34860]="DRAW_BUFFER7_WEBGL",e[e.DRAW_BUFFER8_WEBGL=34861]="DRAW_BUFFER8_WEBGL",e[e.DRAW_BUFFER9_WEBGL=34862]="DRAW_BUFFER9_WEBGL",e[e.DRAW_BUFFER10_WEBGL=34863]="DRAW_BUFFER10_WEBGL",e[e.DRAW_BUFFER11_WEBGL=34864]="DRAW_BUFFER11_WEBGL",e[e.DRAW_BUFFER12_WEBGL=34865]="DRAW_BUFFER12_WEBGL",e[e.DRAW_BUFFER13_WEBGL=34866]="DRAW_BUFFER13_WEBGL",e[e.DRAW_BUFFER14_WEBGL=34867]="DRAW_BUFFER14_WEBGL",e[e.DRAW_BUFFER15_WEBGL=34868]="DRAW_BUFFER15_WEBGL",e[e.MAX_COLOR_ATTACHMENTS_WEBGL=36063]="MAX_COLOR_ATTACHMENTS_WEBGL",e[e.MAX_DRAW_BUFFERS_WEBGL=34852]="MAX_DRAW_BUFFERS_WEBGL",e[e.VERTEX_ARRAY_BINDING_OES=34229]="VERTEX_ARRAY_BINDING_OES",e[e.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",e[e.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",e[e.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",e[e.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",e[e.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",e[e.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",e[e.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT"}(rt||(rt={}));var gt=vt(0,0,0,0),mt=vt(0,0,0,1),Rt=vt(1,1,1,0),yt=vt(1,1,1,1),Tt=!0;function At(e,t){if(void 0===t&&(t=Tt),!t)return e;switch(e){case Me.Less:return Me.Greater;case Me.LessEqual:return Me.GreaterEqual;case Me.GreaterEqual:return Me.LessEqual;case Me.Greater:return Me.Less;default:return e}}function St(e,t){return null!=e?e:t}function Ct(e){return void 0===e?null:e}function Ot(e,t,r){e.length=t,e.fill(r)}function It(e,t){var r=t-1;return e+r&~r}function Nt(e,t){return((e+t-1)/t|0)*t}function xt(e,t,r){for(var n=0,i=e.length;i>n;){var o=n+(i-n>>>1);0>r(t,e[o])?i=o:n=o+1}return n}function Pt(e,t,r){var n=xt(e,t,r);e.splice(n,0,t)}function Mt(e,t,r){return r?e|=t:e&=~t,e}function Dt(e,t){for(var r=new Array(e),n=0;e>n;n++)r[n]=t();return r}function Bt(e,t,r){for(void 0===r&&(r="0");t>e.length;)e=""+r+e;return e}function Lt(e,t){e.blendDstFactor=t.blendDstFactor,e.blendSrcFactor=t.blendSrcFactor,e.blendMode=t.blendMode}function bt(e,t){return void 0===e&&(e={rgbBlendState:{},alphaBlendState:{},channelWriteMask:0}),Lt(e.rgbBlendState,t.rgbBlendState),Lt(e.alphaBlendState,t.alphaBlendState),e.channelWriteMask=t.channelWriteMask,e}function Ft(e,t){e.length!==t.length&&(e.length=t.length);for(var r=0;t.length>r;r++)e[r]=bt(e[r],t[r])}function Ut(e,t){void 0!==t.attachmentsState&&Ft(e.attachmentsState,t.attachmentsState),void 0!==t.blendConstant&&_t(e.blendConstant,t.blendConstant),e.depthCompare=St(t.depthCompare,e.depthCompare),e.depthWrite=St(t.depthWrite,e.depthWrite),e.stencilCompare=St(t.stencilCompare,e.stencilCompare),e.stencilWrite=St(t.stencilWrite,e.stencilWrite),e.stencilPassOp=St(t.stencilPassOp,e.stencilPassOp),e.stencilRef=St(t.stencilRef,e.stencilRef),e.cullMode=St(t.cullMode,e.cullMode),e.frontFace=St(t.frontFace,e.frontFace),e.polygonOffset=St(t.polygonOffset,e.polygonOffset)}function wt(e){var t=Object.assign({},e);return t.attachmentsState=[],Ft(t.attachmentsState,e.attachmentsState),t.blendConstant=Et(t.blendConstant),t}function Gt(e,t){void 0!==t.channelWriteMask&&(e.channelWriteMask=t.channelWriteMask),void 0!==t.rgbBlendMode&&(e.rgbBlendState.blendMode=t.rgbBlendMode),void 0!==t.alphaBlendMode&&(e.alphaBlendState.blendMode=t.alphaBlendMode),void 0!==t.rgbBlendSrcFactor&&(e.rgbBlendState.blendSrcFactor=t.rgbBlendSrcFactor),void 0!==t.alphaBlendSrcFactor&&(e.alphaBlendState.blendSrcFactor=t.alphaBlendSrcFactor),void 0!==t.rgbBlendDstFactor&&(e.rgbBlendState.blendDstFactor=t.rgbBlendDstFactor),void 0!==t.alphaBlendDstFactor&&(e.alphaBlendState.blendDstFactor=t.alphaBlendDstFactor)}var kt={blendMode:be.Add,blendSrcFactor:Le.One,blendDstFactor:Le.Zero},Vt={attachmentsState:[{channelWriteMask:je.RGB,rgbBlendState:kt,alphaBlendState:kt}],blendConstant:Et(gt),depthWrite:!0,depthCompare:Me.LessEqual,stencilCompare:Me.Always,stencilWrite:!1,stencilPassOp:Ke.Keep,stencilRef:0,cullMode:Be.None,frontFace:De.CCW,polygonOffset:!1};function Wt(e,t){void 0===e&&(e=null),void 0===t&&(t=Vt);var r=wt(t);return null!==e&&Ut(r,e),r}var Xt=Wt({depthCompare:Me.Always,depthWrite:!1},Vt);function Ht(e,t){return void 0===e.attachmentsState&&(e.attachmentsState=[],Ft(e.attachmentsState,Vt.attachmentsState)),Gt(e.attachmentsState[0],t),e}var Yt,jt={formatKind:ze.Float,dimension:He.n2D};function Kt(e,t,r){if(e.length!==t.length)return!1;for(var n=0;e.length>n;n++)if(!r(e[n],t[n]))return!1;return!0}function zt(e,t){for(var r=Array(e.length),n=0;e.length>n;n++)r[n]=t(e[n]);return r}function qt(e,t){return e.buffer===t.buffer&&e.wordCount===t.wordCount}function Zt(e,t){return null===e?null===t:null!==t&&(e.sampler===t.sampler&&e.texture===t.texture)}function Qt(e,t){return e.numSamplers===t.numSamplers&&e.numUniformBuffers===t.numUniformBuffers}function Jt(e,t){return e.samplerBindings.length===t.samplerBindings.length&&(!!Kt(e.samplerBindings,t.samplerBindings,Zt)&&(!!Kt(e.uniformBufferBindings,t.uniformBufferBindings,qt)&&!!tr(e.bindingLayout,t.bindingLayout)))}function $t(e,t){return e.blendMode==t.blendMode&&e.blendSrcFactor===t.blendSrcFactor&&e.blendDstFactor===t.blendDstFactor}function er(e,t){return!!$t(e.rgbBlendState,t.rgbBlendState)&&(!!$t(e.alphaBlendState,t.alphaBlendState)&&e.channelWriteMask===t.channelWriteMask)}function tr(e,t){return e.numSamplers===t.numSamplers&&e.numUniformBuffers===t.numUniformBuffers}function rr(e,t){return e===t}function nr(e,t){return e.topology===t.topology&&(e.inputLayout===t.inputLayout&&(e.sampleCount===t.sampleCount&&(!!function(e,t){return!!Kt(e.attachmentsState,t.attachmentsState,er)&&!!pt(e.blendConstant,t.blendConstant)&&e.depthCompare===t.depthCompare&&e.depthWrite===t.depthWrite&&e.stencilCompare===t.stencilCompare&&e.stencilWrite===t.stencilWrite&&e.stencilPassOp===t.stencilPassOp&&e.stencilRef===t.stencilRef&&e.cullMode===t.cullMode&&e.frontFace===t.frontFace&&e.polygonOffset===t.polygonOffset}(e.megaStateDescriptor,t.megaStateDescriptor)&&(!!function(e,t){return e.id===t.id}(e.program,t.program)&&(!!Kt(e.bindingLayouts,t.bindingLayouts,tr)&&(!!Kt(e.colorAttachmentFormats,t.colorAttachmentFormats,rr)&&e.depthStencilAttachmentFormat===t.depthStencilAttachmentFormat))))))}function ir(e,t){return e.bufferIndex===t.bufferIndex&&e.bufferByteOffset===t.bufferByteOffset&&e.location===t.location&&e.format===t.format}function or(e,t){return d(e)?d(t):!d(t)&&(e.byteStride===t.byteStride&&e.frequency===t.frequency)}function ar(e,t){return e.indexBufferFormat===t.indexBufferFormat&&(!!Kt(e.vertexBufferDescriptors,t.vertexBufferDescriptors,or)&&!!Kt(e.vertexAttributeDescriptors,t.vertexAttributeDescriptors,ir))}function sr(e,t){return e.wrapS===t.wrapS&&e.wrapT===t.wrapT&&e.minFilter===t.minFilter&&e.magFilter===t.magFilter&&e.mipFilter===t.mipFilter&&e.minLOD===t.minLOD&&e.maxLOD===t.maxLOD&&e.maxAnisotropy===t.maxAnisotropy&&e.compareMode===t.compareMode}function ur(e){return{sampler:e.sampler,texture:e.texture,lateBinding:e.lateBinding}}function cr(e){return{buffer:e.buffer,wordCount:e.wordCount}}function lr(e){return{bindingLayout:e.bindingLayout,samplerBindings:zt(e.samplerBindings,ur),uniformBufferBindings:zt(e.uniformBufferBindings,cr),pipeline:e.pipeline}}function fr(e){return{dimension:e.dimension,formatKind:e.formatKind}}function hr(e){return{numSamplers:e.numSamplers,numUniformBuffers:e.numUniformBuffers,samplerEntries:void 0!==e.samplerEntries?zt(e.samplerEntries,fr):void 0}}function dr(e){var t=zt(e.bindingLayouts,hr),r=e.program,n=e.topology;return{bindingLayouts:t,inputLayout:e.inputLayout,megaStateDescriptor:wt(e.megaStateDescriptor),program:r,topology:n,colorAttachmentFormats:e.colorAttachmentFormats.slice(),depthStencilAttachmentFormat:e.depthStencilAttachmentFormat,sampleCount:e.sampleCount}}function pr(e){return{location:e.location,format:e.format,bufferIndex:e.bufferIndex,bufferByteOffset:e.bufferByteOffset,byteStride:e.byteStride,divisor:e.divisor}}function _r(e){return d(e)?e:{byteStride:e.byteStride,frequency:e.frequency}}function Er(e){return{vertexAttributeDescriptors:zt(e.vertexAttributeDescriptors,pr),vertexBufferDescriptors:zt(e.vertexBufferDescriptors,_r),indexBufferFormat:e.indexBufferFormat}}!function(e){e[e.LITTLE_ENDIAN=0]="LITTLE_ENDIAN",e[e.BIG_ENDIAN=1]="BIG_ENDIAN"}(Yt||(Yt={}));var vr,gr=new Uint16Array([65279]),mr=255==new DataView(gr.buffer).getUint8(0)?Yt.LITTLE_ENDIAN:Yt.BIG_ENDIAN;var Rr=/([^[]*)(\[[0-9]+\])?/;function yr(){var e=null;return function(t,r,n){var i=e!==n;return i&&(t.uniform1i(r,n),e=n),i}}function Tr(e,t,r,n){var i=null,o=null;return function(a,s,u){var c=t(u,r),l=c.length,f=!1;if(null===i)i=new Float32Array(l),o=l,f=!0;else{ht(o===l,"Uniform length cannot change.");for(var h=0;l>h;++h)if(c[h]!==i[h]){f=!0;break}}return f&&(n(a,e,s,c),i.set(c)),f}}function Ar(e,t,r,n){e[t](r,n)}function Sr(e,t,r,n){e[t](r,!1,n)}var Cr={},Or={},Ir={},Nr=[0];function xr(e,t,r,n){1===t&&"boolean"==typeof e&&(e=e?1:0),Number.isFinite(e)&&(Nr[0]=e,e=Nr);var i=e.length;if(e instanceof r)return e;var o=n[i];o||(o=new r(i),n[i]=o);for(var a=0;i>a;a++)o[a]=e[a];return o}function Pr(e,t){return xr(e,t,Float32Array,Cr)}function Mr(e,t){return xr(e,t,Int32Array,Or)}function Dr(e,t){return xr(e,t,Uint32Array,Ir)}var Br,Lr=((vr={})[rt.FLOAT]=Tr.bind(null,"uniform1fv",Pr,1,Ar),vr[rt.FLOAT_VEC2]=Tr.bind(null,"uniform2fv",Pr,2,Ar),vr[rt.FLOAT_VEC3]=Tr.bind(null,"uniform3fv",Pr,3,Ar),vr[rt.FLOAT_VEC4]=Tr.bind(null,"uniform4fv",Pr,4,Ar),vr[rt.INT]=Tr.bind(null,"uniform1iv",Mr,1,Ar),vr[rt.INT_VEC2]=Tr.bind(null,"uniform2iv",Mr,2,Ar),vr[rt.INT_VEC3]=Tr.bind(null,"uniform3iv",Mr,3,Ar),vr[rt.INT_VEC4]=Tr.bind(null,"uniform4iv",Mr,4,Ar),vr[rt.BOOL]=Tr.bind(null,"uniform1iv",Mr,1,Ar),vr[rt.BOOL_VEC2]=Tr.bind(null,"uniform2iv",Mr,2,Ar),vr[rt.BOOL_VEC3]=Tr.bind(null,"uniform3iv",Mr,3,Ar),vr[rt.BOOL_VEC4]=Tr.bind(null,"uniform4iv",Mr,4,Ar),vr[rt.FLOAT_MAT2]=Tr.bind(null,"uniformMatrix2fv",Pr,4,Sr),vr[rt.FLOAT_MAT3]=Tr.bind(null,"uniformMatrix3fv",Pr,9,Sr),vr[rt.FLOAT_MAT4]=Tr.bind(null,"uniformMatrix4fv",Pr,16,Sr),vr[rt.SAMPLER_2D]=yr,vr[rt.SAMPLER_CUBE]=yr,vr[rt.UNSIGNED_INT]=Tr.bind(null,"uniform1uiv",Dr,1,Ar),vr[rt.UNSIGNED_INT_VEC2]=Tr.bind(null,"uniform2uiv",Dr,2,Ar),vr[rt.UNSIGNED_INT_VEC3]=Tr.bind(null,"uniform3uiv",Dr,3,Ar),vr[rt.UNSIGNED_INT_VEC4]=Tr.bind(null,"uniform4uiv",Dr,4,Ar),vr[rt.FLOAT_MAT2x3]=Tr.bind(null,"uniformMatrix2x3fv",Pr,6,Sr),vr[rt.FLOAT_MAT2x4]=Tr.bind(null,"uniformMatrix2x4fv",Pr,8,Sr),vr[rt.FLOAT_MAT3x2]=Tr.bind(null,"uniformMatrix3x2fv",Pr,6,Sr),vr[rt.FLOAT_MAT3x4]=Tr.bind(null,"uniformMatrix3x4fv",Pr,12,Sr),vr[rt.FLOAT_MAT4x2]=Tr.bind(null,"uniformMatrix4x2fv",Pr,8,Sr),vr[rt.FLOAT_MAT4x3]=Tr.bind(null,"uniformMatrix4x3fv",Pr,12,Sr),vr[rt.SAMPLER_2D]=yr,vr[rt.SAMPLER_CUBE]=yr,vr[rt.SAMPLER_3D]=yr,vr[rt.SAMPLER_2D_SHADOW]=yr,vr[rt.SAMPLER_2D_ARRAY]=yr,vr[rt.SAMPLER_2D_ARRAY_SHADOW]=yr,vr[rt.SAMPLER_CUBE_SHADOW]=yr,vr[rt.INT_SAMPLER_2D]=yr,vr[rt.INT_SAMPLER_3D]=yr,vr[rt.INT_SAMPLER_CUBE]=yr,vr[rt.INT_SAMPLER_2D_ARRAY]=yr,vr[rt.UNSIGNED_INT_SAMPLER_2D]=yr,vr[rt.UNSIGNED_INT_SAMPLER_3D]=yr,vr[rt.UNSIGNED_INT_SAMPLER_CUBE]=yr,vr[rt.UNSIGNED_INT_SAMPLER_2D_ARRAY]=yr,vr);function br(e,t,r){var n=e.createBuffer({viewOrSize:It(r.byteLength,4)/4,usage:t,hint:Ve.Static});return n.setSubData(0,new Uint8Array(r)),n}!function(e){e.CHANGED="changed"}(Br||(Br={}));var Fr,Ur=function(e){function r(t,r){var n;return void 0===r&&(r={}),(n=e.call(this)||this).device=void 0,n.props=void 0,n.drawMode=Ge.Triangles,n.vertexBuffers=[],n.vertices=[],n.indexBuffer=void 0,n.indices=void 0,n.inputLayoutDescriptor={vertexBufferDescriptors:[],vertexAttributeDescriptors:[],indexBufferFormat:tt.U32_R},n.vertexCount=0,n.instancedCount=0,n.indexStart=0,n.primitiveStart=0,n.dirty=!0,n.meshes=[],n.device=t,n.props=r,n}fe(r,e);var n=r.prototype;return n.validate=function(e){return!0},n.build=function(e){},n.computeBoundingBox=function(){return new t.AABB},n.setIndexBuffer=function(e){return this.indexBuffer&&this.indexBuffer.destroy(),this.indexBuffer=br(this.device,ke.INDEX|ke.COPY_DST,new Uint32Array(ArrayBuffer.isView(e)?e.buffer:e).buffer),this.indices=e,this},n.setVertexBuffer=function(e){var t=this,r=e.bufferIndex,n=e.attributes,i=e.data;this.inputLayoutDescriptor.vertexBufferDescriptors[r]={byteStride:e.byteStride,frequency:e.frequency},this.vertices[r]=i,n.forEach((function(e){var n=e.format,i=e.bufferByteOffset,o=e.location,a=e.divisor,s=e.byteStride,u=t.inputLayoutDescriptor.vertexAttributeDescriptors.find((function(e){return e.bufferIndex===r&&e.location===o}));u?(u.format=n,u.bufferByteOffset=i,u.byteStride=s,u.divisor=a):t.inputLayoutDescriptor.vertexAttributeDescriptors.push({format:n,bufferIndex:r,bufferByteOffset:i,location:o,byteStride:s,divisor:a})})),this.vertexBuffers[r]&&this.vertexBuffers[r].destroy();var o=br(this.device,ke.VERTEX|ke.COPY_DST,i.buffer);return this.vertexBuffers[r]=o,this},n.getVertexBuffer=function(e){return this.vertexBuffers[e]},n.updateVertexBuffer=function(e,t,r,n){var i=this.inputLayoutDescriptor.vertexBufferDescriptors[e].byteStride,o=this.inputLayoutDescriptor.vertexAttributeDescriptors.find((function(e){return e.location===t}));o&&this.getVertexBuffer(e).setSubData(o.bufferByteOffset+r*i,n);this.emit(Br.CHANGED)},n.updateIndices=function(e,t){return void 0===t&&(t=0),this.indexBuffer&&this.indexBuffer.setSubData(t,ArrayBuffer.isView(e)?e:new Uint32Array(e)),this},n.destroy=function(){this.vertexBuffers.forEach((function(e){e&&e.destroy()})),this.indexBuffer&&this.indexBuffer.destroy(),this.inputLayoutDescriptor.vertexAttributeDescriptors=[],this.inputLayoutDescriptor.vertexBufferDescriptors=[],this.indexBuffer=void 0,this.vertexBuffers=[],this.indices=void 0,this.vertices=[],this.vertexCount=0,this.instancedCount=0},r}(l.EventEmitter),wr=[[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]];function Gr(e,t){return"#define "+e+" "+t}function kr(e){var t=[],r=[];return e.replace(/\s*struct\s*(.*)\s*{((?:\s*.*\s*)*?)};/g,(function(e,t,n){var i=[];return n.trim().split("\n").forEach((function(e){var t=e.trim().split(/\s+/),r=t[1];i.push({type:t[0].trim(),name:r.replace(";","").trim()})})),r.push({type:t.trim(),uniforms:i}),""})),e.replace(/\s*uniform\s*.*\s*{((?:\s*.*\s*)*?)};/g,(function(e,n){return n.trim().split("\n").forEach((function(e){var n=e.trim().split(" "),i=n[0]||"",o=n[1]||"",a=o.indexOf("[")>-1;if(o=o.replace(";","").replace("[","").trim(),!i.startsWith("#")){if(i){var s=r.find((function(e){return i===e.type}));if(s)if(a)for(var u=function(e){s.uniforms.forEach((function(r){t.push(o+"["+e+"]."+r.name)}))},c=0;5>c;c++)u(c);else s.uniforms.forEach((function(e){t.push(o+"."+e.name)}))}o&&t.push(o)}})),""})),t}function Vr(e,t,r,n,i){void 0===n&&(n=null);var o="#version 100"===e.glslVersion,a=r.split("\n").map((function(e){return e.replace(/[/][/].*$/,"")})).filter((function(e){return!(!e||/^\s+$/.test(e))})),s="";null!==n&&(s=Object.keys(n).map((function(e){return Gr(e,n[e])})).join("\n"));var u=a.find((function(e){return e.startsWith("precision")}))||"precision mediump float;",c=a.filter((function(e){return!e.startsWith("precision")})).join("\n"),l="";if(e.viewportOrigin===qe.UpperLeft&&(l+=Gr("VIEWPORT_ORIGIN_TL","1")+"\n"),e.clipSpaceNearZ===Ze.Zero&&(l+=Gr("CLIPSPACE_NEAR_ZERO","1")+"\n"),e.explicitBindingLocations){var f=0,h=0,d=0;c=c.replace(/^(layout\((.*)\))?\s*uniform(.+{)$/gm,(function(e,t,r,n){return"layout("+(r?r+", ":"")+"set = "+f+", binding = "+h+++") uniform "+n})),f++,h=0,ht(e.separateSamplerTextures),c=(c=c.replace(/uniform sampler2D (.*);/g,(function(e,r){return"frag"===t?"\nlayout(set = "+f+", binding = "+h+++") uniform texture2D T_"+r+";\nlayout(set = "+f+", binding = "+h+++") uniform sampler S_"+r+";\n":""}))).replace("frag"===t?/^\b(varying|in)\b/gm:/^\b(varying|out)\b/gm,(function(e,t){return"layout(location = "+d+++") "+t})),l+=Gr("gl_VertexID","gl_VertexIndex")+"\n"}c=e.separateSamplerTextures?(c=(c=(c=c.replace(/\bPD_SAMPLER_2D\((.*?)\)/g,(function(e,t){return"texture2D T_P_"+t+", sampler S_P_"+t}))).replace(/\bPU_SAMPLER_2D\((.*?)\)/g,(function(e,t){return"SAMPLER_2D(P_"+t+")"}))).replace(/\bPP_SAMPLER_2D\((.*?)\)/g,(function(e,t){return"T_"+t+", S_"+t}))).replace(/\bSAMPLER_2D\((.*?)\)/g,(function(e,t){return"sampler2D(T_"+t+", S_"+t+")"})):(c=(c=(c=c.replace(/\bPD_SAMPLER_2D\((.*?)\)/g,(function(e,t){return"sampler2D P_"+t}))).replace(/\bPU_SAMPLER_2D\((.*?)\)/g,(function(e,t){return"SAMPLER_2D(P_"+t+")"}))).replace(/\bPP_SAMPLER_2D\((.*?)\)/g,(function(e,t){return t}))).replace(/\bSAMPLER_2D\((.*?)\)/g,(function(e,t){return t}));var p=((o?"":e.glslVersion)+"\n\n"+(o&&"frag"===t?"#extension GL_OES_standard_derivatives : enable":"")+"\n"+u+"\n"+l+"\n"+s+"\n"+c+"\n").trim();if(e.explicitBindingLocations&&"frag"===t&&(p=p.replace(/^\b(out)\b/gm,(function(e,t){return"layout(location = 0) "+t}))),o){if("frag"===t&&(p=p.replace(/^\s*in\s+(\S+)\s*(.*);$/gm,(function(e,t,r){return"varying "+t+" "+r+";\n"}))),"vert"===t&&(p=(p=p.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,(function(e,t,r){return"varying "+t+" "+r+";\n"}))).replace(/^\s*layout\(location\s*=\s*\S*\)\s*in\s+(\S+)\s*(.*);$/gm,(function(e,t,r){return"attribute "+t+" "+r+";\n"}))),p=p.replace(/\s*uniform\s*.*\s*{((?:\s*.*\s*)*?)};/g,(function(e,t){return t.trim().replace(/^.*$/gm,(function(e){var t=e.trim();return t.startsWith("#")?t:e?"uniform "+t:""}))})),"frag"===t){var _,E=(p=p.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,(function(e,t,r){return _=r,t+" "+r+";\n"}))).lastIndexOf("}");p=p.substring(0,E)+"\n gl_FragColor = vec4("+_+");\n"+p.substring(E)}p=p.replace(/^\s*layout\((.*)\)/gm,"");for(var v,g=Ee(wr);!(v=g()).done;){var m=v.value;p=p.replace(m[0],m[1])}}return p}function Wr(e,t,r,n,i){return void 0===n&&(n=null),{vert:t,frag:r,preprocessedVert:Vr(e,"vert",t,n),preprocessedFrag:Vr(e,"frag",r,n)}}function Xr(e,t){var r=void 0!==t.defines?t.defines:null,n=void 0!==t.both?t.both+t.vert:t.vert,i=void 0!==t.both?t.both+t.frag:t.frag;return Wr(e.queryVendorInfo(),n,i,r)}!function(e){e.CHANGED="changed"}(Fr||(Fr={}));var Hr=function(e){function t(t,r){var n;(n=e.call(this)||this).device=void 0,n.props={},n.meshes=[],n.defines={},n.uniforms={},n.uniformNames=void 0,n.uboBuffer=[],n.textures={},n.samplers=[],n.programDirty=!0,n.textureDirty=!0,n.geometryDirty=!0;var i=wt(Vt),o=i.cullMode,a=i.depthCompare,s=i.depthWrite,u=i.stencilCompare,c=i.stencilWrite,l=i.stencilPassOp,f=i.frontFace,h=i.polygonOffset,d=i.attachmentsState;return n.device=t,n.props=le({cullMode:o,depthTest:!0,depthCompare:a,depthWrite:s,stencilCompare:u,stencilWrite:c,stencilPassOp:l,frontFace:f,polygonOffset:h,attachmentsState:d,dithering:!1,wireframe:!1,wireframeColor:"black",wireframeLineWidth:1,vertexShader:"",fragmentShader:""},r),n.compile(),n}fe(t,e);var r=t.prototype;return r.compile=function(){var e=this;this.props.fragmentShader.replace(/^\s*uniform\s*sampler2D\s*(.*)\s*;$/gm,(function(t,r){return e.samplers.push(r),""})),this.uniformNames=kr(this.props.fragmentShader)},r.setUniforms=function(e){var t=this,r=!1;Object.keys(e).forEach((function(n){var i,o=e[n],a=t.textures[n];a&&a!==o&&(t.textureDirty=!0),(i=o)&&i.type?(t.textures[n]=o,t.textureDirty=!0,o.on(Xe.LOADED,(function(){t.dispatchMutationEvent()}))):(t.uniforms[n]=o,r=!0),d(e[n])&&(delete t.textures[n],delete t.uniforms[n])})),r&&this.dispatchMutationEvent()},r.dispatchMutationEvent=function(){this.emit(Fr.CHANGED)},ce(t,[{key:"cullMode",get:function(){return this.props.cullMode},set:function(e){this.props.cullMode=e}},{key:"frontFace",get:function(){return this.props.frontFace},set:function(e){this.props.frontFace=e}},{key:"blendConstant",get:function(){return this.props.blendConstant},set:function(e){this.props.blendConstant=e}},{key:"blendEquation",get:function(){return this.props.blendEquation},set:function(e){this.props.blendEquation=e}},{key:"blendEquationAlpha",get:function(){return this.props.blendEquationAlpha},set:function(e){this.props.blendEquationAlpha=e}},{key:"blendSrc",get:function(){return this.props.blendSrc},set:function(e){this.props.blendSrc=e}},{key:"blendDst",get:function(){return this.props.blendDst},set:function(e){this.props.blendDst=e}},{key:"blendSrcAlpha",get:function(){return this.props.blendSrcAlpha},set:function(e){this.props.blendSrcAlpha=e}},{key:"blendDstAlpha",get:function(){return this.props.blendDstAlpha},set:function(e){this.props.blendDstAlpha=e}},{key:"depthCompare",get:function(){return this.props.depthCompare},set:function(e){this.props.depthCompare=e}},{key:"depthTest",get:function(){return this.props.depthTest},set:function(e){this.props.depthTest=e}},{key:"depthWrite",get:function(){return this.props.depthWrite},set:function(e){this.props.depthWrite=e}},{key:"stencilCompare",get:function(){return this.props.stencilCompare},set:function(e){this.props.stencilCompare=e}},{key:"stencilWrite",get:function(){return this.props.stencilWrite},set:function(e){this.props.stencilWrite=e}},{key:"stencilPassOp",get:function(){return this.props.stencilPassOp},set:function(e){this.props.stencilPassOp=e}},{key:"stencilRef",get:function(){return this.props.stencilRef},set:function(e){this.props.stencilRef=e}},{key:"polygonOffset",get:function(){return this.props.polygonOffset},set:function(e){this.props.polygonOffset=e}},{key:"dithering",get:function(){return this.props.dithering},set:function(e){this.props.dithering=e}},{key:"wireframe",get:function(){return this.props.wireframe},set:function(e){this.props.wireframe!==e&&(this.geometryDirty=!0,this.programDirty=!0,this.props.wireframe=e,this.dispatchMutationEvent()),this.defines.USE_WIREFRAME=!!e}},{key:"wireframeColor",get:function(){return this.props.wireframeColor},set:function(e){this.props.wireframeColor=e}},{key:"wireframeLineWidth",get:function(){return this.props.wireframeLineWidth},set:function(e){this.props.wireframeLineWidth=e}},{key:"vertexShader",get:function(){return this.props.vertexShader},set:function(e){this.props.vertexShader!==e&&(this.programDirty=!0,this.props.vertexShader=e,this.compile())}},{key:"fragmentShader",get:function(){return this.props.fragmentShader},set:function(e){this.props.fragmentShader!==e&&(this.programDirty=!0,this.props.fragmentShader=e,this.compile())}}]),t}(l.EventEmitter),Yr=function(e){function t(t,r){var n;return(n=e.call(this,t,le({},r))||this).defines=le({},n.defines,{USE_UV:!1,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1,USE_LIGHT:!1}),n}return fe(t,e),t}(Hr),jr=function(){function e(){this.name="(unnamed)",this.preprocessedVert="",this.preprocessedFrag="",this.both="",this.vert="",this.frag="",this.defines={},this.features={MRT:!0}}var t=e.prototype;return t.definesChanged=function(){this.preprocessedVert="",this.preprocessedFrag=""},t.setDefineString=function(e,t){if(null!==t){if(this.defines[e]===t)return!1;this.defines[e]=t}else{if(d(this.defines[e]))return!1;delete this.defines[e]}return this.definesChanged(),!0},t.setDefineBool=function(e,t){return this.setDefineString(e,t?"1":null)},t.getDefineString=function(e){return Ct(this.defines[e])},t.getDefineBool=function(e){var t=this.getDefineString(e);return null!==t&&ht("1"===t),null!==t},t.ensurePreprocessed=function(e){""===this.preprocessedVert&&(this.preprocessedVert=Vr(e,"vert",this.both+this.vert,this.defines),this.preprocessedFrag=Vr(e,"frag",this.both+this.frag,this.defines))},e}(),Kr=function(){function e(e){this.device=void 0,this.uniformBufferWordAlignment=void 0,this.uniformBufferMaxPageWordSize=void 0,this.currentBufferWordSize=-1,this.currentWordOffset=0,this.buffer=null,this.shadowBufferF32=null,this.shadowBufferU8=null,this.device=e;var t=e.queryLimits();this.uniformBufferWordAlignment=t.uniformBufferWordAlignment,this.uniformBufferMaxPageWordSize=t.uniformBufferMaxPageWordSize}var t=e.prototype;return t.isSupportedUBO=function(){return"WebGL1"!==this.device.queryVendorInfo().platformString},t.findPageIndex=function(e){return e/this.uniformBufferMaxPageWordSize|0},t.allocateChunk=function(e){e=Nt(e,this.uniformBufferWordAlignment),ht(this.uniformBufferMaxPageWordSize>e);var t=this.currentWordOffset;return this.findPageIndex(t)!==this.findPageIndex(t+e-1)&&(t=Nt(t,this.uniformBufferMaxPageWordSize)),this.currentWordOffset=t+e,this.ensureShadowBuffer(t,e),t},t.ensureShadowBuffer=function(e,t){if(null===this.shadowBufferU8||null===this.shadowBufferF32){var r=Nt(this.currentWordOffset,this.uniformBufferMaxPageWordSize);this.shadowBufferU8=new Uint8Array(4*r),this.shadowBufferF32=new Float32Array(this.shadowBufferU8.buffer)}else if(e+t>=this.shadowBufferF32.length){ht(this.currentWordOffset>e&&this.currentWordOffset>=e+t);var n=Nt(Math.max(this.currentWordOffset,2*this.shadowBufferF32.length),this.uniformBufferMaxPageWordSize),i=new Uint8Array(4*n);if(i.set(this.shadowBufferU8,0),this.shadowBufferU8=i,this.shadowBufferF32=new Float32Array(this.shadowBufferU8.buffer),n<this.currentWordOffset)throw new Error("Assert fail: this.currentWordOffset ["+this.currentWordOffset+"] <= newWordCount ["+n+"]")}},t.mapBufferF32=function(){return dt(this.shadowBufferF32)},t.prepareToRender=function(){if(null!==this.shadowBufferF32){var e=dt(this.shadowBufferF32);e.length!==this.currentBufferWordSize&&(this.currentBufferWordSize=e.length,null!==this.buffer&&this.buffer.destroy(),this.buffer=this.device.createBuffer({viewOrSize:this.currentBufferWordSize,usage:ke.UNIFORM|ke.COPY_DST,hint:Ve.Dynamic}));var t=Nt(this.currentWordOffset,this.uniformBufferMaxPageWordSize);if(this.currentBufferWordSize<t)throw new Error("Assert fail: wordCount ["+t+"] ("+this.currentWordOffset+" aligned "+this.uniformBufferMaxPageWordSize+") <= this.currentBufferWordSize ["+this.currentBufferWordSize+"]");if(this.isSupportedUBO())dt(this.buffer).setSubData(0,this.shadowBufferU8,0,4*t);this.currentWordOffset=0}},t.destroy=function(){null!==this.buffer&&this.buffer.destroy(),this.shadowBufferF32=null,this.shadowBufferU8=null},e}();function zr(e,t){return e+=t,e+=e<<10,(e+=e>>>6)>>>0}function qr(e){return e+=e<<3,e^=e>>>11,(e+=e<<15)>>>0}function Zr(e){return 0}var Qr=function(){this.keys=[],this.values=[]},Jr=function(){function e(e,t){this.keyEqualFunc=void 0,this.keyHashFunc=void 0,this.buckets=new Map,this.keyEqualFunc=e,this.keyHashFunc=t}var t=e.prototype;return t.findBucketIndex=function(e,t){for(var r=0;e.keys.length>r;r++)if(this.keyEqualFunc(t,e.keys[r]))return r;return-1},t.findBucket=function(e){var t=this.keyHashFunc(e);return this.buckets.get(t)},t.get=function(e){var t=this.findBucket(e);if(void 0===t)return null;var r=this.findBucketIndex(t,e);return 0>r?null:t.values[r]},t.add=function(e,t){var r=this.keyHashFunc(e);void 0===this.buckets.get(r)&&this.buckets.set(r,new Qr);var n=this.buckets.get(r);n.keys.push(e),n.values.push(t)},t.delete=function(e){var t=this.findBucket(e);if(void 0!==t){var r=this.findBucketIndex(t,e);-1!==r&&(t.keys.splice(r,1),t.values.splice(r,1))}},t.clear=function(){this.buckets.clear()},t.size=function(){for(var e,t=0,r=Ee(this.buckets.values());!(e=r()).done;){t+=e.value.values.length}return t},t.values=oe().mark((function e(){var t,r,n,i;return oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=Ee(this.buckets.values());case 1:if((r=t()).done){e.next=12;break}i=(n=r.value).values.length-1;case 4:if(i<0){e.next=10;break}return e.next=7,n.values[i];case 7:i--,e.next=4;break;case 10:e.next=1;break;case 12:case"end":return e.stop()}}),e,this)})),e}();function $r(e,t){return ht(""!==e.preprocessedVert&&""!==t.preprocessedVert),ht(""!==e.preprocessedFrag&&""!==t.preprocessedFrag),e.preprocessedVert===t.preprocessedVert&&e.preprocessedFrag===t.preprocessedFrag}function en(e,t){return e=zr(e,t.numUniformBuffers),e=zr(e,t.numSamplers)}function tn(e,t){return e=zr(e,t.blendMode),e=zr(e,t.blendSrcFactor),e=zr(e,t.blendDstFactor)}function rn(e,t){return e=tn(e,t.rgbBlendState),e=zr(e=tn(e,t.alphaBlendState),t.channelWriteMask)}function nn(e,t){for(var r=0;t.attachmentsState.length>r;r++)e=rn(e,t.attachmentsState[r]);return e=function(e,t){return zr(e,t.r<<24|t.g<<16|t.b<<8|t.a)}(e,t.blendConstant),e=zr(e,t.depthCompare),e=zr(e,t.depthWrite?1:0),e=zr(e,t.stencilCompare),e=zr(e,t.stencilPassOp),e=zr(e,t.stencilWrite?1:0),e=zr(e,t.cullMode),e=zr(e,t.frontFace?1:0),e=zr(e,t.polygonOffset?1:0)}function on(e){var t=0;t=zr(t,e.program.id),null!==e.inputLayout&&(t=zr(t,e.inputLayout.id));for(var r=0;e.bindingLayouts.length>r;r++)t=en(t,e.bindingLayouts[r]);t=nn(t,e.megaStateDescriptor);for(var n=0;e.colorAttachmentFormats.length>n;n++)t=zr(t,e.colorAttachmentFormats[n]||0);return qr(t=zr(t,e.depthStencilAttachmentFormat||0))}function an(e){for(var t=0,r=0;e.samplerBindings.length>r;r++){var n=e.samplerBindings[r];null!==n&&null!==n.texture&&(t=zr(t,n.texture.id))}for(var i=0;e.uniformBufferBindings.length>i;i++){var o=e.uniformBufferBindings[i];null!==o&&null!==o.buffer&&(t=zr(t,o.buffer.id),t=zr(t,o.wordCount))}return qr(t)}var sn,un=function(){function e(e){this.device=void 0,this.bindingsCache=new Jr(Jt,an),this.renderPipelinesCache=new Jr(nr,on),this.inputLayoutsCache=new Jr(ar,Zr),this.programCache=new Jr($r,Zr),this.samplerCache=new Jr(sr,Zr),this.device=e}var t=e.prototype;return t.createBindings=function(e){var t=this.bindingsCache.get(e);if(null===t){var r=lr(e);t=this.device.createBindings(r),this.bindingsCache.add(r,t)}return t},t.createRenderPipeline=function(e){var t=this.renderPipelinesCache.get(e);if(null===t){var r=dr(e);t=this.device.createRenderPipeline(r),this.renderPipelinesCache.add(r,t)}return t},t.createInputLayout=function(e){var t=this.inputLayoutsCache.get(e);if(null===t){var r=Er(e);t=this.device.createInputLayout(r),this.inputLayoutsCache.add(r,t)}return t},t.createProgramSimple=function(e){var t,r=this.programCache.get(e);if(null===r){var n={preprocessedVert:(t=e).preprocessedVert,preprocessedFrag:t.preprocessedFrag,vert:t.vert,frag:t.frag};r=this.device.createProgramSimple(n),this.programCache.add(n,r)}return r},t.createProgram=function(e){return e.ensurePreprocessed(this.device.queryVendorInfo()),this.createProgramSimple(e)},t.createSampler=function(e){var t=this.samplerCache.get(e);return null===t&&(t=this.device.createSampler(e),this.samplerCache.add(e,t)),t},t.destroy=function(){for(var e,t=Ee(this.bindingsCache.values());!(e=t()).done;){e.value.destroy()}for(var r,n=Ee(this.renderPipelinesCache.values());!(r=n()).done;){r.value.destroy()}for(var i,o=Ee(this.inputLayoutsCache.values());!(i=o()).done;){i.value.destroy()}for(var a,s=Ee(this.programCache.values());!(a=s()).done;){a.value.destroy()}for(var u,c=Ee(this.samplerCache.values());!(u=c()).done;){u.value.destroy()}this.bindingsCache.clear(),this.renderPipelinesCache.clear(),this.inputLayoutsCache.clear(),this.programCache.clear(),this.samplerCache.clear()},e}();!function(e){e[e.Color0=0]="Color0",e[e.Color1=1]="Color1",e[e.Color2=2]="Color2",e[e.Color3=3]="Color3",e[e.ColorMax=3]="ColorMax",e[e.DepthStencil=4]="DepthStencil"}(sn||(sn={}));var cn,ln={x:0,y:0,w:1,h:1},fn=function(){function e(){this.renderTargetIDs=[],this.resolveTextureOutputIDs=[],this.resolveTextureOutputExternalTextures=[],this.resolveTextureInputIDs=[],this.renderTargetExtraRefs=[],this.viewport=ln,this.resolveTextureInputTextures=[],this.renderTargets=[],this.descriptor={colorAttachment:[],colorResolveTo:[],colorStore:[],depthStencilAttachment:null,depthStencilResolveTo:null,depthStencilStore:!0,colorClearColor:["load"],depthClearValue:"load",stencilClearValue:"load",occlusionQueryPool:null},this.viewportX=0,this.viewportY=0,this.viewportW=0,this.viewportH=0,this.execFunc=null,this.postFunc=null,this.debugName=void 0,this.debugThumbnails=[]}var t=e.prototype;return t.setDebugName=function(e){this.debugName=e},t.pushDebugThumbnail=function(e){this.debugThumbnails[e]=!0},t.setViewport=function(e){this.viewport=e},t.attachRenderTargetID=function(e,t){ht(void 0===this.renderTargetIDs[e]),this.renderTargetIDs[e]=t},t.attachResolveTexture=function(e){this.resolveTextureInputIDs.push(e)},t.attachOcclusionQueryPool=function(e){this.descriptor.occlusionQueryPool=e},t.resolveToExternalTexture=function(e,t){this.resolveTextureOutputExternalTextures[e]=t},t.exec=function(e){ht(null===this.execFunc),this.execFunc=e},t.post=function(e){ht(null===this.postFunc),this.postFunc=e},t.addExtraRef=function(e){this.renderTargetExtraRefs[e]=!0},e}(),hn=function(){function e(e,t){this.debugName=void 0,this.dimension=He.n2D,this.depth=1,this.numLevels=1,this.pixelFormat=void 0,this.width=0,this.height=0,this.sampleCount=0,this.usage=Ye.RenderTarget,this.immutable=!0,this.needsClear=!0,this.texture=null,this.attachment=void 0,this.age=0,this.pixelFormat=t.pixelFormat,this.width=t.width,this.height=t.height,this.sampleCount=t.sampleCount,ht(this.sampleCount>=1),this.sampleCount>1?this.attachment=e.createRenderTarget(this):(this.texture=e.createTexture(this),this.attachment=e.createRenderTargetFromTexture(this.texture))}var t=e.prototype;return t.setDebugName=function(e,t){this.debugName=t,null!==this.texture&&e.setResourceName(this.texture,this.debugName),e.setResourceName(this.attachment,this.debugName)},t.matchesDescription=function(e){return this.pixelFormat===e.pixelFormat&&this.width===e.width&&this.height===e.height&&this.sampleCount===e.sampleCount},t.reset=function(e){ht(this.matchesDescription(e)),this.age=0},t.destroy=function(){null!==this.texture&&this.texture.destroy(),this.attachment.destroy()},e}(),dn=function(){function e(e,t){this.dimension=He.n2D,this.depth=1,this.numLevels=1,this.usage=Ye.RenderTarget,this.pixelFormat=void 0,this.width=0,this.height=0,this.texture=void 0,this.age=0,this.immutable=!0,this.pixelFormat=t.pixelFormat,this.width=t.width,this.height=t.height,this.texture=e.createTexture(this)}var t=e.prototype;return t.matchesDescription=function(e){return this.pixelFormat===e.pixelFormat&&this.width===e.width&&this.height===e.height},t.reset=function(e){ht(this.matchesDescription(e)),this.age=0},t.destroy=function(){this.texture.destroy()},e}();cn=Symbol.species;var pn,_n=function(){this[cn]=void 0,this.renderTargetDescriptions=[],this.resolveTextureRenderTargetIDs=[],this.passes=[],this.renderTargetDebugNames=[]},En=function(){function e(e){this.device=void 0,this.currentPass=null,this.renderTargetDeadPool=[],this.singleSampledTextureDeadPool=[],this.currentGraph=null,this.renderTargetOutputCount=[],this.renderTargetResolveCount=[],this.resolveTextureUseCount=[],this.renderTargetAliveForID=[],this.singleSampledTextureForResolveTextureID=[],this.device=e}var t=e.prototype;return t.acquireRenderTargetForDescription=function(e){for(var t=0;this.renderTargetDeadPool.length>t;t++){var r=this.renderTargetDeadPool[t];if(r.matchesDescription(e))return r.reset(e),this.renderTargetDeadPool.splice(t--,1),r}return new hn(this.device,e)},t.acquireSingleSampledTextureForDescription=function(e){for(var t=0;this.singleSampledTextureDeadPool.length>t;t++){var r=this.singleSampledTextureDeadPool[t];if(r.matchesDescription(e))return r.reset(e),this.singleSampledTextureDeadPool.splice(t--,1),r}return new dn(this.device,e)},t.beginGraphBuilder=function(){ht(null===this.currentGraph),this.currentGraph=new _n},t.pushPass=function(e){var t=new fn;e(t),this.currentGraph.passes.push(t)},t.createRenderTargetID=function(e,t){return this.currentGraph.renderTargetDebugNames.push(t),this.currentGraph.renderTargetDescriptions.push(e)-1},t.createResolveTextureID=function(e){return this.currentGraph.resolveTextureRenderTargetIDs.push(e)-1},t.findMostRecentPassThatAttachedRenderTarget=function(e){for(var t=this.currentGraph.passes.length-1;t>=0;t--){var r=this.currentGraph.passes[t];if(r.renderTargetIDs.includes(e))return r}return null},t.resolveRenderTargetPassAttachmentSlot=function(e,t){var r=e;if(void 0===r.resolveTextureOutputIDs[t]){var n=this.createResolveTextureID(r.renderTargetIDs[t]);r.resolveTextureOutputIDs[t]=n}return r.resolveTextureOutputIDs[t]},t.findPassForResolveRenderTarget=function(e){var t=dt(this.findMostRecentPassThatAttachedRenderTarget(e)),r=t.renderTargetIDs.indexOf(e);return ht(void 0===t.resolveTextureOutputExternalTextures[r]),t},t.resolveRenderTarget=function(e){var t=this.findPassForResolveRenderTarget(e),r=t.renderTargetIDs.indexOf(e);return this.resolveRenderTargetPassAttachmentSlot(t,r)},t.resolveRenderTargetToExternalTexture=function(e,t){var r=this.findPassForResolveRenderTarget(e),n=r.renderTargetIDs.indexOf(e);ht(void 0===r.resolveTextureOutputIDs[n]),r.resolveTextureOutputExternalTextures[n]=t},t.getRenderTargetDescription=function(e){return dt(this.currentGraph.renderTargetDescriptions[e])},t.scheduleAddUseCount=function(e,t){for(var r=0;t.renderTargetIDs.length>r;r++){var n=t.renderTargetIDs[r];void 0!==n&&(this.renderTargetOutputCount[n]++,t.renderTargetExtraRefs[r]&&this.renderTargetOutputCount[n]++)}for(var i=0;t.resolveTextureInputIDs.length>i;i++){var o=t.resolveTextureInputIDs[i];if(void 0!==o)this.resolveTextureUseCount[o]++,this.renderTargetResolveCount[e.resolveTextureRenderTargetIDs[o]]++}},t.acquireRenderTargetForID=function(e,t){if(void 0===t)return null;if(ht(this.renderTargetOutputCount[t]>0),!this.renderTargetAliveForID[t]){var r=this.acquireRenderTargetForDescription(e.renderTargetDescriptions[t]);r.setDebugName(this.device,e.renderTargetDebugNames[t]),this.renderTargetAliveForID[t]=r}return this.renderTargetAliveForID[t]},t.releaseRenderTargetForID=function(e,t){if(void 0===e)return null;var r=dt(this.renderTargetAliveForID[e]);return t?(ht(this.renderTargetOutputCount[e]>0),this.renderTargetOutputCount[e]--):(ht(this.renderTargetResolveCount[e]>0),this.renderTargetResolveCount[e]--),0===this.renderTargetOutputCount[e]&&0===this.renderTargetResolveCount[e]&&(r.needsClear=!0,delete this.renderTargetAliveForID[e],this.renderTargetDeadPool.push(r)),r},t.acquireResolveTextureInputTextureForID=function(e,t){var r=e.resolveTextureRenderTargetIDs[t];ht(this.resolveTextureUseCount[t]>0),this.resolveTextureUseCount[t]--;var n=dt(this.releaseRenderTargetForID(r,!1));if(void 0!==this.singleSampledTextureForResolveTextureID[t]){var i=this.singleSampledTextureForResolveTextureID[t];return 0===this.resolveTextureUseCount[t]&&this.singleSampledTextureDeadPool.push(i),i.texture}return dt(n.texture)},t.determineResolveParam=function(e,t,r){var n=t.renderTargetIDs[r],i=t.resolveTextureOutputIDs[r],o=t.resolveTextureOutputExternalTextures[r],a=void 0!==i,s=void 0!==o;ht(!(a&&s));var u=null,c=!1;if(this.renderTargetOutputCount[n]>1&&(c=!0),a){ht(e.resolveTextureRenderTargetIDs[i]===n),ht(this.resolveTextureUseCount[i]>0),ht(this.renderTargetOutputCount[n]>0);var l=dt(this.renderTargetAliveForID[n]);if(null!==l.texture&&1===this.renderTargetOutputCount[n])u=null,c=!0;else{if(!this.singleSampledTextureForResolveTextureID[i]){var f=dt(e.renderTargetDescriptions[n]);this.singleSampledTextureForResolveTextureID[i]=this.acquireSingleSampledTextureForDescription(f),this.device.setResourceName(this.singleSampledTextureForResolveTextureID[i].texture,l.debugName+" (Resolve "+i+")")}u=this.singleSampledTextureForResolveTextureID[i].texture}}else u=s?o:null;return{resolveTo:u,store:c}},t.schedulePass=function(e,t){for(var r=t.renderTargetIDs[sn.DepthStencil],n=sn.Color0;sn.ColorMax>=n;n++){var i=t.renderTargetIDs[n],o=this.acquireRenderTargetForID(e,i);t.renderTargets[n]=o,t.descriptor.colorAttachment[n]=null!==o?o.attachment:null;var a=this.determineResolveParam(e,t,n),s=a.store;t.descriptor.colorResolveTo[n]=a.resolveTo,t.descriptor.colorStore[n]=s,t.descriptor.colorClearColor[n]=null!==o&&o.needsClear?e.renderTargetDescriptions[i].colorClearColor:"load"}var u=this.acquireRenderTargetForID(e,r);t.renderTargets[sn.DepthStencil]=u,t.descriptor.depthStencilAttachment=null!==u?u.attachment:null;var c=this.determineResolveParam(e,t,sn.DepthStencil),l=c.store;t.descriptor.depthStencilResolveTo=c.resolveTo,t.descriptor.depthStencilStore=l,t.descriptor.depthClearValue=null!==u&&u.needsClear?e.renderTargetDescriptions[r].depthClearValue:"load",t.descriptor.stencilClearValue=null!==u&&u.needsClear?e.renderTargetDescriptions[r].stencilClearValue:"load";for(var f=0,h=0,d=0,p=0;t.renderTargets.length>p;p++){var _=t.renderTargets[p];_&&(0===f&&(f=_.width,h=_.height,d=_.sampleCount),ht(_.width===f),ht(_.height===h),ht(_.sampleCount===d),_.needsClear=!1)}if(f>0&&h>0){var E=h*t.viewport.y,v=f*t.viewport.w,g=h*t.viewport.h;t.viewportX=f*t.viewport.x,t.viewportY=E,t.viewportW=v,t.viewportH=g}for(var m=0;t.resolveTextureInputIDs.length>m;m++){t.resolveTextureInputTextures[m]=this.acquireResolveTextureInputTextureForID(e,t.resolveTextureInputIDs[m])}for(var R=0;t.renderTargetIDs.length>R;R++)this.releaseRenderTargetForID(t.renderTargetIDs[R],!0);for(n=0;t.renderTargetExtraRefs.length>n;n++)t.renderTargetExtraRefs[n]&&this.releaseRenderTargetForID(t.renderTargetIDs[n],!0)},t.scheduleGraph=function(e){ht(0===this.renderTargetOutputCount.length),ht(0===this.renderTargetResolveCount.length),ht(0===this.resolveTextureUseCount.length);for(var t=0;this.renderTargetDeadPool.length>t;t++)this.renderTargetDeadPool[t].age++;for(var r=0;this.singleSampledTextureDeadPool.length>r;r++)this.singleSampledTextureDeadPool[r].age++;Ot(this.renderTargetOutputCount,e.renderTargetDescriptions.length,0),Ot(this.renderTargetResolveCount,e.renderTargetDescriptions.length,0),Ot(this.resolveTextureUseCount,e.resolveTextureRenderTargetIDs.length,0);for(var n=0;e.passes.length>n;n++)this.scheduleAddUseCount(e,e.passes[n]);for(var i=0;e.passes.length>i;i++)this.schedulePass(e,e.passes[i]);for(var o=0;this.renderTargetOutputCount.length>o;o++)ht(0===this.renderTargetOutputCount[o]);for(var a=0;this.renderTargetResolveCount.length>a;a++)ht(0===this.renderTargetResolveCount[a]);for(var s=0;this.resolveTextureUseCount.length>s;s++)ht(0===this.resolveTextureUseCount[s]);for(var u=0;this.renderTargetAliveForID.length>u;u++)ht(void 0===this.renderTargetAliveForID[u]);for(var c=0;this.renderTargetDeadPool.length>c;c++)1>this.renderTargetDeadPool[c].age||(this.renderTargetDeadPool[c].destroy(),this.renderTargetDeadPool.splice(c--,1));for(var l=0;this.singleSampledTextureDeadPool.length>l;l++)1>this.singleSampledTextureDeadPool[l].age||(this.singleSampledTextureDeadPool[l].destroy(),this.singleSampledTextureDeadPool.splice(l--,1));this.renderTargetResolveCount.length=0,this.renderTargetOutputCount.length=0,this.resolveTextureUseCount.length=0},t.execPass=function(e){ht(null===this.currentPass),this.currentPass=e;var t=this.device.createRenderPass(e.descriptor);t.beginDebugGroup(e.debugName),t.setViewport(e.viewportX,e.viewportY,e.viewportW,e.viewportH),null!==e.execFunc&&e.execFunc(t,this),t.endDebugGroup(),this.device.submitPass(t),null!==e.postFunc&&e.postFunc(this),this.currentPass=null},t.execGraph=function(e){var t=this;this.scheduleGraph(e),e.passes.forEach((function(e){t.execPass(e)})),this.singleSampledTextureForResolveTextureID.length=0},t.execute=function(){var e=dt(this.currentGraph);this.execGraph(e),this.currentGraph=null},t.getDebug=function(){return this},t.getPasses=function(){return this.currentGraph.passes},t.getPassDebugThumbnails=function(e){return e.debugThumbnails},t.getPassRenderTargetID=function(e,t){return e.renderTargetIDs[t]},t.getRenderTargetIDDebugName=function(e){return this.currentGraph.renderTargetDebugNames[e]},t.getResolveTextureForID=function(e){var t=this.currentPass,r=t.resolveTextureInputIDs.indexOf(e);return ht(r>=0),dt(t.resolveTextureInputTextures[r])},t.getRenderTargetAttachment=function(e){var t=this.currentPass.renderTargets[e];return t?t.attachment:null},t.getRenderTargetTexture=function(e){var t=this.currentPass.renderTargets[e];return t?t.texture:null},t.newGraphBuilder=function(){return this.beginGraphBuilder(),this},t.destroy=function(){for(var e=0;this.renderTargetAliveForID.length>e;e++)ht(void 0===this.renderTargetAliveForID[e]);for(var t=0;this.singleSampledTextureForResolveTextureID.length>t;t++)ht(void 0===this.singleSampledTextureForResolveTextureID[t]);for(var r=0;this.renderTargetDeadPool.length>r;r++)this.renderTargetDeadPool[r].destroy();for(var n=0;this.singleSampledTextureDeadPool.length>n;n++)this.singleSampledTextureDeadPool[n].destroy()},e}();!function(e){e[e.BACKGROUND=0]="BACKGROUND",e[e.ALPHA_TEST=16]="ALPHA_TEST",e[e.OPAQUE=32]="OPAQUE",e[e.TRANSLUCENT=128]="TRANSLUCENT"}(pn||(pn={}));function vn(e,t,r){void 0===r&&(r=65536);var n=_(e,0,r)/r;return t&&(n=1-n),65535&65535*n}function gn(e,t){return(16777215&e|(255&t)<<24)>>>0}function mn(e,t){return!!(e>>>31&1)?e:(4278190335&e|(65535&t)<<8)>>>0}function Rn(e,t){return gn(mn(0,t),e)}function yn(e,t){return ht(t>=0),(4294967040&e|t>>>8&255)>>>0}function Tn(e){return gn(0,e)}function An(e,t){return ht(t>=0),(4278190335&e|t<<8)>>>0}var Sn=Se(1,0,0,0,0,1,0,0,0,0,2,0,0,0,-1,1);var Cn,On=Se(1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1);function In(e,t,r,n,i,o){return void 0===n&&(n=0),void 0===i&&(i=0),void 0===o&&(o=0),e[t+0]=r,e[t+1]=n,e[t+2]=i,e[t+3]=o,4}!function(e){e[e.Indexed=1]="Indexed",e[e.AllowSkippingIfPipelineNotReady=2]="AllowSkippingIfPipelineNotReady",e[e.Template=4]="Template",e[e.Draw=8]="Draw",e[e.InheritedFlags=3]="InheritedFlags"}(Cn||(Cn={}));var Nn,xn=function(){function e(){this.sortKey=0,this.debug=null,this.renderPipelineDescriptor=void 0,this.uniformBuffer=void 0,this.uniforms=[],this.bindingDescriptors=Dt(1,(function(){return{bindingLayout:null,samplerBindings:[],uniformBufferBindings:[]}})),this.dynamicUniformBufferByteOffsets=Dt(4,(function(){return 0})),this.flags=0,this.inputState=null,this.drawStart=0,this.drawCount=0,this.drawInstanceCount=0,this.renderPipelineDescriptor={bindingLayouts:[],inputLayout:null,megaStateDescriptor:wt(Vt),program:null,topology:Ge.Triangles,colorAttachmentFormats:[],depthStencilAttachmentFormat:null,sampleCount:1},this.reset()}var t=e.prototype;return t.reset=function(){this.sortKey=0,this.flags=Cn.AllowSkippingIfPipelineNotReady,this.inputState=null,this.renderPipelineDescriptor.inputLayout=null},t.setFromTemplate=function(e){Ut(this.renderPipelineDescriptor.megaStateDescriptor,e.renderPipelineDescriptor.megaStateDescriptor),this.renderPipelineDescriptor.program=e.renderPipelineDescriptor.program,this.renderPipelineDescriptor.inputLayout=e.renderPipelineDescriptor.inputLayout,this.renderPipelineDescriptor.topology=e.renderPipelineDescriptor.topology,this.renderPipelineDescriptor.colorAttachmentFormats.length=Math.max(this.renderPipelineDescriptor.colorAttachmentFormats.length,e.renderPipelineDescriptor.colorAttachmentFormats.length);for(var t=0;e.renderPipelineDescriptor.colorAttachmentFormats.length>t;t++)this.renderPipelineDescriptor.colorAttachmentFormats[t]=e.renderPipelineDescriptor.colorAttachmentFormats[t];this.renderPipelineDescriptor.depthStencilAttachmentFormat=e.renderPipelineDescriptor.depthStencilAttachmentFormat,this.renderPipelineDescriptor.sampleCount=e.renderPipelineDescriptor.sampleCount,this.inputState=e.inputState,this.uniformBuffer=e.uniformBuffer,this.uniforms=[].concat(e.uniforms),this.drawCount=e.drawCount,this.drawStart=e.drawStart,this.drawInstanceCount=e.drawInstanceCount,this.flags=this.flags&~Cn.InheritedFlags|e.flags&Cn.InheritedFlags,this.sortKey=e.sortKey;var r=this.bindingDescriptors[0],n=e.bindingDescriptors[0];null!==n.bindingLayout&&this.setBindingLayout(n.bindingLayout);for(var i=0;i<Math.min(r.uniformBufferBindings.length,n.uniformBufferBindings.length);i++)r.uniformBufferBindings[i].wordCount=e.bindingDescriptors[0].uniformBufferBindings[i].wordCount;this.setSamplerBindingsFromTextureMappings(n.samplerBindings);for(var o=0;e.dynamicUniformBufferByteOffsets.length>o;o++)this.dynamicUniformBufferByteOffsets[o]=e.dynamicUniformBufferByteOffsets[o]},t.setProgram=function(e){this.renderPipelineDescriptor.program=e},t.setMegaStateFlags=function(e){return Ut(this.renderPipelineDescriptor.megaStateDescriptor,e),this.renderPipelineDescriptor.megaStateDescriptor},t.getMegaStateFlags=function(){return this.renderPipelineDescriptor.megaStateDescriptor},t.setInputLayoutAndState=function(e,t){this.inputState=t,this.renderPipelineDescriptor.inputLayout=e},t.setBindingLayout=function(e){ht(this.dynamicUniformBufferByteOffsets.length>e.numUniformBuffers),this.renderPipelineDescriptor.bindingLayouts[0]=e,this.bindingDescriptors[0].bindingLayout=e;for(var t=this.bindingDescriptors[0].uniformBufferBindings.length;e.numUniformBuffers>t;t++)this.bindingDescriptors[0].uniformBufferBindings.push({buffer:null,wordCount:0});for(var r=this.bindingDescriptors[0].samplerBindings.length;e.numSamplers>r;r++)this.bindingDescriptors[0].samplerBindings.push({sampler:null,texture:null,lateBinding:null})},t.setBindingLayouts=function(e){ht(this.bindingDescriptors.length>=e.length),ht(1===e.length),this.setBindingLayout(e[0])},t.drawIndexes=function(e,t){void 0===t&&(t=0),this.flags=Mt(this.flags,Cn.Indexed,!0),this.drawCount=e,this.drawStart=t,this.drawInstanceCount=1},t.drawIndexesInstanced=function(e,t,r){void 0===r&&(r=0),this.flags=Mt(this.flags,Cn.Indexed,!0),this.drawCount=e,this.drawStart=r,this.drawInstanceCount=t},t.drawPrimitives=function(e,t){void 0===t&&(t=0),this.flags=Mt(this.flags,Cn.Indexed,!1),this.drawCount=e,this.drawStart=t,this.drawInstanceCount=1},t.setUniforms=function(e,t){if(0!==t.length){this.uniforms[e]=t;var r=0,n=[];t.forEach((function(e){var t=e.value;if(E(t)||Array.isArray(t)||t instanceof Float32Array){var i=E(t)?[t]:t,o=4-r%4;if(4!==o)if(o<(i.length>4?4:i.length)){r+=o;for(var a=0;o>a;a++)n.push(0)}else;r+=i.length,n.push.apply(n,i)}}));var i=4-n.length%4;if(4!==i)for(var o=0;i>o;o++)n.push(0);for(var a=this.allocateUniformBuffer(e,n.length),s=this.mapUniformBufferF32(e),u=0;n.length>u;u+=4)a+=In(s,a,n[u],n[u+1],n[u+2],n[u+3])}},t.setUniformBuffer=function(e){this.uniformBuffer=e},t.allocateUniformBuffer=function(e,t){return ht(this.dynamicUniformBufferByteOffsets.length>this.bindingDescriptors[0].bindingLayout.numUniformBuffers),this.dynamicUniformBufferByteOffsets[e]=this.uniformBuffer.allocateChunk(t)<<2,this.bindingDescriptors[0].uniformBufferBindings[e].wordCount=t,this.getUniformBufferOffset(e)},t.getUniformBufferOffset=function(e){return this.dynamicUniformBufferByteOffsets[e]>>>2},t.setUniformBufferOffset=function(e,t,r){this.dynamicUniformBufferByteOffsets[e]=t<<2,this.bindingDescriptors[0].uniformBufferBindings[e].wordCount=r},t.mapUniformBufferF32=function(e){return this.uniformBuffer.mapBufferF32()},t.getUniformBuffer=function(){return this.uniformBuffer},t.setSamplerBindingsFromTextureMappings=function(e){e=e.filter((function(e){return e}));for(var t=0;this.bindingDescriptors[0].samplerBindings.length>t;t++){var r=this.bindingDescriptors[0].samplerBindings[t],n=e[t];null!=n?(r.texture=n.texture,r.sampler=n.sampler,r.lateBinding=n.lateBinding):(r.texture=null,r.sampler=null,r.lateBinding=null)}},t.hasLateSamplerBinding=function(e){for(var t=0;this.bindingDescriptors[0].samplerBindings.length>t;t++){if(this.bindingDescriptors[0].samplerBindings[t].lateBinding===e)return!0}return!1},t.resolveLateSamplerBinding=function(e,t){for(var r=0;this.bindingDescriptors[0].samplerBindings.length>r;r++){var n=this.bindingDescriptors[0].samplerBindings[r];n.lateBinding===e&&(null===t?(n.texture=null,n.sampler=null):(ht(null===t.lateBinding),n.texture=t.texture,null!==t.sampler&&(n.sampler=t.sampler)),n.lateBinding=null)}},t.setAllowSkippingIfPipelineNotReady=function(e){this.flags=Mt(this.flags,Cn.AllowSkippingIfPipelineNotReady,e)},t.setAttachmentFormatsFromRenderPass=function(e,t){for(var r=e.queryRenderPass(t),n=-1,i=0;r.colorAttachment.length>i;i++){var o=null!==r.colorAttachment[i]?e.queryRenderTarget(r.colorAttachment[i]):null;this.renderPipelineDescriptor.colorAttachmentFormats[i]=null!==o?o.pixelFormat:null,null!==o&&(-1===n?n=o.sampleCount:ht(n===o.sampleCount))}var a=null!==r.depthStencilAttachment?e.queryRenderTarget(r.depthStencilAttachment):null;this.renderPipelineDescriptor.depthStencilAttachmentFormat=null!==a?a.pixelFormat:null,null!==a&&(-1===n?n=a.sampleCount:ht(n==a.sampleCount)),ht(n>0),this.renderPipelineDescriptor.sampleCount=n},t.drawOnPass=function(e,t){var r=this,n=e.device;this.setAttachmentFormatsFromRenderPass(n,t);var i=e.createRenderPipeline(this.renderPipelineDescriptor);if(!n.pipelineQueryReady(i)){if(this.flags&Cn.AllowSkippingIfPipelineNotReady)return!1;n.pipelineForceReady(i)}t.setPipeline(i),t.setInputState(this.inputState);for(var o=0;this.bindingDescriptors[0].uniformBufferBindings.length>o;o++)this.bindingDescriptors[0].uniformBufferBindings[o].buffer=dt(this.uniformBuffer.buffer);this.renderPipelineDescriptor.program.gl_program&&this.uniforms.forEach((function(e){var t={};e.forEach((function(e){t[e.name]=e.value})),r.renderPipelineDescriptor.program.setUniforms(t)}));var a=e.createBindings(le({},this.bindingDescriptors[0],{pipeline:i}));return t.setBindings(0,a,this.dynamicUniformBufferByteOffsets),this.drawInstanceCount>1?(ht(!!(this.flags&Cn.Indexed)),t.drawIndexedInstanced(this.drawCount,this.drawStart,this.drawInstanceCount)):this.flags&Cn.Indexed?t.drawIndexed(this.drawCount,this.drawStart):t.draw(this.drawCount,this.drawStart),!0},e}();function Pn(e,t){return e.sortKey-t.sortKey}!function(e){e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards"}(Nn||(Nn={}));var Mn=function(){function e(e,t){void 0===e&&(e=Pn),void 0===t&&(t=Nn.Forwards),this.renderInsts=[],this.compareFunction=void 0,this.executionOrder=void 0,this.usePostSort=!1,this.compareFunction=e,this.executionOrder=t}var t=e.prototype;return t.checkUsePostSort=function(){this.usePostSort=null!==this.compareFunction&&this.renderInsts.length>=500},t.insertSorted=function(e){null===this.compareFunction||this.usePostSort?this.renderInsts.push(e):Pt(this.renderInsts,e,this.compareFunction),this.checkUsePostSort()},t.submitRenderInst=function(e){e.flags|=Cn.Draw,this.insertSorted(e)},t.hasLateSamplerBinding=function(e){for(var t=0;this.renderInsts.length>t;t++)if(this.renderInsts[t].hasLateSamplerBinding(e))return!0;return!1},t.resolveLateSamplerBinding=function(e,t){for(var r=0;this.renderInsts.length>r;r++)this.renderInsts[r].resolveLateSamplerBinding(e,t)},t.ensureSorted=function(){this.usePostSort&&(0!==this.renderInsts.length&&this.renderInsts.sort(this.compareFunction),this.usePostSort=!1)},t.drawOnPassRendererNoReset=function(e,t){this.ensureSorted();var r=0;if(this.executionOrder===Nn.Forwards)for(var n=0;this.renderInsts.length>n;n++)this.renderInsts[n].drawOnPass(e,t)&&r++;else for(var i=this.renderInsts.length-1;i>=0;i--)this.renderInsts[i].drawOnPass(e,t)&&r++;return r},t.reset=function(){this.renderInsts.length=0},t.drawOnPassRenderer=function(e,t){this.drawOnPassRendererNoReset(e,t),this.reset()},e}(),Dn=function(){function e(){this.pool=[],this.allocCount=0}var t=e.prototype;return t.allocRenderInstIndex=function(){return this.allocCount++,this.allocCount>this.pool.length&&this.pool.push(new xn),this.allocCount-1},t.popRenderInst=function(){this.allocCount--},t.reset=function(){for(var e=0;this.pool.length>e;e++)this.pool[e].reset();this.allocCount=0},t.destroy=function(){this.pool.length=0,this.allocCount=0},e}(),Bn=function(){function e(e){this.renderCache=void 0,this.instPool=new Dn,this.templatePool=new Dn,this.simpleRenderInstList=new Mn,this.currentRenderInstList=this.simpleRenderInstList,this.renderCache=e}var t=e.prototype;return t.newRenderInst=function(){var e=this.templatePool.allocCount-1,t=this.instPool.allocRenderInstIndex(),r=this.instPool.pool[t];return r.debug=null,0>e||r.setFromTemplate(this.templatePool.pool[e]),r},t.submitRenderInst=function(e,t){void 0===t&&(t=this.currentRenderInstList),t.submitRenderInst(e)},t.setCurrentRenderInstList=function(e){ht(null===this.simpleRenderInstList),this.currentRenderInstList=e},t.pushTemplateRenderInst=function(){var e=this.templatePool.allocCount-1,t=this.templatePool.allocRenderInstIndex(),r=this.templatePool.pool[t];return 0>e||r.setFromTemplate(this.templatePool.pool[e]),r.flags|=Cn.Template,r},t.popTemplateRenderInst=function(){this.templatePool.popRenderInst()},t.getTemplateRenderInst=function(){return this.templatePool.pool[this.templatePool.allocCount-1]},t.resetRenderInsts=function(){this.instPool.reset(),null!==this.simpleRenderInstList&&this.simpleRenderInstList.reset(),ht(0===this.templatePool.allocCount)},t.destroy=function(){this.instPool.destroy(),this.renderCache.destroy()},t.disableSimpleMode=function(){this.simpleRenderInstList=null},t.drawOnPassRenderer=function(e){dt(this.simpleRenderInstList).drawOnPassRenderer(this.renderCache,e)},t.drawOnPassRendererNoReset=function(e){dt(this.simpleRenderInstList).drawOnPassRendererNoReset(this.renderCache,e)},e}(),Ln=function(){function e(){this.renderCache=void 0,this.renderGraph=void 0,this.renderInstManager=void 0,this.uniformBuffer=void 0,this.device=void 0}var t=e.prototype;return t.getDevice=function(){return this.device},t.setDevice=function(e){this.device=e,this.renderCache=new un(e),this.renderGraph=new En(this.device),this.renderInstManager=new Bn(this.renderCache),this.uniformBuffer=new Kr(this.device)},t.pushTemplateRenderInst=function(){var e=this.renderInstManager.pushTemplateRenderInst();return e.setUniformBuffer(this.uniformBuffer),e},t.prepareToRender=function(){this.uniformBuffer.prepareToRender()},t.destroy=function(){this.uniformBuffer&&this.uniformBuffer.destroy(),this.renderInstManager&&this.renderInstManager.destroy(),this.renderCache.destroy(),this.renderGraph.destroy()},t.getCache=function(){return this.renderCache},e}();Ln=u([t.singleton()],Ln);var bn=function(){function e(e){this.pixelFormat=void 0,this.width=0,this.height=0,this.sampleCount=0,this.colorClearColor="load",this.depthClearValue="load",this.stencilClearValue="load",this.pixelFormat=e}var t=e.prototype;return t.setDimensions=function(e,t,r){this.width=e,this.height=t,this.sampleCount=r},t.copyDimensions=function(e){this.width=e.width,this.height=e.height,this.sampleCount=e.sampleCount},e}();function Fn(e){return{colorClearColor:e,depthClearValue:1,stencilClearValue:0}}var Un,wn=Fn(vt(.88,.88,.88,1)),Gn=Fn(mt),kn=Fn(yt);function Vn(e,t){var r=function(e){return e.antialiasingMode===Un.MSAAx4?4:1}(t);e.setDimensions(t.backbufferWidth,t.backbufferHeight,r)}function Wn(e,t,r){var n=function(e){if(e===sn.Color0)return tt.U8_RGBA_RT;if(e===sn.DepthStencil)return tt.D24_S8;throw new Error("whoops")}(e),i=new bn(n);return Vn(i,t),null!==r&&(i.colorClearColor=r.colorClearColor,i.depthClearValue=r.depthClearValue,i.stencilClearValue=r.stencilClearValue),i}!function(e){e[e.None=0]="None",e[e.FXAA=1]="FXAA",e[e.MSAAx4=2]="MSAAx4"}(Un||(Un={}));var Xn=function(){function e(){this.name=void 0,this.texture=null,this.sampler=null,this.lateBinding=null,this.width=0,this.height=0,this.lodBias=0}var t=e.prototype;return t.reset=function(){this.texture=null,this.sampler=null,this.lateBinding=null,this.width=0,this.height=0,this.lodBias=0},t.copy=function(e){this.texture=e.texture,this.sampler=e.sampler,this.lateBinding=e.lateBinding,this.width=e.width,this.height=e.height,this.lodBias=e.lodBias},e}(),Hn=function(){function e(){this.inputTexture=null,this.outputTexture=null}var t=e.prototype;return t.setDescription=function(e,t){this.inputTexture!==this.outputTexture&&(null!==this.inputTexture&&this.inputTexture.destroy(),this.inputTexture=this.outputTexture),ht(this.inputTexture===this.outputTexture),null!==this.outputTexture&&this.outputTexture.matchesDescription(t)||(this.outputTexture=new dn(e,t),null===this.inputTexture&&(this.inputTexture=this.outputTexture))},t.getTextureForSampling=function(){return null!==this.inputTexture?this.inputTexture.texture:null},t.getTextureForResolving=function(){var e;return null===(e=this.outputTexture)||void 0===e?void 0:e.texture},t.destroy=function(){null!==this.outputTexture&&this.outputTexture!==this.inputTexture&&(this.outputTexture.destroy(),this.outputTexture=null),null!==this.inputTexture&&(this.inputTexture.destroy(),this.inputTexture=null)},e}(),Yn=function(){function e(e,t,r,n){this.imagePool=void 0,this.offscreenCanvas=void 0,this.renderingService=void 0,this.canvasConfig=void 0,this.textureCache={},this.imagePool=e,this.offscreenCanvas=t,this.renderingService=r,this.canvasConfig=n}var r=e.prototype;return r.getOrCreateTexture=function(e,r,n,i){var o,a=this,s="string"==typeof r?r:r.src||"";if(s&&this.textureCache[s])(o=this.textureCache[s]).emit(Xe.LOADED);else if(o=e.createTexture(le({pixelFormat:tt.U8_RGBA_NORM,width:1,height:1,depth:1,numLevels:1,dimension:He.n2D,usage:Ye.Sampled,pixelStore:{unpackFlipY:!1},immutable:!1},n)),s&&(this.textureCache[s]=o),p(r)){var u,c=this.canvasConfig.createImage;c?u=c(r):t.isBrowser&&(u=new window.Image),u&&(u.onload=function(){a.textureCache[s].setImageData(u),a.textureCache[s].emit(Xe.LOADED),a.renderingService.dirtify(),i&&i(a.textureCache[s])},u.onerror=function(){},u.crossOrigin="Anonymous",u.src=r)}else o.setImageData(r),o.emit(Xe.LOADED),this.renderingService.dirtify();return o},r.getOrCreateCanvas=function(){return this.offscreenCanvas.getOrCreateCanvas(this.canvasConfig.offscreenCanvas)},r.getOrCreateGradient=function(e){var t=this,r=e.gradients,n=e.instance.getGeometryBounds().halfExtents,i=2*n[0]||1,o=2*n[1]||1,a=this.offscreenCanvas.getOrCreateCanvas(this.canvasConfig.offscreenCanvas),s=this.offscreenCanvas.getOrCreateContext(this.canvasConfig.offscreenCanvas);a.width=i,a.height=o,r.forEach((function(e){var r=t.imagePool.getOrCreateGradient(le({type:e.type},e.value,{width:i,height:o}),s);s.fillStyle=r,s.fillRect(0,0,i,o)}))},r.getOrCreatePattern=function(e,t,r){var n,i=e.image,o=e.repetition,a=t.getGeometryBounds().halfExtents,s=2*a[0]||1,u=2*a[1]||1,c=this.offscreenCanvas.getOrCreateCanvas(this.canvasConfig.offscreenCanvas),l=this.offscreenCanvas.getOrCreateContext(this.canvasConfig.offscreenCanvas);c.width=s,c.height=u;var f=(n=p(i)?this.imagePool.getImageSync(i,r):i)&&l.createPattern(n,o);l.fillStyle=f,l.fillRect(0,0,s,u)},r.destroy=function(){for(var e in this.textureCache)this.textureCache[e].destroy();this.textureCache={}},e}();Yn=u([t.singleton(),c(0,t.inject(A)),c(1,t.inject(t.OffscreenCanvasCreator)),c(2,t.inject(t.RenderingService)),c(3,t.inject(t.CanvasConfig))],Yn);var jn=t.Syringe.defineToken(""),Kn=t.Syringe.defineToken(""),zn=t.Syringe.defineToken(""),qn=1,Zn=function(){function e(e,t,r){this.renderHelper=void 0,this.rendererFactory=void 0,this.meshFactory=void 0,this.device=void 0,this.renderingService=void 0,this.meshes=[],this.pendingUpdatePatches={},this.stencilRefCache={},this.renderHelper=e,this.rendererFactory=t,this.meshFactory=r}var t=e.prototype;return t.render=function(e,t){var r=this;void 0===t&&(t=!1),t||this.updatePendingPatches(),this.meshes.forEach((function(n){n.init(r.device,r.renderingService);var i=n.objects;n.clipPathTarget&&(i=[n.clipPath]);var o=r.renderHelper.renderInstManager.newRenderInst();o.setAllowSkippingIfPipelineNotReady(!1),n.applyRenderInst(o,i),r.renderHelper.renderInstManager.submitRenderInst(o,e),t||n.objects.forEach((function(e){e.renderable.dirty=!1}))}))},t.attach=function(e,t){this.device=e,this.renderingService=t},t.add=function(e){var t=this,r=e.renderable3D;if(r&&!r.meshes.length){var n=this.rendererFactory(e.nodeName);n&&n.meshes.forEach((function(i,o){if(r.meshes[o]=void 0,n.shouldSubmitRenderInst(e,o)){var a=t.meshes.find((function(t){return i===t.constructor&&t.index===o&&t.shouldMerge(e,o)}));a||((a=t.meshFactory(i)).renderer=n,a.index=o,t.meshes.push(a)),a&&(a.objects.push(e),r.meshes[o]=a,a.geometryDirty=!0)}}))}},t.remove=function(e){var t=this,r=e.renderable3D;r&&(r.meshes.forEach((function(r){if(r){var n=r.objects.indexOf(e);n>-1&&(r.objects.splice(n,1),r.geometryDirty=!0),0===r.objects.length&&t.meshes.splice(t.meshes.indexOf(r),1)}})),r.meshes=[])},t.updateAttribute=function(e,t,r,n){var i=this;void 0===n&&(n=!1);var o=e.renderable3D,a=this.rendererFactory(e.nodeName);a&&a.meshes.forEach((function(s,u){var c=a.shouldSubmitRenderInst(e,u),l=o.meshes.find((function(e){return e&&e.index===u&&e.constructor===s}));if(c!==!!l&&(l&&(l.objects.splice(l.objects.indexOf(e),1),l.geometryDirty=!0,0===l.objects.length&&i.meshes.splice(i.meshes.indexOf(l),1),o.meshes[o.meshes.indexOf(l)]=void 0),c&&((l=i.meshes.find((function(t){return s===t.constructor&&t.index===u&&t.shouldMerge(e,u)})))||((l=i.meshFactory(s)).renderer=a,l.index=u,l.init(i.device,i.renderingService),i.meshes.push(l)),l&&(l.objects.push(e),o.meshes[u]=l))),c&&l&&l.inited&&!l.geometryDirty){var f=l.objects.indexOf(e);if(n)e.parsedStyle[t]=r,l.updateAttribute([e],f,t,r);else{var h=l.id+t;i.pendingUpdatePatches[h]||(i.pendingUpdatePatches[h]={instance:l,objectIndices:[],name:t,value:r}),-1===i.pendingUpdatePatches[h].objectIndices.indexOf(f)&&i.pendingUpdatePatches[h].objectIndices.push(f)}}}))},t.changeRenderOrder=function(e,t){var r=e.renderable3D;r&&r.meshes.length&&r.meshes.forEach((function(r){r&&r.inited&&!r.geometryDirty&&(r.renderer.shouldSubmitRenderInst(e,r.index)&&r.inited&&r.changeRenderOrder(e,t))}))},t.getStencilRef=function(e){return this.stencilRefCache[e.entity]||(this.stencilRefCache[e.entity]=qn++),this.stencilRefCache[e.entity]},t.updatePendingPatches=function(){var e=this;Object.keys(this.pendingUpdatePatches).forEach((function(t){var r=e.pendingUpdatePatches[t],n=r.instance,i=r.objectIndices,o=r.name,a=r.value;i.sort((function(e,t){return e-t}));var s=[];i.forEach((function(e){var t=s[s.length-1];t&&e===t[t.length-1]+1?t.push(e):s.push([e])})),s.forEach((function(e){n.updateAttribute(n.objects.slice(e[0],e[0]+e.length),e[0],o,a)}))})),this.pendingUpdatePatches={}},e}();Zn=u([t.singleton(),c(0,t.inject(Ln)),c(1,t.inject(jn)),c(2,t.inject(zn))],Zn);var Qn=.005,Jn=1,$n=function(){function e(){this.renderHelper=void 0,this.texturePool=void 0,this.camera=void 0,this.lightPool=void 0,this.batchManager=void 0,this.device=void 0,this.renderingService=void 0,this.id=Jn++,this.meshes=[],this.clipPathMeshCreated=!1}var t=e.prototype;return t.shouldSubmitRenderInst=function(e,t){return!0},t.beforeUploadUBO=function(e,t,r){},t.beforeInitMesh=function(e){},t.afterInitMesh=function(e){},e}();function ei(e){var t={};return Object.keys(e).forEach((function(r){"number"==typeof e[r]&&(t[r]=e[r])})),t}function ti(e,t){var r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every((function(r){return e[r]===t[r]}))}u([t.inject(Ln)],$n.prototype,"renderHelper",void 0),u([t.inject(Yn)],$n.prototype,"texturePool",void 0),u([t.inject(t.DefaultCamera)],$n.prototype,"camera",void 0),u([t.inject(ge)],$n.prototype,"lightPool",void 0),u([t.inject(Zn)],$n.prototype,"batchManager",void 0),$n=u([t.injectable()],$n);var ri,ni,ii=function(e){return Object.fromEntries(Object.entries(e).filter((function(e){return void 0!==e[1]})))},oi=1,ai="FillTextureMapping";!function(e){e[e.MODEL_MATRIX=0]="MODEL_MATRIX",e[e.FILL_STROKE=1]="FILL_STROKE",e[e.PACKED_STYLE=2]="PACKED_STYLE",e[e.PICKING_COLOR=3]="PICKING_COLOR",e[e.POSITION=4]="POSITION",e[e.NORMAL=5]="NORMAL",e[e.UV=6]="UV",e[e.BARYCENTRIC=7]="BARYCENTRIC",e[e.MAX=8]="MAX"}(ri||(ri={})),function(e){e[e.MODEL_MATRIX0=0]="MODEL_MATRIX0",e[e.MODEL_MATRIX1=1]="MODEL_MATRIX1",e[e.MODEL_MATRIX2=2]="MODEL_MATRIX2",e[e.MODEL_MATRIX3=3]="MODEL_MATRIX3",e[e.COLOR=4]="COLOR",e[e.STROKE_COLOR=5]="STROKE_COLOR",e[e.PACKED_STYLE1=6]="PACKED_STYLE1",e[e.PACKED_STYLE2=7]="PACKED_STYLE2",e[e.PICKING_COLOR=8]="PICKING_COLOR",e[e.POSITION=9]="POSITION",e[e.NORMAL=10]="NORMAL",e[e.UV=11]="UV",e[e.BARYCENTRIC=12]="BARYCENTRIC",e[e.MAX=13]="MAX"}(ni||(ni={}));var si=function(){function e(){this.id=oi++,this.renderer=void 0,this.index=-1,this.renderHelper=void 0,this.texturePool=void 0,this.camera=void 0,this.lightPool=void 0,this.device=void 0,this.renderingService=void 0,this.objects=[],this.material=void 0,this.geometry=void 0,this.clipPath=void 0,this.clipPathTarget=void 0,this.inputState=void 0,this.program=new jr,this.programDescriptorSimpleWithOrig=void 0,this.geometryDirty=!0,this.materialDirty=!0,this.inputStateDirty=!0,this.textureMappings=[],this.samplerEntries=void 0,this.inited=!1}var r=e.prototype;return r.init=function(e,t){this.inited||(this.renderer.beforeInitMesh(this),this.device=e,this.renderingService=t,this.material=new Yr(this.device),this.material.defines=le({},ei(ni),this.material.defines),this.geometry=new Ur(this.device),this.geometry.meshes=this.objects,this.material.meshes=this.objects,this.observeGeometryChanged(),this.observeMaterialChanged(),this.inited=!0,this.renderer.afterInitMesh(this))},r.observeGeometryChanged=function(){var e=this;this.geometry.on(Br.CHANGED,(function(){e.geometry.meshes.forEach((function(e){e.renderable.dirty=!0})),e.renderingService.dirtify()}))},r.observeMaterialChanged=function(){var e=this;this.material.on(Fr.CHANGED,(function(){e.material.meshes.forEach((function(e){e.renderable.dirty=!0})),e.renderingService.dirtify()}))},r.shouldMergeColor=function(e,r,n){var i=e.parsedStyle[n],o=r.parsedStyle[n];return i instanceof t.CSSRGB&&o instanceof t.CSSRGB||(!(!t.isPattern(i)||!t.isPattern(o)||i.image!==o.image)||!(!Array.isArray(i)||!Array.isArray(o)||e.style[n]!==r.style[n]))},r.shouldMerge=function(e,t){return!this.instance||(this.instance.nodeName===e.nodeName||this.instance.nodeName===e.renderable.proxyNodeName||this.instance.renderable.proxyNodeName===e.nodeName||this.instance.renderable.proxyNodeName===e.renderable.proxyNodeName)&&(!e.parsedStyle.clipPath&&!(!this.shouldMergeColor(this.instance,e,"fill")||!this.shouldMergeColor(this.instance,e,"stroke")))},r.createGeometry=function(e){var r=this,n=Te(),i=Te(),o=[],a=[],s=[],u=[];e.forEach((function(e){var c,l=e.parsedStyle,f=l.fill,h=l.stroke,d=l.opacity,p=l.fillOpacity,_=l.strokeOpacity,E=l.lineWidth,v=l.anchor,g=l.visibility,m=l.increasedLineWidthForHitTesting,R=[0,0,0,0];f instanceof t.CSSRGB&&(R=[Number(f.r)/255,Number(f.g)/255,Number(f.b)/255,Number(f.alpha)]);var y=[0,0,0,0];h instanceof t.CSSRGB&&(y=[Number(h.r)/255,Number(h.g)/255,Number(h.b)/255,Number(h.alpha)]),r.clipPathTarget?(Ae(n,e.getLocalTransform()),R=[1,1,1,1],Oe(n,r.clipPathTarget.getWorldTransform(),n)):Ae(n,e.getWorldTransform()),Oe(i,r.camera.getViewTransform(),n);var T=e.isInteractive()&&(null===(c=e.renderable3D)||void 0===c?void 0:c.encodedPickingColor)||[0,0,0];o.push.apply(o,n),a.push.apply(a,R.concat(y)),s.push(d,p,_,E,"visible"===g?1:0,v[0],v[1],m||0),u.push.apply(u,T.concat([e.sortable.renderOrder*Qn]))})),this.geometry.instancedCount=e.length,this.geometry.setVertexBuffer({bufferIndex:ri.MODEL_MATRIX,byteStride:64,frequency:We.PerInstance,attributes:[{format:tt.F32_RGBA,bufferByteOffset:0,location:ni.MODEL_MATRIX0,divisor:1},{format:tt.F32_RGBA,bufferByteOffset:16,location:ni.MODEL_MATRIX1,divisor:1},{format:tt.F32_RGBA,bufferByteOffset:32,location:ni.MODEL_MATRIX2,divisor:1},{format:tt.F32_RGBA,bufferByteOffset:48,location:ni.MODEL_MATRIX3,divisor:1}],data:new Float32Array(o)}),this.geometry.setVertexBuffer({bufferIndex:ri.FILL_STROKE,byteStride:32,frequency:We.PerInstance,attributes:[{format:tt.F32_RGBA,bufferByteOffset:0,location:ni.COLOR,divisor:1},{format:tt.F32_RGBA,bufferByteOffset:16,location:ni.STROKE_COLOR,divisor:1}],data:new Float32Array(a)}),this.geometry.setVertexBuffer({bufferIndex:ri.PACKED_STYLE,byteStride:32,frequency:We.PerInstance,attributes:[{format:tt.F32_RGBA,bufferByteOffset:0,location:ni.PACKED_STYLE1,divisor:1},{format:tt.F32_RGBA,bufferByteOffset:16,location:ni.PACKED_STYLE2,divisor:1}],data:new Float32Array(s)}),this.geometry.setVertexBuffer({bufferIndex:ri.PICKING_COLOR,byteStride:16,frequency:We.PerInstance,attributes:[{format:tt.F32_RGBA,bufferByteOffset:0,location:ni.PICKING_COLOR,divisor:1}],data:new Float32Array(u)})},r.destroy=function(){this.geometry&&this.geometry.destroy(),this.inputState&&this.inputState.destroy()},r.applyRenderInst=function(e,t){var r=this,n=this.lightPool.getAllLights(),i=!!this.lightPool.getFog(),o=!!n.length,a=le({},this.material.defines);if(this.material.defines.USE_FOG=i,this.material.defines.USE_LIGHT=o,this.material.defines=le({},this.material.defines,this.lightPool.getDefines()),this.clipPathTarget||this.clipPath?this.clipPathTarget?(this.material.stencilWrite=!0,this.material.depthWrite=!1,this.material.stencilCompare=Me.Always,this.material.stencilPassOp=Ke.Replace):(this.material.stencilWrite=!1,this.material.depthWrite=!0,this.material.stencilCompare=Me.Equal,this.material.stencilPassOp=Ke.Keep):this.material.stencilWrite=!1,(this.materialDirty||this.material.programDirty)&&this.createMaterial(t),this.material.textureDirty){this.textureMappings=[];var s=this.createFillGradientTextureMapping(t);s&&this.textureMappings.push(s),Object.keys(this.material.textures).sort((function(e,t){return r.material.samplers.indexOf(e)-r.material.samplers.indexOf(t)})).forEach((function(e){var t=new Xn;t.name=e,t.texture=r.material.textures[e],r.device.setResourceName(t.texture,"Material Texture "+e),t.sampler=r.renderHelper.getCache().createSampler({wrapS:Fe.Clamp,wrapT:Fe.Clamp,minFilter:Ue.Point,magFilter:Ue.Bilinear,mipFilter:we.Linear,minLOD:0,maxLOD:0}),r.textureMappings.push(t)})),this.textureMappings.length?(this.material.defines.USE_UV=!0,this.material.defines.USE_MAP=!0):(this.material.defines.USE_UV=!1,this.material.defines.USE_MAP=!1),this.material.textureDirty=!1}(ti(a,this.material.defines)||this.material.programDirty||this.materialDirty)&&(this.material.defines=le({},this.material.defines,ei(ni)),Object.keys(this.material.defines).forEach((function(e){var t=r.material.defines[e];"number"==typeof t?r.program.setDefineString(e,""+t):r.program.setDefineBool(e,t)})),this.program.vert=this.material.vertexShader,this.program.frag=this.material.fragmentShader,this.programDescriptorSimpleWithOrig=Xr(this.device,this.program),this.material.programDirty=!1,this.materialDirty=!1),this.material.geometryDirty&&(this.geometryDirty=!0,this.inputStateDirty=!0,this.material.geometryDirty=!1),(this.geometryDirty||this.geometry.dirty)&&(this.geometry&&this.geometry.destroy(),this.createGeometry(t),this.material.wireframe&&this.generateWireframe(this.geometry),this.geometryDirty=!1,this.geometry.dirty=!1,this.inputStateDirty=!0);var u=this.renderHelper.getCache().createInputLayout(this.geometry.inputLayoutDescriptor),c=this.renderHelper.getCache().createProgramSimple(this.programDescriptorSimpleWithOrig),l=!!this.geometry.indexBuffer;this.inputStateDirty&&(this.inputState&&this.inputState.destroy(),this.inputState=this.device.createInputState(u,this.geometry.vertexBuffers.map((function(e){return{buffer:e,byteOffset:0}})),l?{buffer:this.geometry.indexBuffer,byteOffset:0}:null,c),this.inputStateDirty=!1),e.renderPipelineDescriptor.topology=this.geometry.drawMode,e.setProgram(c),e.setInputLayoutAndState(u,this.inputState),this.renderer.beforeUploadUBO(e,this,this.index),this.uploadUBO(e),l?e.drawIndexesInstanced(this.geometry.vertexCount,this.geometry.instancedCount,this.geometry.indexStart):e.drawPrimitives(this.geometry.vertexCount,this.geometry.primitiveStart),e.sortKey=Rn(pn.OPAQUE,t[0].sortable.renderOrder)},r.updateBatchedAttribute=function(e,r,n,i){if("fill"===n||"stroke"===n){var o=[];e.forEach((function(e){var r=e.parsedStyle,n=r.fill,i=r.stroke,a=[0,0,0,0];n instanceof t.CSSRGB&&(a=[Number(n.r)/255,Number(n.g)/255,Number(n.b)/255,Number(n.alpha)]);var s=[0,0,0,0];i instanceof t.CSSRGB&&(s=[Number(i.r)/255,Number(i.g)/255,Number(i.b)/255,Number(i.alpha)]),o.push.apply(o,a.concat(s))})),this.geometry.updateVertexBuffer(ri.FILL_STROKE,ni.COLOR,r,new Uint8Array(new Float32Array(o).buffer));var a=this.instance.parsedStyle.fill,s=this.textureMappings.findIndex((function(e){return e.name===ai}));if(a instanceof t.CSSRGB)0>s||(this.textureMappings.splice(s,-1),this.material.textureDirty=!0);else{var u=this.createFillGradientTextureMapping([this.instance]);0>s||this.textureMappings.splice(s,1,u),this.material.textureDirty=!0}}else if(["opacity","fillOpacity","strokeOpacity","lineWidth","visibility","anchor","increasedLineWidthForHitTesting"].indexOf(n)>-1){var c=[];e.forEach((function(e){var t=e.parsedStyle,r=t.anchor;c.push(t.opacity,t.fillOpacity,t.strokeOpacity,t.lineWidth,"visible"===t.visibility?1:0,r[0],r[1],t.increasedLineWidthForHitTesting||0)})),this.geometry.updateVertexBuffer(ri.PACKED_STYLE,ni.PACKED_STYLE1,r,new Uint8Array(new Float32Array(c).buffer))}else if("modelMatrix"===n){var l=[];e.forEach((function(e){var t=Ae(Te(),e.getWorldTransform());l.push.apply(l,t)})),this.geometry.updateVertexBuffer(ri.MODEL_MATRIX,ni.MODEL_MATRIX0,r,new Uint8Array(new Float32Array(l).buffer))}else if("pointerEvents"===n){var f=[];e.forEach((function(e){var t,r=i&&e.isInteractive()&&(null===(t=e.renderable3D)||void 0===t?void 0:t.encodedPickingColor)||[0,0,0];f.push.apply(f,r.concat([e.sortable.renderOrder*Qn]))})),this.geometry.updateVertexBuffer(ri.PICKING_COLOR,ni.PICKING_COLOR,r,new Uint8Array(new Float32Array(f).buffer))}},r.updateAttribute=function(e,t,r,n){"clipPath"===r&&this.clipPath&&(this.geometryDirty=!0)},r.changeRenderOrder=function(e,t){var r,n=this.objects.indexOf(e),i=e.isInteractive()&&(null===(r=e.renderable3D)||void 0===r?void 0:r.encodedPickingColor)||[0,0,0];this.geometry.updateVertexBuffer(ri.PICKING_COLOR,ni.PICKING_COLOR,n,new Uint8Array(new Float32Array([].concat(i,[t*Qn])).buffer))},r.generateWireframe=function(e){for(var t=e.indices,r=e.indices.length,n=e.vertices.map((function(e){return e.slice()})),i=ri.PICKING_COLOR;e.vertexBuffers.length>i;i++){e.vertices[i]=new Float32Array(e.inputLayoutDescriptor.vertexBufferDescriptors[i].byteStride/4*r)}for(var o=0,a=new Uint32Array(r),s=0;r>s;s++){for(var u=t[s],c=1;e.vertices.length>c;c++)for(var l=e.inputLayoutDescriptor.vertexBufferDescriptors[c].byteStride/4,f=0;l>f;f++)e.vertices[c][o*l+f]=n[c][u*l+f];a[s]=o,o++}for(var h=function(t){var r=e.inputLayoutDescriptor.vertexBufferDescriptors[t],n=r.frequency,i=r.byteStride,o=e.inputLayoutDescriptor.vertexAttributeDescriptors.find((function(e){return e.bufferIndex===t}));o&&e.setVertexBuffer({bufferIndex:o.bufferIndex,byteStride:i,frequency:n,attributes:[{format:o.format,bufferByteOffset:o.bufferByteOffset,location:o.location,divisor:o.divisor}],data:e.vertices[t]})},d=ri.PICKING_COLOR+1;e.vertexBuffers.length>d;d++)h(d);for(var p=new Float32Array(3*r),_=0;r>_;)for(var E=0;3>E;E++){p[3*a[_++]+E]=1}e.setVertexBuffer({bufferIndex:ri.BARYCENTRIC,byteStride:12,frequency:We.PerVertex,attributes:[{format:tt.F32_RGB,bufferByteOffset:0,location:Number(ni.BARYCENTRIC)}],data:p}),e.setIndexBuffer(a)},r.beforeUploadUBO=function(e,t,r){},r.uploadUBO=function(e){var r=this,n=this.material,i=this.lightPool.getAllLights(),o=this.lightPool.getFog(),a=!!o,s=!!i.length,u=[];if(n.defines.USE_WIREFRAME){var c=t.parseColor(n.wireframeColor);u.push({name:"u_WireframeLineColor",value:[Number(c.r)/255,Number(c.g)/255,Number(c.b)/255]}),u.push({name:"u_WireframeLineWidth",value:n.wireframeLineWidth})}if(a&&this.uploadFog(u,o),this.uploadMaterial(u,n),s){var l={};i.forEach((function(e){l[e.define]||(l[e.define]=-1),l[e.define]++,e.uploadUBO(u,l[e.define])}))}u.sort((function(e,t){return r.material.uniformNames.indexOf(e.name)-r.material.uniformNames.indexOf(t.name)})),e.setUniforms(1,u);var f=n.blendEquation,h=n.blendEquationAlpha,d=n.blendSrc,p=n.blendDst,_=n.blendSrcAlpha,E=n.blendDstAlpha,v=ii({blendConstant:n.blendConstant,depthCompare:n.depthCompare,depthWrite:n.depthWrite,stencilCompare:n.stencilCompare,stencilWrite:n.stencilWrite,stencilPassOp:n.stencilPassOp,stencilRef:n.stencilRef,cullMode:n.cullMode,frontFace:n.frontFace,polygonOffset:n.polygonOffset}),g=e.getMegaStateFlags().attachmentsState[0];e.setMegaStateFlags(le({attachmentsState:[{channelWriteMask:this.material.stencilWrite?je.None:je.AllChannels,rgbBlendState:le({},g.rgbBlendState,ii({blendMode:f,blendSrcFactor:d,blendDstFactor:p})),alphaBlendState:le({},g.alphaBlendState,ii({blendMode:h,blendSrcFactor:_,blendDstFactor:E}))}]},v)),e.setBindingLayouts([{numUniformBuffers:1,numSamplers:this.textureMappings.length,samplerEntries:this.samplerEntries}]),e.setSamplerBindingsFromTextureMappings(this.textureMappings)},r.uploadFog=function(e,r){var n=r.parsedStyle,i=n.type,o=n.fill,a=n.start,s=n.end,u=n.density;if(o instanceof t.CSSRGB){var c=[Number(o.r)/255,Number(o.g)/255,Number(o.b)/255,Number(o.alpha)];e.push({name:"u_FogInfos",value:[i,a,s,u]}),e.push({name:"u_FogColor",value:c})}},r.uploadMaterial=function(e,t){var r=Object.keys(t.uniforms).map((function(e){return{name:e,value:t.uniforms[e]}}));e.push.apply(e,r)},r.createFillGradientTextureMapping=function(e){var r,n=this,i=e[0],o=i.nodeName===t.Shape.LINE?i.parsedStyle.stroke:i.parsedStyle.fill;if(o&&(t.isPattern(o)||Array.isArray(o))){Array.isArray(o)?(this.program.setDefineBool("USE_PATTERN",!1),this.texturePool.getOrCreateGradient({gradients:o,width:128,height:128,instance:i})):t.isPattern(o)&&(this.program.setDefineBool("USE_PATTERN",!0),this.texturePool.getOrCreatePattern(o,i,(function(){e.forEach((function(e){e.renderable.dirty=!0})),n.material.textureDirty=!0}))),r=this.texturePool.getOrCreateCanvas();var a=this.texturePool.getOrCreateTexture(this.device,r,nt(tt.U8_RGBA_NORM,1,1,1));if(a){var s=new Xn;return s.name=ai,s.texture=a,s.texture.on("loaded",(function(){e.forEach((function(e){e.renderable.dirty=!0})),n.material.textureDirty=!0})),this.device.setResourceName(s.texture,"Fill Texture"+this.id),s.sampler=this.renderHelper.getCache().createSampler({wrapS:Fe.Repeat,wrapT:Fe.Repeat,minFilter:Ue.Point,magFilter:Ue.Bilinear,mipFilter:we.Linear,minLOD:0,maxLOD:0}),s}}return null},ce(e,[{key:"instance",get:function(){return this.objects[0]}}]),e}();u([t.inject(Ln)],si.prototype,"renderHelper",void 0),u([t.inject(Yn)],si.prototype,"texturePool",void 0),u([t.inject(t.DefaultCamera)],si.prototype,"camera",void 0),u([t.inject(ge)],si.prototype,"lightPool",void 0),si=u([t.injectable()],si);var ui,ci;!function(e){e[e.PACKED_STYLE=5]="PACKED_STYLE"}(ui||(ui={})),function(e){e[e.PACKED_STYLE3=13]="PACKED_STYLE3",e[e.SIZE=14]="SIZE"}(ci||(ci={}));var li=[t.Shape.CIRCLE,t.Shape.ELLIPSE],fi=function(e){function r(){return e.apply(this,arguments)||this}fe(r,e);var n=r.prototype;return n.shouldMerge=function(t,r){var n=e.prototype.shouldMerge.call(this,t,r);return!!n&&(!this.needDrawStrokeSeparately(t.parsedStyle)&&!this.needDrawStrokeSeparately(this.instance.parsedStyle)&&this.instance.parsedStyle.fill.isNone===t.parsedStyle.fill.isNone)},n.createMaterial=function(e){this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec2 a_Extrude;\nlayout(location = PACKED_STYLE3) in vec4 a_StylePacked3;\nlayout(location = SIZE) in vec2 a_Size;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nout vec4 v_Data;\nout vec2 v_Radius;\nout vec4 v_StylePacked3;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n float strokeWidth;\n if (u_IsPicking > 0.5) {\n strokeWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n strokeWidth = u_StrokeWidth;\n }\n\n float antialiasblur = 1.0 / (a_Size.x + strokeWidth);\n\n bool omitStroke = a_StylePacked3.z == 1.0;\n vec2 radius = a_Size + vec2(omitStroke ? 0.0 : strokeWidth / 2.0);\n vec2 offset = (a_Extrude + vec2(1.0) - 2.0 * u_Anchor.xy) * radius;\n\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n \n v_Radius = radius;\n v_Data = vec4(a_Extrude, antialiasblur, a_StylePacked3.x);\n v_StylePacked3 = a_StylePacked3;\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nin vec4 v_Data;\nin vec2 v_Radius;\nin vec4 v_StylePacked3;\n\nout vec4 outputColor;\n\n/**\n * 2D signed distance field functions\n * @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\n */\n\nfloat sdCircle(vec2 p, float r) {\n return length(p) - r;\n}\n\n// @see http://www.iquilezles.org/www/articles/ellipsoids/ellipsoids.htm\nfloat sdEllipsoidApproximated(vec2 p, vec2 r) {\n float k0 = length(p / r);\n float k1 = length(p / (r * r));\n return k0 * (k0 - 1.0) / k1;\n}\n\nvoid main() {\n int shape = int(floor(v_Data.w + 0.5));\n float epsilon = 0.000001;\n\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n bool omitStroke = v_StylePacked3.z == 1.0;\n\n float antialiasblur = v_Data.z;\n float antialiased_blur = -max(0.0, antialiasblur);\n vec2 r = (v_Radius - (omitStroke ? 0.0 : u_StrokeWidth)) / v_Radius;\n\n float outer_df;\n float inner_df;\n // 'circle', 'ellipse', 'rect'\n if (shape == 0) {\n outer_df = sdCircle(v_Data.xy, 1.0);\n inner_df = sdCircle(v_Data.xy, r.x);\n } else if (shape == 1) {\n outer_df = sdEllipsoidApproximated(v_Data.xy, vec2(1.0));\n inner_df = sdEllipsoidApproximated(v_Data.xy, r);\n }\n\n float opacity_t = smoothstep(0.0, antialiased_blur, outer_df);\n\n float color_t = u_StrokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiased_blur,\n 0.0,\n inner_df\n );\n\n // vec2 imagecoord = mod(v_Uv, 0.1);\n // vec4 texel = texture(SAMPLER_2D(u_Map), imagecoord);\n // u_Color = texel;\n\n vec4 diffuseColor;\n vec4 strokeColor;\n if (u_IsPicking > 0.5) {\n diffuseColor = vec4(u_PickingColor, 1.0);\n strokeColor = vec4(u_PickingColor, 1.0);\n } else {\n diffuseColor = u_Color;\n strokeColor = (u_StrokeColor == vec4(0) || omitStroke) ? vec4(0.0) : u_StrokeColor;\n }\n\n outputColor = mix(vec4(diffuseColor.rgb, diffuseColor.a * u_FillOpacity), strokeColor * u_StrokeOpacity, color_t);\n outputColor.a = outputColor.a * u_Opacity * opacity_t;\n\n if (outputColor.a < epsilon)\n discard;\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n }\n}",this.material.defines=le({},this.material.defines,ei(ci))},n.createGeometry=function(t){var r=this;e.prototype.createGeometry.call(this,t);var n=[],i=[],o=[];t.forEach((function(e,t){var a=e,s=4*t,u=a.parsedStyle.radius,c=r.shouldOmitStroke(a.parsedStyle),l=r.getSize(e.parsedStyle,a.nodeName);i.push.apply(i,l.concat([li.indexOf(a.nodeName),u||0,c?1:0,0])),n.push(-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1),o.push(0+s,2+s,1+s,0+s,3+s,2+s)})),this.geometry.setIndexBuffer(new Uint32Array(o)),this.geometry.vertexCount=6,this.geometry.setVertexBuffer({bufferIndex:ri.POSITION,byteStride:16,frequency:We.PerVertex,attributes:[{format:tt.F32_RG,bufferByteOffset:0,location:ni.POSITION},{format:tt.F32_RG,bufferByteOffset:8,location:ni.UV}],data:new Float32Array(n)}),this.geometry.setVertexBuffer({bufferIndex:ui.PACKED_STYLE,byteStride:24,frequency:We.PerInstance,attributes:[{format:tt.F32_RG,bufferByteOffset:0,location:ci.SIZE,divisor:1},{format:tt.F32_RGBA,bufferByteOffset:8,location:ci.PACKED_STYLE3,divisor:1}],data:new Float32Array(i)})},n.updateAttribute=function(t,r,n,i){var o=this;if(e.prototype.updateAttribute.call(this,t,r,n,i),this.updateBatchedAttribute(t,r,n,i),"r"===n||"rx"===n||"ry"===n||"lineWidth"===n||"stroke"===n||"lineDash"===n||"strokeOpacity"===n){var a=[];t.forEach((function(e){var t=o.shouldOmitStroke(e.parsedStyle),r=o.getSize(e.parsedStyle,e.nodeName);a.push.apply(a,[r[0],r[1]].concat([li.indexOf(e.nodeName),e.parsedStyle.radius||0,t?1:0,0]))})),this.geometry.updateVertexBuffer(ui.PACKED_STYLE,ci.SIZE,r,new Uint8Array(new Float32Array(a).buffer))}},n.getSize=function(e,r){var n=[0,0];if(r===t.Shape.CIRCLE){var i=e.r;n=[i,i]}else if(r===t.Shape.ELLIPSE){n=[e.rx,e.ry]}return n},n.shouldOmitStroke=function(e){var t=e.lineDash,r=e.stroke,n=e.strokeOpacity,i=r&&!r.isNone,o=t&&t.length&&t.every((function(e){return 0!==e}));return!i||i&&(o||1>n)},n.needDrawStrokeSeparately=function(e){var t=e.stroke,r=e.lineDash,n=e.lineWidth,i=e.strokeOpacity,o=t&&!t.isNone,a=r&&r.length&&r.every((function(e){return 0!==e}));return o&&n>0&&(a||1>i)},r}(si);fi=u([t.injectable()],fi);var hi,di,pi=[0,-.5,0,0,0,1,-.5,1,1,0,1,.5,1,1,1,0,.5,0,0,1];!function(e){e[e.POINT=5]="POINT",e[e.CAP=6]="CAP",e[e.DASH=7]="DASH"}(hi||(hi={})),function(e){e[e.POSITION=9]="POSITION",e[e.UV=11]="UV",e[e.POINTA=10]="POINTA",e[e.POINTB=12]="POINTB",e[e.CAP=13]="CAP",e[e.DASH=14]="DASH"}(di||(di={}));var _i={butt:1,round:2,square:3},Ei=function(e){function r(){return e.apply(this,arguments)||this}fe(r,e);var n=r.prototype;return n.shouldMerge=function(t,r){var n=e.prototype.shouldMerge.call(this,t,r);return!!n},n.createMaterial=function(e){this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec3 a_Position;\nlayout(location = POINTA) in vec3 a_PointA;\nlayout(location = POINTB) in vec3 a_PointB;\nlayout(location = CAP) in float a_Cap;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\nlayout(location = DASH) in vec4 a_Dash;\n\nout vec4 v_Dash;\n// out vec2 v_Normal;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n float strokeWidth;\n if (u_IsPicking > 0.5) {\n strokeWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n strokeWidth = u_StrokeWidth;\n }\n\n float isBillboard = a_Dash.w;\n if (isBillboard < 0.5) {\n vec2 xBasis = a_PointB.xy - a_PointA.xy;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n\n vec2 point = a_PointA.xy + xBasis * a_Position.x + yBasis * strokeWidth * a_Position.y;\n point = point - u_Anchor.xy * abs(xBasis);\n\n // round & square\n if (a_Cap > 1.0) {\n point += sign(a_Position.x - 0.5) * normalize(xBasis) * vec2(strokeWidth / 2.0);\n }\n\n gl_Position = project(vec4(point, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n } else {\n // clip space\n vec4 clip0 = project(vec4(a_PointA, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n vec4 clip1 = project(vec4(a_PointB, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n // screen space\n vec2 screen0 = u_Viewport * (0.5 * clip0.xy / clip0.w + 0.5);\n vec2 screen1 = u_Viewport * (0.5 * clip1.xy / clip1.w + 0.5);\n vec2 xBasis = normalize(screen1 - screen0);\n vec2 yBasis = vec2(-xBasis.y, xBasis.x);\n vec2 pt0 = screen0 + strokeWidth * (a_Position.x * xBasis + a_Position.y * yBasis);\n vec2 pt1 = screen1 + strokeWidth * (a_Position.x * xBasis + a_Position.y * yBasis);\n vec2 pt = mix(pt0, pt1, a_Position.z);\n vec4 clip = mix(clip0, clip1, a_Position.z);\n gl_Position = vec4(clip.w * (2.0 * pt / u_Viewport - 1.0), clip.z, clip.w);\n }\n\n v_Dash = vec4(a_Position.x, a_Dash.xyz);\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nin vec4 v_Dash;\n// in vec2 v_Normal;\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_StrokeColor;\n #ifdef USE_MAP\n outputColor = u_Color;\n #endif\n\n // float blur = 1. - smoothstep(0.98, 1., length(v_Normal));\n float u_dash_offset = v_Dash.y;\n float u_dash_array = v_Dash.z;\n float u_dash_ratio = v_Dash.w;\n outputColor.a = outputColor.a\n // * blur\n * u_Opacity * u_StrokeOpacity\n * ceil(mod(v_Dash.x + u_dash_offset, u_dash_array) - (u_dash_array * u_dash_ratio));\n }\n}",this.material.defines=le({},this.material.defines,ei(di))},n.createGeometry=function(r){var n=this;e.prototype.createGeometry.call(this,r);var i=[],o=[],a=[],s=[],u=0;r.forEach((function(e){var r,c;if(e.nodeName===t.Shape.LINE)r=e.parsedStyle,c=e.getTotalLength();else if(e.nodeName===t.Shape.POLYLINE){var l=e.parsedStyle,f=l.points.points;r={x1:f[0][0],y1:f[0][1],x2:f[f.length-1][0],y2:f[f.length-1][1],z1:0,z2:0,defX:l.defX,defY:l.defY,lineCap:l.lineCap,isBillboard:!0,markerStart:l.markerStart,markerEnd:l.markerEnd,markerStartOffset:l.markerStartOffset,markerEndOffset:l.markerEndOffset},c=e.getTotalLength()}else if(e.nodeName===t.Shape.PATH){var h=e.parsedStyle,d=h.path.curve;r={x1:d[0][1],y1:d[0][2],x2:d[1][5],y2:d[1][6],z1:0,z2:0,defX:h.defX,defY:h.defY,lineCap:h.lineCap,isBillboard:!1,markerStart:h.markerStart,markerEnd:h.markerEnd,markerStartOffset:h.markerStartOffset,markerEndOffset:h.markerEndOffset},c=e.getTotalLength()}var p=r.x1,_=r.y1,E=r.x2,v=r.y2,g=r.z1,m=r.z2,R=r.defX,y=r.defY,T=r.lineCap,A=r.isBillboard,S=n.calcOffset(r),C=S.startOffsetX,O=S.startOffsetY,I=S.endOffsetX,N=S.endOffsetY,x=n.calcDash(r,c),P=x.dashOffset,M=x.dashSegmentPercent,D=x.dashRatioInEachSegment;o.push(_i[T]),a.push(P,M,D,A?1:0),i.push(p-R+C,_-y+O,g,E-R+I,v-y+N,m),s.push(0+u,2+u,1+u,0+u,3+u,2+u),u+=4})),this.geometry.setIndexBuffer(new Uint32Array(s)),this.geometry.vertexCount=6,this.geometry.setVertexBuffer({bufferIndex:ri.POSITION,byteStride:20,frequency:We.PerInstance,attributes:[{format:tt.F32_RGB,bufferByteOffset:0,location:di.POSITION,divisor:0},{format:tt.F32_RG,bufferByteOffset:12,location:di.UV,divisor:0}],data:new Float32Array(pi)}),this.geometry.setVertexBuffer({bufferIndex:hi.POINT,byteStride:24,frequency:We.PerInstance,attributes:[{format:tt.F32_RGB,bufferByteOffset:0,location:di.POINTA,divisor:1},{format:tt.F32_RGB,bufferByteOffset:12,location:di.POINTB,divisor:1}],data:new Float32Array(i)}),this.geometry.setVertexBuffer({bufferIndex:hi.CAP,byteStride:4,frequency:We.PerInstance,attributes:[{format:tt.F32_R,bufferByteOffset:0,location:di.CAP,divisor:1}],data:new Float32Array(o)}),this.geometry.setVertexBuffer({bufferIndex:hi.DASH,byteStride:16,frequency:We.PerInstance,attributes:[{format:tt.F32_RGBA,bufferByteOffset:0,location:di.DASH,divisor:1}],data:new Float32Array(a)})},n.updateAttribute=function(r,n,i,o){var a=this;if(e.prototype.updateAttribute.call(this,r,n,i,o),this.updateBatchedAttribute(r,n,i,o),"x1"===i||"y1"===i||"x2"===i||"y2"===i||"z1"===i||"z2"===i||"markerStartOffset"===i||"markerEndOffset"===i||"markerStart"===i||"markerEnd"===i||"points"===i||"path"===i){var s=[];r.forEach((function(e){var r;if(e.nodeName===t.Shape.LINE)r=e.parsedStyle;else if(e.nodeName===t.Shape.POLYLINE&&e.renderable.proxyNodeName===t.Shape.LINE){var n=e.parsedStyle,i=n.points.points;r={x1:i[0][0],y1:i[0][1],x2:i[i.length-1][0],y2:i[i.length-1][1],z1:0,z2:0,defX:n.defX,defY:n.defY,lineCap:n.lineCap,isBillboard:!0,markerStart:n.markerStart,markerEnd:n.markerEnd,markerStartOffset:n.markerStartOffset,markerEndOffset:n.markerEndOffset}}else if(e.nodeName===t.Shape.PATH&&e.renderable.proxyNodeName===t.Shape.LINE){var o=e.parsedStyle,u=o.path.curve;r={x1:u[0][1],y1:u[0][2],x2:u[1][5],y2:u[1][6],z1:0,z2:0,defX:o.defX,defY:o.defY,lineCap:o.lineCap,isBillboard:!0,markerStart:o.markerStart,markerEnd:o.markerEnd,markerStartOffset:o.markerStartOffset,markerEndOffset:o.markerEndOffset}}var c=r.x1,l=r.y1,f=r.x2,h=r.y2,d=r.z1,p=r.z2,_=r.defX,E=r.defY,v=a.calcOffset(r);s.push(c-_+v.startOffsetX,l-E+v.startOffsetY,d,f-_+v.endOffsetX,h-E+v.endOffsetY,p)})),this.geometry.updateVertexBuffer(hi.POINT,di.POINTA,n,new Uint8Array(new Float32Array(s).buffer))}else if("lineDashOffset"===i||"lineDash"===i){var u=[];r.forEach((function(e){var t=e.getTotalLength(),r=a.calcDash(e.parsedStyle,t);u.push(r.dashOffset,r.dashSegmentPercent,r.dashRatioInEachSegment,e.parsedStyle.isBillboard?1:0)})),this.geometry.updateVertexBuffer(hi.DASH,di.DASH,n,new Uint8Array(new Float32Array(u).buffer))}else if("lineCap"===i){var c=[];r.forEach((function(e){c.push(_i[e.parsedStyle.lineCap])})),this.geometry.updateVertexBuffer(hi.CAP,di.CAP,n,new Uint8Array(new Float32Array(c).buffer))}},n.calcOffset=function(e){var r,n,i=e.x1,o=e.y1,a=e.x2,s=e.y2,u=e.markerStart,c=e.markerEnd,l=e.markerStartOffset,f=e.markerEndOffset,h=0,d=0,p=0,_=0,E=0;return u&&u instanceof t.DisplayObject&&l&&(r=a-i,n=s-o,E=Math.atan2(n,r),h=Math.cos(E)*(l||0),d=Math.sin(E)*(l||0)),c&&c instanceof t.DisplayObject&&f&&(r=i-a,n=o-s,E=Math.atan2(n,r),p=Math.cos(E)*(f||0),_=Math.sin(E)*(f||0)),{startOffsetX:h,startOffsetY:d,endOffsetX:p,endOffsetY:_}},n.calcDash=function(e,t){var r=e.lineDash,n=0,i=1,o=0;if(r&&r.length){n=(e.lineDashOffset||0)/t;var a=r.reduce((function(e,t){return e+t}),0);0===a?(i=1,o=0):(i=a/t,o=r[1]/a)}return{dashOffset:n,dashSegmentPercent:i,dashRatioInEachSegment:o}},r}(si);function vi(e,t,r,n){var i=e-r,o=t-n;return Math.sqrt(i*i+o*o)}Ei=u([t.injectable()],Ei);var gi=function(e,t,r,n,i){return{x:(1-i)*e+i*r,y:(1-i)*t+i*n}};function mi(e,t,r,n,i){var o=1-i;return o*o*o*e+3*t*i*o*o+3*r*i*i*o+n*i*i*i}function Ri(e,t,r,n,i,o,a,s,u){var c=mi(e,r,i,a,u),l=mi(t,n,o,s,u),f=gi(e,t,r,n,u),h=gi(r,n,i,o,u),d=gi(i,o,a,s,u),p=gi(f.x,f.y,h.x,h.y,u),_=gi(h.x,h.y,d.x,d.y,u);return[[e,t,f.x,f.y,p.x,p.y,c,l],[c,l,_.x,_.y,d.x,d.y,a,s]]}function yi(e,t,r,n,i,o,a,s,u){if(0===u)return function(e,t){for(var r=0,n=e.length,i=0;n>i;i++)r+=vi(e[i],t[i],e[(i+1)%n],t[(i+1)%n]);return r/2}([e,r,i,a],[t,n,o,s]);var c=Ri(e,t,r,n,i,o,a,s,.5),l=[].concat(c[0],[u-1]),f=[].concat(c[1],[u-1]);return yi.apply(void 0,l)+yi.apply(void 0,f)}var Ti,Ai=function(e,t,r,n,i,o,a,s){return yi(e,t,r,n,i,o,a,s,3)};!function(e){e[e.NONE=0]="NONE",e[e.FILL=1]="FILL",e[e.JOINT_BEVEL=4]="JOINT_BEVEL",e[e.JOINT_MITER=8]="JOINT_MITER",e[e.JOINT_ROUND=12]="JOINT_ROUND",e[e.JOINT_CAP_BUTT=16]="JOINT_CAP_BUTT",e[e.JOINT_CAP_SQUARE=18]="JOINT_CAP_SQUARE",e[e.JOINT_CAP_ROUND=20]="JOINT_CAP_ROUND",e[e.FILL_EXPAND=24]="FILL_EXPAND",e[e.CAP_BUTT=32]="CAP_BUTT",e[e.CAP_SQUARE=64]="CAP_SQUARE",e[e.CAP_ROUND=96]="CAP_ROUND",e[e.CAP_BUTT2=128]="CAP_BUTT2"}(Ti||(Ti={}));var Si,Ci,Oi;!function(e){e[e.PACKED=0]="PACKED",e[e.VERTEX_NUM=1]="VERTEX_NUM",e[e.TRAVEL=2]="TRAVEL"}(Si||(Si={})),function(e){e[e.PREV=0]="PREV",e[e.POINT1=1]="POINT1",e[e.POINT2=2]="POINT2",e[e.NEXT=3]="NEXT",e[e.VERTEX_JOINT=4]="VERTEX_JOINT",e[e.VERTEX_NUM=5]="VERTEX_NUM",e[e.TRAVEL=6]="TRAVEL"}(Ci||(Ci={})),function(e){e.MODEL_MATRIX="u_ModelMatrix",e.FILL_COLOR="u_FillColor",e.STROKE_COLOR="u_StrokeColor",e.STROKE_WIDTH="u_StrokeWidth",e.INCREASED_LINE_WIDTH_FOR_HIT_TESTING="u_IncreasedLineWidthForHitTesting",e.OPACITY="u_Opacity",e.FILL_OPACITY="u_FillOpacity",e.STROKE_OPACITY="u_StrokeOpacity",e.EXPAND="u_Expand",e.MITER_LIMIT="u_MiterLimit",e.SCALE_MODE="u_ScaleMode",e.ALIGNMENT="u_Alignment",e.PICKING_COLOR="u_PickingColor",e.DASH="u_Dash",e.GAP="u_Gap",e.DASH_OFFSET="u_DashOffset",e.VISIBLE="u_Visible",e.Z_INDEX="u_ZIndex"}(Oi||(Oi={}));var Ii=function(e){function r(){return e.apply(this,arguments)||this}fe(r,e);var n=r.prototype;return n.shouldMerge=function(e,t){return!1},n.updateAttribute=function(r,n,i,o){var a=this;e.prototype.updateAttribute.call(this,r,n,i,o),r.forEach((function(e){var r=e.parsedStyle,n=r.stroke,s=r.opacity,u=r.fillOpacity,c=r.strokeOpacity,l=r.lineWidth,f=r.increasedLineWidthForHitTesting,h=r.anchor,d=r.lineDash,p=r.lineDashOffset,_=r.visibility;if("lineJoin"===i||"lineCap"===i||"markerStart"===i||"markerEnd"===i||"markerStartOffset"===i||"markerEndOffset"===i||e.nodeName===t.Shape.CIRCLE&&"r"===i||e.nodeName===t.Shape.ELLIPSE&&("rx"===i||"ry"===i)||e.nodeName===t.Shape.RECT&&("width"===i||"height"===i||"radius"===i)||e.nodeName===t.Shape.LINE&&("x1"===i||"y1"===i||"x2"===i||"y2"===i)||e.nodeName===t.Shape.POLYLINE&&"points"===i||e.nodeName===t.Shape.POLYGON&&"points"===i||e.nodeName===t.Shape.PATH&&"path"===i)a.material.geometryDirty=!0,a.material.programDirty=!0;else if("stroke"===i){var E,v=[0,0,0,0];n instanceof t.CSSRGB&&(v=[Number(n.r)/255,Number(n.g)/255,Number(n.b)/255,Number(n.alpha)]),a.material.setUniforms(((E={})[Oi.STROKE_COLOR]=v,E))}else if("opacity"===i){var g;a.material.setUniforms(((g={})[Oi.OPACITY]=s,g))}else if("fillOpacity"===i){var m;a.material.setUniforms(((m={})[Oi.FILL_OPACITY]=u,m))}else if("strokeOpacity"===i){var R;a.material.setUniforms(((R={})[Oi.STROKE_OPACITY]=c,R))}else if("lineWidth"===i){var y;a.material.setUniforms(((y={})[Oi.STROKE_WIDTH]=l,y))}else if("increasedLineWidthForHitTesting"===i){var T;a.material.setUniforms(((T={})[Oi.INCREASED_LINE_WIDTH_FOR_HIT_TESTING]=f||0,T))}else if("anchor"===i||"modelMatrix"===i){var A,S=0,C=0,O=e.getGeometryBounds();if(O){var I=O.halfExtents;S=-I[0]*h[0]*2,C=-I[1]*h[1]*2}var N=Te();Oe(N,e.getWorldTransform(),Ce(N,Ie(S,C,0))),a.material.setUniforms(((A={})[Oi.MODEL_MATRIX]=N,A))}else if("visibility"===i){var x;a.material.setUniforms(((x={})[Oi.VISIBLE]="visible"===_?1:0,x))}else if("lineDash"===i){var P;a.material.setUniforms(((P={})[Oi.DASH]=d[0]||0,P[Oi.GAP]=d[1]||0,P))}else if("lineDashOffset"===i){var M;a.material.setUniforms(((M={})[Oi.DASH_OFFSET]=p||0,M))}else if("pointerEvents"===i){var D,B,L=o&&e.isInteractive()&&(null===(D=e.renderable3D)||void 0===D?void 0:D.encodedPickingColor)||[0,0,0];a.material.setUniforms(((B={})[Oi.PICKING_COLOR]=L,B))}}))},n.changeRenderOrder=function(e,t){var r;this.material&&this.material.setUniforms(((r={})[Oi.Z_INDEX]=t*Qn,r))},n.createMaterial=function(e){var r,n;this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nlayout(location = PREV) in vec2 a_Prev;\nlayout(location = POINT1) in vec2 a_Point1;\nlayout(location = POINT2) in vec2 a_Point2;\nlayout(location = NEXT) in vec2 a_Next;\nlayout(location = VERTEX_JOINT) in float a_VertexJoint;\nlayout(location = VERTEX_NUM) in float a_VertexNum;\nlayout(location = TRAVEL) in float a_Travel;\n\nconst float FILL = 1.0;\nconst float BEVEL = 4.0;\nconst float MITER = 8.0;\nconst float ROUND = 12.0;\nconst float JOINT_CAP_BUTT = 16.0;\nconst float JOINT_CAP_SQUARE = 18.0;\nconst float JOINT_CAP_ROUND = 20.0;\nconst float FILL_EXPAND = 24.0;\nconst float CAP_BUTT = 1.0;\nconst float CAP_SQUARE = 2.0;\nconst float CAP_ROUND = 3.0;\nconst float CAP_BUTT2 = 4.0;\n\nout vec4 v_Distance;\nout vec4 v_Arc;\nout float v_Type;\nout float v_Travel;\n\nvec2 doBisect(\n vec2 norm, float len, vec2 norm2, float len2, float dy, float inner\n) {\n vec2 bisect = (norm + norm2) / 2.0;\n bisect /= dot(norm, bisect);\n vec2 shift = dy * bisect;\n if (inner > 0.5) {\n if (len < len2) {\n if (abs(dy * (bisect.x * norm.y - bisect.y * norm.x)) > len) {\n return dy * norm;\n }\n } else {\n if (abs(dy * (bisect.x * norm2.y - bisect.y * norm2.x)) > len2) {\n return dy * norm;\n }\n }\n }\n return dy * bisect;\n}\n\nvoid main() {\n vec2 pointA = (u_ModelMatrix * vec4(a_Point1, 0., 1.0)).xy;\n vec2 pointB = (u_ModelMatrix * vec4(a_Point2, 0., 1.0)).xy;\n\n vec2 xBasis = pointB - pointA;\n float len = length(xBasis);\n vec2 forward = xBasis / len;\n vec2 norm = vec2(forward.y, -forward.x);\n\n float type = a_VertexJoint;\n\n float lineWidth;\n if (u_IsPicking > 0.5) {\n lineWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n lineWidth = u_StrokeWidth;\n }\n\n if (u_ScaleMode > 2.5) {\n lineWidth *= length(u_ModelMatrix * vec4(1.0, 0.0, 0.0, 0.0));\n } else if (u_ScaleMode > 1.5) {\n lineWidth *= length(u_ModelMatrix * vec4(0.0, 1.0, 0.0, 0.0));\n } else if (u_ScaleMode > 0.5) {\n vec2 avgDiag = (u_ModelMatrix * vec4(1.0, 1.0, 0.0, 0.0)).xy;\n lineWidth *= sqrt(dot(avgDiag, avgDiag) * 0.5);\n }\n float capType = floor(type / 32.0);\n type -= capType * 32.0;\n v_Arc = vec4(0.0);\n lineWidth *= 0.5;\n float lineAlignment = 2.0 * u_Alignment - 1.0;\n\n vec2 pos;\n\n if (capType == CAP_ROUND) {\n if (a_VertexNum < 3.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n type = JOINT_CAP_ROUND;\n capType = 0.0;\n }\n\n if (type >= BEVEL) {\n float dy = lineWidth + u_Expand;\n float inner = 0.0;\n if (a_VertexNum >= 1.5) {\n dy = -dy;\n inner = 1.0;\n }\n\n vec2 base, next, xBasis2, bisect;\n float flag = 0.0;\n float sign2 = 1.0;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5 && a_VertexNum < 3.5) {\n next = (u_ModelMatrix * vec4(a_Prev, 0.0, 1.0)).xy;\n base = pointA;\n flag = type - floor(type / 2.0) * 2.0;\n sign2 = -1.0;\n\n } else {\n next = (u_ModelMatrix * vec4(a_Next, 0.0, 1.0)).xy;\n base = pointB;\n if (type >= MITER && type < MITER + 3.5) {\n flag = step(MITER + 1.5, type);\n // check miter limit here?\n }\n }\n xBasis2 = next - base;\n float len2 = length(xBasis2);\n vec2 norm2 = vec2(xBasis2.y, -xBasis2.x) / len2;\n float D = norm.x * norm2.y - norm.y * norm2.x;\n if (D < 0.0) {\n inner = 1.0 - inner;\n }\n norm2 *= sign2;\n\n if (abs(lineAlignment) > 0.01) {\n float shift = lineWidth * lineAlignment;\n pointA += norm * shift;\n pointB += norm * shift;\n if (abs(D) < 0.01) {\n base += norm * shift;\n } else {\n base += doBisect(norm, len, norm2, len2, shift, 0.0);\n }\n }\n\n float collinear = step(0.0, dot(norm, norm2));\n v_Type = 0.0;\n float dy2 = -1000.0;\n float dy3 = -1000.0;\n if (abs(D) < 0.01 && collinear < 0.5) {\n if (type >= ROUND && type < ROUND + 1.5) {\n type = JOINT_CAP_ROUND;\n }\n //TODO: BUTT here too\n }\n\n if (a_VertexNum < 3.5) {\n if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (flag < 0.5 && inner < 0.5) {\n pos = dy * norm;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, inner);\n }\n }\n if (capType >= CAP_BUTT && capType < CAP_ROUND) {\n float extra = step(CAP_SQUARE, capType) * lineWidth;\n vec2 back = -forward;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n pos += back * (u_Expand + extra);\n dy2 = u_Expand;\n } else {\n dy2 = dot(pos + base - pointA, back) - extra;\n }\n }\n if (type >= JOINT_CAP_BUTT && type < JOINT_CAP_SQUARE + 0.5) {\n float extra = step(JOINT_CAP_SQUARE, type) * lineWidth;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n dy3 = dot(pos + base - pointB, forward) - extra;\n } else {\n pos += forward * (u_Expand + extra);\n dy3 = u_Expand;\n if (capType >= CAP_BUTT) {\n dy2 -= u_Expand + extra;\n }\n }\n }\n } else if (type >= JOINT_CAP_ROUND && type < JOINT_CAP_ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n vec2 d2 = abs(dy) * forward;\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = dy * norm;\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum < 6.5) {\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n } else {\n dy = -dy;\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n }\n dy2 = 0.0;\n v_Arc.y = dy;\n v_Arc.z = 0.0;\n v_Arc.w = lineWidth;\n v_Type = 3.0;\n } else if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (type >= ROUND && type < ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n float d2 = abs(dy);\n if (length(pos) > abs(dy) * 1.5) {\n if (a_VertexNum < 6.5) {\n pos.x = dy * norm.x - d2 * norm.y;\n pos.y = dy * norm.y + d2 * norm.x;\n } else {\n pos.x = dy * norm2.x + d2 * norm2.y;\n pos.y = dy * norm2.y - d2 * norm2.x;\n }\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n v_Arc.x = sign * dot(pos, norm3);\n v_Arc.y = pos.x * norm3.y - pos.y * norm3.x;\n v_Arc.z = dot(norm, norm3) * lineWidth;\n v_Arc.w = lineWidth;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = v_Arc.z - v_Arc.x;\n v_Type = 3.0;\n } else {\n float hit = 0.0;\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (dot(norm, norm2) > 0.0) {\n type = MITER;\n }\n }\n if (type >= MITER && type < MITER + 3.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float sign = step(0.0, dy) * 2.0 - 1.0;\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n if (length(pos) > abs(dy) * u_MiterLimit) {\n type = BEVEL;\n } else {\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = doBisect(norm, len, norm2, len2, dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 6.5) {\n pos = dy * norm2;\n }\n v_Type = 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n hit = 1.0;\n }\n }\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float d2 = abs(dy);\n vec2 pos3 = vec2(dy * norm.x - d2 * norm.y, dy * norm.y + d2 * norm.x);\n vec2 pos4 = vec2(dy * norm2.x + d2 * norm2.y, dy * norm2.y - d2 * norm2.x);\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n if (a_VertexNum < 6.5) {\n pos = pos3;\n } else {\n pos = pos4;\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = (-sign * dot(pos, norm3)) + lineWidth;\n v_Type = 4.0;\n hit = 1.0;\n }\n if (hit < 0.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n }\n }\n pos += base;\n v_Distance = vec4(dy, dy2, dy3, lineWidth) * u_DevicePixelRatio;\n v_Arc = v_Arc * u_DevicePixelRatio;\n v_Travel = a_Travel + dot(pos - pointA, vec2(-norm.y, norm.x));\n }\n\n gl_Position = u_ProjectionMatrix * u_ViewMatrix * vec4(pos, u_ZIndex, 1.0);\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nin vec4 v_Distance;\nin vec4 v_Arc;\nin float v_Type;\nin float v_Travel;\n\nout vec4 outputColor;\n\n#define COLOR_SCALE 1. / 255.\n\nvoid main(){\n if (u_Visible < 0.5) {\n discard;\n }\n\n float alpha = 1.0;\n float lineWidth = v_Distance.w;\n if (v_Type < 0.5) {\n float left = max(v_Distance.x - 0.5, -v_Distance.w);\n float right = min(v_Distance.x + 0.5, v_Distance.w);\n float near = v_Distance.y - 0.5;\n float far = min(v_Distance.y + 0.5, 0.0);\n float top = v_Distance.z - 0.5;\n float bottom = min(v_Distance.z + 0.5, 0.0);\n alpha = max(right - left, 0.0) * max(bottom - top, 0.0) * max(far - near, 0.0);\n } else if (v_Type < 1.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n } else if (v_Type < 2.5) {\n alpha *= max(min(v_Distance.x + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.y + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n } else if (v_Type < 3.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n float alpha_miter = a2 * b2 - a1 * b1;\n float alpha_plane = max(min(v_Distance.z + 0.5, 1.0), 0.0);\n float d = length(v_Arc.xy);\n float circle_hor = max(min(v_Arc.w, d + 0.5) - max(-v_Arc.w, d - 0.5), 0.0);\n float circle_vert = min(v_Arc.w * 2.0, 1.0);\n float alpha_circle = circle_hor * circle_vert;\n alpha = min(alpha_miter, max(alpha_circle, alpha_plane));\n } else {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n }\n\n if (u_Dash + u_Gap > 1.0) {\n float scalingFactor = sqrt(u_ModelMatrix[0][0] * u_ModelMatrix[0][0] + u_ModelMatrix[0][1] * u_ModelMatrix[0][1] + u_ModelMatrix[0][2] * u_ModelMatrix[0][2]);\n float travel = mod(v_Travel + u_Gap * scalingFactor * 0.5 + u_DashOffset, u_Dash * scalingFactor + u_Gap * scalingFactor) - (u_Gap * scalingFactor * 0.5);\n float left = max(travel - 0.5, -0.5);\n float right = min(travel + 0.5, u_Gap * scalingFactor + 0.5);\n alpha *= max(0.0, right - left);\n }\n\n if (u_IsPicking > 0.5) {\n vec3 pickingColor = COLOR_SCALE * u_PickingColor;\n if (pickingColor.x == 0.0 && pickingColor.y == 0.0 && pickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(pickingColor, 1.0);\n } else {\n outputColor = u_StrokeColor;\n outputColor.a *= alpha * u_Opacity * u_StrokeOpacity;\n }\n}",this.material.defines=le({},this.material.defines,ei(Ci));var i=e[0],o=i.parsedStyle,a=o.fill,s=o.stroke,u=o.opacity,c=o.fillOpacity,l=o.strokeOpacity,f=o.lineWidth,h=o.increasedLineWidthForHitTesting,d=o.anchor,p=o.lineDash,_=o.lineDashOffset,E=o.visibility,v=[0,0,0,0];a instanceof t.CSSRGB&&(v=[Number(a.r)/255,Number(a.g)/255,Number(a.b)/255,Number(a.alpha)]);var g=[0,0,0,0];s instanceof t.CSSRGB&&(g=[Number(s.r)/255,Number(s.g)/255,Number(s.b)/255,Number(s.alpha)]);var m=i.isInteractive()&&(null===(r=i.renderable3D)||void 0===r?void 0:r.encodedPickingColor)||[0,0,0],R=0,y=0,T=i.getGeometryBounds();if(T){var A=T.halfExtents;R=-A[0]*d[0]*2,y=-A[1]*d[1]*2}var S=Te();Oe(S,i.getWorldTransform(),Ce(S,Ie(R,y,0))),this.material.setUniforms(((n={})[Oi.MODEL_MATRIX]=S,n[Oi.FILL_COLOR]=v,n[Oi.STROKE_COLOR]=g,n[Oi.STROKE_WIDTH]=f,n[Oi.INCREASED_LINE_WIDTH_FOR_HIT_TESTING]=h||0,n[Oi.OPACITY]=u,n[Oi.FILL_OPACITY]=c,n[Oi.STROKE_OPACITY]=l,n[Oi.EXPAND]=1,n[Oi.MITER_LIMIT]=5,n[Oi.SCALE_MODE]=1,n[Oi.ALIGNMENT]=.5,n[Oi.PICKING_COLOR]=m,n[Oi.DASH]=p&&p[0]||0,n[Oi.GAP]=p&&p[1]||0,n[Oi.DASH_OFFSET]=_||0,n[Oi.VISIBLE]="visible"===E?1:0,n[Oi.Z_INDEX]=i.sortable.renderOrder*Qn,n)),this.material.cullMode=Be.None},n.createGeometry=function(e){var t=Pi(e[0]),r=t.travelBuffer,n=t.instancedCount;this.geometry.setVertexBuffer({bufferIndex:Si.PACKED,byteStride:48,frequency:We.PerInstance,attributes:[{format:tt.F32_RG,bufferByteOffset:0,byteStride:12,location:Ci.PREV,divisor:1},{format:tt.F32_RG,bufferByteOffset:12,byteStride:12,location:Ci.POINT1,divisor:1},{format:tt.F32_R,bufferByteOffset:20,byteStride:12,location:Ci.VERTEX_JOINT,divisor:1},{format:tt.F32_RG,bufferByteOffset:24,byteStride:12,location:Ci.POINT2,divisor:1},{format:tt.F32_RG,bufferByteOffset:36,byteStride:12,location:Ci.NEXT,divisor:1}],data:new Float32Array(t.pointsBuffer)}),this.geometry.setVertexBuffer({bufferIndex:Si.VERTEX_NUM,byteStride:4,frequency:We.PerInstance,attributes:[{format:tt.F32_R,bufferByteOffset:0,byteStride:4,location:Ci.VERTEX_NUM,divisor:0}],data:new Float32Array([0,1,2,3,4,5,6,7,8])}),this.geometry.setVertexBuffer({bufferIndex:Si.TRAVEL,byteStride:4,frequency:We.PerInstance,attributes:[{format:tt.F32_R,bufferByteOffset:0,byteStride:4,location:Ci.TRAVEL,divisor:1}],data:new Float32Array(r)}),this.geometry.vertexCount=15,this.geometry.instancedCount=n,this.geometry.setIndexBuffer(new Uint32Array([0,2,1,0,3,2,4,6,5,4,7,6,4,7,8]))},r}(si);function Ni(e,t,r,n,i,o,a){var s=a[a.length-2],u=a[a.length-1];a.length-=2;var c=function(e,t){var r=Math.ceil(e/10);8>r?r=8:r>xi&&(r=xi);return r}(Ai(s,u,e,t,r,n,i,o)),l=0,f=0,h=0,d=0,p=0;a.push(s,u);for(var _=1,E=0;c>=_;++_)a.push((h=(f=(l=1-(E=_/c))*l)*l)*s+3*f*E*e+3*l*(d=E*E)*r+(p=d*E)*i,h*u+3*f*E*t+3*l*d*n+p*o)}Ii=u([t.injectable()],Ii);var xi=2048;function Pi(e,r){void 0===r&&(r=!1);var n=e.parsedStyle,i=n.lineCap,o=n.lineJoin,a=e.parsedStyle,s=a.defX,u=a.defY,c=e.parsedStyle,l=c.markerStart,f=c.markerEnd,h=c.markerStartOffset,d=c.markerEndOffset,p=[],_=[];if(e.nodeName===t.Shape.POLYLINE||e.nodeName===t.Shape.POLYGON){var E,v,g=e.parsedStyle.points.points,m=g.length,R=0,y=0,T=0,A=0,S=0;if(l&&l instanceof t.DisplayObject&&h&&(E=g[1][0]-g[0][0],v=g[1][1]-g[0][1],S=Math.atan2(v,E),R=Math.cos(S)*(h||0),y=Math.sin(S)*(h||0)),f&&f instanceof t.DisplayObject&&d&&(E=g[m-2][0]-g[m-1][0],v=g[m-2][1]-g[m-1][1],S=Math.atan2(v,E),T=Math.cos(S)*(d||0),A=Math.sin(S)*(d||0)),p[0]=g.reduce((function(e,t,r){var n=0,i=0;return 0===r?(n=R,i=y):r===m-1&&(n=T,i=A),e.push(t[0]-s+n,t[1]-u+i),e}),[]),e.nodeName===t.Shape.POLYGON){if(r)return _=I(p[0],[],2),{pointsBuffer:p[0],travelBuffer:[],triangles:_,instancedCount:Math.round(p[0].length/2)};var C;p[0].push(p[0][0],p[0][1]),(C=p[0]).push.apply(C,Mi(p[0][0],p[0][1],p[0][2],p[0][3]))}}else if(e.nodeName===t.Shape.PATH||e.nodeName===t.Shape.CIRCLE||e.nodeName===t.Shape.ELLIPSE||e.nodeName===t.Shape.RECT){var O;if(e.nodeName!==t.Shape.PATH){if(O=t.parsePath(t.convertToPath(e,!1),e),s=O.rect.x,u=O.rect.y,e.nodeName===t.Shape.RECT){var N=e.parsedStyle;0>N.width&&(s+=O.rect.width),0>N.height&&(u+=O.rect.height)}}else O=e.parsedStyle.path;var x,P,M=O.zCommandIndexes,D=[].concat(O.curve).map((function(e,t){return M.includes(t)?["Z"]:e})),B=D.length&&"Z"===D[D.length-1][0],L=0,b=0,F=0,U=0,w=0;if(l&&l instanceof t.DisplayObject&&h){var G=l.parentNode.getStartTangent(),k=G[0],V=G[1];x=k[0]-V[0],P=k[1]-V[1],w=Math.atan2(P,x),L=Math.cos(w)*(h||0),b=Math.sin(w)*(h||0)}if(f&&f instanceof t.DisplayObject&&d){var W=f.parentNode.getEndTangent(),X=W[0],H=W[1];x=X[0]-H[0],P=X[1]-H[1],w=Math.atan2(P,x),F=Math.cos(w)*(d||0),U=Math.sin(w)*(d||0)}var Y=-1,j=-1;if(D.forEach((function(r,n){var i=r[0],o=r.slice(1);if("M"===i)j++,p[j]=[],Y=p[j].length,p[j].push(o[0]-s+L,o[1]-u+b);else if("C"===i){Ni(o[0]-s,o[1]-u,o[2]-s,o[3]-u,o[4]-s+(n===D.length-(B?2:1)?F:0),o[5]-u+(n===D.length-(B?2:1)?U:0),p[j])}else if("Z"===i&&(e.nodeName===t.Shape.PATH||e.nodeName===t.Shape.RECT)){var a,c=1e-4;(Math.abs(p[j][p[j].length-2]-p[j][Y])>c||Math.abs(p[j][p[j].length-1]-p[j][Y+1])>c)&&p[j].push(p[j][Y],p[j][Y+1]),(a=p[j]).push.apply(a,Mi(p[j][Y],p[j][Y+1],p[j][Y+2],p[j][Y+3]))}})),r){var K=p.reduce((function(e,t){return e.push.apply(e,t),e}),[]);return{pointsBuffer:K,travelBuffer:[],triangles:_=I(K,[],2),instancedCount:Math.round(K.length/2)}}}var z=function(e){var t;switch(e){case"bevel":t=Ti.JOINT_BEVEL;break;case"round":t=Ti.JOINT_ROUND;break;default:t=Ti.JOINT_MITER}return t}(o),q=function(e){var t;switch(e){case"square":t=Ti.CAP_SQUARE;break;case"round":t=Ti.CAP_ROUND;break;default:t=Ti.CAP_BUTT}return t}(i),Z=q;return q===Ti.CAP_ROUND&&(Z=Ti.JOINT_CAP_ROUND),q===Ti.CAP_BUTT&&(Z=Ti.JOINT_CAP_BUTT),q===Ti.CAP_SQUARE&&(Z=Ti.JOINT_CAP_SQUARE),p.map((function(e){for(var t=3*(Math.round(0)+2),r=0,n=[],i=[],o=0;e.length>o;o+=2)o>1&&(r+=Math.sqrt(Math.pow(e[o]-e[o-2],2)+Math.pow(e[o+1]-e[o+1-2],2))),i.push(r),n[t++]=e[o],n[t++]=e[o+1],n[t]=z,0==o&&q!==Ti.CAP_ROUND&&(n[t]+=q),e.length>o+4?e.length>o+2||(n[t]=0):n[t]+=Z-z,t++;n[t++]=e[e.length-4],n[t++]=e[e.length-3],n[t++]=0,n[0]=e[0],n[1]=e[1],n[2]=0,n[3]=e[2],n[4]=e[3],n[5]=q===Ti.CAP_ROUND?q:0;var a=Math.round(e.length/2);return{pointsBuffer:n,travelBuffer:i,triangles:_,instancedCount:a}})).reduce((function(e,t){var r,n;return(r=e.pointsBuffer).push.apply(r,t.pointsBuffer),(n=e.travelBuffer).push.apply(n,t.travelBuffer),e.instancedCount+=t.instancedCount,e}),{pointsBuffer:[],travelBuffer:[],triangles:_,instancedCount:0})}function Mi(e,t,r,n){void 0===r&&(r=e),void 0===n&&(n=t);var i=[r-e,n-t];return[e+.01*i[0],t+.01*i[1]]}var Di=function(e){function r(){return e.apply(this,arguments)||this}fe(r,e);var n=r.prototype;return n.shouldMerge=function(e,t){return!1},n.createGeometry=function(e){var t=e[0],r=Pi(t,!0),n=r.triangles,i=r.pointsBuffer;this.geometry.setVertexBuffer({bufferIndex:ri.POSITION,byteStride:8,frequency:We.PerVertex,attributes:[{format:tt.F32_RG,bufferByteOffset:0,location:ni.POSITION}],data:new Float32Array(i)});var o=t.getGeometryBounds().halfExtents,a=i.map((function(e,t){return e/o[t%2]/2}));this.geometry.setVertexBuffer({bufferIndex:ri.UV,byteStride:8,frequency:We.PerVertex,attributes:[{format:tt.F32_RG,bufferByteOffset:0,location:ni.UV}],data:new Float32Array(a)}),this.geometry.vertexCount=n.length,this.geometry.setIndexBuffer(new Uint32Array(n))},n.createMaterial=function(e){var r,n;this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec3 u_PickingColor;\n float u_Opacity;\n float u_FillOpacity;\n float u_Visible;\n float u_ZIndex;\n};\n\nlayout(location = POSITION) in vec2 a_Position;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nvoid main() {\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n gl_Position = u_ProjectionMatrix * u_ViewMatrix * u_ModelMatrix * vec4(a_Position, u_ZIndex, 1.0);\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_FillColor;\n vec3 u_PickingColor;\n float u_Opacity;\n float u_FillOpacity;\n float u_Visible;\n float u_ZIndex;\n};\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nout vec4 outputColor;\n\n#define COLOR_SCALE 1. / 255.\n\nvoid main(){\n if (u_Visible < 0.5) {\n discard;\n }\n\n if (u_IsPicking > 0.5) {\n vec3 pickingColor = COLOR_SCALE * u_PickingColor;\n if (pickingColor.x == 0.0 && pickingColor.y == 0.0 && pickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(pickingColor, 1.0);\n } else {\n\n vec4 u_Color = u_FillColor;\n\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity * u_FillOpacity;\n }\n}";var i=e[0],o=i.parsedStyle,a=o.fill,s=o.opacity,u=o.fillOpacity,c=o.anchor,l=o.visibility,f=[0,0,0,0];a instanceof t.CSSRGB&&(f=[Number(a.r)/255,Number(a.g)/255,Number(a.b)/255,Number(a.alpha)]);var h=i.isInteractive()&&(null===(r=i.renderable3D)||void 0===r?void 0:r.encodedPickingColor)||[0,0,0],d=0,p=0,_=i.getGeometryBounds();if(_){var E=_.halfExtents;d=-E[0]*c[0]*2,p=-E[1]*c[1]*2}var v=Te();Oe(v,i.getWorldTransform(),Ce(v,Ie(d,p,0))),this.material.setUniforms(((n={})[Oi.MODEL_MATRIX]=v,n[Oi.FILL_COLOR]=f,n[Oi.PICKING_COLOR]=h,n[Oi.OPACITY]=s,n[Oi.FILL_OPACITY]=u,n[Oi.VISIBLE]="visible"===l?1:0,n[Oi.Z_INDEX]=i.sortable.renderOrder*Qn,n))},n.updateAttribute=function(r,n,i,o){var a=this;e.prototype.updateAttribute.call(this,r,n,i,o),r.forEach((function(e){var r=e.parsedStyle,n=r.fill,s=r.opacity,u=r.fillOpacity,c=r.anchor,l=r.visibility;if("lineJoin"===i||"lineCap"===i||"markerStart"===i||"markerEnd"===i||"markerStartOffset"===i||"markerEndOffset"===i||e.nodeName===t.Shape.RECT&&("width"===i||"height"===i||"radius"===i)||e.nodeName===t.Shape.LINE&&("x1"===i||"y1"===i||"x2"===i||"y2"===i)||e.nodeName===t.Shape.POLYLINE&&"points"===i||e.nodeName===t.Shape.POLYGON&&"points"===i||e.nodeName===t.Shape.PATH&&"path"===i)a.material.geometryDirty=!0,a.material.programDirty=!0;else if("fill"===i)if(n instanceof t.CSSRGB){var f,h=[Number(n.r)/255,Number(n.g)/255,Number(n.b)/255,Number(n.alpha)];a.material.setUniforms(((f={})[Oi.FILL_COLOR]=h,f))}else{var d=a.textureMappings.findIndex((function(e){return e.name===ai})),p=a.createFillGradientTextureMapping([a.instance]);0>d||a.textureMappings.splice(d,1,p),a.material.textureDirty=!0}else if("opacity"===i){var _;a.material.setUniforms(((_={})[Oi.OPACITY]=s,_))}else if("fillOpacity"===i){var E;a.material.setUniforms(((E={})[Oi.FILL_OPACITY]=u,E))}else if("anchor"===i||"modelMatrix"===i){var v,g=0,m=0,R=e.getGeometryBounds();if(R){var y=R.halfExtents;g=-y[0]*c[0]*2,m=-y[1]*c[1]*2}var T=Te();Oe(T,e.getWorldTransform(),Ce(T,Ie(g,m,0))),a.material.setUniforms(((v={})[Oi.MODEL_MATRIX]=T,v))}else if("visibility"===i){var A;a.material.setUniforms(((A={})[Oi.VISIBLE]="visible"===l?1:0,A))}else if("pointerEvents"===i){var S,C,O=o&&e.isInteractive()&&(null===(S=e.renderable3D)||void 0===S?void 0:S.encodedPickingColor)||[0,0,0];a.material.setUniforms(((C={})[Oi.PICKING_COLOR]=O,C))}}))},n.changeRenderOrder=function(e,t){var r;this.material&&this.material.setUniforms(((r={})[Oi.Z_INDEX]=t*Qn,r))},r}(si);Di=u([t.injectable()],Di);var Bi=function(e){function t(){return e.apply(this,arguments)||this}fe(t,e);var r=t.prototype;return r.shouldMerge=function(t,r){var n=e.prototype.shouldMerge.call(this,t,r);return!!n&&this.instance.parsedStyle.img===t.parsedStyle.img},r.createMaterial=function(e){var t=e[0].parsedStyle.img;this.material.defines=le({},this.material.defines),this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec2 a_Size;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n vec2 offset = (a_Uv - u_Anchor.xy) * a_Size;\n\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n }\n}";var r=this.texturePool.getOrCreateTexture(this.device,t);this.material.setUniforms({u_Map:r})},r.createGeometry=function(t){e.prototype.createGeometry.call(this,t);var r=[],n=[],i=[];t.forEach((function(e,t){var o=4*t,a=e.parsedStyle;r.push(a.width,a.height),n.push(0,0,1,0,1,1,0,1),i.push(0+o,2+o,1+o,0+o,3+o,2+o)})),this.geometry.setIndexBuffer(new Uint32Array(i)),this.geometry.vertexCount=6,this.geometry.setVertexBuffer({bufferIndex:ri.POSITION,byteStride:8,frequency:We.PerInstance,attributes:[{format:tt.F32_RG,bufferByteOffset:0,location:ni.POSITION}],data:new Float32Array(r)}),this.geometry.setVertexBuffer({bufferIndex:ri.UV,byteStride:8,frequency:We.PerVertex,attributes:[{format:tt.F32_RG,bufferByteOffset:0,location:ni.UV}],data:new Float32Array(n)})},r.updateAttribute=function(t,r,n,i){if(e.prototype.updateAttribute.call(this,t,r,n,i),this.updateBatchedAttribute(t,r,n,i),"width"===n||"height"===n){var o=[];t.forEach((function(e){var t=e.parsedStyle;o.push(t.width,t.height)})),this.geometry.updateVertexBuffer(ri.POSITION,ni.POSITION,r,new Uint8Array(new Float32Array(o).buffer))}else if("img"===n){var a=this.texturePool.getOrCreateTexture(this.device,i);this.material.setUniforms({u_Map:a})}},t}(si);Bi=u([t.injectable()],Bi);function Li(e,t,r,n){var i=t.width,o=t.height;if(n){if(n.length!==i*o*r)throw new RangeError("mismatched image size")}else n=new Uint8Array(i*o*r);return e.width=i,e.height=o,e.data=n,e}function bi(e,t,r,n,i,o){if(0===i.width||0===i.height)return t;if(i.width>e.width||i.height>e.height||r.x>e.width-i.width||r.y>e.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>t.width||i.height>t.height||n.x>t.width-i.width||n.y>t.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var a=e.data,s=t.data,u=0;i.height>u;u++)for(var c=((r.y+u)*e.width+r.x)*o,l=((n.y+u)*t.width+n.x)*o,f=0;i.width*o>f;f++)s[l+f]=a[c+f];return t}var Fi=function(){function e(e,t){this.width=void 0,this.height=void 0,this.data=void 0,Li(this,e,1,t)}var t=e.prototype;return t.resize=function(e){!function(e,t,r){var n=t.width,i=t.height;if(n!==e.width||i!==e.height){var o=Li({},{width:n,height:i},r);bi(e,o,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,n),height:Math.min(e.height,i)},r),e.width=n,e.height=i,e.data=o.data}}(this,e,1)},t.clone=function(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))},e.copy=function(e,t,r,n,i){bi(e,t,r,n,i,1)},e}();var Ui=function(e){this.image=void 0,this.positions=void 0;var t={},r=[];for(var n in e){var i=e[n],o=t[n]={};for(var a in i){if((c=i[+a])&&0!==c.bitmap.width&&0!==c.bitmap.height)r.push(l={x:0,y:0,w:c.bitmap.width+2,h:c.bitmap.height+2}),o[a]={rect:l,metrics:c.metrics}}}var s=function(e){for(var t,r=0,n=0,i=Ee(e);!(t=i()).done;){var o=t.value;r+=o.w*o.h,n=Math.max(n,o.w)}e.sort((function(e,t){return t.h-e.h}));for(var a,s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),n),h:1/0}],u=0,c=0,l=Ee(e);!(a=l()).done;)for(var f=a.value,h=s.length-1;h>=0;h--){var d=s[h];if(d.w>=f.w&&d.h>=f.h){if(f.x=d.x,f.y=d.y,c=Math.max(c,f.y+f.h),u=Math.max(u,f.x+f.w),f.w===d.w&&f.h===d.h){var p=s.pop();s.length>h&&(s[h]=p)}else f.h===d.h?(d.x+=f.w,d.w-=f.w):f.w===d.w?(d.y+=f.h,d.h-=f.h):(s.push({x:d.x+f.w,y:d.y,w:d.w-f.w,h:f.h}),d.y+=f.h,d.h-=f.h);break}}return{w:u,h:c,fill:r/(u*c)||0}}(r),u=new Fi({width:s.w||1,height:s.h||1});for(var n in e){i=e[n];for(var a in i){var c,l;if((c=i[+a])&&0!==c.bitmap.width&&0!==c.bitmap.height)Fi.copy(c.bitmap,u,{x:0,y:0},{x:(l=t[n][a].rect).x+1,y:l.y+1},c.bitmap)}}this.image=u,this.positions=t};var wi,Gi,ki,Vi=function(){function e(){this.sdfGeneratorCache={},this.textMetricsCache={},this.glyphAtlas=void 0,this.glyphMap={},this.glyphAtlasTexture=void 0}var t=e.prototype;return t.getMap=function(){return this.glyphMap},t.getAtlas=function(){return this.glyphAtlas},t.getAtlasTexture=function(){return this.glyphAtlasTexture},t.layout=function(e,t,r,n,i,o,a){var s=this,u=[],c=o,l=a,f="right"===n||"end"===n?1:"left"===n||"start"===n?0:.5;return e.forEach((function(e){var n=u.length;Array.from(e).forEach((function(e){var r=s.glyphMap[t],n=e.charCodeAt(0),o=r&&r[n];o&&(u.push({glyph:n,x:c,y:l,scale:1,fontStack:t}),c+=o.metrics.advance+i)}));for(var o=c-i,a=n;u.length>a;a++)u[a].x=u[a].x-f*o;c=0,l+=r})),u},t.generateAtlas=function(e,t,r,n,i,o){var a=this;void 0===e&&(e=""),void 0===n&&(n="");var s=[];this.glyphMap[e]||(s=function(){for(var e=[],t=32;128>t;t++)e.push(String.fromCharCode(t));return e}());var u=Object.keys(this.glyphMap[e]||{});if(Array.from(new Set(i.split(""))).forEach((function(e){-1===u.indexOf(e.charCodeAt(0).toString())&&s.push(e)})),s.length){var c=s.map((function(i){return a.generateSDF(e,t,r,n,i)})).reduce((function(e,t){return e[t.id]=t,e}),{});this.glyphMap[e]=le({},this.glyphMap[e],c),this.glyphAtlas=new Ui(this.glyphMap);var l=this.glyphAtlas.image,f=l.width,h=l.height,d=l.data;this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.glyphAtlasTexture=o.createTexture(le({},nt(tt.ALPHA,f,h,1),{pixelStore:{unpackFlipY:!1,unpackAlignment:1},immutable:!1})),this.glyphAtlasTexture.setImageData([d],0)}},t.generateSDF=function(e,t,r,n,i){void 0===e&&(e="");var o=i.charCodeAt(0),a=this.sdfGeneratorCache[e];a||(a=this.sdfGeneratorCache[e]=new re({fontSize:24,fontFamily:t,fontWeight:r,fontStyle:n,buffer:3,radius:8,cutoff:.25})),this.textMetricsCache[e]||(this.textMetricsCache[e]={}),this.textMetricsCache[e][i]||(this.textMetricsCache[e][i]=a.ctx.measureText(i).width);var s=a.draw(i),u=s.glyphWidth,c=s.glyphHeight,l=s.glyphLeft,f=s.glyphTop,h=s.glyphAdvance;return{id:o,bitmap:new Fi({width:s.width,height:s.height},s.data),metrics:{width:u,height:c,left:l,top:f-24+3,advance:h}}},e}();Vi=u([t.injectable()],Vi),function(e){e[e.INSTANCED=5]="INSTANCED",e[e.TEX=6]="TEX"}(wi||(wi={})),function(e){e[e.TEX=13]="TEX",e[e.OFFSET=14]="OFFSET"}(Gi||(Gi={})),function(e){e.SDF_MAP="u_SDFMap",e.SDF_MAP_SIZE="u_SDFMapSize",e.FONT_SIZE="u_FontSize",e.GAMMA_SCALE="u_GammaScale",e.STROKE_BLUR="u_StrokeBlur",e.HAS_STROKE="u_HasStroke"}(ki||(ki={}));var Wi=function(e){function r(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).glyphManager=void 0,t}fe(r,e);var n=r.prototype;return n.shouldMerge=function(t,r){var n=e.prototype.shouldMerge.call(this,t,r);if(!n)return!1;if(this.index!==r)return!1;var i=this.instance;return i.parsedStyle.metrics.font===t.parsedStyle.metrics.font&&!["fontSize","fontFamily","fontWeight","textBaseline","letterSpacing"].some((function(e){return i.parsedStyle[e].value!==t.parsedStyle[e].value}))},n.createGeometry=function(e){var t=this,r=this.instance.parsedStyle,n=r.textBaseline,i=r.letterSpacing,o=24/r.fontSize,a=[],s=[],u=[],c=0;e.forEach((function(e){var r=e.parsedStyle,l=r.metrics,f=l.font,h=l.lines,d=l.height,p=l.lineHeight,_=r.dx||0,E=r.dy||0,v=0;"middle"===n?v=-d/2:"bottom"===n?v=-d:"top"===n||"hanging"===n?v=0:"alphabetic"===n?v=.25*p-d:"ideographic"===n&&(v=-d);var g=t.glyphManager.getAtlas(),m=t.buildTextBuffers({object:e,lines:h,fontStack:f,lineHeight:o*p,offsetX:o*_,offsetY:o*(v+E),letterSpacing:o*i,glyphAtlas:g,indicesOffset:c}),R=m.indexBuffer,y=m.charUVOffsetBuffer;c=m.indicesOffset,u.push.apply(u,m.charPackedBuffer),s.push.apply(s,y),a.push.apply(a,R)})),this.geometry.vertexCount=a.length,this.geometry.setIndexBuffer(new Uint32Array(a)),this.geometry.setVertexBuffer({bufferIndex:wi.INSTANCED,byteStride:144,frequency:We.PerVertex,attributes:[{format:tt.F32_RGBA,bufferByteOffset:0,location:ni.MODEL_MATRIX0},{format:tt.F32_RGBA,bufferByteOffset:16,location:ni.MODEL_MATRIX1},{format:tt.F32_RGBA,bufferByteOffset:32,location:ni.MODEL_MATRIX2},{format:tt.F32_RGBA,bufferByteOffset:48,location:ni.MODEL_MATRIX3},{format:tt.F32_RGBA,bufferByteOffset:64,location:ni.COLOR},{format:tt.F32_RGBA,bufferByteOffset:80,location:ni.STROKE_COLOR},{format:tt.F32_RGBA,bufferByteOffset:96,location:ni.PACKED_STYLE1},{format:tt.F32_RGBA,bufferByteOffset:112,location:ni.PACKED_STYLE2},{format:tt.F32_RGBA,bufferByteOffset:128,location:ni.PICKING_COLOR}],data:new Float32Array(u)}),this.geometry.setVertexBuffer({bufferIndex:wi.TEX,byteStride:16,frequency:We.PerVertex,attributes:[{format:tt.F32_RG,bufferByteOffset:0,location:Gi.TEX},{format:tt.F32_RG,bufferByteOffset:8,location:Gi.OFFSET}],data:new Float32Array(s)})},n.createMaterial=function(e){var t;this.material.vertexShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n vec2 u_SDFMapSize;\n float u_FontSize;\n float u_GammaScale;\n float u_StrokeBlur;\n float u_HasStroke;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = TEX) in vec2 a_Tex;\nlayout(location = OFFSET) in vec2 a_Offset;\n\nout vec2 v_UV;\nout float v_GammaScale;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n v_UV = a_Tex / u_SDFMapSize;\n\n float fontScale = u_FontSize / 24.;\n\n gl_Position = project(vec4(a_Offset * fontScale, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n v_GammaScale = gl_Position.w;\n}",this.material.fragmentShader="#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n vec2 u_SDFMapSize;\n float u_FontSize;\n float u_GammaScale;\n float u_StrokeBlur;\n float u_HasStroke;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n\nuniform sampler2D u_SDFMap;\n\n#define SDF_PX 8.0\n\nin vec2 v_UV;\nin float v_GammaScale;\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n\n float dist = texture(SAMPLER_2D(u_SDFMap), v_UV).a;\n\n float EDGE_GAMMA = 0.105 / u_DevicePixelRatio;\n float fontScale = u_FontSize / 24.0;\n highp float gamma = EDGE_GAMMA / (fontScale * u_GammaScale);\n lowp vec4 color = u_Color;\n lowp float buff = (256.0 - 64.0) / 256.0;\n float opacity = u_FillOpacity;\n if (u_HasStroke > 0.5 && u_StrokeWidth > 0.0) {\n color = u_StrokeColor;\n gamma = (u_StrokeBlur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_GammaScale);\n buff = (6.0 - u_StrokeWidth / fontScale / 2.0) / SDF_PX;\n opacity = u_StrokeOpacity;\n }\n\n highp float gamma_scaled = gamma * v_GammaScale;\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n opacity *= alpha * u_Opacity;\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n\n if (opacity < 0.001) {\n discard;\n }\n\n outputColor = color;\n outputColor.a *= opacity;\n }\n}",this.material.cullMode=Be.Back,this.material.defines=le({},this.material.defines,ei(Gi));var r=this.instance.parsedStyle,n=r.fontSize,i=r.fontFamily,o=void 0===i?"":i,a=r.fontWeight,s=void 0===a?"":a,u=r.fontStyle,c=r.metrics.font,l=e.map((function(e){return e.parsedStyle.text})).join("");this.glyphManager.generateAtlas(c,o,s.toString(),u,l,this.device);var f=this.glyphManager.getAtlasTexture(),h=this.glyphManager.getAtlas();this.device.setResourceName(f,"TextSDF Texture");var d=h.image,p=d.width,_=d.height;this.material.setUniforms(((t={})[ki.SDF_MAP]=f,t[ki.SDF_MAP_SIZE]=[p,_],t[ki.FONT_SIZE]=n,t[ki.GAMMA_SCALE]=1,t[ki.STROKE_BLUR]=.2,t[ki.HAS_STROKE]=this.index,t))},n.changeRenderOrder=function(e,t){this.material&&(this.material.programDirty=!0,this.material.geometryDirty=!0)},n.updateAttribute=function(e,t,r,n){"text"===r||"fontFamily"===r||"fontSize"===r||"fontWeight"===r||"fontStyle"===r||"fontVariant"===r||"textBaseline"===r||"letterSpacing"===r||"wordWrapWidth"===r||"lineHeight"===r||"wordWrap"===r||"textAlign"===r||"modelMatrix"===r||"visibility"===r||"dx"===r||"dy"===r?(this.material.programDirty=!0,this.material.geometryDirty=!0,this.material.textureDirty=!0):"fill"!==r&&"fillOpacity"!==r&&"stroke"!==r&&"strokeOpacity"!==r&&"opacity"!==r&&"lineWidth"!==r&&"visibility"!==r&&"pointerEvents"!==r||(this.material.geometryDirty=!0)},n.buildTextBuffers=function(e){var r,n=e.object,i=e.lines,o=e.fontStack,a=e.lineHeight,s=e.letterSpacing,u=e.offsetX,c=e.offsetY,l=e.glyphAtlas,f=e.indicesOffset,h=n.parsedStyle,d=h.textAlign,p=h.fill,_=h.stroke,E=h.opacity,v=h.fillOpacity,g=h.strokeOpacity,m=h.lineWidth,R=h.visibility,y=[0,0,0,0];p instanceof t.CSSRGB&&(y=[Number(p.r)/255,Number(p.g)/255,Number(p.b)/255,Number(p.alpha)]);var T=[0,0,0,0];_ instanceof t.CSSRGB&&(T=[Number(_.r)/255,Number(_.g)/255,Number(_.b)/255,Number(_.alpha)]);var A=n.isInteractive()&&(null===(r=n.renderable3D)||void 0===r?void 0:r.encodedPickingColor)||[0,0,0],S=Ae(Te(),n.getWorldTransform()),C=[],O=[],I=[],N=f,x=function(e,t){for(var r=[],n=0;e.length>n;n++){var i=e[n],o=t[i.fontStack],a=o&&o[i.glyph];if(a){var s=a.rect;if(s){var u=a.metrics.advance*i.scale/2,c=[i.x+u,i.y],l=(a.metrics.left-4)*i.scale-u+c[0],f=(-a.metrics.top-4)*i.scale+c[1],h=l+s.w*i.scale,d=f+s.h*i.scale;r.push({tl:{x:l,y:f},tr:{x:h,y:f},bl:{x:l,y:d},br:{x:h,y:d},tex:s,glyphOffset:[0,0]})}}}return r}(this.glyphManager.layout(i,o,a,d,s,u,c),l.positions);return x.forEach((function(e){var t=[];t.push.apply(t,S);var r=[].concat(t,y,T,[E,v,g,m,"visible"===R?1:0,0,0,0],A,[n.sortable.renderOrder*Qn]);C.push.apply(C,r.concat(r,r,r)),O.push(e.tex.x,e.tex.y,e.tl.x,e.tl.y),O.push(e.tex.x+e.tex.w,e.tex.y,e.tr.x,e.tr.y),O.push(e.tex.x+e.tex.w,e.tex.y+e.tex.h,e.br.x,e.br.y),O.push(e.tex.x,e.tex.y+e.tex.h,e.bl.x,e.bl.y),I.push(0+N,2+N,1+N),I.push(2+N,0+N,3+N),N+=4})),{indexBuffer:I,charUVOffsetBuffer:O,charPackedBuffer:C,indicesOffset:N}},r}(si);u([t.inject(Vi)],Wi.prototype,"glyphManager",void 0),Wi=u([t.injectable()],Wi);var Xi=function(e){function r(){return e.apply(this,arguments)||this}fe(r,e);var n=r.prototype;return n.shouldMerge=function(r,n){var i=e.prototype.shouldMerge.call(this,r,n);return!!i&&(this.instance.nodeName!==t.Shape.MESH||this.instance.parsedStyle.material===r.parsedStyle.material&&this.instance.parsedStyle.geometry===r.parsedStyle.geometry)},n.updateAttribute=function(t,r,n,i){e.prototype.updateAttribute.call(this,t,r,n,i),this.updateBatchedAttribute(t,r,n,i)},n.createMaterial=function(e){this.material=this.instance.parsedStyle.material,this.observeMaterialChanged()},n.createGeometry=function(t){this.geometry=this.instance.parsedStyle.geometry,e.prototype.createGeometry.call(this,t),this.geometry.build(t),this.observeGeometryChanged()},r}(si);Xi=u([t.injectable()],Xi);var Hi=function(){function e(){}return e.prototype.update=function(e){return e.geometry.computeBoundingBox(),{width:0,height:0,depth:0}},e}();Hi=u([t.singleton({token:{token:t.GeometryAABBUpdater,named:t.Shape.MESH}})],Hi);var Yi=function(){function e(){this.counter=0,this.id2DisplayObjectMap={}}var t=e.prototype;return t.getId=function(e){var t=this.counter++;return this.id2DisplayObjectMap[t]=e,t},t.getById=function(e){return this.id2DisplayObjectMap[e]},t.reset=function(){this.counter=0,this.id2DisplayObjectMap={}},t.decodePickingColor=function(e){return e[0]+256*e[1]+65536*e[2]-1},t.encodePickingColor=function(e){return[e+1&255,e+1>>8&255,e+1>>8>>8&255]},e}();Yi=u([t.singleton()],Yi);var ji=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).meshes=[fi,Ii],t}fe(t,e);var r=t.prototype;return r.shouldSubmitRenderInst=function(e,t){if(0===t&&e.parsedStyle.fill.isNone)return!1;return 1!==t||this.needDrawStrokeSeparately(e)},r.needDrawStrokeSeparately=function(e){var t=e.parsedStyle,r=t.fill,n=t.stroke,i=t.lineDash,o=t.lineWidth,a=t.strokeOpacity,s=r&&!r.isNone,u=n&&!n.isNone,c=i&&i.length&&i.every((function(e){return 0!==e}));return!s||u&&o>0&&(1>a||c)},t}($n);ji=u([t.injectable({token:[{token:Kn,named:t.Shape.CIRCLE},{token:Kn,named:t.Shape.ELLIPSE}]})],ji);var Ki=function(e){function r(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).meshes=[Di,Ii,Ei],t}fe(r,e);var n=r.prototype;return n.shouldSubmitRenderInst=function(e,r){var n=e.parsedStyle,i=n.fill,o=n.stroke,a=n.opacity,s=n.strokeOpacity,u=n.lineDash,c=n.lineWidth,l=e.nodeName,f=o&&!o.isNone,h=u&&u.length&&u.every((function(e){return 0!==e})),d=this.isLine(e);if(e.renderable.proxyNodeName=d?t.Shape.LINE:null,0===r&&(e.nodeName===t.Shape.POLYLINE||i.isNone))return!1;if(1===r){if(d||0===s||0===a||0===c||!f)return!1;if(l===t.Shape.CIRCLE||l===t.Shape.ELLIPSE)return h}return 2!==r||d},n.isLine=function(e){if(e.nodeName===t.Shape.PATH){var r=e.parsedStyle.path.curve;if(2===r.length&&"M"===r[0][0]&&"C"===r[1][0]){var n=r[0],i=n[1],o=n[2],a=r[1],s=a[5],u=a[6],c=(i-s)/(o-u);return.01>(i-a[1])/(o-a[2])-c&&.01>(a[3]-s)/(a[4]-u)-c}}else if(e.nodeName===t.Shape.POLYLINE){for(var l=e.parsedStyle.points.points,f=(l[1][0]-l[1][1])/(l[0][0]-l[0][1]),h=1;l.length-1>h;h++)if((l[h+1][0]-l[h+1][1])/(l[h][0]-l[h][1])!==f)return!1;return!0}return!1},r}($n);Ki=u([t.injectable({token:[{token:Kn,named:t.Shape.POLYLINE},{token:Kn,named:t.Shape.PATH},{token:Kn,named:t.Shape.POLYGON},{token:Kn,named:t.Shape.RECT}]})],Ki);var zi=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).meshes=[],t}return fe(t,e),t.prototype.shouldSubmitRenderInst=function(e,t){return!0},t}($n);zi=u([t.injectable({token:[{token:Kn,named:t.Shape.GROUP}]})],zi);var qi=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).meshes=[Bi],t}return fe(t,e),t.prototype.shouldSubmitRenderInst=function(e,t){return!0},t}($n);qi=u([t.injectable({token:[{token:Kn,named:t.Shape.IMAGE}]})],qi);var Zi=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).meshes=[Wi,Wi],t}fe(t,e);var r=t.prototype;return r.shouldSubmitRenderInst=function(e,t){var r=e.parsedStyle;return!!(r.stroke&&r.lineWidth||0!==t)},r.beforeUploadUBO=function(e,t,r){var n;t.material.setUniforms(((n={})[ki.HAS_STROKE]=1-t.index,n))},t}($n);Zi=u([t.injectable({token:[{token:Kn,named:t.Shape.TEXT}]})],Zi);var Qi=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).meshes=[Ei],t}return fe(t,e),t.prototype.shouldSubmitRenderInst=function(e,t){return!0},t}($n);Qi=u([t.injectable({token:{token:Kn,named:t.Shape.LINE}})],Qi);var Ji=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).meshes=[Xi],t}return fe(t,e),t}($n);Ji=u([t.injectable({token:[{token:Kn,named:t.Shape.MESH}]})],Ji);var $i=t.Syringe.defineToken(""),eo=["style"],to=function(e){function t(r){var n=void 0===r?{}:r,i=n.style,o=de(n,eo);return e.call(this,le({type:t.tag,style:le({intensity:Math.PI},i)},o))||this}return fe(t,e),t}(t.DisplayObject);to.tag="light";var ro,no=["style"];!function(e){e[e.NONE=0]="NONE",e[e.EXP=1]="EXP",e[e.EXP2=2]="EXP2",e[e.LINEAR=3]="LINEAR"}(ro||(ro={}));var io,oo,ao=function(e){function t(r){var n=void 0===r?{}:r,i=n.style,o=de(n,no);return e.call(this,le({type:t.tag,style:le({type:ro.NONE,fill:"black",start:1,end:1e3,density:0},i)},o))||this}return fe(t,e),t}(t.DisplayObject);ao.tag="fog";var so;!function(e){e.PROJECTION_MATRIX="u_ProjectionMatrix",e.VIEW_MATRIX="u_ViewMatrix",e.CAMERA_POSITION="u_CameraPosition",e.DEVICE_PIXEL_RATIO="u_DevicePixelRatio",e.VIEWPORT="u_Viewport",e.IS_ORTHO="u_IsOrtho",e.IS_PICKING="u_IsPicking"}(so||(so={}));var uo,co,lo=(io=function(){function e(e,t,r,n,i,o,a,s,u){this.canvasConfig=void 0,this.contextService=void 0,this.renderingContext=void 0,this.camera=void 0,this.renderHelper=void 0,this.lightPool=void 0,this.texturePool=void 0,this.batchManager=void 0,this.deviceContribution=void 0,this.device=void 0,this.swapChain=void 0,this.renderLists={world:new Mn,picking:new Mn},this.builder=void 0,this.enableCapture=void 0,this.captureOptions=void 0,this.capturePromise=void 0,this.resolveCapturePromise=void 0,this.canvasConfig=e,this.contextService=t,this.renderingContext=r,this.camera=n,this.renderHelper=i,this.lightPool=o,this.texturePool=a,this.batchManager=s,this.deviceContribution=u}var r=e.prototype;return r.getDevice=function(){return this.device},r.getSwapChain=function(){return this.swapChain},r.getRenderLists=function(){return this.renderLists},r.apply=function(e){var r=this,n=function(e){var t=e.target;if(t.nodeName!==to.tag)if(t.nodeName!==ao.tag){var n=new ve;t.renderable3D=n,r.batchManager.add(t)}else r.lightPool.addFog(t);else r.lightPool.addLight(t)},i=function(e){var t=e.target;t.nodeName!==to.tag?t.nodeName!==ao.tag?(r.batchManager.remove(t),delete t.renderable3D):r.lightPool.removeFog(t):r.lightPool.removeLight(t)},o=function(e){r.batchManager.updateAttribute(e.target,e.attrName,e.newValue)},a=function(e){r.batchManager.updateAttribute(e.target,"modelMatrix",null)},s=function(e){r.batchManager.changeRenderOrder(e.target,e.detail.renderOrder)};e.hooks.init.tapPromise(oo.tag,se(oe().mark((function u(){var c,l;return oe().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return r.renderingContext.root.addEventListener(t.ElementEvent.MOUNTED,n),r.renderingContext.root.addEventListener(t.ElementEvent.UNMOUNTED,i),r.renderingContext.root.addEventListener(t.ElementEvent.ATTR_MODIFIED,o),r.renderingContext.root.addEventListener(t.ElementEvent.BOUNDS_CHANGED,a),r.renderingContext.root.addEventListener(t.ElementEvent.RENDER_ORDER_CHANGED,s),r.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering=!1,c=r.contextService.getDomElement(),r.contextService.resize((l=r.canvasConfig).width,l.height),u.next=11,r.deviceContribution.createSwapChain(c);case 11:r.swapChain=u.sent,r.device=r.swapChain.getDevice(),r.renderHelper.setDevice(r.device),r.renderHelper.renderInstManager.disableSimpleMode(),r.swapChain.configureSwapChain(c.width,c.height),r.renderingContext.root.ownerDocument.defaultView.addEventListener(t.CanvasEvent.RESIZE,(function(){r.swapChain.configureSwapChain(c.width,c.height)})),r.batchManager.attach(r.device,e);case 18:case"end":return u.stop()}}),u)})))),e.hooks.destroy.tap(oo.tag,(function(){r.renderHelper.destroy(),r.renderingContext.root.removeEventListener(t.ElementEvent.MOUNTED,n),r.renderingContext.root.removeEventListener(t.ElementEvent.UNMOUNTED,i),r.renderingContext.root.removeEventListener(t.ElementEvent.ATTR_MODIFIED,o),r.renderingContext.root.removeEventListener(t.ElementEvent.BOUNDS_CHANGED,a),r.renderingContext.root.removeEventListener(t.ElementEvent.RENDER_ORDER_CHANGED,s)})),e.hooks.beginFrame.tap(oo.tag,(function(){var e=r.swapChain.getCanvas(),n=r.renderHelper.renderInstManager;r.builder=r.renderHelper.renderGraph.newGraphBuilder();var i=t.parseColor(r.canvasConfig.background),o=r.canvasConfig.background?vt(Number(i.r)/255*Number(i.alpha),Number(i.g)/255*Number(i.alpha),Number(i.b)/255*Number(i.alpha),Number(i.alpha)):gt,a={backbufferWidth:e.width,backbufferHeight:e.height,antialiasingMode:Un.None},s=Wn(sn.Color0,a,Fn(o)),u=Wn(sn.DepthStencil,a,kn),c=r.builder.createRenderTargetID(s,"Main Color"),l=r.builder.createRenderTargetID(u,"Main Depth");r.builder.pushPass((function(e){e.setDebugName("Main Render Pass"),e.attachRenderTargetID(sn.Color0,c),e.attachRenderTargetID(sn.DepthStencil,l),e.exec((function(e){r.renderLists.world.drawOnPassRenderer(n.renderCache,e)}))})),r.builder.resolveRenderTargetToExternalTexture(c,r.swapChain.getOnscreenTexture())})),e.hooks.endFrame.tap(oo.tag,(function(){var e=r.renderHelper.renderInstManager,t=r.renderHelper.pushTemplateRenderInst();t.setBindingLayouts([{numUniformBuffers:2,numSamplers:0}]),t.setMegaStateFlags(Ht({depthWrite:!0,blendConstant:gt},{rgbBlendMode:be.Add,alphaBlendMode:be.Add,rgbBlendSrcFactor:Le.SrcAlpha,alphaBlendSrcFactor:Le.One,rgbBlendDstFactor:Le.OneMinusSrcAlpha,alphaBlendDstFactor:Le.OneMinusSrcAlpha}));var n=r.canvasConfig,i=n.width,o=n.height;if(t.setUniforms(0,[{name:so.PROJECTION_MATRIX,value:r.camera.getPerspective()},{name:so.VIEW_MATRIX,value:r.camera.getViewTransform()},{name:so.CAMERA_POSITION,value:r.camera.getPosition()},{name:so.DEVICE_PIXEL_RATIO,value:r.contextService.getDPR()},{name:so.VIEWPORT,value:[i,o]},{name:so.IS_ORTHO,value:r.camera.isOrtho()?1:0},{name:so.IS_PICKING,value:0}]),r.batchManager.render(r.renderLists.world),e.popTemplateRenderInst(),r.renderHelper.prepareToRender(),r.renderHelper.renderGraph.execute(),e.resetRenderInsts(),r.swapChain.present(),r.enableCapture&&r.resolveCapturePromise){var a=r.captureOptions,s=a.type,u=a.encoderOptions,c=r.contextService.getDomElement().toDataURL(s,u);r.resolveCapturePromise(c),r.enableCapture=!1,r.captureOptions=void 0,r.resolveCapturePromise=void 0}}))},r.loadTexture=function(e,t,r){return this.texturePool.getOrCreateTexture(this.device,e,t,(function(e){r&&r(e)}))},r.toDataURL=function(){var e=se(oe().mark((function e(t){var r=this;return oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.enableCapture=!0,this.captureOptions=t,this.capturePromise=new Promise((function(e){r.resolveCapturePromise=function(t){e(t)}})),e.abrupt("return",this.capturePromise);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),e}(),io.tag="RenderGraph",oo=io);lo=oo=u([t.singleton({contrib:t.RenderingPluginContribution}),c(0,t.inject(t.CanvasConfig)),c(1,t.inject(t.ContextService)),c(2,t.inject(t.RenderingContext)),c(3,t.inject(t.DefaultCamera)),c(4,t.inject(Ln)),c(5,t.inject(ge)),c(6,t.inject(Yn)),c(7,t.inject(Zn)),c(8,t.inject($i))],lo);var fo=(uo=function(){function e(e,t,r,n,i,o,a,s,u){this.canvasConfig=void 0,this.sceneGraphService=void 0,this.contextService=void 0,this.renderingContext=void 0,this.renderHelper=void 0,this.renderGraphPlugin=void 0,this.pickingIdGenerator=void 0,this.camera=void 0,this.batchManager=void 0,this.canvasConfig=e,this.sceneGraphService=t,this.contextService=r,this.renderingContext=n,this.renderHelper=i,this.renderGraphPlugin=o,this.pickingIdGenerator=a,this.camera=s,this.batchManager=u}var r=e.prototype;return r.apply=function(e){var r=this,n=function(e){var t=e.target,n=t.renderable3D;if(n){var i=r.pickingIdGenerator.getId(t);n.pickingId=i,n.encodedPickingColor=r.pickingIdGenerator.encodePickingColor(i)}};e.hooks.init.tapPromise(co.tag,se(oe().mark((function e(){return oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.renderingContext.root.addEventListener(t.ElementEvent.MOUNTED,n);case 1:case"end":return e.stop()}}),e)})))),e.hooks.destroy.tap(co.tag,(function(){r.renderingContext.root.removeEventListener(t.ElementEvent.MOUNTED,n)})),e.hooks.pickSync.tap(co.tag,(function(e){return e})),e.hooks.pick.tapPromise(co.tag,function(){var e=se(oe().mark((function e(n){var i,o,a,s,u,c,l,f,h;return oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.topmost,a=(o=n.position).viewportX,s=o.viewportY,u=r.contextService.getDPR(),l=r.canvasConfig.height*u,h=s*u,!((f=a*u)>(c=r.canvasConfig.width*u)||0>f||h>l||0>h)){e.next=10;break}return n.picked=[],e.abrupt("return",n);case 10:return e.next=12,r.pickByRectangleInDepth(new t.Rectangle(_(Math.round(f),0,c-1),_(Math.round(h),0,l-1),1,1),i?1:100);case 12:return n.picked=e.sent,e.abrupt("return",n);case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())},r.pickByRectangleInDepth=function(){var e=se(oe().mark((function e(t,r){var n,i,o;return oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:void 0===r&&(r=100),n=null,i=1,o=[];case 4:return e.next=6,this.pickByRectangle(t,n);case 6:if(!(n=e.sent)){e.next=12;break}i++,o.push(n),e.next=13;break;case 12:return e.abrupt("break",14);case 13:if(n&&r>=i){e.next=4;break}case 14:return r>1&&this.restorePickingColor(o),e.abrupt("return",o);case 16:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.restorePickingColor=function(e){var t=this;e.forEach((function(e){t.batchManager.updateAttribute(e,"pointerEvents",!0,!0)}))},r.pickByRectangle=function(e,t){var r=this,n=this.renderGraphPlugin.getDevice(),i=this.renderGraphPlugin.getRenderLists(),o=this.renderHelper.renderInstManager,a=this.renderHelper.renderGraph.newGraphBuilder(),s=e.x,u=e.y,c=e.width,l=e.height,f={backbufferWidth:c,backbufferHeight:l,antialiasingMode:Un.None},h=Wn(sn.Color0,f,Fn(gt)),d=a.createRenderTargetID(h,"Picking Color"),p=Wn(sn.DepthStencil,f,kn),_=a.createRenderTargetID(p,"Picking Depth"),E=le({},this.camera.getView());return new Promise((function(e){r.renderHelper.renderGraph.renderTargetDeadPool.forEach((function(e){e.age=-1})),a.pushPass((function(t){t.setDebugName("Picking Pass"),t.attachRenderTargetID(sn.Color0,d),t.attachRenderTargetID(sn.DepthStencil,_),t.exec((function(e){i.picking.drawOnPassRenderer(o.renderCache,e)})),t.post((function(t){var i=t.getRenderTargetTexture(sn.Color0),o=n.createReadback();E&&E.enabled?r.camera.setViewOffset(E.fullWidth,E.fullHeight,E.offsetX,E.offsetY,E.width,E.height):r.camera.clearViewOffset(),r.camera.setEnableUpdate(!0),o.readTexture(i,0,0,c,l,new Uint8Array(c*l*4)).then((function(t){var n,i=-1;if(!t||0===t[0]&&0===t[1]&&0===t[2]||(i=r.pickingIdGenerator.decodePickingColor(t)),i>-1){var a=r.pickingIdGenerator.getById(i);a&&a.isVisible()&&a.isInteractive()&&(n=a)}o.destroy(),e(n)}))}))}));var f=r.renderHelper.pushTemplateRenderInst();f.setBindingLayouts([{numUniformBuffers:2,numSamplers:0}]),f.setMegaStateFlags(Ht({depthWrite:!0},{rgbBlendMode:be.Add,rgbBlendSrcFactor:Le.One,rgbBlendDstFactor:Le.Zero,alphaBlendMode:be.Add,alphaBlendSrcFactor:Le.One,alphaBlendDstFactor:Le.Zero}));var h=r.canvasConfig,p=h.width,v=h.height,g=r.contextService.getDPR();r.camera.setEnableUpdate(!1),r.camera.setViewOffset(p*g,v*g,s,u,c,l),f.setUniforms(0,[{name:so.PROJECTION_MATRIX,value:r.camera.getPerspective()},{name:so.VIEW_MATRIX,value:r.camera.getViewTransform()},{name:so.CAMERA_POSITION,value:r.camera.getPosition()},{name:so.DEVICE_PIXEL_RATIO,value:r.contextService.getDPR()},{name:so.VIEWPORT,value:[p,v]},{name:so.IS_ORTHO,value:r.camera.isOrtho()?1:0},{name:so.IS_PICKING,value:1}]),t&&r.batchManager.updateAttribute(t,"pointerEvents",!1,!0),r.batchManager.render(i.picking,!0),o.popTemplateRenderInst(),r.renderHelper.prepareToRender(),r.renderHelper.renderGraph.execute(),o.resetRenderInsts()}))},e}(),uo.tag="WebGLPicker",co=uo);fo=co=u([t.singleton({contrib:t.RenderingPluginContribution}),c(0,t.inject(t.CanvasConfig)),c(1,t.inject(t.SceneGraphService)),c(2,t.inject(t.ContextService)),c(3,t.inject(t.RenderingContext)),c(4,t.inject(Ln)),c(5,t.inject(lo)),c(6,t.inject(Yi)),c(7,t.inject(t.DefaultCamera)),c(8,t.inject(Zn))],fo);var ho,po,_o,Eo="#define GLSLIFY 1\nlayout(location = 0) in vec2 a_Position;\n\nout vec2 v_TexCoord;\n\nvoid main() {\n v_TexCoord = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n\n #ifdef VIEWPORT_ORIGIN_TL\n v_TexCoord.y = 1.0 - v_TexCoord.y;\n #endif\n}",vo="#define GLSLIFY 1\nuniform sampler2D u_Texture;\nin vec2 v_TexCoord;\n\nout vec4 outputColor;\n\nvoid main() {\n outputColor = texture(SAMPLER_2D(u_Texture), v_TexCoord);\n}",go=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).vert=Eo,t.frag=vo,t.features={},t}return fe(t,e),t}(jr),mo="#define GLSLIFY 1\nuniform sampler2D u_Texture;\nin vec2 v_TexCoord;\n\nout vec4 outputColor;\n\nfloat MonochromeNTSC(vec3 t_Color) {\n // NTSC primaries.\n return dot(t_Color.rgb, vec3(0.299, 0.587, 0.114));\n}\n\nvec4 FXAA(PD_SAMPLER_2D(t_Texture), in vec2 t_PixelCenter, in vec2 t_InvResolution) {\n // FXAA v2, based on implementations:\n // http://www.geeks3d.com/20110405/fxaa-fast-approximate-anti-aliasing-demo-glsl-opengl-test-radeon-geforce/\n // https://github.com/mitsuhiko/webgl-meincraft\n\n float lumaMM = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy).rgb);\n\n #if 1\n vec2 t_PixelTopLeft = t_PixelCenter.xy - t_InvResolution.xy * 0.5;\n float lumaNW = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelTopLeft.xy) .rgb);\n float lumaNE = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelTopLeft.xy + vec2(1.0, 0.0)).rgb);\n float lumaSW = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelTopLeft.xy + vec2(0.0, 1.0)).rgb);\n float lumaSE = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelTopLeft.xy + vec2(1.0, 1.0)).rgb);\n #else\n // We're at the pixel center -- pixel edges are 0.5 units away.\n // NOTE(jstpierre): mitsuhiko's port seems to get this wrong?\n vec2 t_PixelSize = t_InvResolution.xy * 0.5;\n\n float lumaNW = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + t_PixelSize * vec2(-1.0, -1.0)).rgb);\n float lumaNE = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + t_PixelSize * vec2( 1.0, -1.0)).rgb);\n float lumaSW = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + t_PixelSize * vec2(-1.0, 1.0)).rgb);\n float lumaSE = MonochromeNTSC(texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + t_PixelSize * vec2( 1.0, 1.0)).rgb);\n #endif\n\n vec2 dir; \n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n const float FXAA_REDUCE_MIN = 1.0/128.0;\n const float FXAA_REDUCE_MUL = 1.0/8.0;\n const float FXAA_SPAN_MAX = 8.0;\n\n float dirReduce = max(\n (lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL),\n FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * u_InvResolution.xy;\n\n float lumaMin = min(lumaMM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaMM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n vec4 rgbA = (1.0/2.0) * (\n texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + dir * (1.0/3.0 - 0.5)) +\n texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + dir * (2.0/3.0 - 0.5)));\n vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (\n texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + dir * (0.0/3.0 - 0.5)) +\n texture(PU_SAMPLER_2D(t_Texture), t_PixelCenter.xy + dir * (3.0/3.0 - 0.5)));\n float lumaB = MonochromeNTSC(rgbB.rgb);\n\n vec4 rgbOutput = ((lumaB < lumaMin) || (lumaB > lumaMax)) ? rgbA : rgbB;\n return rgbOutput;\n}\n\nvoid main() {\n outputColor = FXAA(PP_SAMPLER_2D(u_Texture), v_TexCoord.xy, u_InvResolution.xy);\n}",Ro=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).features={},t.both="\nlayout(std140) uniform ub_Params {\n vec4 u_Misc[1];\n};\n#define u_InvResolution (u_Misc[0].xy)\n",t.vert=Eo,t.frag=mo,t}return fe(t,e),t}(jr),yo=Dt(1,(function(){return new Xn}));var To,Ao,So=t.Module((function(e){e(Ln),e(Yn),e(ge),e(Vi),e(Yi),e(Zn),e(lo),e(fo),e(fi),e(Ei),e(Ii),e(Di),e(Bi),e(Wi),e(Xi),e({token:zn,useFactory:function(e){return function(t){return e.container.isBound(t)&&e.container.get(t)||null}}}),e(ji),e(Ki),e(qi),e(Qi),e(Zi),e(Ji),e({token:jn,useFactory:function(e){var t={};return function(r){return t[r]||e.container.isBoundNamed(Kn,r)&&(t[r]=e.container.getNamed(Kn,r)),t[r]||null}}})})),Co=function(e){function r(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).name="device-renderer",t}fe(r,e);var n=r.prototype;return n.init=function(){t.GlobalContainer.isBound(Hi)||t.GlobalContainer.register(Hi),this.container.load(So,!0)},n.destroy=function(){t.GlobalContainer.isBound(Hi)&&t.GlobalContainer.remove(Hi),this.container.unload(So)},n.getDevice=function(){return this.container.get(lo).getDevice()},n.loadTexture=function(e,t,r){return this.container.get(lo).loadTexture(e,t,r)},n.toDataURL=function(e){return this.container.get(lo).toDataURL(e)},r}(t.AbstractRendererPlugin),Oo=Object.freeze({__proto__:null,get AntialiasingMode(){return Un},get Batch(){return $n},get BlendFactor(){return Le},get BlendMode(){return be},get BufferFrequencyHint(){return Ve},BufferGeometry:Ur,get BufferUsage(){return ke},get ChannelWriteMask(){return je},get ClipSpaceNearZ(){return Ze},get CompareMode(){return Me},CopyProgram:go,get CullMode(){return Be},DeviceContribution:$i,DeviceProgram:jr,DynamicUniformBuffer:Kr,get Endianness(){return Yt},FILL_TEXTURE_MAPPING:ai,get FillMesh(){return Di},Fog:ao,get FogType(){return ro},get Format(){return tt},get FormatCompFlags(){return $e},get FormatFlags(){return et},get FormatTypeFlags(){return Je},get FrontFaceMode(){return De},get GL(){return rt},get GeometryEvent(){return Br},HashMap:Jr,IdentityViewportCoords:ln,get ImageMesh(){return Bi},get Instanced(){return si},get InstancedLineMesh(){return Ei},IsDepthReversed:Tt,get JOINT_TYPE(){return Ti},Light:to,get LineMesh(){return Ii},Material:Hr,get MaterialEvent(){return Fr},Mesh:Re,get MeshMesh(){return Xi},get MipFilterMode(){return we},OpaqueBlack:mt,OpaqueWhite:yt,Plugin:Co,get PrimitiveTopology(){return Ge},get QueryPoolType(){return Qe},get RGAttachmentSlot(){return sn},RenderCache:un,get RenderGraphPlugin(){return lo},get RenderHelper(){return Ln},RenderInst:xn,get RenderInstExecutionOrder(){return Nn},get RenderInstFlags(){return Cn},RenderInstList:Mn,RenderInstManager:Bn,Renderable3D:ve,get RendererLayer(){return pn},get ResourceType(){return Pe},get SDFMesh(){return fi},get SamplerFormatKind(){return ze},ShaderMaterial:Yr,SingleSampledTexture:dn,get StencilOp(){return Ke},TemporalTexture:Hn,get TexFilterMode(){return Ue},get TextMesh(){return Wi},get TextUniform(){return ki},get TextureDimension(){return He},get TextureEvent(){return Xe},TextureMapping:Xn,get TexturePool(){return Yn},get TextureUsage(){return Ye},TransparentBlack:gt,TransparentWhite:Rt,UNIFORM_SETTERS:Lr,get Uniform(){return Oi},get VertexAttributeBufferIndex(){return ri},get VertexAttributeLocation(){return ni},get VertexBufferFrequency(){return We},get ViewportOrigin(){return qe},get WrapMode(){return Fe},align:It,alignNonPowerOfTwo:Nt,arrayCopy:zt,arrayEqual:Kt,assert:ht,assertExists:dt,bindingLayoutDescriptorCopy:hr,bindingLayoutDescriptorEqual:Qt,bindingLayoutSamplerDescriptorCopy:fr,bindingsDescriptorCopy:lr,bindingsDescriptorEquals:Jt,bisectRight:xt,bufferBindingCopy:cr,colorCopy:_t,colorEqual:pt,colorNewCopy:Et,colorNewFromRGBA:vt,compareDefines:ti,compareDepthValues:function(e,t,r,n){if(void 0===n&&(n=Tt),(r=At(r,n))===Me.Less)return t>e;if(r===Me.LessEqual)return t>=e;if(r===Me.Greater)return e>t;if(r===Me.GreaterEqual)return e>=t;throw new Error("whoops")},containerModule:So,copyAttachmentState:bt,copyAttachmentStateFromSimple:Gt,copyMegaState:wt,defaultBindingLayoutSamplerDescriptor:jt,defaultMegaState:Vt,definedProps:ii,enumToObject:ei,fallbackUndefined:St,fillArray:Ot,fillColor:function(e,t,r,n){return void 0===n&&(n=r.a),e[t+0]=r.r,e[t+1]=r.g,e[t+2]=r.b,e[t+3]=n,4},fillMatrix4x4:function(e,t,r){return e[t+0]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],16},fillVec3v:function(e,t,r,n){return void 0===n&&(n=0),e[t+0]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=n,4},fillVec4:In,fillVec4v:function(e,t,r){return e[t+0]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],4},fullscreenMegaState:Xt,getAttributeLocations:function(e,t){var r=[];return e.replace(/^\s*layout\(location\s*=\s*(\S*)\)\s*in\s+\S+\s*(.*);$/gm,(function(e,n,i){var o=Number(n);return r.push({location:isNaN(o)?t[n]:o,name:i}),""})),r},getDefines:function(e){var t={};return e.replace(/^\s*#define\s*(\S*)\s*(\S*)\s*$/gm,(function(e,r,n){var i=Number(n);return t[r]=isNaN(i)?n:i,""})),t},getFormatByteSize:function(e){return ct(st(e))*at(e)},getFormatCompByteSize:lt,getFormatCompFlags:at,getFormatCompFlagsComponentCount:it,getFormatComponentCount:function(e){return at(e)},getFormatFlags:ut,getFormatSamplerKind:ft,getFormatTypeFlags:st,getFormatTypeFlagsByteSize:ct,getSortKeyDepth:function(e){return!!(e>>>31&1)?e>>>8&65535:e>>>8&65532|3&e},getSortKeyLayer:function(e){return e>>>24&255},getSystemEndianness:function(){return mr},getUniformSetter:function(e,t,r){var n=Lr[r.type];if(!n)throw new Error("Unknown GLSL uniform type "+r.type);return n().bind(null,e,t)},getUniforms:kr,hashCodeNumberFinish:qr,hashCodeNumberUpdate:zr,inputLayoutBufferDescriptorCopy:_r,inputLayoutBufferDescriptorEquals:or,inputLayoutDescriptorCopy:Er,inputLayoutDescriptorEquals:ar,isPowerOfTwo:function(e){return e&&0==(e&e-1)},leftPad:Bt,makeAttachmentClearDescriptor:Fn,makeBackbufferDescSimple:Wn,makeDepthKey:vn,makeFormat:ot,makeMegaState:Wt,makeSortKey:function(e,t){return void 0===t&&(t=0),e&pn.TRANSLUCENT?Tn(e):Rn(e,t)},makeSortKeyOpaque:Rn,makeSortKeyTranslucent:Tn,makeStaticDataBuffer:br,makeTextureDescriptor2D:nt,nArray:Dt,nullHashFunc:Zr,nullify:Ct,opaqueBlackFullClearRenderPassDescriptor:Gn,opaqueWhiteFullClearRenderPassDescriptor:kn,parseUniformName:function(e){if("]"!==e[e.length-1])return{name:e,length:1,isArray:!1};var t=e.match(Rr);if(!t||2>t.length)throw new Error("Failed to parse GLSL uniform name "+e);return{name:t[1],length:Number(t[2])||1,isArray:Boolean(t[2])}},prependLineNo:function(e,t){return void 0===t&&(t=1),e.split("\n").map((function(e,r){return Bt(""+(t+r),4," ")+" "+e})).join("\n")},preprocessProgramObj_GLSL:Xr,preprocessProgram_GLSL:Wr,preprocessShader_GLSL:Vr,projectionMatrixConvertClipSpaceNearZ:function(e,t,r){t!==r&&(t===Ze.NegativeOne?function(e){Oe(e,Sn,e)}(e):t===Ze.Zero&&function(e){Oe(e,On,e)}(e))},pushFXAAPass:function(e,t,r,n){e.pushPass((function(i){i.setDebugName("FXAA"),i.attachRenderTargetID(sn.Color0,n);var o=e.resolveRenderTarget(n);i.attachResolveTexture(o);var a=t.renderInstManager.newRenderInst();a.setUniformBuffer(t.uniformBuffer),a.setAllowSkippingIfPipelineNotReady(!1),a.setMegaStateFlags(Xt),a.setBindingLayouts([{numUniformBuffers:1,numSamplers:1}]),a.drawPrimitives(3);var s=a.allocateUniformBuffer(0,4);In(a.mapUniformBufferF32(0),s,1/r.backbufferWidth,1/r.backbufferHeight);var u=new Ro,c=t.renderCache.createProgram(u);a.setProgram(c),ho||((ho=new Ur(t.getDevice())).setVertexBuffer({bufferIndex:0,byteStride:8,frequency:We.PerVertex,attributes:[{format:tt.F32_RG,bufferByteOffset:0,location:0}],data:new Float32Array([-4,-4,4,-4,0,4])}),ho.vertexCount=3,_o=t.getCache().createInputLayout(ho.inputLayoutDescriptor),po=t.getDevice().createInputState(_o,ho.vertexBuffers.map((function(e){return{buffer:e,byteOffset:0}})),null,c)),i.exec((function(e,r){yo[0].texture=r.getResolveTextureForID(o),a.setSamplerBindingsFromTextureMappings(yo),a.setInputLayoutAndState(_o,po),a.drawOnPass(t.renderCache,e)}))}))},range:function(e,t){for(var r=[],n=e;e+t>n;n++)r.push(n);return r},renderInstCompareNone:null,renderInstCompareSortKey:Pn,renderPipelineDescriptorCopy:dr,renderPipelineDescriptorEquals:nr,reverseDepthForClearValue:function(e,t){return void 0===t&&(t=Tt),t?1-e:e},reverseDepthForCompareMode:At,reverseDepthForDepthOffset:function(e,t){return void 0===t&&(t=Tt),t?-e:e},reverseDepthForOrthographicProjectionMatrix:function(e,t){void 0===t&&(t=Tt),t&&(e[10]=-e[10],e[14]=1-e[14])},reverseDepthForPerspectiveProjectionMatrix:function(e,t){void 0===t&&(t=Tt),t&&(e[10]=-e[10],e[14]=-e[14])},samplerBindingCopy:ur,samplerBindingNew:function(){return{sampler:null,texture:null,lateBinding:null}},samplerDescriptorEquals:sr,segmentInstanceGeometry:pi,setAttachmentStateSimple:Ht,setBackbufferDescSimple:Vn,setBitFlagEnabled:Mt,setFormatComponentCount:function(e,t){return 4294902015&e|t<<8},setFormatFlags:function(e,t){return 4294967040&e|t},setMegaStateFlags:Ut,setSortKeyBias:function(e,t){return!!(e>>>31&1)?(4294967040&e|255&t)>>>0:e},setSortKeyDepth:function(e,t,r){void 0===r&&(r=65536);var n=!!(e>>>31&1),i=vn(t,n,r);return n?An(e,i):yn(e,i)},setSortKeyDepthKey:function(e,t){return!!(e>>>31&1)?An(e,t):yn(e,t)},setSortKeyLayer:gn,setSortKeyOpaqueDepth:yn,setSortKeyProgramKey:mn,setSortKeyTranslucentDepth:An,spliceBisectRight:Pt,standardFullClearRenderPassDescriptor:wn,updateBuffer:Pi,vertexAttributeDescriptorCopy:pr,vertexAttributeDescriptorEquals:ir});function Io(){
8
8
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
9
- bo=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=Object.create((t&&t.prototype instanceof f?t:f).prototype),o=new A(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return C()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=R(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function h(){}function d(){}var p={};s(p,i,(function(){return this}));var _=Object.getPrototypeOf,v=_&&_(_(S([])));v&&v!==t&&r.call(v,i)&&(p=v);var E=d.prototype=f.prototype=Object.create(p);function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){function n(i,o,a,s){var u=c(e[i],e,o);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function R(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return h.prototype=d,s(E,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(E),e},e.awrap=function(e){return{__await:e}},g(m.prototype),s(m.prototype,o,(function(){return this})),e.AsyncIterator=m,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new m(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(E),s(E,a,"Generator"),s(E,i,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=S,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(this.prev>=o.tryLoc){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(o.catchLoc>this.prev)return n(o.catchLoc,!0);if(o.finallyLoc>this.prev)return n(o.finallyLoc)}else if(s){if(o.catchLoc>this.prev)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(this.prev>=i.tryLoc&&r.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function Fo(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function Uo(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Fo(o,n,i,a,s,"next",e)}function s(e){Fo(o,n,i,a,s,"throw",e)}a(void 0)}))}}function wo(e,t){return wo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},wo(e,t)}var Go=(Po=function(){function e(e,t){this.contextService=void 0,this.renderingContext=void 0,this.contextService=e,this.renderingContext=t}return e.prototype.apply=function(e){var t=this,r=this.renderingContext.root.ownerDocument.defaultView,n=function(t){e.hooks.pointerMove.call(t)},i=function(t){e.hooks.pointerUp.call(t)},o=function(t){e.hooks.pointerDown.call(t)},a=function(t){e.hooks.pointerOver.call(t)},s=function(t){e.hooks.pointerOut.call(t)},u=function(t){e.hooks.pointerCancel.call(t)},c=function(t){e.hooks.pointerWheel.call(t)},l=function(e){globalThis.document.addEventListener("pointermove",n,!0),e.addEventListener("pointerdown",o,!0),e.addEventListener("pointerleave",s,!0),e.addEventListener("pointerover",a,!0),globalThis.addEventListener("pointerup",i,!0)},f=function(e){e.addEventListener("touchstart",o,!0),e.addEventListener("touchend",i,!0),e.addEventListener("touchmove",n,!0),e.addEventListener("touchcancel",u,!0)},h=function(e){globalThis.document.addEventListener("mousemove",n,!0),e.addEventListener("mousedown",o,!0),e.addEventListener("mouseout",s,!0),e.addEventListener("mouseover",a,!0),globalThis.addEventListener("mouseup",i,!0)};e.hooks.init.tapPromise(Mo.tag,Uo(bo().mark((function e(){var n;return bo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.contextService.getDomElement(),globalThis.navigator.msPointerEnabled?(n.style.msContentZooming="none",n.style.msTouchAction="none"):r.supportsPointerEvents&&(n.style.touchAction="none"),r.supportsPointerEvents?l(n):h(n),r.supportsTouchEvents&&f(n),n.addEventListener("wheel",c,{passive:!0,capture:!0});case 5:case"end":return e.stop()}}),e)})))),e.hooks.destroy.tap(Mo.tag,(function(){var e=t.contextService.getDomElement();globalThis.navigator.msPointerEnabled?(e.style.msContentZooming="",e.style.msTouchAction=""):r.supportsPointerEvents&&(e.style.touchAction=""),r.supportsPointerEvents?function(e){globalThis.document.removeEventListener("pointermove",n,!0),e.removeEventListener("pointerdown",o,!0),e.removeEventListener("pointerleave",s,!0),e.removeEventListener("pointerover",a,!0),globalThis.removeEventListener("pointerup",i,!0)}(e):function(e){globalThis.document.removeEventListener("mousemove",n,!0),e.removeEventListener("mousedown",o,!0),e.removeEventListener("mouseout",s,!0),e.removeEventListener("mouseover",a,!0),globalThis.removeEventListener("mouseup",i,!0)}(e),r.supportsTouchEvents&&function(e){e.removeEventListener("touchstart",o,!0),e.removeEventListener("touchend",i,!0),e.removeEventListener("touchmove",n,!0),e.removeEventListener("touchcancel",u,!0)}(e),e.removeEventListener("wheel",c,!0)}))},e}(),Po.tag="DOMInteraction",Mo=Po);Go=Mo=u([t.singleton({contrib:t.RenderingPluginContribution}),c(0,t.inject(t.ContextService)),c(1,t.inject(t.RenderingContext))],Go);var ko=t.Module((function(e){e(Go)})),Vo=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).name="dom-interaction",t}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,wo(t,r);var i=n.prototype;return i.init=function(){this.container.load(ko,!0)},i.destroy=function(){this.container.unload(ko)},n}(t.AbstractRendererPlugin),Wo=Object.freeze({__proto__:null,Plugin:Vo});function Xo(){
9
+ Io=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=Object.create((t&&t.prototype instanceof f?t:f).prototype),o=new A(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return C()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=R(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function h(){}function d(){}var p={};s(p,i,(function(){return this}));var _=Object.getPrototypeOf,E=_&&_(_(S([])));E&&E!==t&&r.call(E,i)&&(p=E);var v=d.prototype=f.prototype=Object.create(p);function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){function n(i,o,a,s){var u=c(e[i],e,o);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function R(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return h.prototype=d,s(v,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(m.prototype),s(m.prototype,o,(function(){return this})),e.AsyncIterator=m,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new m(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(v),s(v,a,"Generator"),s(v,i,(function(){return this})),s(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=S,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(this.prev>=o.tryLoc){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(o.catchLoc>this.prev)return n(o.catchLoc,!0);if(o.finallyLoc>this.prev)return n(o.finallyLoc)}else if(s){if(o.catchLoc>this.prev)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(this.prev>=i.tryLoc&&r.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function No(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function xo(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){No(o,n,i,a,s,"next",e)}function s(e){No(o,n,i,a,s,"throw",e)}a(void 0)}))}}function Po(e,t){return Po=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Po(e,t)}var Mo=(To=function(){function e(e,t){this.contextService=void 0,this.renderingContext=void 0,this.contextService=e,this.renderingContext=t}return e.prototype.apply=function(e){var t=this,r=this.renderingContext.root.ownerDocument.defaultView,n=function(t){e.hooks.pointerMove.call(t)},i=function(t){e.hooks.pointerUp.call(t)},o=function(t){e.hooks.pointerDown.call(t)},a=function(t){e.hooks.pointerOver.call(t)},s=function(t){e.hooks.pointerOut.call(t)},u=function(t){e.hooks.pointerCancel.call(t)},c=function(t){e.hooks.pointerWheel.call(t)},l=function(e){globalThis.document.addEventListener("pointermove",n,!0),e.addEventListener("pointerdown",o,!0),e.addEventListener("pointerleave",s,!0),e.addEventListener("pointerover",a,!0),globalThis.addEventListener("pointerup",i,!0)},f=function(e){e.addEventListener("touchstart",o,!0),e.addEventListener("touchend",i,!0),e.addEventListener("touchmove",n,!0),e.addEventListener("touchcancel",u,!0)},h=function(e){globalThis.document.addEventListener("mousemove",n,!0),e.addEventListener("mousedown",o,!0),e.addEventListener("mouseout",s,!0),e.addEventListener("mouseover",a,!0),globalThis.addEventListener("mouseup",i,!0)};e.hooks.init.tapPromise(Ao.tag,xo(Io().mark((function e(){var n;return Io().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.contextService.getDomElement(),globalThis.navigator.msPointerEnabled?(n.style.msContentZooming="none",n.style.msTouchAction="none"):r.supportsPointerEvents&&(n.style.touchAction="none"),r.supportsPointerEvents?l(n):h(n),r.supportsTouchEvents&&f(n),n.addEventListener("wheel",c,{passive:!0,capture:!0});case 5:case"end":return e.stop()}}),e)})))),e.hooks.destroy.tap(Ao.tag,(function(){var e=t.contextService.getDomElement();globalThis.navigator.msPointerEnabled?(e.style.msContentZooming="",e.style.msTouchAction=""):r.supportsPointerEvents&&(e.style.touchAction=""),r.supportsPointerEvents?function(e){globalThis.document.removeEventListener("pointermove",n,!0),e.removeEventListener("pointerdown",o,!0),e.removeEventListener("pointerleave",s,!0),e.removeEventListener("pointerover",a,!0),globalThis.removeEventListener("pointerup",i,!0)}(e):function(e){globalThis.document.removeEventListener("mousemove",n,!0),e.removeEventListener("mousedown",o,!0),e.removeEventListener("mouseout",s,!0),e.removeEventListener("mouseover",a,!0),globalThis.removeEventListener("mouseup",i,!0)}(e),r.supportsTouchEvents&&function(e){e.removeEventListener("touchstart",o,!0),e.removeEventListener("touchend",i,!0),e.removeEventListener("touchmove",n,!0),e.removeEventListener("touchcancel",u,!0)}(e),e.removeEventListener("wheel",c,!0)}))},e}(),To.tag="DOMInteraction",Ao=To);Mo=Ao=u([t.singleton({contrib:t.RenderingPluginContribution}),c(0,t.inject(t.ContextService)),c(1,t.inject(t.RenderingContext))],Mo);var Do,Bo,Lo=t.Module((function(e){e(Mo)})),bo=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).name="dom-interaction",t}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,Po(t,r);var i=n.prototype;return i.init=function(){this.container.load(Lo,!0)},i.destroy=function(){this.container.unload(Lo)},n}(t.AbstractRendererPlugin),Fo=Object.freeze({__proto__:null,Plugin:bo});function Uo(){
10
10
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
11
- Xo=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=Object.create((t&&t.prototype instanceof f?t:f).prototype),o=new A(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return C()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=R(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function h(){}function d(){}var p={};s(p,i,(function(){return this}));var _=Object.getPrototypeOf,v=_&&_(_(S([])));v&&v!==t&&r.call(v,i)&&(p=v);var E=d.prototype=f.prototype=Object.create(p);function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){function n(i,o,a,s){var u=c(e[i],e,o);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function R(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return h.prototype=d,s(E,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(E),e},e.awrap=function(e){return{__await:e}},g(m.prototype),s(m.prototype,o,(function(){return this})),e.AsyncIterator=m,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new m(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(E),s(E,a,"Generator"),s(E,i,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=S,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(this.prev>=o.tryLoc){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(o.catchLoc>this.prev)return n(o.catchLoc,!0);if(o.finallyLoc>this.prev)return n(o.finallyLoc)}else if(s){if(o.catchLoc>this.prev)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(this.prev>=i.tryLoc&&r.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function Ho(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function jo(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Ho(o,n,i,a,s,"next",e)}function s(e){Ho(o,n,i,a,s,"throw",e)}a(void 0)}))}}function Yo(e,t){return Yo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Yo(e,t)}var Ko={}.toString,zo=function(e,t){return Ko.call(e)==="[object "+t+"]"},qo=function(e){return zo(e,"Function")};function Zo(e,t){var r;if(e)if(r=e,Array.isArray?Array.isArray(r):zo(r,"Array"))for(var n=0,i=e.length;i>n&&!1!==t(e[n],n);n++);else if(function(e){var t=typeof e;return null!==e&&"object"===t||"function"===t}(e))for(var o in e)if(e.hasOwnProperty(o)&&!1===t(e[o],o))break}var Qo,Jo,$o,ea=function(e){return zo(e,"String")},ta=Object.values?function(e){return Object.values(e)}:function(e){var t=[];return Zo(e,(function(r,n){qo(e)&&"prototype"===n||t.push(r)})),t};!function(e,t){if(!qo(e))throw new TypeError("Expected a function");var r=function r(){for(var n=[],i=0;arguments.length>i;i++)n[i]=arguments[i];var o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var s=e.apply(this,n);return a.set(o,s),s};r.cache=new Map}((function(e,t){void 0===t&&(t={});var r=t.fontSize,n=t.fontFamily,i=t.fontWeight,o=t.fontStyle,a=t.fontVariant;return Qo||(Qo=document.createElement("canvas").getContext("2d")),Qo.font=[o,a,i,r+"px",n].join(" "),Qo.measureText(ea(e)?e:"").width}),(function(e,t){return void 0===t&&(t={}),l([e],ta(t)).join("")}));var ra=(Jo=function(){function e(e,t,r){this.contextService=void 0,this.renderingContext=void 0,this.canvasConfig=void 0,this.$camera=void 0,this.contextService=e,this.renderingContext=t,this.canvasConfig=r}var r=e.prototype;return r.apply=function(e){var r=this,n=function(e,t){var r=e.getWorldTransform();t.style.transform="matrix("+[r[0],r[1],r[4],r[5],r[12],r[13]].join(",")+")"},i=function(e){var i=e.target;if(i.nodeName===t.Shape.HTML){var o=r.getOrCreateEl(i),a=i.ownerDocument.documentElement.attributes;Object.keys(a).forEach((function(e){o.style[e]=a[e]})),Object.keys(i.attributes).forEach((function(e){r.updateAttribute(e,i)})),n(i,o)}},o=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){var i=r.getId(n),o=r.contextService.getDomElement().parentNode;if(o){var a=o.querySelector("#"+i);a&&o.removeChild(a)}}},a=function(e){var n=e.target;n.nodeName===t.Shape.HTML&&r.updateAttribute(e.attrName,n)},s=function(e){var i=e.target;if(i.nodeName===t.Shape.HTML){var o=r.getOrCreateEl(i);n(i,o)}};e.hooks.init.tapPromise($o.tag,jo(Xo().mark((function e(){return Xo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.renderingContext.root.addEventListener(t.ElementEvent.MOUNTED,i),r.renderingContext.root.addEventListener(t.ElementEvent.UNMOUNTED,o),r.renderingContext.root.addEventListener(t.ElementEvent.ATTR_MODIFIED,a),r.renderingContext.root.addEventListener(t.ElementEvent.BOUNDS_CHANGED,s);case 4:case"end":return e.stop()}}),e)})))),e.hooks.destroy.tap($o.tag,(function(){r.renderingContext.root.removeEventListener(t.ElementEvent.MOUNTED,i),r.renderingContext.root.removeEventListener(t.ElementEvent.UNMOUNTED,o),r.renderingContext.root.removeEventListener(t.ElementEvent.ATTR_MODIFIED,a),r.renderingContext.root.removeEventListener(t.ElementEvent.BOUNDS_CHANGED,s)}))},r.getId=function(e){return e.id||"g-html-"+e.entity},r.getOrCreateEl=function(e){var t=this.canvasConfig.document,r=this.getId(e),n=this.contextService.getDomElement(),i=n.parentNode;if(i){var o=i.querySelector("#"+r);if(!o){o=(t||document).createElement("div"),e.parsedStyle.$el=o,o.id=r,e.name&&o.setAttribute("name",e.name),e.className&&(o.className=e.className),i.appendChild(o),o.style.position="absolute",o.style.left=(n.offsetLeft||0)+"px",o.style.top=(n.offsetTop||0)+"px",o.style["will-change"]="transform";var a=e.getWorldTransform();o.style.transform="matrix("+[a[0],a[1],a[4],a[5],a[12],a[13]].join(",")+")"}return o}return null},r.updateAttribute=function(e,r){var n=this.getOrCreateEl(r);switch(e){case"innerHTML":var i=r.parsedStyle.innerHTML;ea(i)?n.innerHTML=i:(n.innerHTML="",n.appendChild(i));break;case"transformOrigin":var o=r.parsedStyle.transformOrigin;n.style["transform-origin"]=o[0].value+" "+o[1].value;break;case"width":var a=r.computedStyleMap().get("width");n.style.width=a.toString();break;case"height":var s=r.computedStyleMap().get("height");n.style.height=s.toString();break;case"zIndex":n.style["z-index"]=""+r.parsedStyle.zIndex;break;case"visibility":n.style.visibility=r.parsedStyle.visibility;break;case"pointerEvents":n.style.pointerEvents=r.parsedStyle.pointerEvents;break;case"opacity":n.style.opacity=""+r.parsedStyle.opacity;break;case"fill":var u=r.parsedStyle.fill,c="";u instanceof t.CSSRGB?c=u.isNone?"transparent":r.getAttribute("fill"):Array.isArray(u)?c=r.getAttribute("fill"):t.isPattern(u),n.style.background=c;break;case"stroke":var l=r.parsedStyle.stroke,f="";l instanceof t.CSSRGB?f=l.isNone?"transparent":r.getAttribute("stroke"):Array.isArray(l)?f=r.getAttribute("stroke"):t.isPattern(l),n.style["border-color"]=f,n.style["border-style"]="solid";break;case"lineWidth":n.style["border-width"]=(r.parsedStyle.lineWidth||0)+"px";break;case"lineDash":n.style["border-style"]="dashed";break;case"filter":n.style.filter=r.style.filter}},e}(),Jo.tag="HTMLRendering",$o=Jo);ra=$o=u([t.singleton({contrib:t.RenderingPluginContribution}),c(0,t.inject(t.ContextService)),c(1,t.inject(t.RenderingContext)),c(2,t.inject(t.CanvasConfig))],ra);var na=t.Module((function(e){e(ra)})),ia=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).name="html-renderer",t}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,Yo(t,r);var i=n.prototype;return i.init=function(){this.container.load(na,!0)},i.destroy=function(){this.container.unload(na)},n}(t.AbstractRendererPlugin),oa=Object.freeze({__proto__:null,Plugin:ia});function aa(){
11
+ Uo=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=Object.create((t&&t.prototype instanceof f?t:f).prototype),o=new A(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return C()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=R(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function h(){}function d(){}var p={};s(p,i,(function(){return this}));var _=Object.getPrototypeOf,E=_&&_(_(S([])));E&&E!==t&&r.call(E,i)&&(p=E);var v=d.prototype=f.prototype=Object.create(p);function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){function n(i,o,a,s){var u=c(e[i],e,o);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function R(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return h.prototype=d,s(v,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(m.prototype),s(m.prototype,o,(function(){return this})),e.AsyncIterator=m,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new m(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(v),s(v,a,"Generator"),s(v,i,(function(){return this})),s(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=S,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(this.prev>=o.tryLoc){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(o.catchLoc>this.prev)return n(o.catchLoc,!0);if(o.finallyLoc>this.prev)return n(o.finallyLoc)}else if(s){if(o.catchLoc>this.prev)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(this.prev>=i.tryLoc&&r.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function wo(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function Go(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){wo(o,n,i,a,s,"next",e)}function s(e){wo(o,n,i,a,s,"throw",e)}a(void 0)}))}}function ko(e,t){return ko=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ko(e,t)}var Vo=(Do=function(){function e(e,t,r){this.contextService=void 0,this.renderingContext=void 0,this.canvasConfig=void 0,this.$camera=void 0,this.contextService=e,this.renderingContext=t,this.canvasConfig=r}var r=e.prototype;return r.apply=function(e){var r=this,n=function(e,t){var r=e.getWorldTransform();t.style.transform="matrix("+[r[0],r[1],r[4],r[5],r[12],r[13]].join(",")+")"},i=function(e){var i=e.target;if(i.nodeName===t.Shape.HTML){var o=r.getOrCreateEl(i),a=i.ownerDocument.documentElement.attributes;Object.keys(a).forEach((function(e){o.style[e]=a[e]})),Object.keys(i.attributes).forEach((function(e){r.updateAttribute(e,i)})),n(i,o)}},o=function(e){var n=e.target;if(n.nodeName===t.Shape.HTML){var i=r.getId(n),o=r.contextService.getDomElement().parentNode;if(o){var a=o.querySelector("#"+i);a&&o.removeChild(a)}}},a=function(e){var n=e.target;n.nodeName===t.Shape.HTML&&r.updateAttribute(e.attrName,n)},s=function(e){var i=e.target;if(i.nodeName===t.Shape.HTML){var o=r.getOrCreateEl(i);n(i,o)}};e.hooks.init.tapPromise(Bo.tag,Go(Uo().mark((function e(){return Uo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.renderingContext.root.addEventListener(t.ElementEvent.MOUNTED,i),r.renderingContext.root.addEventListener(t.ElementEvent.UNMOUNTED,o),r.renderingContext.root.addEventListener(t.ElementEvent.ATTR_MODIFIED,a),r.renderingContext.root.addEventListener(t.ElementEvent.BOUNDS_CHANGED,s);case 4:case"end":return e.stop()}}),e)})))),e.hooks.destroy.tap(Bo.tag,(function(){r.renderingContext.root.removeEventListener(t.ElementEvent.MOUNTED,i),r.renderingContext.root.removeEventListener(t.ElementEvent.UNMOUNTED,o),r.renderingContext.root.removeEventListener(t.ElementEvent.ATTR_MODIFIED,a),r.renderingContext.root.removeEventListener(t.ElementEvent.BOUNDS_CHANGED,s)}))},r.getId=function(e){return e.id||"g-html-"+e.entity},r.getOrCreateEl=function(e){var t=this.canvasConfig.document,r=this.getId(e),n=this.contextService.getDomElement(),i=n.parentNode;if(i){var o=i.querySelector("#"+r);if(!o){o=(t||document).createElement("div"),e.parsedStyle.$el=o,o.id=r,e.name&&o.setAttribute("name",e.name),e.className&&(o.className=e.className),i.appendChild(o),o.style.position="absolute",o.style.left=(n.offsetLeft||0)+"px",o.style.top=(n.offsetTop||0)+"px",o.style["will-change"]="transform";var a=e.getWorldTransform();o.style.transform="matrix("+[a[0],a[1],a[4],a[5],a[12],a[13]].join(",")+")"}return o}return null},r.updateAttribute=function(e,r){var n=this.getOrCreateEl(r);switch(e){case"innerHTML":var i=r.parsedStyle.innerHTML;p(i)?n.innerHTML=i:(n.innerHTML="",n.appendChild(i));break;case"transformOrigin":var o=r.parsedStyle.transformOrigin;n.style["transform-origin"]=o[0].value+" "+o[1].value;break;case"width":var a=r.computedStyleMap().get("width");n.style.width=a.toString();break;case"height":var s=r.computedStyleMap().get("height");n.style.height=s.toString();break;case"zIndex":n.style["z-index"]=""+r.parsedStyle.zIndex;break;case"visibility":n.style.visibility=r.parsedStyle.visibility;break;case"pointerEvents":n.style.pointerEvents=r.parsedStyle.pointerEvents;break;case"opacity":n.style.opacity=""+r.parsedStyle.opacity;break;case"fill":var u=r.parsedStyle.fill,c="";u instanceof t.CSSRGB?c=u.isNone?"transparent":r.getAttribute("fill"):Array.isArray(u)?c=r.getAttribute("fill"):t.isPattern(u),n.style.background=c;break;case"stroke":var l=r.parsedStyle.stroke,f="";l instanceof t.CSSRGB?f=l.isNone?"transparent":r.getAttribute("stroke"):Array.isArray(l)?f=r.getAttribute("stroke"):t.isPattern(l),n.style["border-color"]=f,n.style["border-style"]="solid";break;case"lineWidth":n.style["border-width"]=(r.parsedStyle.lineWidth||0)+"px";break;case"lineDash":n.style["border-style"]="dashed";break;case"filter":n.style.filter=r.style.filter}},e}(),Do.tag="HTMLRendering",Bo=Do);Vo=Bo=u([t.singleton({contrib:t.RenderingPluginContribution}),c(0,t.inject(t.ContextService)),c(1,t.inject(t.RenderingContext)),c(2,t.inject(t.CanvasConfig))],Vo);var Wo=t.Module((function(e){e(Vo)})),Xo=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).name="html-renderer",t}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,ko(t,r);var i=n.prototype;return i.init=function(){this.container.load(Wo,!0)},i.destroy=function(){this.container.unload(Wo)},n}(t.AbstractRendererPlugin),Ho=Object.freeze({__proto__:null,Plugin:Xo});function Yo(){
12
12
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
13
- aa=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=Object.create((t&&t.prototype instanceof f?t:f).prototype),o=new A(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return C()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=R(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function h(){}function d(){}var p={};s(p,i,(function(){return this}));var _=Object.getPrototypeOf,v=_&&_(_(S([])));v&&v!==t&&r.call(v,i)&&(p=v);var E=d.prototype=f.prototype=Object.create(p);function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){function n(i,o,a,s){var u=c(e[i],e,o);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function R(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return h.prototype=d,s(E,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(E),e},e.awrap=function(e){return{__await:e}},g(m.prototype),s(m.prototype,o,(function(){return this})),e.AsyncIterator=m,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new m(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(E),s(E,a,"Generator"),s(E,i,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=S,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(this.prev>=o.tryLoc){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(o.catchLoc>this.prev)return n(o.catchLoc,!0);if(o.finallyLoc>this.prev)return n(o.finallyLoc)}else if(s){if(o.catchLoc>this.prev)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(this.prev>=i.tryLoc&&r.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function sa(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function ua(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){sa(o,n,i,a,s,"next",e)}function s(e){sa(o,n,i,a,s,"throw",e)}a(void 0)}))}}function ca(){return ca=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ca.apply(this,arguments)}function la(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,fa(e,t)}function fa(e,t){return fa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},fa(e,t)}function ha(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var da,pa=t.Syringe.defineToken(""),_a=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});_a.decode();var va=null;function Ea(){return null!==va&&va.buffer===da.memory.buffer||(va=new Uint8Array(da.memory.buffer)),va}function ga(e,t){return _a.decode(Ea().subarray(e,e+t))}var ma=new Array(32).fill(void 0);ma.push(void 0,null,!0,!1);var Ra=ma.length;function ya(e){Ra===ma.length&&ma.push(ma.length+1);var t=Ra;return Ra=ma[t],ma[t]=e,t}function Ta(e){return ma[e]}function Aa(e){var t=Ta(e);return function(e){36>e||(ma[e]=Ra,Ra=e)}(e),t}var Sa=0,Ca=new TextEncoder("utf-8"),Oa="function"==typeof Ca.encodeInto?function(e,t){return Ca.encodeInto(e,t)}:function(e,t){var r=Ca.encode(e);return t.set(r),{read:e.length,written:r.length}};function Ia(e,t,r){if(void 0===r){var n=Ca.encode(e),i=t(n.length);return Ea().subarray(i,i+n.length).set(n),Sa=n.length,i}for(var o=e.length,a=t(o),s=Ea(),u=0;o>u;u++){var c=e.charCodeAt(u);if(c>127)break;s[a+u]=c}if(u!==o){0!==u&&(e=e.slice(u)),a=r(a,o,o=u+3*e.length);var l=Ea().subarray(a+u,a+o);u+=Oa(e,l).written}return Sa=u,a}var Na,xa,Pa=null;function Ma(){return null!==Pa&&Pa.buffer===da.memory.buffer||(Pa=new Int32Array(da.memory.buffer)),Pa}function Da(e,t,r){try{var n=da.__wbindgen_add_to_stack_pointer(-16),i=Ia(e,da.__wbindgen_malloc,da.__wbindgen_realloc),o=Sa,a=Ia(t,da.__wbindgen_malloc,da.__wbindgen_realloc);da.glsl_compile(n,i,o,a,Sa,r);var s=Ma()[n/4+0],u=Ma()[n/4+1];return ga(s,u)}finally{da.__wbindgen_add_to_stack_pointer(16),da.__wbindgen_free(s,u)}}function Ba(e,t){return La.apply(this,arguments)}function La(){return(La=ua(aa().mark((function e(t,r){var n,i;return aa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!("function"==typeof Response&&t instanceof Response)){e.next=23;break}if("function"!=typeof WebAssembly.instantiateStreaming){e.next=15;break}return e.prev=2,e.next=5,WebAssembly.instantiateStreaming(t,r);case 5:case 20:return e.abrupt("return",e.sent);case 8:if(e.prev=8,e.t0=e.catch(2),"application/wasm"==t.headers.get("Content-Type")){e.next=14;break}console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",e.t0),e.next=15;break;case 14:throw e.t0;case 15:return e.next=17,t.arrayBuffer();case 17:return n=e.sent,e.next=20,WebAssembly.instantiate(n,r);case 23:return e.next=25,WebAssembly.instantiate(t,r);case 25:if(!((i=e.sent)instanceof WebAssembly.Instance)){e.next=30;break}return e.abrupt("return",{instance:i,module:t});case 30:return e.abrupt("return",i);case 31:case"end":return e.stop()}}),e,null,[[2,8]])})))).apply(this,arguments)}function ba(e){return Fa.apply(this,arguments)}function Fa(){return(Fa=ua(aa().mark((function e(t){var r,n;return aa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r={}).wbg={},r.wbg.__wbindgen_string_new=function(e,t){return ya(ga(e,t))},r.wbg.__wbindgen_object_drop_ref=function(e){Aa(e)},r.wbg.__wbg_log_fbd13631356d44e4=function(e){console.log(Ta(e))},r.wbg.__wbg_log_00fa6d531d56c191=function(e,t){console.log(Ta(e),Ta(t))},r.wbg.__wbindgen_throw=function(e,t){throw new Error(ga(e,t))},("string"==typeof t||"function"==typeof Request&&t instanceof Request||"function"==typeof URL&&t instanceof URL)&&(t=fetch(t)),e.t0=Ba,e.next=12,t;case 12:return e.t1=e.sent,e.t2=r,e.next=16,(0,e.t0)(e.t1,e.t2);case 16:return da=(n=e.sent).instance.exports,ba.__wbindgen_wasm_module=n.module,e.abrupt("return",da);case 22:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ua(e){if(e===ct.U8_RGBA_RT)return"bgra8unorm";if(e===ct.U8_RGBA_NORM)return"rgba8unorm";if(e===ct.U8_RG_NORM)return"rg8unorm";if(e===ct.U32_R)return"r32uint";if(e===ct.D24)return"depth24plus";if(e===ct.D24_S8)return"depth24plus-stencil8";if(e===ct.D32F)return"depth32float";if(e===ct.D32F_S8)return"depth32float-stencil8";if(e===ct.BC1)return"bc1-rgba-unorm";if(e===ct.BC1_SRGB)return"bc1-rgba-unorm-srgb";if(e===ct.BC2)return"bc2-rgba-unorm";if(e===ct.BC2_SRGB)return"bc2-rgba-unorm-srgb";if(e===ct.BC3)return"bc3-rgba-unorm";if(e===ct.BC3_SRGB)return"bc3-rgba-unorm-srgb";if(e===ct.BC4_SNORM)return"bc4-r-snorm";if(e===ct.BC4_UNORM)return"bc4-r-unorm";if(e===ct.BC5_SNORM)return"bc5-rg-snorm";if(e===ct.BC5_UNORM)return"bc5-rg-unorm";throw new Error("whoops")}function wa(e){if(e===He.Clamp)return"clamp-to-edge";if(e===He.Repeat)return"repeat";if(e===He.Mirror)return"mirror-repeat";throw new Error("whoops")}function Ga(e){if(e===je.Bilinear)return"linear";if(e===je.Point)return"nearest";throw new Error("whoops")}function ka(e){if(e===Ye.Linear)return"linear";if(e===Ye.Nearest)return"nearest";if(e===Ye.NoMip)return"nearest";throw new Error("whoops")}function Va(e){if(e===rt.Float)return"float";if(e===rt.Depth)return"depth";throw new Error("whoops")}function Wa(e){if(e===Je.n2D)return"2d";if(e===Je.n2DArray)return"2d-array";if(e===Je.n3D)return"3d";if(e===Je.Cube)return"cube";throw new Error("whoops")}function Xa(e){return e.gpuBuffer}function Ha(e){if(e===ot.OcclusionConservative)return"occlusion";throw new Error("whoops")}function ja(e){switch(e){case Ke.Triangles:return"triangle-list";case Ke.Points:return"point-list";case Ke.TriangleStrip:return"triangle-strip";case Ke.Lines:return"line-list";case Ke.LineStrip:return"line-strip";default:throw new Error("Unknown primitive topology mode")}}function Ya(e){if(e===Ve.None)return"none";if(e===Ve.Front)return"front";if(e===Ve.Back)return"back";throw new Error("whoops")}function Ka(e){if(e===ke.CCW)return"ccw";if(e===ke.CW)return"cw";throw new Error("whoops")}function za(e){if(e===We.Zero)return"zero";if(e===We.One)return"one";if(e===We.Src)return"src";if(e===We.OneMinusSrc)return"one-minus-src";if(e===We.Dst)return"dst";if(e===We.OneMinusDst)return"one-minus-dst";if(e===We.SrcAlpha)return"src-alpha";if(e===We.OneMinusSrcAlpha)return"one-minus-src-alpha";if(e===We.DstAlpha)return"dst-alpha";if(e===We.OneMinusDstAlpha)return"one-minus-dst-alpha";throw new Error("whoops")}function qa(e){if(e===Xe.Add)return"add";if(e===Xe.Subtract)return"subtract";if(e===Xe.ReverseSubtract)return"reverse-subtract";throw new Error("whoops")}function Za(e){return{operation:qa(e.blendMode),srcFactor:za(e.blendSrcFactor),dstFactor:za(e.blendDstFactor)}}function Qa(e,t){return t.attachmentsState.map((function(t,r){return function(e,t){return{format:Ua(t),blend:{color:Za(e.rgbBlendState),alpha:Za(e.alphaBlendState)},writeMask:e.channelWriteMask}}(t,e[r])}))}function Ja(e){if(e===Ge.Never)return"never";if(e===Ge.Less)return"less";if(e===Ge.Equal)return"equal";if(e===Ge.LessEqual)return"less-equal";if(e===Ge.Greater)return"greater";if(e===Ge.NotEqual)return"not-equal";if(e===Ge.GreaterEqual)return"greater-equal";if(e===Ge.Always)return"always";throw new Error("whoops")}function $a(e){if(e===Ze.PerVertex)return"vertex";if(e===Ze.PerInstance)return"instance";throw new Error("whoops")}function es(e){if(e===ct.U8_R)return"uint8x2";if(e===ct.U8_RG)return"uint8x2";if(e===ct.U8_RGB)return"uint8x4";if(e===ct.U8_RGBA)return"uint8x4";if(e===ct.U8_RGBA_NORM)return"unorm8x4";if(e===ct.S8_RGB_NORM)return"snorm8x4";if(e===ct.S8_RGBA_NORM)return"snorm8x4";if(e===ct.S16_RG)return"uint16x2";if(e===ct.F32_R)return"float32";if(e===ct.F32_RG)return"float32x2";if(e===ct.F32_RGB)return"float32x3";if(e===ct.F32_RGBA)return"float32x4";throw new Error("whoops")}function ts(e,t,r,n){switch(void 0===r&&(r=!1),e){case ct.S8_R:case ct.S8_R_NORM:case ct.S8_RG_NORM:case ct.S8_RGB_NORM:case ct.S8_RGBA_NORM:var i=(ArrayBuffer,new Int8Array(t));return n&&i.set(new Int8Array(n)),i;case ct.U8_R:case ct.U8_R_NORM:case ct.U8_RG:case ct.U8_RG_NORM:case ct.U8_RGB:case ct.U8_RGB_NORM:case ct.U8_RGB_SRGB:case ct.U8_RGBA:case ct.U8_RGBA_NORM:case ct.U8_RGBA_SRGB:var o=(ArrayBuffer,new Uint8Array(t));return n&&o.set(new Uint8Array(n)),o;case ct.S16_R:case ct.S16_RG:case ct.S16_RG_NORM:case ct.S16_RGB_NORM:case ct.S16_RGBA:case ct.S16_RGBA_NORM:var a=t instanceof ArrayBuffer?new Int16Array(t):new Int16Array(r?t/2:t);return n&&a.set(new Int16Array(n)),a;case ct.U16_R:case ct.U16_RGB:case ct.U16_RGBA_5551:case ct.U16_RGBA_NORM:case ct.U16_RG_NORM:case ct.U16_R_NORM:var s=t instanceof ArrayBuffer?new Uint16Array(t):new Uint16Array(r?t/2:t);return n&&s.set(new Uint16Array(n)),s;case ct.S32_R:var u=t instanceof ArrayBuffer?new Int32Array(t):new Int32Array(r?t/4:t);return n&&u.set(new Int32Array(n)),u;case ct.U32_R:case ct.U32_RG:var c=t instanceof ArrayBuffer?new Uint32Array(t):new Uint32Array(r?t/4:t);return n&&c.set(new Uint32Array(n)),c;case ct.F32_R:case ct.F32_RG:case ct.F32_RGB:case ct.F32_RGBA:var l=t instanceof ArrayBuffer?new Float32Array(t):new Float32Array(r?t/4:t);return n&&l.set(new Float32Array(n)),l}var f=(ArrayBuffer,new Uint8Array(t));return n&&f.set(new Uint8Array(n)),f}!function(e){e[e.COPY_SRC=1]="COPY_SRC",e[e.COPY_DST=2]="COPY_DST",e[e.TEXTURE_BINDING=4]="TEXTURE_BINDING",e[e.STORAGE_BINDING=8]="STORAGE_BINDING",e[e.STORAGE=8]="STORAGE",e[e.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT"}(Na||(Na={})),function(e){e[e.READ=1]="READ",e[e.WRITE=2]="WRITE"}(xa||(xa={}));var rs=function(e){function t(t){var r,n=t.id,i=t.device;return(r=e.call(this)||this).type=void 0,r.id=void 0,r.name=void 0,r.device=void 0,r.id=n,r.device=i,r}return la(t,e),t.prototype.destroy=function(){},t}(f.EventEmitter),ns=function(e){function t(t){var r,n=t.descriptor;(r=e.call(this,{id:t.id,device:t.device})||this).type=we.Bindings,r.bindingLayout=void 0,r.gpuBindGroup=void 0,r.bindGroupLayout=void 0;var i=n.pipeline,o=n.bindingLayout;Rt(!!i);var a=r.device._createBindGroupLayout(o),s=[[],[]],u=0;if(o.storageEntries)for(var c=0;o.storageEntries.length>c;c++){var l=n.storageBufferBindings[c];Rt(l.wordCount>0);var f={buffer:Xa(l.buffer),offset:0,size:l.wordCount<<2};s[0].push({binding:u++,resource:f})}for(var h=0;o.numUniformBuffers>h;h++){var d=n.uniformBufferBindings[h];Rt(d.wordCount>0);var p={buffer:Xa(d.buffer),offset:0,size:d.wordCount<<2};s[0].push({binding:u++,resource:p})}u=0;for(var _=0;o.numSamplers>_;_++){var v=void 0!==o.samplerEntries?o.samplerEntries[_]:er,E=n.samplerBindings[_],g=null!==E.texture?E.texture:r.device.getFallbackTexture(v);Rt(v.dimension===g.dimension),Rt(v.formatKind===mt(g.pixelFormat)),s[1].push({binding:u++,resource:g.gpuTextureView});var m=(null!==E.sampler?E.sampler:r.device.fallbackSampler).gpuSampler;s[1].push({binding:u++,resource:m})}return r.gpuBindGroup=s.map((function(e,t){return r.device.device.createBindGroup({layout:i.getBindGroupLayout(t),entries:e})})),r.bindingLayout=n.bindingLayout,r.bindGroupLayout=a,r}return la(t,e),t}(rs);function is(e){return void 0!==e.byteLength}var os=function(e){function t(t){var r,n=t.descriptor;(r=e.call(this,{id:t.id,device:t.device})||this).type=we.Buffer,r.gpuBuffer=void 0,r.size=void 0,r.view=void 0,r.usage=void 0;var i=n.usage,o=n.viewOrSize,a=is(o)?o.byteLength+3&-4:o+3&-4;r.usage=i,r.usage&ze.MAP_READ&&(r.usage=ze.MAP_READ|ze.COPY_DST);var s=is(o);if(r.size=is(o)?o.byteLength:o,r.view=is(o)?o:null,r.gpuBuffer=r.device.device.createBuffer({usage:r.usage,size:a,mappedAtCreation:s}),s){var u=r.gpuBuffer.getMappedRange();new o.constructor(u).set(o),r.gpuBuffer.unmap()}return r}la(t,e);var r=t.prototype;return r.setSubData=function(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var i=this.gpuBuffer;n=n||t.byteLength,n=Math.min(n,this.size-e);var o=t.byteOffset+r,a=o+n,s=n+3&-4;if(s!==n){var u=new Uint8Array(t.buffer.slice(o,a));(t=new Uint8Array(s)).set(u),r=0,o=0,a=s,n=s}for(var c=15728640,l=0;a-(o+l)>c;)this.device.device.queue.writeBuffer(i,e+l,t.buffer,o+l,c),l+=c;this.device.device.queue.writeBuffer(i,e+l,t.buffer,o+l,n-l)},r.destroy=function(){e.prototype.destroy.call(this),this.gpuBuffer.destroy()},t}(rs),as=function(){function e(){this.commandEncoder=null,this.descriptor=void 0,this.gpuComputePassDescriptor=void 0,this.gpuComputePassEncoder=null}var t=e.prototype;return t.dispatch=function(e,t,r){this.gpuComputePassEncoder.dispatchWorkgroups(e,t,r)},t.finish=function(){return this.gpuComputePassEncoder.end(),this.gpuComputePassEncoder=null,this.commandEncoder.finish()},t.beginComputePass=function(e){Rt(null===this.gpuComputePassEncoder),this.setComputePassDescriptor(e),this.gpuComputePassEncoder=this.commandEncoder.beginComputePass(this.gpuComputePassDescriptor)},t.setPipeline=function(e){var t=yt(e.gpuComputePipeline);this.gpuComputePassEncoder.setPipeline(t)},t.setBindings=function(e,t){this.gpuComputePassEncoder.setBindGroup(e,t.gpuBindGroup[0])},t.setComputePassDescriptor=function(e){this.descriptor=e},e}(),ss=function(e){function t(t){var r,n=t.descriptor;(r=e.call(this,{id:t.id,device:t.device})||this).type=we.ComputePipeline,r.descriptor=void 0,r.gpuComputePipeline=null,r.descriptor=n;var i=n.program.computeStage;if(null===i)return ha(r);var o={compute:ca({},i),layout:"auto"};return r.gpuComputePipeline=r.device.device.createComputePipeline(o),void 0!==r.name&&(r.gpuComputePipeline.label=r.name),r}return la(t,e),t.prototype.getBindGroupLayout=function(e){return this.gpuComputePipeline.getBindGroupLayout(e)},t}(rs),us={}.toString,cs=function(e,t){return us.call(e)==="[object "+t+"]"},ls=function(e){return cs(e,"Function")},fs=function(e){return null==e};function hs(e,t){var r;if(e)if(r=e,Array.isArray?Array.isArray(r):cs(r,"Array"))for(var n=0,i=e.length;i>n&&!1!==t(e[n],n);n++);else if(function(e){var t=typeof e;return null!==e&&"object"===t||"function"===t}(e))for(var o in e)if(e.hasOwnProperty(o)&&!1===t(e[o],o))break}var ds,ps=Object.values?function(e){return Object.values(e)}:function(e){var t=[];return hs(e,(function(r,n){ls(e)&&"prototype"===n||t.push(r)})),t};!function(e,t){if(!ls(e))throw new TypeError("Expected a function");var r=function r(){for(var n=[],i=0;arguments.length>i;i++)n[i]=arguments[i];var o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var s=e.apply(this,n);return a.set(o,s),s};r.cache=new Map}((function(e,t){void 0===t&&(t={});var r,n=t.fontSize,i=t.fontFamily,o=t.fontWeight,a=t.fontStyle,s=t.fontVariant;return ds||(ds=document.createElement("canvas").getContext("2d")),ds.font=[a,s,o,n+"px",i].join(" "),ds.measureText((r=e,cs(r,"String")?e:"")).width}),(function(e,t){return void 0===t&&(t={}),l([e],ps(t)).join("")}));var _s=function(e){function t(t){var r,n=t.descriptor;(r=e.call(this,{id:t.id,device:t.device})||this).type=we.InputLayout,r.buffers=void 0,r.indexFormat=void 0;for(var i=[],o=0;n.vertexBufferDescriptors.length>o;o++){var a=n.vertexBufferDescriptors[o];if(!fs(a)){var s=a.byteStride,u=$a(a.frequency);i[o]={arrayStride:s,stepMode:u,attributes:[]}}}for(var c=0;n.vertexAttributeDescriptors.length>c;c++){var l=n.vertexAttributeDescriptors[c],f=yt(i[l.bufferIndex]),h={shaderLocation:l.location,format:es(l.format),offset:l.bufferByteOffset};f.attributes.push(h)}return r.indexFormat=function(e){if(null!==e){if(e===ct.U16_R)return"uint16";if(e===ct.U32_R)return"uint32";throw new Error("whoops")}}(n.indexBufferFormat),r.buffers=i,r}return la(t,e),t}(rs),vs=function(e){function t(t){var r,n=t.inputLayout,i=t.vertexBuffers,o=t.indexBuffer;return(r=e.call(this,{id:t.id,device:t.device})||this).type=we.InputState,r.inputLayout=void 0,r.vertexBuffers=void 0,r.indexBuffer=void 0,r.inputLayout=n,r.vertexBuffers=i,r.indexBuffer=o,r}return la(t,e),t}(rs),Es=function(e){function t(t){var r,n=t.descriptor;return(r=e.call(this,{id:t.id,device:t.device})||this).type=we.Program,r.descriptor=void 0,r.vertexStage=null,r.fragmentStage=null,r.computeStage=null,r.descriptor=n,n.preprocessedVert&&(r.vertexStage=r.createShaderStage(n.preprocessedVert,"vertex")),n.preprocessedFrag&&(r.fragmentStage=r.createShaderStage(n.preprocessedFrag,"fragment")),n.preprocessedCompute&&(r.computeStage=r.createShaderStage(n.preprocessedCompute,"compute")),r}return la(t,e),t.prototype.createShaderStage=function(e,t){var r=e;if("compute"!==t)try{r=this.device.glsl_compile(e,t,!1)}catch(t){throw console.error(t,e),new Error("whoops")}for(var n=function(){var e=o[i];if(!r.includes(e))return"continue";r=(r=r.replace("var T_"+e+": texture_2d<f32>;","var T_"+e+": texture_depth_2d;")).replace(new RegExp("textureSample\\(T_"+e+"(.*)\\);$","gm"),(function(t,r){return"vec4<f32>(textureSample(T_"+e+r+"), 0.0, 0.0, 0.0);"}))},i=0,o=["u_TextureFramebufferDepth"];o.length>i;i++)n();return{module:this.device.device.createShaderModule({code:r}),entryPoint:"main"}},t}(rs),gs=function(e){function t(t){var r,n=t.descriptor;(r=e.call(this,{id:t.id,device:t.device})||this).type=we.QueryPool,r.querySet=void 0;var i=n.elemCount;return r.querySet=r.device.device.createQuerySet({type:Ha(n.type),count:i}),r}return la(t,e),t.prototype.queryResultOcclusion=function(e){return!0},t}(rs),ms=function(e){function t(t){var r;return(r=e.call(this,{id:t.id,device:t.device})||this).type=we.Readback,r}la(t,e);var r=t.prototype;return r.readTexture=function(e,t,r,n,i,o,a,s){void 0===a&&(a=0),void 0===s&&(s=0);var u=e,c=this.getBlockInformationFromFormat(u.format),l=Math.ceil(n/c.width)*c.length,f=256*Math.ceil(l/256),h=f*i,d=this.device.createBuffer({usage:ze.STORAGE|ze.MAP_READ|ze.COPY_DST,hint:qe.Static,viewOrSize:h}),p=this.device.device.createCommandEncoder();return p.copyTextureToBuffer({texture:u.gpuTexture,mipLevel:0,origin:{x:t,y:r,z:Math.max(0,0)}},{buffer:d.gpuBuffer,offset:0,bytesPerRow:f},{width:n,height:i,depthOrArrayLayers:1}),this.device.device.queue.submit([p.finish()]),this.readBuffer(d,h,o,a,s,u.pixelFormat)},r.readBuffer=function(e,t,r,n,i,o,a,s){var u=this;void 0===t&&(t=0),void 0===r&&(r=null),void 0===i&&(i=0),void 0===o&&(o=ct.U8_RGB),void 0===a&&(a=!1);var c=e,l=i||c.size,f=r||c.view,h=f&&f.constructor&&f.constructor.BYTES_PER_ELEMENT||gt(o),d=c;if(!(c.usage&ze.MAP_READ&&c.usage&ze.COPY_DST)){var p=this.device.device.createCommandEncoder();d=this.device.createBuffer({usage:ze.STORAGE|ze.MAP_READ|ze.COPY_DST,hint:qe.Static,viewOrSize:l}),p.copyBufferToBuffer(c.gpuBuffer,t,d.gpuBuffer,0,l),this.device.device.queue.submit([p.finish()])}return new Promise((function(e,r){d.gpuBuffer.mapAsync(xa.READ,t,l).then((function(){var r=d.gpuBuffer.getMappedRange(t,l),n=f;if(a)n=null===n?ts(o,l,!0,r):ts(o,n.buffer,void 0,r);else if(null===n)switch(h){case 1:(n=new Uint8Array(l)).set(new Uint8Array(r));break;case 2:n=u.getHalfFloatAsFloatRGBAArrayBuffer(l/2,r);break;case 4:(n=new Float32Array(l/4)).set(new Float32Array(r))}else switch(h){case 1:(n=new Uint8Array(n.buffer)).set(new Uint8Array(r));break;case 2:n=u.getHalfFloatAsFloatRGBAArrayBuffer(l/2,r,f);break;case 4:var i=f&&f.constructor||Float32Array;(n=new i(n.buffer)).set(new i(r))}d.gpuBuffer.unmap(),e(n)}),(function(e){return r(e)}))}))},r.getHalfFloatAsFloatRGBAArrayBuffer=function(e,t,r){r||(r=new Float32Array(e));for(var n,i,o,a,s=new Uint16Array(t);e--;)r[e]=(i=void 0,o=void 0,a=void 0,i=(32768&(n=s[e]))>>15,a=1023&n,0===(o=(31744&n)>>10)?(i?-1:1)*Math.pow(2,-14)*(a/Math.pow(2,10)):31==o?a?NaN:1/0*(i?-1:1):(i?-1:1)*Math.pow(2,o-15)*(1+a/Math.pow(2,10)));return r},r.getBlockInformationFromFormat=function(e){switch(e){case"r8unorm":case"r8snorm":case"r8uint":case"r8sint":return{width:1,height:1,length:1};case"r16uint":case"r16sint":case"r16float":case"rg8unorm":case"rg8snorm":case"rg8uint":case"rg8sint":case"depth16unorm":return{width:1,height:1,length:2};case"r32uint":case"r32sint":case"r32float":case"rg16uint":case"rg16sint":case"rg16float":case"rgba8unorm":case"rgba8unorm-srgb":case"rgba8snorm":case"rgba8uint":case"rgba8sint":case"bgra8unorm":case"bgra8unorm-srgb":case"rgb9e5ufloat":case"rgb10a2unorm":case"rg11b10ufloat":case"depth32float":default:return{width:1,height:1,length:4};case"rg32uint":case"rg32sint":case"rg32float":case"rgba16uint":case"rgba16sint":case"rgba16float":return{width:1,height:1,length:8};case"rgba32uint":case"rgba32sint":case"rgba32float":return{width:1,height:1,length:16};case"stencil8":throw new Error("No fixed size for Stencil8 format!");case"depth24plus":throw new Error("No fixed size for Depth24Plus format!");case"depth24plus-stencil8":throw new Error("No fixed size for Depth24PlusStencil8 format!");case"depth32float-stencil8":return{width:1,height:1,length:5};case"bc7-rgba-unorm":case"bc7-rgba-unorm-srgb":case"bc6h-rgb-ufloat":case"bc6h-rgb-float":case"bc2-rgba-unorm":case"bc2-rgba-unorm-srgb":case"bc3-rgba-unorm":case"bc3-rgba-unorm-srgb":case"bc5-rg-unorm":case"bc5-rg-snorm":return{width:4,height:4,length:16};case"bc4-r-unorm":case"bc4-r-snorm":case"bc1-rgba-unorm":case"bc1-rgba-unorm-srgb":return{width:4,height:4,length:8}}},t}(rs),Rs=function(){function e(){this.commandEncoder=null,this.descriptor=void 0,this.gpuRenderPassEncoder=null,this.gpuRenderPassDescriptor=void 0,this.gpuColorAttachments=void 0,this.gpuDepthStencilAttachment=void 0,this.gfxColorAttachment=[],this.gfxColorResolveTo=[],this.gfxDepthStencilAttachment=null,this.gfxDepthStencilResolveTo=null,this.gpuColorAttachments=[],this.gpuDepthStencilAttachment={view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"},this.gpuRenderPassDescriptor={colorAttachments:this.gpuColorAttachments,depthStencilAttachment:this.gpuDepthStencilAttachment}}var t=e.prototype;return t.setRenderPassDescriptor=function(e){this.descriptor=e,this.gpuRenderPassDescriptor.colorAttachments=this.gpuColorAttachments;var t=e.colorAttachment.length;this.gfxColorAttachment.length=t,this.gfxColorResolveTo.length=t;for(var r=0;e.colorAttachment.length>r;r++){var n=e.colorAttachment[r],i=e.colorResolveTo[r];if(null===n&&null!==i&&(n=i,i=null),this.gfxColorAttachment[r]=n,this.gfxColorResolveTo[r]=i,null===n){this.gpuColorAttachments.length=r,this.gfxColorAttachment.length=r,this.gfxColorResolveTo.length=r;break}void 0===this.gpuColorAttachments[r]&&(this.gpuColorAttachments[r]={});var o=this.gpuColorAttachments[r];o.view=n.gpuTextureView;var a=e.colorClearColor[r];"load"===a?o.loadOp="load":(o.loadOp="clear",o.clearValue=a),o.storeOp=e.colorStore[r]?"store":"discard",o.resolveTarget=void 0,null!==i&&(n.sampleCount>1?o.resolveTarget=i.gpuTextureView:o.storeOp="store")}if(this.gfxDepthStencilAttachment=e.depthStencilAttachment,this.gfxDepthStencilResolveTo=e.depthStencilResolveTo,null!==e.depthStencilAttachment){var s=this.gpuDepthStencilAttachment;s.view=e.depthStencilAttachment.gpuTextureView,"load"===e.depthClearValue?s.depthLoadOp="load":(s.depthLoadOp="clear",s.depthClearValue=e.depthClearValue),"load"===e.stencilClearValue?s.stencilLoadOp="load":(s.stencilLoadOp="clear",s.stencilClearValue=e.stencilClearValue),s.depthStoreOp=e.depthStencilStore?"store":"discard",s.stencilStoreOp=e.depthStencilStore?"store":"discard",this.gpuRenderPassDescriptor.depthStencilAttachment=this.gpuDepthStencilAttachment,null!==this.gfxDepthStencilResolveTo&&(s.depthStoreOp="store",s.stencilStoreOp="store")}else this.gpuRenderPassDescriptor.depthStencilAttachment=void 0;this.gpuRenderPassDescriptor.occlusionQuerySet=null!==e.occlusionQueryPool?e.occlusionQueryPool.querySet:void 0},t.beginRenderPass=function(e){Rt(null===this.gpuRenderPassEncoder),this.setRenderPassDescriptor(e),this.gpuRenderPassEncoder=this.commandEncoder.beginRenderPass(this.gpuRenderPassDescriptor)},t.setViewport=function(e,t,r,n){this.gpuRenderPassEncoder.setViewport(e,t,r,n,0,1)},t.setScissor=function(e,t,r,n){this.gpuRenderPassEncoder.setScissorRect(e,t,r,n)},t.setPipeline=function(e){var t=yt(e.gpuRenderPipeline);this.gpuRenderPassEncoder.setPipeline(t)},t.setInputState=function(e){if(null!==e){var t=e;if(null!==t.indexBuffer){var r=t.inputLayout,n=t.indexBuffer;this.gpuRenderPassEncoder.setIndexBuffer(Xa(n.buffer),yt(r.indexFormat),n.byteOffset)}for(var i=0;t.vertexBuffers.length>i;i++){var o=t.vertexBuffers[i];fs(o)||this.gpuRenderPassEncoder.setVertexBuffer(i,Xa(o.buffer),o.byteOffset)}}},t.setBindings=function(e,t,r){var n=t;this.gpuRenderPassEncoder.setBindGroup(e+0,n.gpuBindGroup[0],r.slice(0,n.bindingLayout.numUniformBuffers)),this.gpuRenderPassEncoder.setBindGroup(e+1,n.gpuBindGroup[1])},t.setStencilRef=function(e){this.gpuRenderPassEncoder.setStencilReference(e)},t.draw=function(e,t){this.gpuRenderPassEncoder.draw(e,1,t,0)},t.drawIndexed=function(e,t){this.gpuRenderPassEncoder.drawIndexed(e,1,t,0,0)},t.drawIndexedInstanced=function(e,t,r){this.gpuRenderPassEncoder.drawIndexed(e,r,t,0,0)},t.beginOcclusionQuery=function(e){this.gpuRenderPassEncoder.beginOcclusionQuery(e)},t.endOcclusionQuery=function(e){this.gpuRenderPassEncoder.endOcclusionQuery()},t.beginDebugGroup=function(e){void 0!==this.gpuRenderPassEncoder.pushDebugGroup&&this.gpuRenderPassEncoder.pushDebugGroup(e)},t.endDebugGroup=function(){void 0!==this.gpuRenderPassEncoder.popDebugGroup&&this.gpuRenderPassEncoder.popDebugGroup()},t.finish=function(){this.gpuRenderPassEncoder.end(),this.gpuRenderPassEncoder=null;for(var e=0;this.gfxColorAttachment.length>e;e++){var t=this.gfxColorAttachment[e],r=this.gfxColorResolveTo[e];null!==t&&null!==r&&1===t.sampleCount&&this.copyAttachment(r,t)}return null!==this.gfxDepthStencilAttachment&&null!==this.gfxDepthStencilResolveTo&&(this.gfxDepthStencilAttachment.sampleCount>1||this.copyAttachment(this.gfxDepthStencilResolveTo,this.gfxDepthStencilAttachment)),this.commandEncoder.finish()},t.copyAttachment=function(e,t){Rt(1===t.sampleCount);var r={texture:t.gpuTexture},n={texture:e.gpuTexture};Rt(t.width===e.width),Rt(t.height===e.height),Rt(!!(t.usage&Na.COPY_SRC)),Rt(!!(e.usage&Na.COPY_DST)),this.commandEncoder.copyTextureToTexture(r,n,[e.width,e.height,1])},e}(),ys=function(e){function t(t){var r,n=t.descriptor;return(r=e.call(this,{id:t.id,device:t.device})||this).type=we.RenderPipeline,r.descriptor=void 0,r.isCreating=!1,r.isCreatingAsync=!1,r.gpuRenderPipeline=null,r.descriptor=n,r.device._createRenderPipeline(ha(r),!1),r}return la(t,e),t.prototype.getBindGroupLayout=function(e){return this.gpuRenderPipeline.getBindGroupLayout(e)},t}(rs),Ts=function(e){function t(t){var r,n,i,o=t.descriptor;(i=e.call(this,{id:t.id,device:t.device})||this).type=we.Sampler,i.gpuSampler=void 0;var a=o.minLOD,s=o.mipFilter===Ye.NoMip?o.minLOD:o.maxLOD,u=null!==(r=o.maxAnisotropy)&&void 0!==r?r:1;return u>1&&Rt(o.minFilter===je.Bilinear&&o.magFilter===je.Bilinear&&o.mipFilter===Ye.Linear),i.gpuSampler=i.device.device.createSampler({addressModeU:wa(o.wrapS),addressModeV:wa(o.wrapT),addressModeW:wa(null!==(n=o.wrapQ)&&void 0!==n?n:o.wrapS),lodMinClamp:a,lodMaxClamp:s,minFilter:Ga(o.minFilter),magFilter:Ga(o.magFilter),mipmapFilter:ka(o.mipFilter),maxAnisotropy:u}),i}return la(t,e),t}(rs),As=function(e){function t(t){var r,n=t.descriptor,i=t.skipCreate;return(r=e.call(this,{id:t.id,device:t.device})||this).type=we.Texture,r.pixelFormat=void 0,r.dimension=void 0,r.format=void 0,r.width=void 0,r.height=void 0,r.depthOrArrayLayers=void 0,r.numLevels=void 0,r.sampleCount=void 0,r.usage=void 0,r.gpuTexture=void 0,r.gpuTextureView=void 0,r.device.createTextureShared({pixelFormat:n.pixelFormat,dimension:n.dimension,width:n.width,height:n.height,depthOrArrayLayers:n.depth,numLevels:n.numLevels,usage:n.usage,sampleCount:1},ha(r),i),r}la(t,e);var r=t.prototype;return r.setImageData=function(e,t){},r.destroy=function(){this.gpuTexture.destroy()},t}(rs),Ss=function(){function e(e,t,r,n,i){this.swapChainWidth=0,this.swapChainHeight=0,this.swapChainTextureUsage=Na.RENDER_ATTACHMENT|Na.COPY_DST,this._resourceUniqueId=0,this.renderPassPool=[],this.computePassPool=[],this.bindGroupLayoutCache=new sn(or,on),this.fallbackTexture2D=void 0,this.fallbackTexture2DDepth=void 0,this.fallbackTexture2DArray=void 0,this.fallbackTexture3D=void 0,this.fallbackTextureCube=void 0,this.fallbackSampler=void 0,this.featureTextureCompressionBC=!1,this.platformString="WebGPU",this.glslVersion="#version 440",this.explicitBindingLocations=!0,this.separateSamplerTextures=!0,this.viewportOrigin=nt.UpperLeft,this.clipSpaceNearZ=it.Zero,this.supportsSyncPipelineCompilation=!1,this.supportMRT=!0,this.adapter=void 0,this.device=void 0,this.canvas=void 0,this.canvasContext=void 0,this.glsl_compile=void 0,this.adapter=e,this.device=t,this.canvas=r,this.canvasContext=n,this.glsl_compile=i,this.fallbackTexture2D=this.createFallbackTexture(Je.n2D,rt.Float),this.fallbackTexture2DDepth=this.createFallbackTexture(Je.n2D,rt.Depth),this.fallbackTexture2DArray=this.createFallbackTexture(Je.n2DArray,rt.Float),this.fallbackTexture3D=this.createFallbackTexture(Je.n3D,rt.Float),this.fallbackTextureCube=this.createFallbackTexture(Je.Cube,rt.Float),this.fallbackSampler=this.createSampler({wrapS:He.Clamp,wrapT:He.Clamp,minFilter:je.Point,magFilter:je.Point,mipFilter:Ye.NoMip}),this.device.features&&(this.featureTextureCompressionBC=this.device.features.has("texture-compression-bc")),this.device.onuncapturederror=function(e){console.error(e.error)}}var t=e.prototype;return t.configureSwapChain=function(e,t){this.swapChainWidth===e&&this.swapChainHeight===t||(this.swapChainWidth=e,this.swapChainHeight=t,this.canvasContext.configure({device:this.device,format:"bgra8unorm",usage:this.swapChainTextureUsage,compositingAlphaMode:"premultiplied"}))},t.getOnscreenTexture=function(){var e=this.canvasContext.getCurrentTexture(),t=e.createView(),r=new As({id:0,device:this,descriptor:{pixelFormat:ct.U8_RGBA_RT,width:this.swapChainWidth,height:this.swapChainHeight,depth:0,dimension:Je.n2D,numLevels:1,usage:this.swapChainTextureUsage},skipCreate:!0});return r.depthOrArrayLayers=1,r.sampleCount=1,r.gpuTexture=e,r.gpuTextureView=t,r},t.getDevice=function(){return this},t.getCanvas=function(){return this.canvas},t.present=function(){},t.getNextUniqueId=function(){return++this._resourceUniqueId},t.createBuffer=function(e){return new os({id:this.getNextUniqueId(),device:this,descriptor:e})},t.createTexture=function(e){return new As({id:this.getNextUniqueId(),device:this,descriptor:e})},t.createSampler=function(e){return new Ts({id:this.getNextUniqueId(),device:this,descriptor:e})},t.createRenderTarget=function(e){var t=new As({id:this.getNextUniqueId(),device:this,descriptor:ca({},e,{dimension:Je.n2D,numLevels:1,depth:1,usage:$e.RenderTarget})});return t.depthOrArrayLayers=1,t.type=we.RenderTarget,t},t.createRenderTargetFromTexture=function(e){var t=e.pixelFormat,r=e.width,n=e.height,i=e.depthOrArrayLayers,o=e.sampleCount,a=e.numLevels,s=e.gpuTexture,u=e.gpuTextureView,c=e.usage;Rt(!!(c&Na.RENDER_ATTACHMENT));var l=new As({id:this.getNextUniqueId(),device:this,descriptor:{pixelFormat:t,width:r,height:n,depth:i,dimension:Je.n2D,numLevels:a,usage:c},skipCreate:!0});return l.depthOrArrayLayers=i,l.sampleCount=o,l.gpuTexture=s,l.gpuTextureView=u,l},t.createProgram=function(e){return e.ensurePreprocessed(this),this.createProgramSimple(e)},t.createProgramSimple=function(e){return new Es({id:this.getNextUniqueId(),device:this,descriptor:e})},t.createTextureShared=function(e,t,r){var n={width:e.width,height:e.height,depthOrArrayLayers:e.depthOrArrayLayers},i=e.numLevels,o=Ua(e.pixelFormat),a=function(e){if(e===Je.n2D)return"2d";if(e===Je.Cube)return"3d";if(e===Je.n2DArray)return"3d";if(e===Je.n3D)return"3d";throw new Error("whoops")}(e.dimension),s=function(e){var t=0;return e&$e.Sampled&&(t|=Na.TEXTURE_BINDING|Na.COPY_DST),e&$e.RenderTarget&&(t|=Na.RENDER_ATTACHMENT|Na.TEXTURE_BINDING|Na.COPY_SRC|Na.COPY_DST),t}(e.usage);if(t.format=o,t.dimension=e.dimension,t.pixelFormat=e.pixelFormat,t.width=e.width,t.height=e.height,t.depthOrArrayLayers=e.depthOrArrayLayers,t.numLevels=i,t.usage=s,t.sampleCount=1,!r){var u=this.device.createTexture({size:n,mipLevelCount:i,format:o,dimension:a,usage:s}),c=u.createView();t.gpuTexture=u,t.gpuTextureView=c}},t.getFallbackTexture=function(e){var t=e.dimension;if(t===Je.n2D)return e.formatKind===rt.Depth?this.fallbackTexture2DDepth:this.fallbackTexture2D;if(t===Je.n2DArray)return this.fallbackTexture2DArray;if(t===Je.n3D)return this.fallbackTexture3D;if(t===Je.Cube)return this.fallbackTextureCube;throw new Error("whoops")},t.createFallbackTexture=function(e,t){return this.createTexture({dimension:e,pixelFormat:t===rt.Float?ct.U8_RGBA_NORM:ct.D24,usage:$e.Sampled,width:1,height:1,depth:e===Je.Cube?6:1,numLevels:1})},t.createBindings=function(e){return new ns({id:this.getNextUniqueId(),device:this,descriptor:e})},t.createInputLayout=function(e){return new _s({id:this.getNextUniqueId(),device:this,descriptor:e})},t.createInputState=function(e,t,r){return new vs({id:this.getNextUniqueId(),device:this,inputLayout:e,vertexBuffers:t,indexBuffer:r})},t.createComputePipeline=function(e){return new ss({id:this.getNextUniqueId(),device:this,descriptor:e})},t.createRenderPipeline=function(e){return new ys({id:this.getNextUniqueId(),device:this,descriptor:ca({},e)})},t.createQueryPool=function(e,t){return new gs({id:this.getNextUniqueId(),device:this,descriptor:{type:e,elemCount:t}})},t._createBindGroupLayout=function(e){var t=this.bindGroupLayoutCache.get(e);return null===t&&(t=this._createBindGroupLayoutInternal(e),this.bindGroupLayoutCache.add(e,t)),t},t._createBindGroupLayoutInternal=function(e){var t,r=this,n=[[],[]];if(e.storageEntries)for(var i=0;e.storageEntries.length>i;i++)n[0].push({binding:n[0].length,visibility:GPUShaderStage.COMPUTE,buffer:{type:e.storageEntries[i].type}});for(var o=0;e.numUniformBuffers>o;o++)n[0].push({binding:n[0].length,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"uniform",hasDynamicOffset:!0}});for(var a=0;e.numSamplers>a;a++){n[1].push({binding:n[1].length,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:(t=void 0!==e.samplerEntries?e.samplerEntries[a]:er,{sampleType:Va(t.formatKind),viewDimension:Wa(t.dimension)})}),n[1].push({binding:n[1].length,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}})}return{gpuBindGroupLayout:n.map((function(e){return r.device.createBindGroupLayout({entries:e})}))}},t._createPipelineLayout=function(e){var t=this,r=e.flatMap((function(e){return t._createBindGroupLayout(e).gpuBindGroupLayout}));return this.device.createPipelineLayout({bindGroupLayouts:r})},t._createRenderPipeline=function(e,t){if(!e.isCreating&&null===e.gpuRenderPipeline){var r=e.descriptor,n=r.program,i=n.vertexStage,o=n.fragmentStage;if(null!==i&&null!==o){var a,s=this._createPipelineLayout(r.bindingLayouts),u=(a=r.megaStateDescriptor,{topology:ja(r.topology),cullMode:Ya(a.cullMode),frontFace:Ka(a.frontFace)}),c=Qa(r.colorAttachmentFormats,r.megaStateDescriptor),l=function(e,t){if(null!==e)return{format:Ua(e),depthWriteEnabled:t.depthWrite,depthCompare:Ja(t.depthCompare),depthBias:t.polygonOffset?1:0,depthBiasSlopeScale:t.polygonOffset?1:0}}(r.depthStencilAttachmentFormat,r.megaStateDescriptor),f=void 0;null!==r.inputLayout&&(f=r.inputLayout.buffers);var h=r.sampleCount;e.isCreating=!0;var d={layout:s,vertex:ca({},i,{buffers:f}),primitive:u,depthStencil:l,multisample:{count:h},fragment:ca({},o,{targets:c})};e.gpuRenderPipeline=this.device.createRenderPipeline(d),void 0!==e.name&&(e.gpuRenderPipeline.label=e.name)}}},t.createReadback=function(){return new ms({id:this.getNextUniqueId(),device:this})},t.destroyRenderTarget=function(e){e.gpuTexture.destroy()},t.createRenderPass=function(e){var t=this.renderPassPool.pop();return void 0===t&&(t=new Rs),t.commandEncoder=this.device.createCommandEncoder(),t.beginRenderPass(e),t},t.createComputePass=function(e){var t=this.computePassPool.pop();return void 0===t&&(t=new as),t.commandEncoder=this.device.createCommandEncoder(),t.beginComputePass(e),t},t.submitPass=function(e){var t=this.device.queue,r=e,n=r.finish();t.submit([n]),r.commandEncoder=null,r instanceof Rs?this.renderPassPool.push(r):this.computePassPool.push(r)},t.copySubTexture2D=function(e,t,r,n,i,o){var a=this.device.createCommandEncoder(),s=e,u=n,c={texture:u.gpuTexture,origin:[i,o,0]},l={texture:s.gpuTexture,origin:[t,r,0]};Rt(!!(u.usage&Na.COPY_SRC)),Rt(!!(s.usage&Na.COPY_DST)),a.copyTextureToTexture(c,l,[u.width,u.height,1]),this.device.queue.submit([a.finish()])},t.queryLimits=function(){return{uniformBufferMaxPageWordSize:4096,uniformBufferWordAlignment:64,supportedSampleCounts:[1]}},t.queryTextureFormatSupported=function(e,t,r){if(function(e){switch(_t(e)){case at.BC1:case at.BC2:case at.BC3:case at.BC4_SNORM:case at.BC4_UNORM:case at.BC5_SNORM:case at.BC5_UNORM:return!0;default:return!1}}(e)){if(!this.featureTextureCompressionBC)return!1;var n=function(e){switch(_t(e)){case at.BC1:case at.BC2:case at.BC3:case at.BC4_SNORM:case at.BC4_UNORM:case at.BC5_SNORM:case at.BC5_UNORM:return 4;default:return 1}}(e);return t%n==0&&r%n==0&&this.featureTextureCompressionBC}switch(e){case ct.U16_RGBA_NORM:case ct.F32_RGBA:return!1}return!0},t.queryPlatformAvailable=function(){return!0},t.queryVendorInfo=function(){return this},t.queryRenderPass=function(e){return e.descriptor},t.queryRenderTarget=function(e){return e},t.setResourceName=function(e,t){if(e.name=t,e.type===we.Buffer)e.gpuBuffer.label=t;else if(e.type===we.Texture){var r=e;r.gpuTexture.label=t,r.gpuTextureView.label=t}else if(e.type===we.RenderTarget){var n=e;n.gpuTexture.label=t,n.gpuTextureView.label=t}else if(e.type===we.Sampler){e.gpuSampler.label=t}else if(e.type===we.RenderPipeline){null!==e.gpuRenderPipeline&&(e.gpuRenderPipeline.label=t)}},t.setResourceLeakCheck=function(e,t){},t.checkForLeaks=function(){},t.programPatched=function(e){},t.pushDebugGroup=function(e){},t.popDebugGroup=function(){},t.pipelineQueryReady=function(e){return null!==e.gpuRenderPipeline},t.pipelineForceReady=function(e){this._createRenderPipeline(e,!1)},e}(),Cs=function(){function e(e){this.pluginOptions=void 0,this.pluginOptions=e}return e.prototype.createSwapChain=function(){var e=ua(aa().mark((function e(t){var r,n,i,o;return aa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==navigator.gpu){e.next=2;break}return e.abrupt("return",null);case 2:return r=null,e.prev=3,e.next=6,navigator.gpu.requestAdapter();case 6:r=e.sent,e.next=12;break;case 9:e.prev=9,e.t0=e.catch(3),console.log(e.t0);case 12:if(null!==r){e.next=14;break}return e.abrupt("return",null);case 14:return n=["depth32float-stencil8","texture-compression-bc"].filter((function(e){return r.features.has(e)})),e.next=18,r.requestDevice({requiredFeatures:n});case 18:if(null!==(i=e.sent)){e.next=21;break}return e.abrupt("return",null);case 21:if(o=t.getContext("webgpu")){e.next=24;break}return e.abrupt("return",null);case 24:return e.prev=24,e.next=27,ba("/glsl_wgsl_compiler_bg.wasm");case 27:e.next=31;break;case 29:e.prev=29,e.t1=e.catch(24);case 31:return e.abrupt("return",new Ss(r,i,t,o,Da));case 32:case"end":return e.stop()}}),e,null,[[3,9],[24,29]])})));return function(t){return e.apply(this,arguments)}}(),e}();Cs=u([t.singleton({token:so}),c(0,t.inject(pa))],Cs);var Os=t.Module((function(e){e(Cs)})),Is=function(e){function t(t){var r;return void 0===t&&(t={}),(r=e.call(this)||this).options=void 0,r.name="webgpu-device",r.options=t,r}la(t,e);var r=t.prototype;return r.init=function(){this.container.register(pa,{useValue:ca({},this.options)}),this.container.load(Os,!0)},r.destroy=function(){this.container.remove(pa),this.container.unload(Os)},t}(t.AbstractRendererPlugin),Ns=Object.freeze({__proto__:null,Plugin:Is}),xs=t.Syringe.defineToken(""),Ps={}.toString,Ms=function(e,t){return Ps.call(e)==="[object "+t+"]"},Ds=function(e){return Ms(e,"Function")};function Bs(e,t){var r;if(e)if(r=e,Array.isArray?Array.isArray(r):Ms(r,"Array"))for(var n=0,i=e.length;i>n&&!1!==t(e[n],n);n++);else if(function(e){var t=typeof e;return null!==e&&"object"===t||"function"===t}(e))for(var o in e)if(e.hasOwnProperty(o)&&!1===t(e[o],o))break}var Ls,bs=function(e){return Ms(e,"String")},Fs=Object.values?function(e){return Object.values(e)}:function(e){var t=[];return Bs(e,(function(r,n){Ds(e)&&"prototype"===n||t.push(r)})),t};!function(e,t){if(!Ds(e))throw new TypeError("Expected a function");var r=function(){for(var n=[],i=0;arguments.length>i;i++)n[i]=arguments[i];var o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var s=e.apply(this,n);return a.set(o,s),s};r.cache=new Map}((function(e,t){void 0===t&&(t={});var r=t.fontSize,n=t.fontFamily,i=t.fontWeight,o=t.fontStyle,a=t.fontVariant;return Ls||(Ls=document.createElement("canvas").getContext("2d")),Ls.font=[o,a,i,r+"px",n].join(" "),Ls.measureText(bs(e)?e:"").width}),(function(e,t){return void 0===t&&(t={}),l([e],Fs(t)).join("")}));var Us=function(){function e(e,t){this.canvasConfig=void 0,this.deviceRendererPlugin=void 0,this.$container=void 0,this.$canvas=void 0,this.dpr=void 0,this.canvasConfig=e,this.deviceRendererPlugin=t}var n=e.prototype;return n.init=function(){var e=i(r().mark((function e(){var n,i,o,a,s,u;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=(n=this.canvasConfig).container,a=n.devicePixelRatio,(o=n.canvas)?(this.$canvas=o,i&&o.parentElement!==i&&i.appendChild(o),this.$container=o.parentElement,this.canvasConfig.container=this.$container):i&&(this.$container=bs(i)?document.getElementById(i):i,this.$container&&(s=document.createElement("canvas"),this.$container.appendChild(s),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=s)),u=1>(u=a||t.isBrowser&&window.devicePixelRatio||1)?1:Math.ceil(u),this.dpr=u;case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n.getDomElement=function(){return this.$canvas},n.getContext=function(){return this.deviceRendererPlugin.getDevice().canvasContext},n.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},n.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},n.resize=function(e,r){if(this.$canvas){var n=this.getDPR();this.$canvas.width=n*e,this.$canvas.height=n*r,t.setDOMSize(this.$canvas,e,r)}},n.getDPR=function(){return this.dpr},n.applyCursorStyle=function(e){this.$container&&this.$container.style&&(this.$container.style.cursor=e)},n.toDataURL=function(){var e=i(r().mark((function e(t){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return","");case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e}();Us=u([t.singleton({token:t.ContextService}),c(0,t.inject(t.CanvasConfig)),c(1,t.inject(xs))],Us);var ws=t.Module((function(e){e(Us)})),Gs=function(e){function t(t){var r;return(r=e.call(this)||this).rendererPlugin=void 0,r.name="webgpu-context-register",r.rendererPlugin=t,r}o(t,e);var r=t.prototype;return r.init=function(){this.container.register(xs,{useValue:this.rendererPlugin}),this.container.load(ws,!0)},r.destroy=function(){this.container.unload(ws),this.container.remove(xs)},t}(t.AbstractRendererPlugin),ks=function(e){function t(t){var r;r=e.call(this,t)||this;var n=new Bo;return r.registerPlugin(new Gs(n)),r.registerPlugin(new L),r.registerPlugin(new Is),r.registerPlugin(n),r.registerPlugin(new Vo),r.registerPlugin(new ia),r}return o(t,e),t}(t.AbstractRenderer);e.DeviceRenderer=Lo,e.DomInteraction=Wo,e.HTMLRenderer=oa,e.Renderer=ks,e.WebGPUDevice=Ns,Object.defineProperty(e,"__esModule",{value:!0})}));
13
+ Yo=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=Object.create((t&&t.prototype instanceof f?t:f).prototype),o=new A(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return C()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=R(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function h(){}function d(){}var p={};s(p,i,(function(){return this}));var _=Object.getPrototypeOf,E=_&&_(_(S([])));E&&E!==t&&r.call(E,i)&&(p=E);var v=d.prototype=f.prototype=Object.create(p);function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){function n(i,o,a,s){var u=c(e[i],e,o);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function R(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return h.prototype=d,s(v,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(m.prototype),s(m.prototype,o,(function(){return this})),e.AsyncIterator=m,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new m(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(v),s(v,a,"Generator"),s(v,i,(function(){return this})),s(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=S,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(this.prev>=o.tryLoc){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(o.catchLoc>this.prev)return n(o.catchLoc,!0);if(o.finallyLoc>this.prev)return n(o.finallyLoc)}else if(s){if(o.catchLoc>this.prev)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(this.prev>=i.tryLoc&&r.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function jo(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function Ko(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){jo(o,n,i,a,s,"next",e)}function s(e){jo(o,n,i,a,s,"throw",e)}a(void 0)}))}}function zo(){return zo=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},zo.apply(this,arguments)}function qo(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Zo(e,t)}function Zo(e,t){return Zo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Zo(e,t)}function Qo(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Jo,$o=t.Syringe.defineToken(""),ea=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});ea.decode();var ta=null;function ra(){return null!==ta&&ta.buffer===Jo.memory.buffer||(ta=new Uint8Array(Jo.memory.buffer)),ta}function na(e,t){return ea.decode(ra().subarray(e,e+t))}var ia=new Array(32).fill(void 0);ia.push(void 0,null,!0,!1);var oa=ia.length;function aa(e){oa===ia.length&&ia.push(ia.length+1);var t=oa;return oa=ia[t],ia[t]=e,t}function sa(e){return ia[e]}function ua(e){var t=sa(e);return function(e){36>e||(ia[e]=oa,oa=e)}(e),t}var ca=0,la=new TextEncoder("utf-8"),fa="function"==typeof la.encodeInto?function(e,t){return la.encodeInto(e,t)}:function(e,t){var r=la.encode(e);return t.set(r),{read:e.length,written:r.length}};function ha(e,t,r){if(void 0===r){var n=la.encode(e),i=t(n.length);return ra().subarray(i,i+n.length).set(n),ca=n.length,i}for(var o=e.length,a=t(o),s=ra(),u=0;o>u;u++){var c=e.charCodeAt(u);if(c>127)break;s[a+u]=c}if(u!==o){0!==u&&(e=e.slice(u)),a=r(a,o,o=u+3*e.length);var l=ra().subarray(a+u,a+o);u+=fa(e,l).written}return ca=u,a}var da,pa,_a=null;function Ea(){return null!==_a&&_a.buffer===Jo.memory.buffer||(_a=new Int32Array(Jo.memory.buffer)),_a}function va(e,t,r){try{var n=Jo.__wbindgen_add_to_stack_pointer(-16),i=ha(e,Jo.__wbindgen_malloc,Jo.__wbindgen_realloc),o=ca,a=ha(t,Jo.__wbindgen_malloc,Jo.__wbindgen_realloc);Jo.glsl_compile(n,i,o,a,ca,r);var s=Ea()[n/4+0],u=Ea()[n/4+1];return na(s,u)}finally{Jo.__wbindgen_add_to_stack_pointer(16),Jo.__wbindgen_free(s,u)}}function ga(e,t){return ma.apply(this,arguments)}function ma(){return(ma=Ko(Yo().mark((function e(t,r){var n,i;return Yo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!("function"==typeof Response&&t instanceof Response)){e.next=23;break}if("function"!=typeof WebAssembly.instantiateStreaming){e.next=15;break}return e.prev=2,e.next=5,WebAssembly.instantiateStreaming(t,r);case 5:case 20:return e.abrupt("return",e.sent);case 8:if(e.prev=8,e.t0=e.catch(2),"application/wasm"==t.headers.get("Content-Type")){e.next=14;break}console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",e.t0),e.next=15;break;case 14:throw e.t0;case 15:return e.next=17,t.arrayBuffer();case 17:return n=e.sent,e.next=20,WebAssembly.instantiate(n,r);case 23:return e.next=25,WebAssembly.instantiate(t,r);case 25:if(!((i=e.sent)instanceof WebAssembly.Instance)){e.next=30;break}return e.abrupt("return",{instance:i,module:t});case 30:return e.abrupt("return",i);case 31:case"end":return e.stop()}}),e,null,[[2,8]])})))).apply(this,arguments)}function Ra(e){return ya.apply(this,arguments)}function ya(){return(ya=Ko(Yo().mark((function e(t){var r,n;return Yo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r={}).wbg={},r.wbg.__wbindgen_string_new=function(e,t){return aa(na(e,t))},r.wbg.__wbindgen_object_drop_ref=function(e){ua(e)},r.wbg.__wbg_log_fbd13631356d44e4=function(e){console.log(sa(e))},r.wbg.__wbg_log_00fa6d531d56c191=function(e,t){console.log(sa(e),sa(t))},r.wbg.__wbindgen_throw=function(e,t){throw new Error(na(e,t))},("string"==typeof t||"function"==typeof Request&&t instanceof Request||"function"==typeof URL&&t instanceof URL)&&(t=fetch(t)),e.t0=ga,e.next=12,t;case 12:return e.t1=e.sent,e.t2=r,e.next=16,(0,e.t0)(e.t1,e.t2);case 16:return Jo=(n=e.sent).instance.exports,Ra.__wbindgen_wasm_module=n.module,e.abrupt("return",Jo);case 22:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ta(e){if(e===tt.U8_RGBA_RT)return"bgra8unorm";if(e===tt.U8_RGBA_NORM)return"rgba8unorm";if(e===tt.U8_RG_NORM)return"rg8unorm";if(e===tt.U32_R)return"r32uint";if(e===tt.D24)return"depth24plus";if(e===tt.D24_S8)return"depth24plus-stencil8";if(e===tt.D32F)return"depth32float";if(e===tt.D32F_S8)return"depth32float-stencil8";if(e===tt.BC1)return"bc1-rgba-unorm";if(e===tt.BC1_SRGB)return"bc1-rgba-unorm-srgb";if(e===tt.BC2)return"bc2-rgba-unorm";if(e===tt.BC2_SRGB)return"bc2-rgba-unorm-srgb";if(e===tt.BC3)return"bc3-rgba-unorm";if(e===tt.BC3_SRGB)return"bc3-rgba-unorm-srgb";if(e===tt.BC4_SNORM)return"bc4-r-snorm";if(e===tt.BC4_UNORM)return"bc4-r-unorm";if(e===tt.BC5_SNORM)return"bc5-rg-snorm";if(e===tt.BC5_UNORM)return"bc5-rg-unorm";throw new Error("whoops")}function Aa(e){if(e===Fe.Clamp)return"clamp-to-edge";if(e===Fe.Repeat)return"repeat";if(e===Fe.Mirror)return"mirror-repeat";throw new Error("whoops")}function Sa(e){if(e===Ue.Bilinear)return"linear";if(e===Ue.Point)return"nearest";throw new Error("whoops")}function Ca(e){if(e===we.Linear)return"linear";if(e===we.Nearest)return"nearest";if(e===we.NoMip)return"nearest";throw new Error("whoops")}function Oa(e){if(e===ze.Float)return"float";if(e===ze.Depth)return"depth";throw new Error("whoops")}function Ia(e){if(e===He.n2D)return"2d";if(e===He.n2DArray)return"2d-array";if(e===He.n3D)return"3d";if(e===He.Cube)return"cube";throw new Error("whoops")}function Na(e){return e.gpuBuffer}function xa(e){if(e===Qe.OcclusionConservative)return"occlusion";throw new Error("whoops")}function Pa(e){switch(e){case Ge.Triangles:return"triangle-list";case Ge.Points:return"point-list";case Ge.TriangleStrip:return"triangle-strip";case Ge.Lines:return"line-list";case Ge.LineStrip:return"line-strip";default:throw new Error("Unknown primitive topology mode")}}function Ma(e){if(e===Be.None)return"none";if(e===Be.Front)return"front";if(e===Be.Back)return"back";throw new Error("whoops")}function Da(e){if(e===De.CCW)return"ccw";if(e===De.CW)return"cw";throw new Error("whoops")}function Ba(e){if(e===Le.Zero)return"zero";if(e===Le.One)return"one";if(e===Le.Src)return"src";if(e===Le.OneMinusSrc)return"one-minus-src";if(e===Le.Dst)return"dst";if(e===Le.OneMinusDst)return"one-minus-dst";if(e===Le.SrcAlpha)return"src-alpha";if(e===Le.OneMinusSrcAlpha)return"one-minus-src-alpha";if(e===Le.DstAlpha)return"dst-alpha";if(e===Le.OneMinusDstAlpha)return"one-minus-dst-alpha";throw new Error("whoops")}function La(e){if(e===be.Add)return"add";if(e===be.Subtract)return"subtract";if(e===be.ReverseSubtract)return"reverse-subtract";throw new Error("whoops")}function ba(e){return{operation:La(e.blendMode),srcFactor:Ba(e.blendSrcFactor),dstFactor:Ba(e.blendDstFactor)}}function Fa(e,t){return t.attachmentsState.map((function(t,r){return function(e,t){return{format:Ta(t),blend:{color:ba(e.rgbBlendState),alpha:ba(e.alphaBlendState)},writeMask:e.channelWriteMask}}(t,e[r])}))}function Ua(e){if(e===Me.Never)return"never";if(e===Me.Less)return"less";if(e===Me.Equal)return"equal";if(e===Me.LessEqual)return"less-equal";if(e===Me.Greater)return"greater";if(e===Me.NotEqual)return"not-equal";if(e===Me.GreaterEqual)return"greater-equal";if(e===Me.Always)return"always";throw new Error("whoops")}function wa(e){if(e===We.PerVertex)return"vertex";if(e===We.PerInstance)return"instance";throw new Error("whoops")}function Ga(e){if(e===tt.U8_R)return"uint8x2";if(e===tt.U8_RG)return"uint8x2";if(e===tt.U8_RGB)return"uint8x4";if(e===tt.U8_RGBA)return"uint8x4";if(e===tt.U8_RGBA_NORM)return"unorm8x4";if(e===tt.S8_RGB_NORM)return"snorm8x4";if(e===tt.S8_RGBA_NORM)return"snorm8x4";if(e===tt.S16_RG)return"uint16x2";if(e===tt.F32_R)return"float32";if(e===tt.F32_RG)return"float32x2";if(e===tt.F32_RGB)return"float32x3";if(e===tt.F32_RGBA)return"float32x4";throw new Error("whoops")}function ka(e,t,r,n){switch(void 0===r&&(r=!1),e){case tt.S8_R:case tt.S8_R_NORM:case tt.S8_RG_NORM:case tt.S8_RGB_NORM:case tt.S8_RGBA_NORM:var i=(ArrayBuffer,new Int8Array(t));return n&&i.set(new Int8Array(n)),i;case tt.U8_R:case tt.U8_R_NORM:case tt.U8_RG:case tt.U8_RG_NORM:case tt.U8_RGB:case tt.U8_RGB_NORM:case tt.U8_RGB_SRGB:case tt.U8_RGBA:case tt.U8_RGBA_NORM:case tt.U8_RGBA_SRGB:var o=(ArrayBuffer,new Uint8Array(t));return n&&o.set(new Uint8Array(n)),o;case tt.S16_R:case tt.S16_RG:case tt.S16_RG_NORM:case tt.S16_RGB_NORM:case tt.S16_RGBA:case tt.S16_RGBA_NORM:var a=t instanceof ArrayBuffer?new Int16Array(t):new Int16Array(r?t/2:t);return n&&a.set(new Int16Array(n)),a;case tt.U16_R:case tt.U16_RGB:case tt.U16_RGBA_5551:case tt.U16_RGBA_NORM:case tt.U16_RG_NORM:case tt.U16_R_NORM:var s=t instanceof ArrayBuffer?new Uint16Array(t):new Uint16Array(r?t/2:t);return n&&s.set(new Uint16Array(n)),s;case tt.S32_R:var u=t instanceof ArrayBuffer?new Int32Array(t):new Int32Array(r?t/4:t);return n&&u.set(new Int32Array(n)),u;case tt.U32_R:case tt.U32_RG:var c=t instanceof ArrayBuffer?new Uint32Array(t):new Uint32Array(r?t/4:t);return n&&c.set(new Uint32Array(n)),c;case tt.F32_R:case tt.F32_RG:case tt.F32_RGB:case tt.F32_RGBA:var l=t instanceof ArrayBuffer?new Float32Array(t):new Float32Array(r?t/4:t);return n&&l.set(new Float32Array(n)),l}var f=(ArrayBuffer,new Uint8Array(t));return n&&f.set(new Uint8Array(n)),f}!function(e){e[e.COPY_SRC=1]="COPY_SRC",e[e.COPY_DST=2]="COPY_DST",e[e.TEXTURE_BINDING=4]="TEXTURE_BINDING",e[e.STORAGE_BINDING=8]="STORAGE_BINDING",e[e.STORAGE=8]="STORAGE",e[e.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT"}(da||(da={})),function(e){e[e.READ=1]="READ",e[e.WRITE=2]="WRITE"}(pa||(pa={}));var Va=function(e){function t(t){var r,n=t.id,i=t.device;return(r=e.call(this)||this).type=void 0,r.id=void 0,r.name=void 0,r.device=void 0,r.id=n,r.device=i,r}return qo(t,e),t.prototype.destroy=function(){},t}(l.EventEmitter),Wa=function(e){function t(t){var r,n=t.descriptor;(r=e.call(this,{id:t.id,device:t.device})||this).type=Pe.Bindings,r.bindingLayout=void 0,r.gpuBindGroup=void 0,r.bindGroupLayout=void 0;var i=n.pipeline,o=n.bindingLayout;ht(!!i);var a=r.device._createBindGroupLayout(o),s=[[],[]],u=0;if(o.storageEntries)for(var c=0;o.storageEntries.length>c;c++){var l=n.storageBufferBindings[c];ht(l.wordCount>0);var f={buffer:Na(l.buffer),offset:0,size:l.wordCount<<2};s[0].push({binding:u++,resource:f})}for(var h=0;o.numUniformBuffers>h;h++){var d=n.uniformBufferBindings[h];ht(d.wordCount>0);var p={buffer:Na(d.buffer),offset:0,size:d.wordCount<<2};s[0].push({binding:u++,resource:p})}u=0;for(var _=0;o.numSamplers>_;_++){var E=void 0!==o.samplerEntries?o.samplerEntries[_]:jt,v=n.samplerBindings[_],g=null!==v.texture?v.texture:r.device.getFallbackTexture(E);ht(E.dimension===g.dimension),ht(E.formatKind===ft(g.pixelFormat)),s[1].push({binding:u++,resource:g.gpuTextureView});var m=(null!==v.sampler?v.sampler:r.device.fallbackSampler).gpuSampler;s[1].push({binding:u++,resource:m})}return r.gpuBindGroup=s.map((function(e,t){return r.device.device.createBindGroup({layout:i.getBindGroupLayout(t),entries:e})})),r.bindingLayout=n.bindingLayout,r.bindGroupLayout=a,r}return qo(t,e),t}(Va);function Xa(e){return void 0!==e.byteLength}var Ha=function(e){function t(t){var r,n=t.descriptor;(r=e.call(this,{id:t.id,device:t.device})||this).type=Pe.Buffer,r.gpuBuffer=void 0,r.size=void 0,r.view=void 0,r.usage=void 0;var i=n.usage,o=n.viewOrSize,a=Xa(o)?o.byteLength+3&-4:o+3&-4;r.usage=i,r.usage&ke.MAP_READ&&(r.usage=ke.MAP_READ|ke.COPY_DST);var s=Xa(o);if(r.size=Xa(o)?o.byteLength:o,r.view=Xa(o)?o:null,r.gpuBuffer=r.device.device.createBuffer({usage:r.usage,size:a,mappedAtCreation:s}),s){var u=r.gpuBuffer.getMappedRange();new o.constructor(u).set(o),r.gpuBuffer.unmap()}return r}qo(t,e);var r=t.prototype;return r.setSubData=function(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var i=this.gpuBuffer;n=n||t.byteLength,n=Math.min(n,this.size-e);var o=t.byteOffset+r,a=o+n,s=n+3&-4;if(s!==n){var u=new Uint8Array(t.buffer.slice(o,a));(t=new Uint8Array(s)).set(u),r=0,o=0,a=s,n=s}for(var c=15728640,l=0;a-(o+l)>c;)this.device.device.queue.writeBuffer(i,e+l,t.buffer,o+l,c),l+=c;this.device.device.queue.writeBuffer(i,e+l,t.buffer,o+l,n-l)},r.destroy=function(){e.prototype.destroy.call(this),this.gpuBuffer.destroy()},t}(Va),Ya=function(){function e(){this.commandEncoder=null,this.descriptor=void 0,this.gpuComputePassDescriptor=void 0,this.gpuComputePassEncoder=null}var t=e.prototype;return t.dispatch=function(e,t,r){this.gpuComputePassEncoder.dispatchWorkgroups(e,t,r)},t.finish=function(){return this.gpuComputePassEncoder.end(),this.gpuComputePassEncoder=null,this.commandEncoder.finish()},t.beginComputePass=function(e){ht(null===this.gpuComputePassEncoder),this.setComputePassDescriptor(e),this.gpuComputePassEncoder=this.commandEncoder.beginComputePass(this.gpuComputePassDescriptor)},t.setPipeline=function(e){var t=dt(e.gpuComputePipeline);this.gpuComputePassEncoder.setPipeline(t)},t.setBindings=function(e,t){this.gpuComputePassEncoder.setBindGroup(e,t.gpuBindGroup[0])},t.setComputePassDescriptor=function(e){this.descriptor=e},e}(),ja=function(e){function t(t){var r,n=t.descriptor;(r=e.call(this,{id:t.id,device:t.device})||this).type=Pe.ComputePipeline,r.descriptor=void 0,r.gpuComputePipeline=null,r.descriptor=n;var i=n.program.computeStage;if(null===i)return Qo(r);var o={compute:zo({},i),layout:"auto"};return r.gpuComputePipeline=r.device.device.createComputePipeline(o),void 0!==r.name&&(r.gpuComputePipeline.label=r.name),r}return qo(t,e),t.prototype.getBindGroupLayout=function(e){return this.gpuComputePipeline.getBindGroupLayout(e)},t}(Va),Ka=function(e){function t(t){var r,n=t.descriptor;(r=e.call(this,{id:t.id,device:t.device})||this).type=Pe.InputLayout,r.buffers=void 0,r.indexFormat=void 0;for(var i=[],o=0;n.vertexBufferDescriptors.length>o;o++){var a=n.vertexBufferDescriptors[o];if(!d(a)){var s=a.byteStride,u=wa(a.frequency);i[o]={arrayStride:s,stepMode:u,attributes:[]}}}for(var c=0;n.vertexAttributeDescriptors.length>c;c++){var l=n.vertexAttributeDescriptors[c],f=dt(i[l.bufferIndex]),h={shaderLocation:l.location,format:Ga(l.format),offset:l.bufferByteOffset};f.attributes.push(h)}return r.indexFormat=function(e){if(null!==e){if(e===tt.U16_R)return"uint16";if(e===tt.U32_R)return"uint32";throw new Error("whoops")}}(n.indexBufferFormat),r.buffers=i,r}return qo(t,e),t}(Va),za=function(e){function t(t){var r,n=t.inputLayout,i=t.vertexBuffers,o=t.indexBuffer;return(r=e.call(this,{id:t.id,device:t.device})||this).type=Pe.InputState,r.inputLayout=void 0,r.vertexBuffers=void 0,r.indexBuffer=void 0,r.inputLayout=n,r.vertexBuffers=i,r.indexBuffer=o,r}return qo(t,e),t}(Va),qa=function(e){function t(t){var r,n=t.descriptor;return(r=e.call(this,{id:t.id,device:t.device})||this).type=Pe.Program,r.descriptor=void 0,r.vertexStage=null,r.fragmentStage=null,r.computeStage=null,r.descriptor=n,n.preprocessedVert&&(r.vertexStage=r.createShaderStage(n.preprocessedVert,"vertex")),n.preprocessedFrag&&(r.fragmentStage=r.createShaderStage(n.preprocessedFrag,"fragment")),n.preprocessedCompute&&(r.computeStage=r.createShaderStage(n.preprocessedCompute,"compute")),r}return qo(t,e),t.prototype.createShaderStage=function(e,t){var r=e;if("compute"!==t)try{r=this.device.glsl_compile(e,t,!1)}catch(t){throw console.error(t,e),new Error("whoops")}for(var n=function(){var e=o[i];if(!r.includes(e))return"continue";r=(r=r.replace("var T_"+e+": texture_2d<f32>;","var T_"+e+": texture_depth_2d;")).replace(new RegExp("textureSample\\(T_"+e+"(.*)\\);$","gm"),(function(t,r){return"vec4<f32>(textureSample(T_"+e+r+"), 0.0, 0.0, 0.0);"}))},i=0,o=["u_TextureFramebufferDepth"];o.length>i;i++)n();return{module:this.device.device.createShaderModule({code:r}),entryPoint:"main"}},t}(Va),Za=function(e){function t(t){var r,n=t.descriptor;(r=e.call(this,{id:t.id,device:t.device})||this).type=Pe.QueryPool,r.querySet=void 0;var i=n.elemCount;return r.querySet=r.device.device.createQuerySet({type:xa(n.type),count:i}),r}return qo(t,e),t.prototype.queryResultOcclusion=function(e){return!0},t}(Va),Qa=function(e){function t(t){var r;return(r=e.call(this,{id:t.id,device:t.device})||this).type=Pe.Readback,r}qo(t,e);var r=t.prototype;return r.readTexture=function(e,t,r,n,i,o,a,s){void 0===a&&(a=0),void 0===s&&(s=0);var u=e,c=this.getBlockInformationFromFormat(u.format),l=Math.ceil(n/c.width)*c.length,f=256*Math.ceil(l/256),h=f*i,d=this.device.createBuffer({usage:ke.STORAGE|ke.MAP_READ|ke.COPY_DST,hint:Ve.Static,viewOrSize:h}),p=this.device.device.createCommandEncoder();return p.copyTextureToBuffer({texture:u.gpuTexture,mipLevel:0,origin:{x:t,y:r,z:Math.max(0,0)}},{buffer:d.gpuBuffer,offset:0,bytesPerRow:f},{width:n,height:i,depthOrArrayLayers:1}),this.device.device.queue.submit([p.finish()]),this.readBuffer(d,h,o,a,s,u.pixelFormat)},r.readBuffer=function(e,t,r,n,i,o,a,s){var u=this;void 0===t&&(t=0),void 0===r&&(r=null),void 0===i&&(i=0),void 0===o&&(o=tt.U8_RGB),void 0===a&&(a=!1);var c=e,l=i||c.size,f=r||c.view,h=f&&f.constructor&&f.constructor.BYTES_PER_ELEMENT||lt(o),d=c;if(!(c.usage&ke.MAP_READ&&c.usage&ke.COPY_DST)){var p=this.device.device.createCommandEncoder();d=this.device.createBuffer({usage:ke.STORAGE|ke.MAP_READ|ke.COPY_DST,hint:Ve.Static,viewOrSize:l}),p.copyBufferToBuffer(c.gpuBuffer,t,d.gpuBuffer,0,l),this.device.device.queue.submit([p.finish()])}return new Promise((function(e,r){d.gpuBuffer.mapAsync(pa.READ,t,l).then((function(){var r=d.gpuBuffer.getMappedRange(t,l),n=f;if(a)n=null===n?ka(o,l,!0,r):ka(o,n.buffer,void 0,r);else if(null===n)switch(h){case 1:(n=new Uint8Array(l)).set(new Uint8Array(r));break;case 2:n=u.getHalfFloatAsFloatRGBAArrayBuffer(l/2,r);break;case 4:(n=new Float32Array(l/4)).set(new Float32Array(r))}else switch(h){case 1:(n=new Uint8Array(n.buffer)).set(new Uint8Array(r));break;case 2:n=u.getHalfFloatAsFloatRGBAArrayBuffer(l/2,r,f);break;case 4:var i=f&&f.constructor||Float32Array;(n=new i(n.buffer)).set(new i(r))}d.gpuBuffer.unmap(),e(n)}),(function(e){return r(e)}))}))},r.getHalfFloatAsFloatRGBAArrayBuffer=function(e,t,r){r||(r=new Float32Array(e));for(var n,i,o,a,s=new Uint16Array(t);e--;)r[e]=(i=void 0,o=void 0,a=void 0,i=(32768&(n=s[e]))>>15,a=1023&n,0===(o=(31744&n)>>10)?(i?-1:1)*Math.pow(2,-14)*(a/Math.pow(2,10)):31==o?a?NaN:1/0*(i?-1:1):(i?-1:1)*Math.pow(2,o-15)*(1+a/Math.pow(2,10)));return r},r.getBlockInformationFromFormat=function(e){switch(e){case"r8unorm":case"r8snorm":case"r8uint":case"r8sint":return{width:1,height:1,length:1};case"r16uint":case"r16sint":case"r16float":case"rg8unorm":case"rg8snorm":case"rg8uint":case"rg8sint":case"depth16unorm":return{width:1,height:1,length:2};case"r32uint":case"r32sint":case"r32float":case"rg16uint":case"rg16sint":case"rg16float":case"rgba8unorm":case"rgba8unorm-srgb":case"rgba8snorm":case"rgba8uint":case"rgba8sint":case"bgra8unorm":case"bgra8unorm-srgb":case"rgb9e5ufloat":case"rgb10a2unorm":case"rg11b10ufloat":case"depth32float":default:return{width:1,height:1,length:4};case"rg32uint":case"rg32sint":case"rg32float":case"rgba16uint":case"rgba16sint":case"rgba16float":return{width:1,height:1,length:8};case"rgba32uint":case"rgba32sint":case"rgba32float":return{width:1,height:1,length:16};case"stencil8":throw new Error("No fixed size for Stencil8 format!");case"depth24plus":throw new Error("No fixed size for Depth24Plus format!");case"depth24plus-stencil8":throw new Error("No fixed size for Depth24PlusStencil8 format!");case"depth32float-stencil8":return{width:1,height:1,length:5};case"bc7-rgba-unorm":case"bc7-rgba-unorm-srgb":case"bc6h-rgb-ufloat":case"bc6h-rgb-float":case"bc2-rgba-unorm":case"bc2-rgba-unorm-srgb":case"bc3-rgba-unorm":case"bc3-rgba-unorm-srgb":case"bc5-rg-unorm":case"bc5-rg-snorm":return{width:4,height:4,length:16};case"bc4-r-unorm":case"bc4-r-snorm":case"bc1-rgba-unorm":case"bc1-rgba-unorm-srgb":return{width:4,height:4,length:8}}},t}(Va),Ja=function(){function e(){this.commandEncoder=null,this.descriptor=void 0,this.gpuRenderPassEncoder=null,this.gpuRenderPassDescriptor=void 0,this.gpuColorAttachments=void 0,this.gpuDepthStencilAttachment=void 0,this.gfxColorAttachment=[],this.gfxColorResolveTo=[],this.gfxDepthStencilAttachment=null,this.gfxDepthStencilResolveTo=null,this.gpuColorAttachments=[],this.gpuDepthStencilAttachment={view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"},this.gpuRenderPassDescriptor={colorAttachments:this.gpuColorAttachments,depthStencilAttachment:this.gpuDepthStencilAttachment}}var t=e.prototype;return t.setRenderPassDescriptor=function(e){this.descriptor=e,this.gpuRenderPassDescriptor.colorAttachments=this.gpuColorAttachments;var t=e.colorAttachment.length;this.gfxColorAttachment.length=t,this.gfxColorResolveTo.length=t;for(var r=0;e.colorAttachment.length>r;r++){var n=e.colorAttachment[r],i=e.colorResolveTo[r];if(null===n&&null!==i&&(n=i,i=null),this.gfxColorAttachment[r]=n,this.gfxColorResolveTo[r]=i,null===n){this.gpuColorAttachments.length=r,this.gfxColorAttachment.length=r,this.gfxColorResolveTo.length=r;break}void 0===this.gpuColorAttachments[r]&&(this.gpuColorAttachments[r]={});var o=this.gpuColorAttachments[r];o.view=n.gpuTextureView;var a=e.colorClearColor[r];"load"===a?o.loadOp="load":(o.loadOp="clear",o.clearValue=a),o.storeOp=e.colorStore[r]?"store":"discard",o.resolveTarget=void 0,null!==i&&(n.sampleCount>1?o.resolveTarget=i.gpuTextureView:o.storeOp="store")}if(this.gfxDepthStencilAttachment=e.depthStencilAttachment,this.gfxDepthStencilResolveTo=e.depthStencilResolveTo,null!==e.depthStencilAttachment){var s=this.gpuDepthStencilAttachment;s.view=e.depthStencilAttachment.gpuTextureView,"load"===e.depthClearValue?s.depthLoadOp="load":(s.depthLoadOp="clear",s.depthClearValue=e.depthClearValue),"load"===e.stencilClearValue?s.stencilLoadOp="load":(s.stencilLoadOp="clear",s.stencilClearValue=e.stencilClearValue),s.depthStoreOp=e.depthStencilStore?"store":"discard",s.stencilStoreOp=e.depthStencilStore?"store":"discard",this.gpuRenderPassDescriptor.depthStencilAttachment=this.gpuDepthStencilAttachment,null!==this.gfxDepthStencilResolveTo&&(s.depthStoreOp="store",s.stencilStoreOp="store")}else this.gpuRenderPassDescriptor.depthStencilAttachment=void 0;this.gpuRenderPassDescriptor.occlusionQuerySet=null!==e.occlusionQueryPool?e.occlusionQueryPool.querySet:void 0},t.beginRenderPass=function(e){ht(null===this.gpuRenderPassEncoder),this.setRenderPassDescriptor(e),this.gpuRenderPassEncoder=this.commandEncoder.beginRenderPass(this.gpuRenderPassDescriptor)},t.setViewport=function(e,t,r,n){this.gpuRenderPassEncoder.setViewport(e,t,r,n,0,1)},t.setScissor=function(e,t,r,n){this.gpuRenderPassEncoder.setScissorRect(e,t,r,n)},t.setPipeline=function(e){var t=dt(e.gpuRenderPipeline);this.gpuRenderPassEncoder.setPipeline(t)},t.setInputState=function(e){if(null!==e){var t=e;if(null!==t.indexBuffer){var r=t.inputLayout,n=t.indexBuffer;this.gpuRenderPassEncoder.setIndexBuffer(Na(n.buffer),dt(r.indexFormat),n.byteOffset)}for(var i=0;t.vertexBuffers.length>i;i++){var o=t.vertexBuffers[i];d(o)||this.gpuRenderPassEncoder.setVertexBuffer(i,Na(o.buffer),o.byteOffset)}}},t.setBindings=function(e,t,r){var n=t;this.gpuRenderPassEncoder.setBindGroup(e+0,n.gpuBindGroup[0],r.slice(0,n.bindingLayout.numUniformBuffers)),this.gpuRenderPassEncoder.setBindGroup(e+1,n.gpuBindGroup[1])},t.setStencilRef=function(e){this.gpuRenderPassEncoder.setStencilReference(e)},t.draw=function(e,t){this.gpuRenderPassEncoder.draw(e,1,t,0)},t.drawIndexed=function(e,t){this.gpuRenderPassEncoder.drawIndexed(e,1,t,0,0)},t.drawIndexedInstanced=function(e,t,r){this.gpuRenderPassEncoder.drawIndexed(e,r,t,0,0)},t.beginOcclusionQuery=function(e){this.gpuRenderPassEncoder.beginOcclusionQuery(e)},t.endOcclusionQuery=function(e){this.gpuRenderPassEncoder.endOcclusionQuery()},t.beginDebugGroup=function(e){void 0!==this.gpuRenderPassEncoder.pushDebugGroup&&this.gpuRenderPassEncoder.pushDebugGroup(e)},t.endDebugGroup=function(){void 0!==this.gpuRenderPassEncoder.popDebugGroup&&this.gpuRenderPassEncoder.popDebugGroup()},t.finish=function(){this.gpuRenderPassEncoder.end(),this.gpuRenderPassEncoder=null;for(var e=0;this.gfxColorAttachment.length>e;e++){var t=this.gfxColorAttachment[e],r=this.gfxColorResolveTo[e];null!==t&&null!==r&&1===t.sampleCount&&this.copyAttachment(r,t)}return null!==this.gfxDepthStencilAttachment&&null!==this.gfxDepthStencilResolveTo&&(this.gfxDepthStencilAttachment.sampleCount>1||this.copyAttachment(this.gfxDepthStencilResolveTo,this.gfxDepthStencilAttachment)),this.commandEncoder.finish()},t.copyAttachment=function(e,t){ht(1===t.sampleCount);var r={texture:t.gpuTexture},n={texture:e.gpuTexture};ht(t.width===e.width),ht(t.height===e.height),ht(!!(t.usage&da.COPY_SRC)),ht(!!(e.usage&da.COPY_DST)),this.commandEncoder.copyTextureToTexture(r,n,[e.width,e.height,1])},e}(),$a=function(e){function t(t){var r,n=t.descriptor;return(r=e.call(this,{id:t.id,device:t.device})||this).type=Pe.RenderPipeline,r.descriptor=void 0,r.isCreating=!1,r.isCreatingAsync=!1,r.gpuRenderPipeline=null,r.descriptor=n,r.device._createRenderPipeline(Qo(r),!1),r}return qo(t,e),t.prototype.getBindGroupLayout=function(e){return this.gpuRenderPipeline.getBindGroupLayout(e)},t}(Va),es=function(e){function t(t){var r,n,i,o=t.descriptor;(i=e.call(this,{id:t.id,device:t.device})||this).type=Pe.Sampler,i.gpuSampler=void 0;var a=o.minLOD,s=o.mipFilter===we.NoMip?o.minLOD:o.maxLOD,u=null!==(r=o.maxAnisotropy)&&void 0!==r?r:1;return u>1&&ht(o.minFilter===Ue.Bilinear&&o.magFilter===Ue.Bilinear&&o.mipFilter===we.Linear),i.gpuSampler=i.device.device.createSampler({addressModeU:Aa(o.wrapS),addressModeV:Aa(o.wrapT),addressModeW:Aa(null!==(n=o.wrapQ)&&void 0!==n?n:o.wrapS),lodMinClamp:a,lodMaxClamp:s,minFilter:Sa(o.minFilter),magFilter:Sa(o.magFilter),mipmapFilter:Ca(o.mipFilter),maxAnisotropy:u}),i}return qo(t,e),t}(Va),ts=function(e){function t(t){var r,n=t.descriptor,i=t.skipCreate;return(r=e.call(this,{id:t.id,device:t.device})||this).type=Pe.Texture,r.pixelFormat=void 0,r.dimension=void 0,r.format=void 0,r.width=void 0,r.height=void 0,r.depthOrArrayLayers=void 0,r.numLevels=void 0,r.sampleCount=void 0,r.usage=void 0,r.gpuTexture=void 0,r.gpuTextureView=void 0,r.device.createTextureShared({pixelFormat:n.pixelFormat,dimension:n.dimension,width:n.width,height:n.height,depthOrArrayLayers:n.depth,numLevels:n.numLevels,usage:n.usage,sampleCount:1},Qo(r),i),r}qo(t,e);var r=t.prototype;return r.setImageData=function(e,t){},r.destroy=function(){this.gpuTexture.destroy()},t}(Va),rs=function(){function e(e,t,r,n,i){this.swapChainWidth=0,this.swapChainHeight=0,this.swapChainTextureUsage=da.RENDER_ATTACHMENT|da.COPY_DST,this._resourceUniqueId=0,this.renderPassPool=[],this.computePassPool=[],this.bindGroupLayoutCache=new Jr(Qt,Zr),this.fallbackTexture2D=void 0,this.fallbackTexture2DDepth=void 0,this.fallbackTexture2DArray=void 0,this.fallbackTexture3D=void 0,this.fallbackTextureCube=void 0,this.fallbackSampler=void 0,this.featureTextureCompressionBC=!1,this.platformString="WebGPU",this.glslVersion="#version 440",this.explicitBindingLocations=!0,this.separateSamplerTextures=!0,this.viewportOrigin=qe.UpperLeft,this.clipSpaceNearZ=Ze.Zero,this.supportsSyncPipelineCompilation=!1,this.supportMRT=!0,this.adapter=void 0,this.device=void 0,this.canvas=void 0,this.canvasContext=void 0,this.glsl_compile=void 0,this.adapter=e,this.device=t,this.canvas=r,this.canvasContext=n,this.glsl_compile=i,this.fallbackTexture2D=this.createFallbackTexture(He.n2D,ze.Float),this.fallbackTexture2DDepth=this.createFallbackTexture(He.n2D,ze.Depth),this.fallbackTexture2DArray=this.createFallbackTexture(He.n2DArray,ze.Float),this.fallbackTexture3D=this.createFallbackTexture(He.n3D,ze.Float),this.fallbackTextureCube=this.createFallbackTexture(He.Cube,ze.Float),this.fallbackSampler=this.createSampler({wrapS:Fe.Clamp,wrapT:Fe.Clamp,minFilter:Ue.Point,magFilter:Ue.Point,mipFilter:we.NoMip}),this.device.features&&(this.featureTextureCompressionBC=this.device.features.has("texture-compression-bc")),this.device.onuncapturederror=function(e){console.error(e.error)}}var t=e.prototype;return t.configureSwapChain=function(e,t){this.swapChainWidth===e&&this.swapChainHeight===t||(this.swapChainWidth=e,this.swapChainHeight=t,this.canvasContext.configure({device:this.device,format:"bgra8unorm",usage:this.swapChainTextureUsage,compositingAlphaMode:"premultiplied"}))},t.getOnscreenTexture=function(){var e=this.canvasContext.getCurrentTexture(),t=e.createView(),r=new ts({id:0,device:this,descriptor:{pixelFormat:tt.U8_RGBA_RT,width:this.swapChainWidth,height:this.swapChainHeight,depth:0,dimension:He.n2D,numLevels:1,usage:this.swapChainTextureUsage},skipCreate:!0});return r.depthOrArrayLayers=1,r.sampleCount=1,r.gpuTexture=e,r.gpuTextureView=t,r},t.getDevice=function(){return this},t.getCanvas=function(){return this.canvas},t.present=function(){},t.getNextUniqueId=function(){return++this._resourceUniqueId},t.createBuffer=function(e){return new Ha({id:this.getNextUniqueId(),device:this,descriptor:e})},t.createTexture=function(e){return new ts({id:this.getNextUniqueId(),device:this,descriptor:e})},t.createSampler=function(e){return new es({id:this.getNextUniqueId(),device:this,descriptor:e})},t.createRenderTarget=function(e){var t=new ts({id:this.getNextUniqueId(),device:this,descriptor:zo({},e,{dimension:He.n2D,numLevels:1,depth:1,usage:Ye.RenderTarget})});return t.depthOrArrayLayers=1,t.type=Pe.RenderTarget,t},t.createRenderTargetFromTexture=function(e){var t=e.pixelFormat,r=e.width,n=e.height,i=e.depthOrArrayLayers,o=e.sampleCount,a=e.numLevels,s=e.gpuTexture,u=e.gpuTextureView,c=e.usage;ht(!!(c&da.RENDER_ATTACHMENT));var l=new ts({id:this.getNextUniqueId(),device:this,descriptor:{pixelFormat:t,width:r,height:n,depth:i,dimension:He.n2D,numLevels:a,usage:c},skipCreate:!0});return l.depthOrArrayLayers=i,l.sampleCount=o,l.gpuTexture=s,l.gpuTextureView=u,l},t.createProgram=function(e){return e.ensurePreprocessed(this),this.createProgramSimple(e)},t.createProgramSimple=function(e){return new qa({id:this.getNextUniqueId(),device:this,descriptor:e})},t.createTextureShared=function(e,t,r){var n={width:e.width,height:e.height,depthOrArrayLayers:e.depthOrArrayLayers},i=e.numLevels,o=Ta(e.pixelFormat),a=function(e){if(e===He.n2D)return"2d";if(e===He.Cube)return"3d";if(e===He.n2DArray)return"3d";if(e===He.n3D)return"3d";throw new Error("whoops")}(e.dimension),s=function(e){var t=0;return e&Ye.Sampled&&(t|=da.TEXTURE_BINDING|da.COPY_DST),e&Ye.RenderTarget&&(t|=da.RENDER_ATTACHMENT|da.TEXTURE_BINDING|da.COPY_SRC|da.COPY_DST),t}(e.usage);if(t.format=o,t.dimension=e.dimension,t.pixelFormat=e.pixelFormat,t.width=e.width,t.height=e.height,t.depthOrArrayLayers=e.depthOrArrayLayers,t.numLevels=i,t.usage=s,t.sampleCount=1,!r){var u=this.device.createTexture({size:n,mipLevelCount:i,format:o,dimension:a,usage:s}),c=u.createView();t.gpuTexture=u,t.gpuTextureView=c}},t.getFallbackTexture=function(e){var t=e.dimension;if(t===He.n2D)return e.formatKind===ze.Depth?this.fallbackTexture2DDepth:this.fallbackTexture2D;if(t===He.n2DArray)return this.fallbackTexture2DArray;if(t===He.n3D)return this.fallbackTexture3D;if(t===He.Cube)return this.fallbackTextureCube;throw new Error("whoops")},t.createFallbackTexture=function(e,t){return this.createTexture({dimension:e,pixelFormat:t===ze.Float?tt.U8_RGBA_NORM:tt.D24,usage:Ye.Sampled,width:1,height:1,depth:e===He.Cube?6:1,numLevels:1})},t.createBindings=function(e){return new Wa({id:this.getNextUniqueId(),device:this,descriptor:e})},t.createInputLayout=function(e){return new Ka({id:this.getNextUniqueId(),device:this,descriptor:e})},t.createInputState=function(e,t,r){return new za({id:this.getNextUniqueId(),device:this,inputLayout:e,vertexBuffers:t,indexBuffer:r})},t.createComputePipeline=function(e){return new ja({id:this.getNextUniqueId(),device:this,descriptor:e})},t.createRenderPipeline=function(e){return new $a({id:this.getNextUniqueId(),device:this,descriptor:zo({},e)})},t.createQueryPool=function(e,t){return new Za({id:this.getNextUniqueId(),device:this,descriptor:{type:e,elemCount:t}})},t._createBindGroupLayout=function(e){var t=this.bindGroupLayoutCache.get(e);return null===t&&(t=this._createBindGroupLayoutInternal(e),this.bindGroupLayoutCache.add(e,t)),t},t._createBindGroupLayoutInternal=function(e){var t,r=this,n=[[],[]];if(e.storageEntries)for(var i=0;e.storageEntries.length>i;i++)n[0].push({binding:n[0].length,visibility:GPUShaderStage.COMPUTE,buffer:{type:e.storageEntries[i].type}});for(var o=0;e.numUniformBuffers>o;o++)n[0].push({binding:n[0].length,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"uniform",hasDynamicOffset:!0}});for(var a=0;e.numSamplers>a;a++){n[1].push({binding:n[1].length,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,texture:(t=void 0!==e.samplerEntries?e.samplerEntries[a]:jt,{sampleType:Oa(t.formatKind),viewDimension:Ia(t.dimension)})}),n[1].push({binding:n[1].length,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}})}return{gpuBindGroupLayout:n.map((function(e){return r.device.createBindGroupLayout({entries:e})}))}},t._createPipelineLayout=function(e){var t=this,r=e.flatMap((function(e){return t._createBindGroupLayout(e).gpuBindGroupLayout}));return this.device.createPipelineLayout({bindGroupLayouts:r})},t._createRenderPipeline=function(e,t){if(!e.isCreating&&null===e.gpuRenderPipeline){var r=e.descriptor,n=r.program,i=n.vertexStage,o=n.fragmentStage;if(null!==i&&null!==o){var a,s=this._createPipelineLayout(r.bindingLayouts),u=(a=r.megaStateDescriptor,{topology:Pa(r.topology),cullMode:Ma(a.cullMode),frontFace:Da(a.frontFace)}),c=Fa(r.colorAttachmentFormats,r.megaStateDescriptor),l=function(e,t){if(null!==e)return{format:Ta(e),depthWriteEnabled:t.depthWrite,depthCompare:Ua(t.depthCompare),depthBias:t.polygonOffset?1:0,depthBiasSlopeScale:t.polygonOffset?1:0}}(r.depthStencilAttachmentFormat,r.megaStateDescriptor),f=void 0;null!==r.inputLayout&&(f=r.inputLayout.buffers);var h=r.sampleCount;e.isCreating=!0;var d={layout:s,vertex:zo({},i,{buffers:f}),primitive:u,depthStencil:l,multisample:{count:h},fragment:zo({},o,{targets:c})};e.gpuRenderPipeline=this.device.createRenderPipeline(d),void 0!==e.name&&(e.gpuRenderPipeline.label=e.name)}}},t.createReadback=function(){return new Qa({id:this.getNextUniqueId(),device:this})},t.destroyRenderTarget=function(e){e.gpuTexture.destroy()},t.createRenderPass=function(e){var t=this.renderPassPool.pop();return void 0===t&&(t=new Ja),t.commandEncoder=this.device.createCommandEncoder(),t.beginRenderPass(e),t},t.createComputePass=function(e){var t=this.computePassPool.pop();return void 0===t&&(t=new Ya),t.commandEncoder=this.device.createCommandEncoder(),t.beginComputePass(e),t},t.submitPass=function(e){var t=this.device.queue,r=e,n=r.finish();t.submit([n]),r.commandEncoder=null,r instanceof Ja?this.renderPassPool.push(r):this.computePassPool.push(r)},t.copySubTexture2D=function(e,t,r,n,i,o){var a=this.device.createCommandEncoder(),s=e,u=n,c={texture:u.gpuTexture,origin:[i,o,0]},l={texture:s.gpuTexture,origin:[t,r,0]};ht(!!(u.usage&da.COPY_SRC)),ht(!!(s.usage&da.COPY_DST)),a.copyTextureToTexture(c,l,[u.width,u.height,1]),this.device.queue.submit([a.finish()])},t.queryLimits=function(){return{uniformBufferMaxPageWordSize:4096,uniformBufferWordAlignment:64,supportedSampleCounts:[1]}},t.queryTextureFormatSupported=function(e,t,r){if(function(e){switch(st(e)){case Je.BC1:case Je.BC2:case Je.BC3:case Je.BC4_SNORM:case Je.BC4_UNORM:case Je.BC5_SNORM:case Je.BC5_UNORM:return!0;default:return!1}}(e)){if(!this.featureTextureCompressionBC)return!1;var n=function(e){switch(st(e)){case Je.BC1:case Je.BC2:case Je.BC3:case Je.BC4_SNORM:case Je.BC4_UNORM:case Je.BC5_SNORM:case Je.BC5_UNORM:return 4;default:return 1}}(e);return t%n==0&&r%n==0&&this.featureTextureCompressionBC}switch(e){case tt.U16_RGBA_NORM:case tt.F32_RGBA:return!1}return!0},t.queryPlatformAvailable=function(){return!0},t.queryVendorInfo=function(){return this},t.queryRenderPass=function(e){return e.descriptor},t.queryRenderTarget=function(e){return e},t.setResourceName=function(e,t){if(e.name=t,e.type===Pe.Buffer)e.gpuBuffer.label=t;else if(e.type===Pe.Texture){var r=e;r.gpuTexture.label=t,r.gpuTextureView.label=t}else if(e.type===Pe.RenderTarget){var n=e;n.gpuTexture.label=t,n.gpuTextureView.label=t}else if(e.type===Pe.Sampler){e.gpuSampler.label=t}else if(e.type===Pe.RenderPipeline){null!==e.gpuRenderPipeline&&(e.gpuRenderPipeline.label=t)}},t.setResourceLeakCheck=function(e,t){},t.checkForLeaks=function(){},t.programPatched=function(e){},t.pushDebugGroup=function(e){},t.popDebugGroup=function(){},t.pipelineQueryReady=function(e){return null!==e.gpuRenderPipeline},t.pipelineForceReady=function(e){this._createRenderPipeline(e,!1)},e}(),ns=function(){function e(e){this.pluginOptions=void 0,this.pluginOptions=e}return e.prototype.createSwapChain=function(){var e=Ko(Yo().mark((function e(t){var r,n,i,o;return Yo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==navigator.gpu){e.next=2;break}return e.abrupt("return",null);case 2:return r=null,e.prev=3,e.next=6,navigator.gpu.requestAdapter();case 6:r=e.sent,e.next=12;break;case 9:e.prev=9,e.t0=e.catch(3),console.log(e.t0);case 12:if(null!==r){e.next=14;break}return e.abrupt("return",null);case 14:return n=["depth32float-stencil8","texture-compression-bc"].filter((function(e){return r.features.has(e)})),e.next=18,r.requestDevice({requiredFeatures:n});case 18:if(null!==(i=e.sent)){e.next=21;break}return e.abrupt("return",null);case 21:if(o=t.getContext("webgpu")){e.next=24;break}return e.abrupt("return",null);case 24:return e.prev=24,e.next=27,Ra("/glsl_wgsl_compiler_bg.wasm");case 27:e.next=31;break;case 29:e.prev=29,e.t1=e.catch(24);case 31:return e.abrupt("return",new rs(r,i,t,o,va));case 32:case"end":return e.stop()}}),e,null,[[3,9],[24,29]])})));return function(t){return e.apply(this,arguments)}}(),e}();ns=u([t.singleton({token:$i}),c(0,t.inject($o))],ns);var is=t.Module((function(e){e(ns)})),os=function(e){function t(t){var r;return void 0===t&&(t={}),(r=e.call(this)||this).options=void 0,r.name="webgpu-device",r.options=t,r}qo(t,e);var r=t.prototype;return r.init=function(){this.container.register($o,{useValue:zo({},this.options)}),this.container.load(is,!0)},r.destroy=function(){this.container.remove($o),this.container.unload(is)},t}(t.AbstractRendererPlugin),as=Object.freeze({__proto__:null,Plugin:os}),ss=t.Syringe.defineToken(""),us=function(){function e(e,t){this.canvasConfig=void 0,this.deviceRendererPlugin=void 0,this.$container=void 0,this.$canvas=void 0,this.dpr=void 0,this.canvasConfig=e,this.deviceRendererPlugin=t}var n=e.prototype;return n.init=function(){var e=i(r().mark((function e(){var t,n,i,o;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=(t=this.canvasConfig).container,(i=t.canvas)?(this.$canvas=i,n&&i.parentElement!==n&&n.appendChild(i),this.$container=i.parentElement,this.canvasConfig.container=this.$container):n&&(this.$container=p(n)?document.getElementById(n):n,this.$container&&(o=document.createElement("canvas"),this.$container.appendChild(o),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=o)),this.resize(this.canvasConfig.width,this.canvasConfig.height);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),n.getDomElement=function(){return this.$canvas},n.getContext=function(){return this.deviceRendererPlugin.getDevice().canvasContext},n.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},n.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},n.resize=function(e,r){var n=this.canvasConfig.devicePixelRatio||t.isBrowser&&window.devicePixelRatio||1;if(n=1>n?1:Math.ceil(n),this.dpr=n,this.$canvas){var i=this.getDPR();this.$canvas.width=i*e,this.$canvas.height=i*r,t.setDOMSize(this.$canvas,e,r)}},n.getDPR=function(){return this.dpr},n.applyCursorStyle=function(e){this.$container&&this.$container.style&&(this.$container.style.cursor=e)},n.toDataURL=function(){var e=i(r().mark((function e(t){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return","");case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e}();us=u([t.singleton({token:t.ContextService}),c(0,t.inject(t.CanvasConfig)),c(1,t.inject(ss))],us);var cs=t.Module((function(e){e(us)})),ls=function(e){function t(t){var r;return(r=e.call(this)||this).rendererPlugin=void 0,r.name="webgpu-context-register",r.rendererPlugin=t,r}o(t,e);var r=t.prototype;return r.init=function(){this.container.register(ss,{useValue:this.rendererPlugin}),this.container.load(cs,!0)},r.destroy=function(){this.container.unload(cs),this.container.remove(ss)},t}(t.AbstractRendererPlugin),fs=function(e){function t(t){var r;r=e.call(this,t)||this;var n=new Co;return r.registerPlugin(new ls(n)),r.registerPlugin(new O),r.registerPlugin(new os),r.registerPlugin(n),r.registerPlugin(new bo),r.registerPlugin(new Xo),r}return o(t,e),t}(t.AbstractRenderer);e.DeviceRenderer=Oo,e.DomInteraction=Fo,e.HTMLRenderer=Ho,e.Renderer=fs,e.WebGPUDevice=as,Object.defineProperty(e,"__esModule",{value:!0})}));