vizor_2d 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vizor_2d.min.js +1 -1
- package/package.json +1 -1
package/dist/vizor_2d.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see vizor_2d.min.js.LICENSE.txt */
|
|
2
|
-
var t,e,n={5870:(t,e,n)=>{n.d(e,{A:()=>p});var r=n(1601),i=n.n(r),o=n(6314),s=n.n(o),a=n(4417),l=n.n(a),c=new URL(n(4002),n.b),h=new URL(n(2653),n.b),u=s()(i()),d=l()(c),f=l()(h);u.push([t.id,`.choices{position:relative;overflow:hidden;margin-bottom:var(--choices-guttering, 24px);font-size:var(--choices-font-size-lg, 16px)}.choices:focus{outline:0}.choices:last-child{margin-bottom:0}.choices.is-open{overflow:visible}.choices.is-disabled :is(.choices__inner,.choices__input){background-color:var(--choices-bg-color-disabled, #eaeaea);cursor:not-allowed!important;-webkit-user-select:none;user-select:none}.choices.is-disabled .choices__item{cursor:not-allowed;color:var(--choices-item-disabled-color, #fff)}.choices [hidden]{position:absolute;inset:0;pointer-events:none;opacity:0}.choices[data-type*=select-one]{cursor:pointer}.choices[data-type*=select-one] .choices__inner{padding-bottom:var(--choices-inner-one-padding, 7.5px)}.choices[data-type*=select-one] .choices__input{display:block;width:var(--choices-width, 100%);padding:var(--choices-dropdown-item-padding, 10px);border-bottom:var(--choices-base-border, 1px solid) var(--choices-keyline-color, #ddd);background-color:var(--choices-bg-color-dropdown, #fff);margin:0}.choices[data-type*=select-one] .choices__button{background-image:var(--choices-icon-cross-inverse, url(${d}));padding:0;background-size:8px;position:absolute;top:50%;right:0;margin-top:-10px;margin-right:25px;height:20px;width:20px;border-radius:10em;opacity:.25}.choices[data-type*=select-one] .choices__button:is(:hover,:focus){opacity:var(--choices-button-opacity-hover, 1)}.choices[data-type*=select-one] .choices__button:focus{box-shadow:0 0 0 2px var(--choices-highlight-color, #005F75)}.choices[data-type*=select-one] .choices__item[data-placeholder] .choices__button{display:none}.choices[data-type*=select-one]::after{content:"";height:0;width:0;border-style:solid;border-color:var(--choices-text-color, #333) transparent transparent transparent;border-width:var(--choices-arrow-size, 5px);position:absolute;right:var(--choices-arrow-right, 11.5px);top:50%;margin-top:var(--choices-arrow-margin-top, -2.5px);pointer-events:none}.choices[data-type*=select-one].is-open::after{border-color:transparent transparent var(--choices-text-color, #333);margin-top:var(--choices-arrow-margin-top-open, -7.5px)}.choices[data-type*=select-one][dir=rtl]::after{left:11.5px;right:auto}.choices[data-type*=select-one][dir=rtl] .choices__button{right:auto;left:0;margin-left:25px;margin-right:0}.choices:is([data-type*=select-multiple],[data-type*=text]) .choices__inner{cursor:text}.choices:is([data-type*=select-multiple],[data-type*=text]) .choices__button{position:relative;display:inline-block;margin:0 calc(var(--choices-button-offset, 8px)*-.5)0 var(--choices-button-offset, 8px);padding-left:calc(var(--choices-button-offset, 8px)*2);border-left:1px solid color-mix(in srgb,var(--choices-primary-color, #005F75) 90%,var(--choices-darken, black));background-image:var(--choices-icon-cross, url(${f}));background-size:var(--choices-button-dimension, 8px);width:var(--choices-button-dimension, 8px);line-height:var(--choices-button-line-height, 1);border-radius:var(--choices-button-border-radius, 0);opacity:var(--choices-button-opacity, 0.75)}.choices:is([data-type*=select-multiple],[data-type*=text]) .choices__button:is(:hover,:focus){--choices-button-opacity:var(--choices-button-opacity-hover, 1)}.choices__inner{display:inline-block;vertical-align:top;width:var(--choices-width, 100%);background-color:var(--choices-bg-color, #f9f9f9);padding:var(--choices-inner-padding, 7.5px 7.5px 3.75px);border:var(--choices-base-border, 1px solid) var(--choices-keyline-color, #ddd);border-radius:var(--choices-border-radius, 2.5px);font-size:var(--choices-font-size-md, 14px);min-height:var(--choices-input-height, 44px);overflow:hidden}.is-focused .choices__inner,.is-open .choices__inner{border-color:color-mix(in srgb,var(--choices-keyline-color, #ddd) 85%,var(--choices-darken, black))}.is-open .choices__inner{border-radius:var(--choices-border-radius, 2.5px) var(--choices-border-radius, 2.5px)0 0}.is-invalid .choices__inner{border-color:var(--choices-invalid-color, #d33141)}.is-flipped.is-open .choices__inner{border-radius:0 0 var(--choices-border-radius, 2.5px) var(--choices-border-radius, 2.5px)}.choices__list{margin:0;padding-left:0;list-style:none}.choices__list--single{display:inline-block;padding:var(--choices-list-single-padding, 4px 16px 4px 4px)}[dir=rtl] .choices__list--single{padding-right:4px;padding-left:16px}.choices__list--single,.choices__list--single .choices__item{width:var(--choices-width, 100%)}.choices__list--multiple{display:inline}.choices__list--multiple .choices__item{display:inline-block;vertical-align:middle;border-radius:var(--choices-border-radius-item, 20px);padding:var(--choices-multiple-item-padding, 4px 10px);font-size:var(--choices-font-size-sm, 12px);font-weight:500;margin-right:var(--choices-multiple-item-margin, 3.75px);margin-bottom:var(--choices-multiple-item-margin, 3.75px);background-color:var(--choices-primary-color, #005F75);border:1px solid color-mix(in srgb,var(--choices-primary-color, #005F75) 95%,var(--choices-darken, black));color:var(--choices-item-color, #fff);word-break:break-all;box-sizing:border-box}.choices__list--multiple .choices__item[data-deletable]{padding-right:5px}[dir=rtl] .choices__list--multiple .choices__item{margin-right:0;margin-left:var(--choices-multiple-item-margin, 3.75px)}.choices__list--multiple .choices__item.is-highlighted{background-color:color-mix(in srgb,var(--choices-primary-color, #005F75) 95%,var(--choices-darken, black));border:1px solid color-mix(in srgb,var(--choices-primary-color, #005F75) 90%,var(--choices-darken, black))}.is-disabled .choices__list--multiple .choices__item{background-color:color-mix(in srgb,var(--choices-disabled-color, #eaeaea) 75%,var(--choices-darken, black));border:1px solid color-mix(in srgb,var(--choices-disabled-color, #eaeaea) 65%,var(--choices-darken, black))}.choices__list--dropdown,.choices__list[aria-expanded]{display:none;z-index:var(--choices-z-index, 1);position:absolute;width:var(--choices-width, 100%);background-color:var(--choices-bg-color-dropdown, #fff);border:var(--choices-base-border, 1px solid) var(--choices-keyline-color, #ddd);top:100%;margin-top:-1px;border-bottom-left-radius:var(--choices-border-radius, 2.5px);border-bottom-right-radius:var(--choices-border-radius, 2.5px);overflow:hidden;word-break:break-all}.is-active.choices__list--dropdown,.is-active.choices__list[aria-expanded]{display:block}.is-open .choices__list--dropdown,.is-open .choices__list[aria-expanded]{border-color:color-mix(in srgb,var(--choices-keyline-color, #ddd) 85%,var(--choices-darken, black))}.is-flipped .choices__list--dropdown,.is-flipped .choices__list[aria-expanded]{top:auto;bottom:100%;margin-top:0;margin-bottom:-1px;border-radius:.25rem .25rem 0 0}.choices__list--dropdown .choices__list,.choices__list[aria-expanded] .choices__list{position:relative;max-height:300px;overflow:auto;-webkit-overflow-scrolling:touch;will-change:scroll-position}.choices__list--dropdown .choices__item,.choices__list[aria-expanded] .choices__item{position:relative;padding:var(--choices-dropdown-item-padding, 10px);font-size:var(--choices-font-size-md, 14px)}[dir=rtl] .choices__list--dropdown .choices__item,[dir=rtl] .choices__list[aria-expanded] .choices__item{text-align:right}@media (min-width:640px){.choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text],.choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]{padding-right:100px}.choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text]::after,.choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]::after{content:attr(data-select-text);font-size:var(--choices-font-size-sm, 12px);position:absolute;right:10px;top:50%;transform:translateY(-50%)}[dir=rtl] .choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text],[dir=rtl] .choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]{text-align:right;padding-left:100px;padding-right:10px}[dir=rtl] .choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text]::after,[dir=rtl] .choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]::after{right:auto;left:10px}}.choices__list--dropdown .choices__item--selectable.is-selected::after,.choices__list[aria-expanded] .choices__item--selectable.is-selected::after{content:none!important}.choices__list--dropdown .choices__item--selectable.is-highlighted,.choices__list--dropdown .choices__item--selectable.is-selected,.choices__list[aria-expanded] .choices__item--selectable.is-highlighted,.choices__list[aria-expanded] .choices__item--selectable.is-selected{background-color:var(--choices-highlighted-color, #f2f2f2)}.choices__item{cursor:default}.choices__item--selectable{cursor:pointer}.choices__item--disabled{cursor:not-allowed;-webkit-user-select:none;user-select:none;opacity:.5}.choices__heading{font-weight:600;font-size:12px;padding:10px;border-bottom:1px solid color-mix(in srgb,var(--choices-keyline-color, #ddd) 90%,var(--choices-lighten, white));color:gray}.choices__button{text-indent:-9999px;appearance:none;border:0;background-color:transparent;background-repeat:no-repeat;background-position:center;cursor:pointer}.choices__button:focus,.choices__input:focus{outline:0}.choices__input{display:inline-block;vertical-align:baseline;background-color:var(--choices-bg-color, #f9f9f9);font-size:var(--choices-font-size-md, 14px);margin-bottom:var(--choices-input-margin-bottom, 5px);border:0;border-radius:0;max-width:var(--choices-width, 100%);padding:var(--choices-input-padding, 4px 0 4px 2px)}.choices__input::-webkit-search-cancel-button,.choices__input::-webkit-search-decoration,.choices__input::-webkit-search-results-button,.choices__input::-webkit-search-results-decoration{display:none}.choices__input::-ms-clear,.choices__input::-ms-reveal{display:none;width:0;height:0}[dir=rtl] .choices__input{padding-right:2px;padding-left:0}.choices__placeholder{opacity:var(--choices-placeholder-opacity, 0.5)}`,""]);const p=u},6314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,i,o){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(r)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var c=0;c<t.length;c++){var h=[].concat(t[c]);r&&s[h[0]]||(void 0!==o&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=o),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),i&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=i):h[4]="".concat(i)),e.push(h))}},e}},4417:t=>{t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]|(%20)/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t):t}},1601:t=>{t.exports=function(t){return t[1]}},228:t=>{var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||t,s),l=n?n+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},a.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i<o;i++)s[i]=r[i].fn;return s},a.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,i,o,s){var a=n?n+t:t;if(!this._events[a])return!1;var l,c,h=this._events[a],u=arguments.length;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),u){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,i),!0;case 5:return h.fn.call(h.context,e,r,i,o),!0;case 6:return h.fn.call(h.context,e,r,i,o,s),!0}for(c=1,l=new Array(u-1);c<u;c++)l[c-1]=arguments[c];h.fn.apply(h.context,l)}else{var d,f=h.length;for(c=0;c<f;c++)switch(h[c].once&&this.removeListener(t,h[c].fn,void 0,!0),u){case 1:h[c].fn.call(h[c].context);break;case 2:h[c].fn.call(h[c].context,e);break;case 3:h[c].fn.call(h[c].context,e,r);break;case 4:h[c].fn.call(h[c].context,e,r,i);break;default:if(!l)for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];h[c].fn.apply(h[c].context,l)}}return!0},a.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},a.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},a.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||i&&!a.once||r&&a.context!==r||s(this,o);else{for(var l=0,c=[],h=a.length;l<h;l++)(a[l].fn!==e||i&&!a[l].once||r&&a[l].context!==r)&&c.push(a[l]);c.length?this._events[o]=1===c.length?c[0]:c:s(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a},8133:t=>{t.exports=function(t){var i=[];return t.replace(n,(function(t,n,o){var s=n.toLowerCase();for(o=function(t){var e=t.match(r);return e?e.map(Number):[]}(o),"m"==s&&o.length>2&&(i.push([n].concat(o.splice(0,2))),s="l",n="m"==n?"l":"L");;){if(o.length==e[s])return o.unshift(n),i.push(o);if(o.length<e[s])throw new Error("malformed path data");i.push([n].concat(o.splice(0,e[s])))}})),i};var e={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},n=/([astvzqmhlc])([^astvzqmhlc]*)/gi;var r=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi},5585:t=>{var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||t,s),l=n?n+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},a.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i<o;i++)s[i]=r[i].fn;return s},a.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,i,o,s){var a=n?n+t:t;if(!this._events[a])return!1;var l,c,h=this._events[a],u=arguments.length;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),u){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,i),!0;case 5:return h.fn.call(h.context,e,r,i,o),!0;case 6:return h.fn.call(h.context,e,r,i,o,s),!0}for(c=1,l=new Array(u-1);c<u;c++)l[c-1]=arguments[c];h.fn.apply(h.context,l)}else{var d,f=h.length;for(c=0;c<f;c++)switch(h[c].once&&this.removeListener(t,h[c].fn,void 0,!0),u){case 1:h[c].fn.call(h[c].context);break;case 2:h[c].fn.call(h[c].context,e);break;case 3:h[c].fn.call(h[c].context,e,r);break;case 4:h[c].fn.call(h[c].context,e,r,i);break;default:if(!l)for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];h[c].fn.apply(h[c].context,l)}}return!0},a.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},a.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},a.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||i&&!a.once||r&&a.context!==r||s(this,o);else{for(var l=0,c=[],h=a.length;l<h;l++)(a[l].fn!==e||i&&!a[l].once||r&&a[l].context!==r)&&c.push(a[l]);c.length?this._events[o]=1===c.length?c[0]:c:s(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a},5072:t=>{var e=[];function n(t){for(var n=-1,r=0;r<e.length;r++)if(e[r].identifier===t){n=r;break}return n}function r(t,r){for(var o={},s=[],a=0;a<t.length;a++){var l=t[a],c=r.base?l[0]+r.base:l[0],h=o[c]||0,u="".concat(c," ").concat(h);o[c]=h+1;var d=n(u),f={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(f);else{var p=i(f,r);r.byIndex=a,e.splice(a,0,{identifier:u,updater:p,references:1})}s.push(u)}return s}function i(t,e){var n=e.domAPI(e);n.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,i){var o=r(t=t||[],i=i||{});return function(t){t=t||[];for(var s=0;s<o.length;s++){var a=n(o[s]);e[a].references--}for(var l=r(t,i),c=0;c<o.length;c++){var h=n(o[c]);0===e[h].references&&(e[h].updater(),e.splice(h,1))}o=l}}},7659:t=>{var e={};t.exports=function(t,n){var r=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},5056:(t,e,n)=>{t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},7825:t=>{t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,i&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},1113:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},4002:t=>{t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg=="},2653:t=>{t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg=="},2406:(t,e,n)=>{n.d(e,{z:()=>r});const r=(t,e,n=!1)=>(Array.isArray(t)||(t=[t]),e?t.map((t=>"string"==typeof t||n?e(t):t)):t)},2577:(t,e,n)=>{n.d(e,{Q:()=>I});var r={grad:.9,turn:360,rad:360/(2*Math.PI)},i=function(t){return"string"==typeof t?t.length>0:"number"==typeof t},o=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},s=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=1),t>n?n:t>e?t:e},a=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},l=function(t){return{r:s(t.r,0,255),g:s(t.g,0,255),b:s(t.b,0,255),a:s(t.a)}},c=function(t){return{r:o(t.r),g:o(t.g),b:o(t.b),a:o(t.a,3)}},h=/^#([0-9a-f]{3,8})$/i,u=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},d=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,o=Math.max(e,n,r),s=o-Math.min(e,n,r),a=s?o===e?(n-r)/s:o===n?2+(r-e)/s:4+(e-n)/s:0;return{h:60*(a<0?a+6:a),s:o?s/o*100:0,v:o/255*100,a:i}},f=function(t){var e=t.h,n=t.s,r=t.v,i=t.a;e=e/360*6,n/=100,r/=100;var o=Math.floor(e),s=r*(1-n),a=r*(1-(e-o)*n),l=r*(1-(1-e+o)*n),c=o%6;return{r:255*[r,a,s,s,l,r][c],g:255*[l,r,r,a,s,s][c],b:255*[s,s,l,r,r,a][c],a:i}},p=function(t){return{h:a(t.h),s:s(t.s,0,100),l:s(t.l,0,100),a:s(t.a)}},m=function(t){return{h:o(t.h),s:o(t.s),l:o(t.l),a:o(t.a,3)}},y=function(t){return f((n=(e=t).s,{h:e.h,s:(n*=((r=e.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:e.a}));var e,n,r},g=function(t){return{h:(e=d(t)).h,s:(i=(200-(n=e.s))*(r=e.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,n,r,i},v=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,b=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,x=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,w={string:[[function(t){var e=h.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:4===t.length?o(parseInt(t[3]+t[3],16)/255,2):1}:6===t.length||8===t.length?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:8===t.length?o(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=x.exec(t)||_.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:l({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:void 0===e[7]?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=v.exec(t)||b.exec(t);if(!e)return null;var n,i,o=p({h:(n=e[1],i=e[2],void 0===i&&(i="deg"),Number(n)*(r[i]||1)),s:Number(e[3]),l:Number(e[4]),a:void 0===e[5]?1:Number(e[5])/(e[6]?100:1)});return y(o)},"hsl"]],object:[[function(t){var e=t.r,n=t.g,r=t.b,o=t.a,s=void 0===o?1:o;return i(e)&&i(n)&&i(r)?l({r:Number(e),g:Number(n),b:Number(r),a:Number(s)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,o=t.a,s=void 0===o?1:o;if(!i(e)||!i(n)||!i(r))return null;var a=p({h:Number(e),s:Number(n),l:Number(r),a:Number(s)});return y(a)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,o=t.a,l=void 0===o?1:o;if(!i(e)||!i(n)||!i(r))return null;var c=function(t){return{h:a(t.h),s:s(t.s,0,100),v:s(t.v,0,100),a:s(t.a)}}({h:Number(e),s:Number(n),v:Number(r),a:Number(l)});return f(c)},"hsv"]]},S=function(t,e){for(var n=0;n<e.length;n++){var r=e[n][0](t);if(r)return[r,e[n][1]]}return[null,void 0]},C=function(t){return"string"==typeof t?S(t.trim(),w.string):"object"==typeof t&&null!==t?S(t,w.object):[null,void 0]},E=function(t,e){var n=g(t);return{h:n.h,s:s(n.s+100*e,0,100),l:n.l,a:n.a}},k=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},T=function(t,e){var n=g(t);return{h:n.h,s:n.s,l:s(n.l+100*e,0,100),a:n.a}},A=function(){function t(t){this.parsed=C(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return null!==this.parsed},t.prototype.brightness=function(){return o(k(this.rgba),2)},t.prototype.isDark=function(){return k(this.rgba)<.5},t.prototype.isLight=function(){return k(this.rgba)>=.5},t.prototype.toHex=function(){return e=(t=c(this.rgba)).r,n=t.g,r=t.b,s=(i=t.a)<1?u(o(255*i)):"","#"+u(e)+u(n)+u(r)+s;var t,e,n,r,i,s},t.prototype.toRgb=function(){return c(this.rgba)},t.prototype.toRgbString=function(){return e=(t=c(this.rgba)).r,n=t.g,r=t.b,(i=t.a)<1?"rgba("+e+", "+n+", "+r+", "+i+")":"rgb("+e+", "+n+", "+r+")";var t,e,n,r,i},t.prototype.toHsl=function(){return m(g(this.rgba))},t.prototype.toHslString=function(){return e=(t=m(g(this.rgba))).h,n=t.s,r=t.l,(i=t.a)<1?"hsla("+e+", "+n+"%, "+r+"%, "+i+")":"hsl("+e+", "+n+"%, "+r+"%)";var t,e,n,r,i},t.prototype.toHsv=function(){return t=d(this.rgba),{h:o(t.h),s:o(t.s),v:o(t.v),a:o(t.a,3)};var t},t.prototype.invert=function(){return M({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},t.prototype.saturate=function(t){return void 0===t&&(t=.1),M(E(this.rgba,t))},t.prototype.desaturate=function(t){return void 0===t&&(t=.1),M(E(this.rgba,-t))},t.prototype.grayscale=function(){return M(E(this.rgba,-1))},t.prototype.lighten=function(t){return void 0===t&&(t=.1),M(T(this.rgba,t))},t.prototype.darken=function(t){return void 0===t&&(t=.1),M(T(this.rgba,-t))},t.prototype.rotate=function(t){return void 0===t&&(t=15),this.hue(this.hue()+t)},t.prototype.alpha=function(t){return"number"==typeof t?M({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):o(this.rgba.a,3);var e},t.prototype.hue=function(t){var e=g(this.rgba);return"number"==typeof t?M({h:t,s:e.s,l:e.l,a:e.a}):o(e.h)},t.prototype.isEqual=function(t){return this.toHex()===M(t).toHex()},t}(),M=function(t){return t instanceof A?t:new A(t)},P=[];!function(t){t.forEach((function(t){P.indexOf(t)<0&&(t(A,w),P.push(t))}))}([function(t,e){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var i in n)r[n[i]]=i;var o={};t.prototype.toName=function(e){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var i,s,a=r[this.toHex()];if(a)return a;if(null==e?void 0:e.closest){var l=this.toRgb(),c=1/0,h="black";if(!o.length)for(var u in n)o[u]=new t(n[u]).toRgb();for(var d in n){var f=(i=l,s=o[d],Math.pow(i.r-s.r,2)+Math.pow(i.g-s.g,2)+Math.pow(i.b-s.b,2));f<c&&(c=f,h=d)}return h}},e.string.push([function(e){var r=e.toLowerCase(),i="transparent"===r?"#0000":n[r];return i?new t(i).toRgb():null},"name"])}]);const O=class t{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(e){if(e instanceof t)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(null===e)throw new Error("Cannot set Color#value to null");null!==this._value&&this._isSourceEqual(this._value,e)||(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return"string"==typeof t||"number"==typeof t||t instanceof Number||null===t?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):"object"==typeof t&&null!==t?{...t}:t}_isSourceEqual(t,e){const n=typeof t;if(n!==typeof e)return!1;if("number"===n||"string"===n||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length===e.length&&t.every(((t,n)=>t===e[n]));if(null!==t&&null!==e){const n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every((n=>t[n]===e[n]))}return t===e}toRgba(){const[t,e,n,r]=this._components;return{r:t,g:e,b:n,a:r}}toRgb(){const[t,e,n]=this._components;return{r:t,g:e,b:n}}toRgbaString(){const[t,e,n]=this.toUint8RgbArray();return`rgba(${t},${e},${n},${this.alpha})`}toUint8RgbArray(t){const[e,n,r]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(255*e),t[1]=Math.round(255*n),t[2]=Math.round(255*r),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);const[e,n,r,i]=this._components;return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);const[e,n,r]=this._components;return t[0]=e,t[1]=n,t[2]=r,t}toNumber(){return this._int}toBgrNumber(){const[t,e,n]=this.toUint8RgbArray();return(n<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(65280&t)+((255&t)<<16)}multiply(e){const[n,r,i,o]=t._temp.setValue(e)._components;return this._components[0]*=n,this._components[1]*=r,this._components[2]*=i,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(1===t)return(255<<24)+this._int;if(0===t)return e?0:this._int;let n=this._int>>16&255,r=this._int>>8&255,i=255&this._int;return e&&(n=n*t+.5|0,r=r*t+.5|0,i=i*t+.5|0),(255*t<<24)+(n<<16)+(r<<8)+i}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(255*this._components[3]).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this._value=null,this}_normalize(e){let n,r,i,o;if(("number"==typeof e||e instanceof Number)&&e>=0&&e<=16777215){n=(e>>16&255)/255,r=(e>>8&255)/255,i=(255&e)/255,o=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[n,r,i,o=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[n,r,i,o=255]=e,n/=255,r/=255,i/=255,o/=255;else if("string"==typeof e||"object"==typeof e){if("string"==typeof e){const n=t.HEX_PATTERN.exec(e);n&&(e=`#${n[2]}`)}const s=M(e);s.isValid()&&(({r:n,g:r,b:i,a:o}=s.rgba),n/=255,r/=255,i/=255)}if(void 0===n)throw new Error(`Unable to convert color ${e}`);this._components[0]=n,this._components[1]=r,this._components[2]=i,this._components[3]=o,this._refreshInt()}_refreshInt(){this._clamp(this._components);const[t,e,n]=this._components;this._int=(255*t<<16)+(255*e<<8)+(255*n|0)}_clamp(t,e=0,n=1){return"number"==typeof t?Math.min(Math.max(t,e),n):(t.forEach(((r,i)=>{t[i]=Math.min(Math.max(r,e),n)})),t)}static isColorLike(e){return"number"==typeof e||"string"==typeof e||e instanceof Number||e instanceof t||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||void 0!==e.r&&void 0!==e.g&&void 0!==e.b||void 0!==e.r&&void 0!==e.g&&void 0!==e.b&&void 0!==e.a||void 0!==e.h&&void 0!==e.s&&void 0!==e.l||void 0!==e.h&&void 0!==e.s&&void 0!==e.l&&void 0!==e.a||void 0!==e.h&&void 0!==e.s&&void 0!==e.v||void 0!==e.h&&void 0!==e.s&&void 0!==e.v&&void 0!==e.a}};O.shared=new O,O._temp=new O,O.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let I=O},1761:(t,e,n)=>{n.d(e,{e:()=>o});const r={createCanvas:(t,e)=>{const n=document.createElement("canvas");return n.width=t,n.height=e,n},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>(new DOMParser).parseFromString(t,"text/xml")};let i=r;const o={get:()=>i,set(t){i=t}}},8507:(t,e,n)=>{n.d(e,{Ag:()=>r,XO:()=>s});var r=(t=>(t.Application="application",t.WebGLPipes="webgl-pipes",t.WebGLPipesAdaptor="webgl-pipes-adaptor",t.WebGLSystem="webgl-system",t.WebGPUPipes="webgpu-pipes",t.WebGPUPipesAdaptor="webgpu-pipes-adaptor",t.WebGPUSystem="webgpu-system",t.CanvasSystem="canvas-system",t.CanvasPipesAdaptor="canvas-pipes-adaptor",t.CanvasPipes="canvas-pipes",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t.MaskEffect="mask-effect",t.BlendMode="blend-mode",t.TextureSource="texture-source",t.Environment="environment",t.ShapeBuilder="shape-builder",t.Batcher="batcher",t))(r||{});const i=t=>{if("function"==typeof t||"object"==typeof t&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={..."object"!=typeof t.extension?{type:t.extension}:t.extension,ref:t}}if("object"!=typeof t)throw new Error("Invalid extension type");return"string"==typeof(t={...t}).type&&(t.type=[t.type]),t},o=(t,e)=>i(t).priority??e,s={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(i).forEach((t=>{t.type.forEach((e=>this._removeHandlers[e]?.(t)))})),this},add(...t){return t.map(i).forEach((t=>{t.type.forEach((e=>{const n=this._addHandlers,r=this._queue;n[e]?n[e]?.(t):(r[e]=r[e]||[],r[e]?.push(t))}))})),this},handle(t,e,n){const r=this._addHandlers,i=this._removeHandlers;if(r[t]||i[t])throw new Error(`Extension type ${t} already has a handler`);r[t]=e,i[t]=n;const o=this._queue;return o[t]&&(o[t]?.forEach((t=>e(t))),delete o[t]),this},handleByMap(t,e){return this.handle(t,(t=>{t.name&&(e[t.name]=t.ref)}),(t=>{t.name&&delete e[t.name]}))},handleByNamedList(t,e,n=-1){return this.handle(t,(t=>{e.findIndex((e=>e.name===t.name))>=0||(e.push({name:t.name,value:t.ref}),e.sort(((t,e)=>o(e.value,n)-o(t.value,n))))}),(t=>{const n=e.findIndex((e=>e.name===t.name));-1!==n&&e.splice(n,1)}))},handleByList(t,e,n=-1){return this.handle(t,(t=>{e.includes(t.ref)||(e.push(t.ref),e.sort(((t,e)=>o(e,n)-o(t,n))))}),(t=>{const n=e.indexOf(t.ref);-1!==n&&e.splice(n,1)}))},mixin(t,...e){for(const n of e)Object.defineProperties(t.prototype,Object.getOwnPropertyDescriptors(n))}}},9049:(t,e,n)=>{n.d(e,{a:()=>r});class r{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}},9313:(t,e,n)=>{n.d(e,{u:()=>o});var r=n(1652),i=n(5101);class o{constructor(t=1,e=0,n=0,r=1,i=0,o=0){this.array=null,this.a=t,this.b=e,this.c=n,this.d=r,this.tx=i,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,n,r,i,o){return this.a=t,this.b=e,this.c=n,this.d=r,this.tx=i,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const n=e||this.array;return t?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n}apply(t,e){e=e||new i.b;const n=t.x,r=t.y;return e.x=this.a*n+this.c*r+this.tx,e.y=this.b*n+this.d*r+this.ty,e}applyInverse(t,e){e=e||new i.b;const n=this.a,r=this.b,o=this.c,s=this.d,a=this.tx,l=this.ty,c=1/(n*s+o*-r),h=t.x,u=t.y;return e.x=s*c*h+-o*c*u+(l*o-a*s)*c,e.y=n*c*u+-r*c*h+(-l*n+a*r)*c,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),r=this.a,i=this.c,o=this.tx;return this.a=r*e-this.b*n,this.b=r*n+this.b*e,this.c=i*e-this.d*n,this.d=i*n+this.d*e,this.tx=o*e-this.ty*n,this.ty=o*n+this.ty*e,this}append(t){const e=this.a,n=this.b,r=this.c,i=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*n+t.b*i,this.c=t.c*e+t.d*r,this.d=t.c*n+t.d*i,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*n+t.ty*i+this.ty,this}appendFrom(t,e){const n=t.a,r=t.b,i=t.c,o=t.d,s=t.tx,a=t.ty,l=e.a,c=e.b,h=e.c,u=e.d;return this.a=n*l+r*h,this.b=n*c+r*u,this.c=i*l+o*h,this.d=i*c+o*u,this.tx=s*l+a*h+e.tx,this.ty=s*c+a*u+e.ty,this}setTransform(t,e,n,r,i,o,s,a,l){return this.a=Math.cos(s+l)*i,this.b=Math.sin(s+l)*i,this.c=-Math.sin(s-a)*o,this.d=Math.cos(s-a)*o,this.tx=t-(n*this.a+r*this.c),this.ty=e-(n*this.b+r*this.d),this}prepend(t){const e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){const e=this.a,n=this.c;this.a=e*t.a+this.b*t.c,this.b=e*t.b+this.b*t.d,this.c=n*t.a+this.d*t.c,this.d=n*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,n=this.b,i=this.c,o=this.d,s=t.pivot,a=-Math.atan2(-i,o),l=Math.atan2(n,e),c=Math.abs(a+l);return c<1e-5||Math.abs(r.TO-c)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+n*n),t.scale.y=Math.sqrt(i*i+o*o),t.position.x=this.tx+(s.x*e+s.y*i),t.position.y=this.ty+(s.x*n+s.y*o),t}invert(){const t=this.a,e=this.b,n=this.c,r=this.d,i=this.tx,o=t*r-e*n;return this.a=r/o,this.b=-e/o,this.c=-n/o,this.d=t/o,this.tx=(n*this.ty-r*i)/o,this.ty=-(t*this.ty-e*i)/o,this}isIdentity(){return 1===this.a&&0===this.b&&0===this.c&&1===this.d&&0===this.tx&&0===this.ty}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new o;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return a.identity()}static get shared(){return s.identity()}}const s=new o,a=new o},2079:(t,e,n)=>{n.d(e,{E:()=>u});var r=n(9313);const i=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],o=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],s=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],a=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],l=[],c=[],h=Math.sign;!function(){for(let t=0;t<16;t++){const e=[];l.push(e);for(let n=0;n<16;n++){const r=h(i[t]*i[n]+s[t]*o[n]),l=h(o[t]*i[n]+a[t]*o[n]),c=h(i[t]*s[n]+s[t]*a[n]),u=h(o[t]*s[n]+a[t]*a[n]);for(let t=0;t<16;t++)if(i[t]===r&&o[t]===l&&s[t]===c&&a[t]===u){e.push(t);break}}}for(let t=0;t<16;t++){const e=new r.u;e.set(i[t],o[t],s[t],a[t],0,0),c.push(e)}}();const u={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:t=>i[t],uY:t=>o[t],vX:t=>s[t],vY:t=>a[t],inv:t=>8&t?15&t:7&-t,add:(t,e)=>l[t][e],sub:(t,e)=>l[t][u.inv(e)],rotate180:t=>4^t,isVertical:t=>2==(3&t),byDirection:(t,e)=>2*Math.abs(t)<=Math.abs(e)?e>=0?u.S:u.N:2*Math.abs(e)<=Math.abs(t)?t>0?u.E:u.W:e>0?t>0?u.SE:u.SW:t>0?u.NE:u.NW,matrixAppendRotationInv:(t,e,n=0,r=0,i=0,o=0)=>{const s=c[u.inv(e)],a=s.a,l=s.b,h=s.c,d=s.d,f=n-Math.min(0,a*i,h*o,a*i+h*o),p=r-Math.min(0,l*i,d*o,l*i+d*o),m=t.a,y=t.b,g=t.c,v=t.d;t.a=a*m+l*g,t.b=a*y+l*v,t.c=h*m+d*g,t.d=h*y+d*v,t.tx=f*m+p*g+t.tx,t.ty=f*y+p*v+t.ty},transformRectCoords:(t,e,n,r)=>{const{x:i,y:o,width:s,height:a}=t,{x:l,y:c,width:h,height:d}=e;return n===u.E?(r.set(i+l,o+c,s,a),r):n===u.S?r.set(h-o-a+l,i+c,a,s):n===u.W?r.set(h-i-s+l,d-o-a+c,s,a):n===u.N?r.set(o+l,d-i-s+c,a,s):r.set(i+l,o+c,s,a)}}},1652:(t,e,n)=>{n.d(e,{TO:()=>r,Td:()=>o,bO:()=>i});const r=2*Math.PI,i=180/Math.PI,o=Math.PI/180},9939:(t,e,n)=>{function r(t){return t+=0===t?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function i(t){return!(t&t-1||!t)}n.d(e,{U5:()=>r,f3:()=>i})},2812:(t,e,n)=>{n.d(e,{o:()=>r});class r{constructor(t,e,n){this._x=e||0,this._y=n||0,this._observer=t}clone(t){return new r(t??this._observer,this._x,this._y)}set(t=0,e=t){return this._x===t&&this._y===e||(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}},5101:(t,e,n)=>{n.d(e,{b:()=>r});class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return i.x=0,i.y=0,i}}const i=new r},6125:(t,e,n)=>{n.d(e,{j:()=>i});var r=n(9252);class i{constructor(t=0,e=0,n=0){this.type="circle",this.x=t,this.y=e,this.radius=n}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const n=this.radius*this.radius;let r=this.x-t,i=this.y-e;return r*=r,i*=i,r+i<=n}strokeContains(t,e,n,r=.5){if(0===this.radius)return!1;const i=this.x-t,o=this.y-e,s=this.radius,a=(1-r)*n,l=Math.sqrt(i*i+o*o);return l<=s+a&&l>s-(n-a)}getBounds(t){return t||(t=new r.M),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=2*this.radius,t.height=2*this.radius,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}},9252:(t,e,n)=>{n.d(e,{M:()=>o});var r=n(5101);const i=[new r.b,new r.b,new r.b,new r.b];class o{constructor(t=0,e=0,n=0,r=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(n),this.height=Number(r)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new o(0,0,0,0)}clone(){return new o(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height)}strokeContains(t,e,n,r=.5){const{width:i,height:o}=this;if(i<=0||o<=0)return!1;const s=this.x,a=this.y,l=n*(1-r),c=n-l;return t>=s-l&&t<=s+i+l&&e>=a-l&&e<=a+o+l&&!(t>s+c&&t<s+i-c&&e>a+c&&e<a+o-c)}intersects(t,e){if(!e){const e=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=e)return!1;const n=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>n}const n=this.left,r=this.right,o=this.top,s=this.bottom;if(r<=n||s<=o)return!1;const a=i[0].set(t.left,t.top),l=i[1].set(t.left,t.bottom),c=i[2].set(t.right,t.top),h=i[3].set(t.right,t.bottom);if(c.x<=a.x||l.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(0===u)return!1;if(e.apply(a,a),e.apply(l,l),e.apply(c,c),e.apply(h,h),Math.max(a.x,l.x,c.x,h.x)<=n||Math.min(a.x,l.x,c.x,h.x)>=r||Math.max(a.y,l.y,c.y,h.y)<=o||Math.min(a.y,l.y,c.y,h.y)>=s)return!1;const d=u*(l.y-a.y),f=u*(a.x-l.x),p=d*n+f*o,m=d*r+f*o,y=d*n+f*s,g=d*r+f*s;if(Math.max(p,m,y,g)<=d*a.x+f*a.y||Math.min(p,m,y,g)>=d*h.x+f*h.y)return!1;const v=u*(a.y-c.y),b=u*(c.x-a.x),x=v*n+b*o,_=v*r+b*o,w=v*n+b*s,S=v*r+b*s;return!(Math.max(x,_,w,S)<=v*a.x+b*a.y||Math.min(x,_,w,S)>=v*h.x+b*h.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this}fit(t){const e=Math.max(this.x,t.x),n=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),i=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(n-e,0),this.y=r,this.height=Math.max(i-r,0),this}ceil(t=1,e=.001){const n=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=n-this.x,this.height=r-this.y,this}scale(t,e=t){return this.x*=t,this.y*=e,this.width*=t,this.height*=e,this}enlarge(t){const e=Math.min(this.x,t.x),n=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),i=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=n-e,this.y=r,this.height=i-r,this}getBounds(t){return t||(t=new o),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;const e=t.x,n=t.y,r=t.x+t.width,i=t.y+t.height;return e>=this.x&&e<this.x+this.width&&n>=this.y&&n<this.y+this.height&&r>=this.x&&r<this.x+this.width&&i>=this.y&&i<this.y+this.height}set(t,e,n,r){return this.x=t,this.y=e,this.width=n,this.height=r,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}},6512:(t,e,n)=>{n.d(e,{u:()=>o});const r=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function i(t){let e="";for(let n=0;n<t;++n)n>0&&(e+="\nelse "),n<t-1&&(e+=`if(test == ${n}.0){}`);return e}function o(t,e){if(0===t)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const n=e.createShader(e.FRAGMENT_SHADER);try{for(;;){const o=r.replace(/%forloop%/gi,i(t));if(e.shaderSource(n,o),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS))break;t=t/2|0}}finally{e.deleteShader(n)}return t}},341:(t,e,n)=>{n.d(e,{w:()=>s});var r=n(3513),i=n(5589);const o={};function s(t,e,n){let s=2166136261;for(let n=0;n<e;n++)s^=t[n].uid,s=Math.imul(s,16777619),s>>>=0;return o[s]||function(t,e,n,s){const a={};let l=0;for(let n=0;n<s;n++){const r=n<e?t[n]:i.g.EMPTY.source;a[l++]=r.source,a[l++]=r.style}const c=new r.T(a);return o[n]=c,c}(t,e,s,n)}},2043:(t,e,n)=>{n.d(e,{J:()=>F});var r=n(8507),i=n(133);class o{constructor(t){"number"==typeof t?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this.uint32View=null,this.float32View=null,this.uint16View=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._int32View=null,this._float64Array=null,this._bigUint64Array=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}var s=n(4670),a=n(6083),l=n(6736),c=n(1957);function h(t,e){return"no-premultiply-alpha"===e.alphaMode&&c.Q[t]||t}var u=n(3804),d=n(6512);let f=null;class p{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){const e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}class m{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new p,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null,this.elements=null}}const y=[];let g=0;function v(){return g>0?y[--g]:new m}function b(t){t.elements=null,y[g++]=t}a.L.register({clear:()=>{if(y.length>0)for(const t of y)t&&t.destroy();y.length=0,g=0}});let x=0;const _=class t{constructor(e){this.uid=(0,i.L)("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],(e={...t.defaultOptions,...e}).maxTextures||((0,s.t6)("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=function(){if(f)return f;const t=(0,u.W)();return f=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),f=(0,d.u)(f,t),t.getExtension("WEBGL_lose_context")?.loseContext(),f}());const{maxTextures:n,attributesInitialSize:r,indicesInitialSize:a}=e;this.attributeBuffer=new o(4*r),this.indexBuffer=new Uint16Array(a),this.maxTextures=n}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)b(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){const n=t._batch.textures.ids[e._source.uid];return!(!n&&0!==n)&&(t._textureId=n,t.texture=e,!0)}updateElement(t){this.dirty=!0;const e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){const e=this._elements;if(!e[this.elementStart])return;let n=v(),r=n.textures;r.clear();const i=e[this.elementStart];let o=h(i.blendMode,i.texture._source),s=i.topology;4*this.attributeSize>this.attributeBuffer.size&&this._resizeAttributeBuffer(4*this.attributeSize),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const a=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,c=this.indexBuffer;let u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",p=[];const m=this.maxTextures;for(let i=this.elementStart;i<this.elementSize;++i){const y=e[i];e[i]=null;const g=y.texture._source,b=h(y.blendMode,g),_=o!==b||s!==y.topology;g._batchTick!==x||_?(g._batchTick=x,(r.count>=m||_)&&(this._finishBatch(n,d,u-d,r,o,s,t,f,p),f="renderBatch",d=u,o=b,s=y.topology,n=v(),r=n.textures,r.clear(),p=[],++x),y._textureId=g._textureBindLocation=r.count,r.ids[g.uid]=r.count,r.textures[r.count++]=g,y._batch=n,p.push(y),u+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,a,l,y._attributeStart,y._textureId),this.packQuadIndex(c,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,a,l,y._attributeStart,y._textureId),this.packIndex(y,c,y._indexStart,y._attributeStart/this.vertexSize))):(y._textureId=g._textureBindLocation,u+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,a,l,y._attributeStart,y._textureId),this.packQuadIndex(c,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,a,l,y._attributeStart,y._textureId),this.packIndex(y,c,y._indexStart,y._attributeStart/this.vertexSize)),y._batch=n,p.push(y))}r.count>0&&(this._finishBatch(n,d,u-d,r,o,s,t,f,p),d=u,++x),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,n,r,i,o,s,a,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=a,t.batcher=this,t.textures=r,t.blendMode=i,t.topology=o,t.start=e,t.size=n,t.elements=l,++x,this.batches[this.batchIndex++]=t,s.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){4*t<=this.attributeBuffer.size||this._resizeAttributeBuffer(4*t)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,2*this.attributeBuffer.size),n=new o(e);(0,l.W)(this.attributeBuffer.rawBinaryData,n.rawBinaryData),this.attributeBuffer=n}_resizeIndexBuffer(t){const e=this.indexBuffer;let n=Math.max(t,1.5*e.length);n+=n%2;const r=n>65535?new Uint32Array(n):new Uint16Array(n);if(r.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let t=0;t<e.length;t++)r[t]=e[t];else(0,l.W)(e.buffer,r.buffer);this.indexBuffer=r}packQuadIndex(t,e,n){t[e]=n+0,t[e+1]=n+1,t[e+2]=n+2,t[e+3]=n+0,t[e+4]=n+2,t[e+5]=n+3}packIndex(t,e,n,r){const i=t.indices,o=t.indexSize,s=t.indexOffset,a=t.attributeOffset;for(let t=0;t<o;t++)e[n++]=r+i[t+s]-a}destroy(t={}){if(null!==this.batches){for(let t=0;t<this.batchIndex;t++)b(this.batches[t]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,t.shader&&(this.shader?.destroy(),this.shader=null);for(let t=0;t<this._elements.length;t++)this._elements[t]&&(this._elements[t]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};_.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let w=_;var S=n(949),C=n(1132),E=n(6011);const k=new Float32Array(1),T=new Uint32Array(1);class A extends E.V{constructor(){const t=new S.h({data:k,label:"attribute-batch-buffer",usage:C.S.VERTEX|C.S.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:24,offset:0},aUV:{buffer:t,format:"float32x2",stride:24,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:24,offset:16},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:24,offset:20}},indexBuffer:new S.h({data:T,label:"index-batch-buffer",usage:C.S.INDEX|C.S.COPY_DST,shrinkToFit:!1})})}}var M=n(5611),P=n(4459),O=n(4e3),I=n(6665),L=n(6040),j=n(8475);class R extends j.M{constructor(t){super({glProgram:(0,M.I)({name:"batch",bits:[P.a,(0,O.P)(t),I.m]}),gpuProgram:(0,M.v)({name:"batch",bits:[P.F,(0,O._)(t),I.b]}),resources:{batchSamplers:(0,L.n)(t)}}),this.maxTextures=t}}let D=null;const N=class t extends w{constructor(e){super(e),this.geometry=new A,this.name=t.extension.name,this.vertexSize=6,D??(D=new R(e.maxTextures)),this.shader=D}packAttributes(t,e,n,r,i){const o=i<<16|65535&t.roundPixels,s=t.transform,a=s.a,l=s.b,c=s.c,h=s.d,u=s.tx,d=s.ty,{positions:f,uvs:p}=t,m=t.color,y=t.attributeOffset,g=y+t.attributeSize;for(let t=y;t<g;t++){const i=2*t,s=f[i],y=f[i+1];e[r++]=a*s+c*y+u,e[r++]=h*y+l*s+d,e[r++]=p[i],e[r++]=p[i+1],n[r++]=m,n[r++]=o}}packQuadAttributes(t,e,n,r,i){const o=t.texture,s=t.transform,a=s.a,l=s.b,c=s.c,h=s.d,u=s.tx,d=s.ty,f=t.bounds,p=f.maxX,m=f.minX,y=f.maxY,g=f.minY,v=o.uvs,b=t.color,x=i<<16|65535&t.roundPixels;e[r+0]=a*m+c*g+u,e[r+1]=h*g+l*m+d,e[r+2]=v.x0,e[r+3]=v.y0,n[r+4]=b,n[r+5]=x,e[r+6]=a*p+c*g+u,e[r+7]=h*g+l*p+d,e[r+8]=v.x1,e[r+9]=v.y1,n[r+10]=b,n[r+11]=x,e[r+12]=a*p+c*y+u,e[r+13]=h*y+l*p+d,e[r+14]=v.x2,e[r+15]=v.y2,n[r+16]=b,n[r+17]=x,e[r+18]=a*m+c*y+u,e[r+19]=h*y+l*m+d,e[r+20]=v.x3,e[r+21]=v.y3,n[r+22]=b,n[r+23]=x}_updateMaxTextures(t){this.shader.maxTextures!==t&&(D=new R(t),this.shader=D)}destroy(){this.shader=null,super.destroy()}};N.extension={type:[r.Ag.Batcher],name:"default"};let F=N},5611:(t,e,n)=>{n.d(e,{I:()=>T,v:()=>k});var r=n(9113),i=n(3012),o=n(268);function s(t,e,n){if(t)for(const r in t){const i=e[r.toLocaleLowerCase()];if(i){let e=t[r];"header"===r&&(e=e.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),n&&i.push(`//----${n}----//`),i.push(e)}else(0,o.R)(`${r} placement hook does not exist in shader`)}}const a=/\{\{(.*?)\}\}/g;function l(t){const e={};return(t.match(a)?.map((t=>t.replace(/[{()}]/g,"")))??[]).forEach((t=>{e[t]=[]})),e}function c(t,e){let n;const r=/@in\s+([^;]+);/g;for(;null!==(n=r.exec(t));)e.push(n[1])}function h(t,e,n=!1){const r=[];c(e,r),t.forEach((t=>{t.header&&c(t.header,r)}));const i=r;n&&i.sort();const o=i.map(((t,e)=>` @location(${e}) ${t},`)).join("\n");let s=e.replace(/@in\s+[^;]+;\s*/g,"");return s=s.replace("{{in}}",`\n${o}\n`),s}function u(t,e){let n;const r=/@out\s+([^;]+);/g;for(;null!==(n=r.exec(t));)e.push(n[1])}function d(t,e){let n=t;for(const t in e){const r=e[t];n=r.join("\n").length?n.replace(`{{${t}}}`,`//-----${t} START-----//\n${r.join("\n")}\n//----${t} FINISH----//`):n.replace(`{{${t}}}`,"")}return n}const f=Object.create(null),p=new Map;let m=0;function y({template:t,bits:e}){const n=v(t,e);if(f[n])return f[n];const{vertex:r,fragment:i}=function(t,e){const n=e.map((t=>t.vertex)).filter((t=>!!t)),r=e.map((t=>t.fragment)).filter((t=>!!t));let i=h(n,t.vertex,!0);i=function(t,e){const n=[];u(e,n),t.forEach((t=>{t.header&&u(t.header,n)}));let r=0;const i=n.sort().map((t=>t.indexOf("builtin")>-1?t:`@location(${r++}) ${t}`)).join(",\n"),o=n.sort().map((t=>{return` var ${e=t,e.replace(/@.*?\s+/g,"")};`;var e})).join("\n"),s=`return VSOutput(\n ${n.sort().map((t=>` ${function(t){const e=/\b(\w+)\s*:/g.exec(t);return e?e[1]:""}(t)}`)).join(",\n")});`;let a=e.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`\n${i}\n`),a=a.replace("{{start}}",`\n${o}\n`),a=a.replace("{{return}}",`\n${s}\n`),a}(n,i);const o=h(r,t.fragment,!0);return{vertex:i,fragment:o}}(t,e);return f[n]=b(r,i,e),f[n]}function g({template:t,bits:e}){const n=v(t,e);return f[n]||(f[n]=b(t.vertex,t.fragment,e)),f[n]}function v(t,e){return e.map((t=>(p.has(t)||p.set(t,m++),p.get(t)))).sort(((t,e)=>t-e)).join("-")+t.vertex+t.fragment}function b(t,e,n){const r=l(t),i=l(e);return n.forEach((t=>{s(t.vertex,r,t.name),s(t.fragment,i,t.name)})),{vertex:d(t,r),fragment:d(e,i)}}const x="\n @in aPosition: vec2<f32>;\n @in aUV: vec2<f32>;\n\n @out @builtin(position) vPosition: vec4<f32>;\n @out vUV : vec2<f32>;\n @out vColor : vec4<f32>;\n\n {{header}}\n\n struct VSOutput {\n {{struct}}\n };\n\n @vertex\n fn main( {{in}} ) -> VSOutput {\n\n var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;\n var modelMatrix = mat3x3<f32>(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0\n );\n var position = aPosition;\n var uv = aUV;\n\n {{start}}\n\n vColor = vec4<f32>(1., 1., 1., 1.);\n\n {{main}}\n\n vUV = uv;\n\n var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;\n\n vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);\n\n vColor *= globalUniforms.uWorldColorAlpha;\n\n {{end}}\n\n {{return}}\n };\n",_="\n @in vUV : vec2<f32>;\n @in vColor : vec4<f32>;\n\n {{header}}\n\n @fragment\n fn main(\n {{in}}\n ) -> @location(0) vec4<f32> {\n\n {{start}}\n\n var outColor:vec4<f32>;\n\n {{main}}\n\n var finalColor:vec4<f32> = outColor * vColor;\n\n {{end}}\n\n return finalColor;\n };\n",w="\n in vec2 aPosition;\n in vec2 aUV;\n\n out vec4 vColor;\n out vec2 vUV;\n\n {{header}}\n\n void main(void){\n\n mat3 worldTransformMatrix = uWorldTransformMatrix;\n mat3 modelMatrix = mat3(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0\n );\n vec2 position = aPosition;\n vec2 uv = aUV;\n\n {{start}}\n\n vColor = vec4(1.);\n\n {{main}}\n\n vUV = uv;\n\n mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;\n\n gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n\n vColor *= uWorldColorAlpha;\n\n {{end}}\n }\n",S="\n\n in vec4 vColor;\n in vec2 vUV;\n\n out vec4 finalColor;\n\n {{header}}\n\n void main(void) {\n\n {{start}}\n\n vec4 outColor;\n\n {{main}}\n\n finalColor = outColor * vColor;\n\n {{end}}\n }\n",C={name:"global-uniforms-bit",vertex:{header:"\n struct GlobalUniforms {\n uProjectionMatrix:mat3x3<f32>,\n uWorldTransformMatrix:mat3x3<f32>,\n uWorldColorAlpha: vec4<f32>,\n uResolution: vec2<f32>,\n }\n\n @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;\n "}},E={name:"global-uniforms-bit",vertex:{header:"\n uniform mat3 uProjectionMatrix;\n uniform mat3 uWorldTransformMatrix;\n uniform vec4 uWorldColorAlpha;\n uniform vec2 uResolution;\n "}};function k({bits:t,name:e}){const n=y({template:{fragment:_,vertex:x},bits:[C,...t]});return i.B.from({name:e,vertex:{source:n.vertex,entryPoint:"main"},fragment:{source:n.fragment,entryPoint:"main"}})}function T({bits:t,name:e}){return new r.M({name:e,...g({template:{vertex:w,fragment:S},bits:[E,...t]})})}},4459:(t,e,n)=>{n.d(e,{F:()=>r,a:()=>i});const r={name:"color-bit",vertex:{header:"\n @in aColor: vec4<f32>;\n ",main:"\n vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);\n "}},i={name:"color-bit",vertex:{header:"\n in vec4 aColor;\n ",main:"\n vColor *= vec4(aColor.rgb * aColor.a, aColor.a);\n "}}},4e3:(t,e,n)=>{n.d(e,{P:()=>c,_:()=>s});const r={};function i(t){const e=[];if(1===t)e.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let n=0;for(let r=0;r<t;r++)e.push(`@group(1) @binding(${n++}) var textureSource${r+1}: texture_2d<f32>;`),e.push(`@group(1) @binding(${n++}) var textureSampler${r+1}: sampler;`)}return e.join("\n")}function o(t){const e=[];if(1===t)e.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{e.push("switch vTextureId {");for(let n=0;n<t;n++)n===t-1?e.push(" default:{"):e.push(` case ${n}:{`),e.push(` outColor = textureSampleGrad(textureSource${n+1}, textureSampler${n+1}, vUV, uvDx, uvDy);`),e.push(" break;}");e.push("}")}return e.join("\n")}function s(t){return r[t]||(r[t]={name:"texture-batch-bit",vertex:{header:"\n @in aTextureIdAndRound: vec2<u32>;\n @out @interpolate(flat) vTextureId : u32;\n ",main:"\n vTextureId = aTextureIdAndRound.y;\n ",end:"\n if(aTextureIdAndRound.x == 1)\n {\n vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);\n }\n "},fragment:{header:`\n @in @interpolate(flat) vTextureId: u32;\n\n ${i(t)}\n `,main:`\n var uvDx = dpdx(vUV);\n var uvDy = dpdy(vUV);\n\n ${o(t)}\n `}}),r[t]}const a={};function l(t){const e=[];for(let n=0;n<t;n++)n>0&&e.push("else"),n<t-1&&e.push(`if(vTextureId < ${n}.5)`),e.push("{"),e.push(`\toutColor = texture(uTextures[${n}], vUV);`),e.push("}");return e.join("\n")}function c(t){return a[t]||(a[t]={name:"texture-batch-bit",vertex:{header:"\n in vec2 aTextureIdAndRound;\n out float vTextureId;\n\n ",main:"\n vTextureId = aTextureIdAndRound.y;\n ",end:"\n if(aTextureIdAndRound.x == 1.)\n {\n gl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n }\n "},fragment:{header:`\n in float vTextureId;\n\n uniform sampler2D uTextures[${t}];\n\n `,main:`\n\n ${l(t)}\n `}}),a[t]}},6665:(t,e,n)=>{n.d(e,{b:()=>r,m:()=>i});const r={name:"round-pixels-bit",vertex:{header:"\n fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>\n {\n return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n }\n "}},i={name:"round-pixels-bit",vertex:{header:"\n vec2 roundPixels(vec2 position, vec2 targetSize)\n {\n return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n }\n "}}},5753:(t,e,n)=>{var r=n(8507),i=n(6844),o=n(9636),s=n(9443);const a=new o.c;function l(t,e,n){const r=a;t.measurable=!0,(0,s.f)(t,n,r),e.addBoundsMask(r),t.measurable=!1}var c=n(7269),h=n(2208),u=n(268);function d(t,e,n){const r=h.o.get();t.measurable=!0;const i=h.u.get().identity(),o=f(t,n,i);(0,c.n)(t,r,o),t.measurable=!1,e.addBoundsMask(r),h.u.return(i),h.o.return(r)}function f(t,e,n){return t?(t!==e&&(f(t.parent,e,n),t.updateLocalTransform(),n.append(t.localTransform)),n):((0,u.R)("Mask bounds, renderable is not inside the root container"),n)}class p{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof i.k),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){null!==this.mask&&(this.mask.measurable=!0,this.mask=null)}addBounds(t,e){this.inverse||l(this.mask,t,e)}addLocalBounds(t,e){d(this.mask,t,e)}containsPoint(t,e){return e(this.mask,t)}destroy(){this.reset()}static test(t){return t instanceof i.k}}p.extension=r.Ag.MaskEffect;class m{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return"number"==typeof t}}m.extension=r.Ag.MaskEffect;var y=n(5559);class g{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){null!==this.mask&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(t,e){l(this.mask,t,e)}addLocalBounds(t,e){d(this.mask,t,e)}containsPoint(t,e){return e(this.mask,t)}destroy(){this.reset()}static test(t){return t instanceof y.mc}}g.extension=r.Ag.MaskEffect;var v=n(4195),b=n(4884),x=n(8293),_=n(7309),w=n(1761);let S;var C=n(583);const E=class t extends C.v{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...t.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=!1!==e.autoPlay,this.alphaMode=e.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),!1!==e.autoLoad&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=_.R.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await async function(){return S??(S=(async()=>{const t=w.e.get().createCanvas(1,1).getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise((t=>{const e=document.createElement("video");e.onloadeddata=()=>t(e),e.onerror=()=>t(null),e.autoplay=!1,e.crossOrigin="anonymous",e.preload="auto",e.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",e.load()}));if(!e)return"premultiply-alpha-on-upload";const n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const i=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,i),t.deleteFramebuffer(r),t.deleteTexture(n),t.getExtension("WEBGL_lose_context")?.loseContext(),i[0]<=i[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),S}(),this._load=new Promise(((n,r)=>{this.isValid?n(this):(this._resolve=n,this._reject=r,void 0!==e.preloadTimeoutMs&&(this._preloadTimeout=setTimeout((()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))}))),t.load())})),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(_.R.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),null===this._videoFrameRequestCallbackHandle&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(null!==this._videoFrameRequestCallbackHandle&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(_.R.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(null!==this._videoFrameRequestCallbackHandle&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(_.R.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};E.extension=r.Ag.TextureSource,E.defaultOptions={...C.v.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},E.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let k=E;n(9726);r.XO.add(p,m,g,k,x.b,b.q,v.P)},1257:(t,e,n)=>{n.d(e,{u:()=>r});var r=(t=>(t[t.NONE=0]="NONE",t[t.COLOR=16384]="COLOR",t[t.STENCIL=1024]="STENCIL",t[t.DEPTH=256]="DEPTH",t[t.COLOR_DEPTH=16640]="COLOR_DEPTH",t[t.COLOR_STENCIL=17408]="COLOR_STENCIL",t[t.DEPTH_STENCIL=1280]="DEPTH_STENCIL",t[t.ALL=17664]="ALL",t))(r||{})},9113:(t,e,n)=>{n.d(e,{M:()=>d});var r=n(7952),i=n(3804);let o;function s(){if(!o){o="mediump";const t=(0,i.W)();if(t&&t.getShaderPrecisionFormat){const e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);o=e.precision?"highp":"mediump"}}return o}const a={},l={};const c={stripVersion:function(t,e){return e?t.replace("#version 300 es",""):t},ensurePrecision:function(t,e,n){const r=n?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if("precision"!==t.substring(0,9)){let i=n?e.requestedFragmentPrecision:e.requestedVertexPrecision;return"highp"===i&&"highp"!==r&&(i="mediump"),`precision ${i} float;\n${t}`}return"highp"!==r&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t},addProgramDefines:function(t,e,n){return e?t:n?`\n\n #ifdef GL_ES // This checks if it is WebGL1\n #define in varying\n #define finalColor gl_FragColor\n #define texture texture2D\n #endif\n ${t=t.replace("out vec4 finalColor;","")}\n `:`\n\n #ifdef GL_ES // This checks if it is WebGL1\n #define in attribute\n #define out varying\n #endif\n ${t}\n `},setProgramName:function(t,{name:e="pixi-program"},n=!0){e=e.replace(/\s+/g,"-");const r=n?a:l;return r[e+=n?"-fragment":"-vertex"]?(r[e]++,e+=`-${r[e]}`):r[e]=1,-1!==t.indexOf("#define SHADER_NAME")?t:`${`#define SHADER_NAME ${e}`}\n${t}`},insertVersion:function(t,e){return e?`#version 300 es\n${t}`:t}},h=Object.create(null),u=class t{constructor(e){const n=-1!==(e={...t.defaultOptions,...e}).fragment.indexOf("#version 300 es"),i={stripVersion:n,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:s()},setProgramName:{name:e.name},addProgramDefines:n,insertVersion:n};let o=e.fragment,a=e.vertex;Object.keys(c).forEach((t=>{const e=i[t];o=c[t](o,e,!0),a=c[t](a,e,!1)})),this.fragment=o,this.vertex=a,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=(0,r.X)(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null,h[this._cacheKey]=null}static from(e){const n=`${e.vertex}:${e.fragment}`;return h[n]||(h[n]=new t(e),h[n]._cacheKey=n),h[n]}};u.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let d=u},6040:(t,e,n)=>{n.d(e,{n:()=>o});var r=n(5811);const i={};function o(t){let e=i[t];if(e)return e;const n=new Int32Array(t);for(let e=0;e<t;e++)n[e]=e;return e=i[t]=new r.k({uTextures:{value:n,type:"i32",size:t}},{isStatic:!0}),e}},3804:(t,e,n)=>{n.d(e,{W:()=>o});var r=n(1761);let i;function o(){if(!i||i?.isContextLost()){const t=r.e.get().createCanvas();i=t.getContext("webgl",{})}return i}},3513:(t,e,n)=>{n.d(e,{T:()=>r});class r{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const n in t){const r=t[n];this.setResource(r,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const n in this.resources)t[e++]=this.resources[n]._resourceId;this._key=t.join("|")}setResource(t,e){const n=this.resources[e];t!==n&&(n?.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t,e){const n=this.resources;for(const r in n)n[r]._gcLastUsed=t,n[r]._touched=e}destroy(){const t=this.resources;for(const e in t){const n=t[e];n?.off?.("change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){this._dirty=!0,t.destroyed?this.destroy():this._updateKey()}}},3012:(t,e,n)=>{n.d(e,{B:()=>u});var r=n(7952),i=n(8306);const o={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"},s=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function a(t,e){let n;for(;null!==(n=s.exec(t));){const t=o[n[3]]??"float32";e[n[2]]={location:parseInt(n[1],10),format:t,stride:(0,i.m)(t).stride,offset:0,instance:!1,start:0}}s.lastIndex=0}function l(t){const e=/@group\((\d+)\)/,n=/@binding\((\d+)\)/,r=/var(<[^>]+>)? (\w+)/,i=/:\s*([\w<>]+)/,o=/(\w+)\s*:\s*([\w\<\>]+)/g,s=/struct\s+(\w+)/,a=t.match(/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g)?.map((t=>({group:parseInt(t.match(e)[1],10),binding:parseInt(t.match(n)[1],10),name:t.match(r)[2],isUniform:"<uniform>"===t.match(r)[1],type:t.match(i)[1]})));if(!a)return{groups:[],structs:[]};const l=t.match(/struct\s+(\w+)\s*{([^}]+)}/g)?.map((t=>{const e=t.match(s)[1],n=t.match(o).reduce(((t,e)=>{const[n,r]=e.split(":");return t[n.trim()]=r.trim(),t}),{});return n?{name:e,members:n}:null})).filter((({name:t})=>a.some((e=>e.type===t||e.type.includes(`<${t}>`)))))??[];return{groups:a,structs:l}}var c=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(c||{});const h=Object.create(null);class u{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:e,vertex:n,layout:r,gpuLayout:i,name:o}=t;if(this.name=o,this.fragment=e,this.vertex=n,e.source===n.source){const t=l(e.source);this.structsAndGroups=t}else{const t=l(n.source),r=l(e.source);this.structsAndGroups=function(t,e){const n=new Set,r=new Set;return{structs:[...t.structs,...e.structs].filter((t=>!n.has(t.name)&&(n.add(t.name),!0))),groups:[...t.groups,...e.groups].filter((t=>{const e=`${t.name}-${t.binding}`;return!r.has(e)&&(r.add(e),!0)}))}}(t,r)}this.layout=r??function({groups:t}){const e=[];for(let n=0;n<t.length;n++){const r=t[n];e[r.group]||(e[r.group]={}),e[r.group][r.name]=r.binding}return e}(this.structsAndGroups),this.gpuLayout=i??function({groups:t}){const e=[];for(let n=0;n<t.length;n++){const r=t[n];e[r.group]||(e[r.group]=[]),r.isUniform?e[r.group].push({binding:r.binding,visibility:c.VERTEX|c.FRAGMENT,buffer:{type:"uniform"}}):"sampler"===r.type?e[r.group].push({binding:r.binding,visibility:c.FRAGMENT,sampler:{type:"filtering"}}):"texture_2d"===r.type||r.type.startsWith("texture_2d<")?e[r.group].push({binding:r.binding,visibility:c.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):"texture_2d_array"===r.type||r.type.startsWith("texture_2d_array<")?e[r.group].push({binding:r.binding,visibility:c.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):("texture_cube"===r.type||r.type.startsWith("texture_cube<"))&&e[r.group].push({binding:r.binding,visibility:c.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let t=0;t<e.length;t++)e[t]||(e[t]=[]);return e}(this.structsAndGroups),this.autoAssignGlobalUniforms=!(void 0===this.layout[0]?.globalUniforms),this.autoAssignLocalUniforms=!(void 0===this.layout[1]?.localUniforms),this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,n=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=(0,r.X)(n,"program")}get attributeData(){return this._attributeData??(this._attributeData=function({source:t,entryPoint:e}){const n={},r=function(t){return t.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}(t),i=r.indexOf(`fn ${e}(`);if(-1===i)return n;const o=r.indexOf("->",i);if(-1===o)return n;const s=r.substring(i,o);if(a(s,n),0===Object.keys(n).length){const t=s.match(/\(\s*\w+\s*:\s*(\w+)/);if(t){const e=t[1],i=new RegExp(`struct\\s+${e}\\s*\\{([^}]+)\\}`,"s"),o=r.match(i);o&&a(o[1],n)}}return n}(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,h[this._cacheKey]=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return h[e]||(h[e]=new u(t),h[e]._cacheKey=e),h[e]}}},949:(t,e,n)=>{n.d(e,{h:()=>s});var r=n(8875),i=n(133),o=n(1132);class s extends r.A{constructor(t){let{data:e,size:n}=t;const{usage:r,label:o,shrinkToFit:s}=t;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=(0,i.L)("buffer"),this._resourceType="buffer",this._resourceId=(0,i.L)("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,n??(n=e?.byteLength);const a=!!e;this.descriptor={size:n,usage:r,mappedAtCreation:a,label:o},this.shrinkToFit=s??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&o.S.STATIC)}set static(t){t?this.descriptor.usage|=o.S.STATIC:this.descriptor.usage&=~o.S.STATIC}setDataWithSize(t,e,n){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t)return void(n&&this.emit("update",this));const r=this._data;this._data=t,this._dataInt32=null,r&&r.length===t.length||!this.shrinkToFit&&r&&t.byteLength<r.byteLength?n&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=(0,i.L)("resource"),this.emit("change",this))}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}},1132:(t,e,n)=>{n.d(e,{S:()=>r});var r=(t=>(t[t.MAP_READ=1]="MAP_READ",t[t.MAP_WRITE=2]="MAP_WRITE",t[t.COPY_SRC=4]="COPY_SRC",t[t.COPY_DST=8]="COPY_DST",t[t.INDEX=16]="INDEX",t[t.VERTEX=32]="VERTEX",t[t.UNIFORM=64]="UNIFORM",t[t.STORAGE=128]="STORAGE",t[t.INDIRECT=256]="INDIRECT",t[t.QUERY_RESOLVE=512]="QUERY_RESOLVE",t[t.STATIC=1024]="STATIC",t))(r||{})},6736:(t,e,n)=>{function r(t,e,n,r){if(n??(n=0),r??(r=Math.min(t.byteLength-n,e.byteLength)),7&n||7&r)if(3&n||3&r)new Uint8Array(e).set(new Uint8Array(t,n,r));else{const i=r/4;new Float32Array(e,0,i).set(new Float32Array(t,n,i))}else{const i=r/8;new Float64Array(e,0,i).set(new Float64Array(t,n,i))}}n.d(e,{W:()=>r})},6011:(t,e,n)=>{n.d(e,{V:()=>c});var r=n(8875),i=n(9636),o=n(133),s=n(949),a=n(1132);function l(t,e){if(!(t instanceof s.h)){let n=e?a.S.INDEX:a.S.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),n=a.S.INDEX|a.S.COPY_DST):(t=new Float32Array(t),n=a.S.VERTEX|a.S.COPY_DST)),t=new s.h({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:n})}return t}class c extends r.A{constructor(t={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=(0,o.L)("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new i.c,this._boundsDirty=!0;const{attributes:e,indexBuffer:n,topology:r}=t;if(this.buffers=[],this.attributes={},e)for(const t in e)this.addAttribute(t,e[t]);this.instanceCount=t.instanceCount??1,n&&this.addIndex(n),this.topology=r||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(const t in this.attributes){const e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){const n=function(t){return(t instanceof s.h||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=l(t.buffer,!1),t}(e);-1===this.buffers.indexOf(n.buffer)&&(this.buffers.push(n.buffer),n.buffer.on("update",this.onBufferUpdate,this),n.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=n}addIndex(t){this.indexBuffer=l(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,function(t,e,n){const r=t.getAttribute(e);if(!r)return n.minX=0,n.minY=0,n.maxX=0,n.maxY=0,n;const i=r.buffer.data;let o=1/0,s=1/0,a=-1/0,l=-1/0;const c=i.BYTES_PER_ELEMENT,h=(r.offset||0)/c,u=(r.stride||8)/c;for(let t=h;t<i.length;t+=u){const e=i[t],n=i[t+1];e>a&&(a=e),n>l&&(l=n),e<o&&(o=e),n<s&&(s=n)}return n.minX=o,n.minY=s,n.maxX=a,n.maxY=l,n}(this,"aPosition",this._bounds)):this._bounds}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach((t=>t.destroy())),this.unload(),this.indexBuffer?.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}},8306:(t,e,n)=>{n.d(e,{m:()=>i});const r={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function i(t){return r[t]??r.float32}},848:(t,e,n)=>{n.d(e,{L:()=>i});var r=n(133);class i{constructor(){this.uid=(0,r.L)("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}},8475:(t,e,n)=>{n.d(e,{M:()=>h});var r=n(8875),i=n(133),o=n(9113),s=n(3513),a=n(3012),l=n(5099),c=n(5811);class h extends r.A{constructor(t){super(),this.uid=(0,i.L)("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:e,glProgram:n,groups:r,resources:o,compatibleRenderers:a,groupMap:h}=t;this.gpuProgram=e,this.glProgram=n,void 0===a&&(a=0,e&&(a|=l.W.WEBGPU),n&&(a|=l.W.WEBGL)),this.compatibleRenderers=a;const u={};if(o||r||(o={}),o&&r)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&r&&!h)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&r&&h)for(const t in h)for(const e in h[t]){const n=h[t][e];u[n]={group:t,binding:e,name:n}}else if(e&&r&&!h){const t=e.structsAndGroups.groups;h={},t.forEach((t=>{h[t.group]=h[t.group]||{},h[t.group][t.binding]=t.name,u[t.name]=t}))}else if(o){if(r={},h={},e){e.structsAndGroups.groups.forEach((t=>{h[t.group]=h[t.group]||{},h[t.group][t.binding]=t.name,u[t.name]=t}))}let t=0;for(const e in o)u[e]||(r[99]||(r[99]=new s.T,this._ownedBindGroups.push(r[99])),u[e]={group:99,binding:t,name:e},h[99]=h[99]||{},h[99][t]=e,t++);for(const t in o){const e=t;let n=o[t];n.source||n._resourceType||(n=new c.k(n));const i=u[e];i&&(r[i.group]||(r[i.group]=new s.T,this._ownedBindGroups.push(r[i.group])),r[i.group].setResource(n,i.binding))}}this.groups=r,this._uniformBindMap=h,this.resources=this._buildResourceAccessor(r,u)}addResource(t,e,n){var r,i;(r=this._uniformBindMap)[e]||(r[e]={}),(i=this._uniformBindMap[e])[n]||(i[n]=t),this.groups[e]||(this.groups[e]=new s.T,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const n={};for(const r in e){const i=e[r];Object.defineProperty(n,i.name,{get:()=>t[i.group].getResource(i.binding),set(e){t[i.group].setResource(e,i.binding)}})}return n}destroy(t=!1){this._destroyed||(this._destroyed=!0,this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach((t=>{t.destroy()})),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(t){const{gpu:e,gl:n,...r}=t;let i,s;return e&&(i=a.B.from(e)),n&&(s=o.M.from(n)),new h({gpuProgram:i,glProgram:s,...r})}}},5811:(t,e,n)=>{n.d(e,{k:()=>c});var r=n(133),i=n(7952);const o=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],s=o.reduce(((t,e)=>(t[e]=!0,t)),{});function a(t,e){switch(t){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const l=class t{constructor(e,n){this._touched=0,this.uid=(0,r.L)("uniform"),this._resourceType="uniformGroup",this._resourceId=(0,r.L)("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,n={...t.defaultOptions,...n},this.uniformStructures=e;const l={};for(const t in e){const n=e[t];if(n.name=t,n.size=n.size??1,!s[n.type]){const t=n.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(t){const[,e,r]=t;throw new Error(`Uniform type ${n.type} is not supported. Use type: '${e}', size: ${r} instead.`)}throw new Error(`Uniform type ${n.type} is not supported. Supported uniform types are: ${o.join(", ")}`)}n.value??(n.value=a(n.type,n.size)),l[t]=n.value}this.uniforms=l,this._dirtyId=1,this.ubo=n.ubo,this.isStatic=n.isStatic,this._signature=(0,i.X)(Object.keys(l).map((t=>`${t}-${e[t].type}`)).join("-"),"uniform-group")}update(){this._dirtyId++}};l.defaultOptions={ubo:!1,isStatic:!1};let c=l},7547:(t,e,n)=>{n.d(e,{U:()=>o});const r={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},i=class t{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(1&this.data)}set blend(t){!!(1&this.data)!==t&&(this.data^=1)}get offsets(){return!!(2&this.data)}set offsets(t){!!(2&this.data)!==t&&(this.data^=2)}set cullMode(t){"none"!==t?(this.culling=!0,this.clockwiseFrontFace="front"===t):this.culling=!1}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(4&this.data)}set culling(t){!!(4&this.data)!==t&&(this.data^=4)}get depthTest(){return!!(8&this.data)}set depthTest(t){!!(8&this.data)!==t&&(this.data^=8)}get depthMask(){return!!(32&this.data)}set depthMask(t){!!(32&this.data)!==t&&(this.data^=32)}get clockwiseFrontFace(){return!!(16&this.data)}set clockwiseFrontFace(t){!!(16&this.data)!==t&&(this.data^=16)}get blendMode(){return this._blendMode}set blendMode(t){this.blend="none"!==t,this._blendMode=t,this._blendModeId=r[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const e=new t;return e.depthTest=!1,e.blend=!0,e}};i.default2d=i.for2d();let o=i},1957:(t,e,n)=>{n.d(e,{K:()=>i,Q:()=>r});const r={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var i=(t=>(t[t.DISABLED=0]="DISABLED",t[t.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",t[t.MASK_ACTIVE=2]="MASK_ACTIVE",t[t.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",t[t.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",t[t.NONE=5]="NONE",t))(i||{})},800:(t,e,n)=>{n.d(e,{k:()=>g});var r=n(2577),i=n(8507);const o=[];async function s(t){if(!t)for(let t=0;t<o.length;t++){const e=o[t];if(e.value.test())return void await e.value.load()}}i.XO.handleByNamedList(i.Ag.Environment,o);var a=n(5559),l=n(4577),c=n(133),h=n(4670),u=n(6083),d=n(1257),f=n(7729),p=n(8875);const m=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],y=class t extends p.A{constructor(t){super(),this.tick=0,this.uid=(0,c.L)("renderer"),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;const e=[...m,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(e={}){const n=!0===e.skipExtensionImports||!1===e.manageImports;await s(n),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const t in this._systemsHash){e={...this._systemsHash[t].constructor.defaultOptions,...e}}e={...t.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let t=0;t<this.runners.init.items.length;t++)await this.runners.init.items[t].init(e);this._initOptions=e}render(t,e){this.tick++;let n=t;if(n instanceof a.mc&&(n={container:n},e&&((0,h.t6)(h.lj,"passing a second argument is deprecated, please use render options instead"),n.target=e.renderTexture)),n.target||(n.target=this.view.renderTarget),n.target===this.view.renderTarget&&(this._lastObjectRendered=n.container,n.clearColor??(n.clearColor=this.background.colorRgba),n.clear??(n.clear=this.background.clearBeforeRender)),n.clearColor){const t=Array.isArray(n.clearColor)&&4===n.clearColor.length;n.clearColor=t?n.clearColor:r.Q.shared.setValue(n.clearColor).toArray()}n.transform||(n.container.updateLocalTransform(),n.transform=n.container.localTransform),n.container.visible&&(n.container.enableRenderGroup(),this.runners.prerender.emit(n),this.runners.renderStart.emit(n),this.runners.render.emit(n),this.runners.renderEnd.emit(n),this.runners.postrender.emit(n))}resize(t,e,n){const r=this.view.resolution;this.view.resize(t,e,n),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),void 0!==n&&n!==r&&this.runners.resolutionChange.emit(n)}clear(t={}){t.target||(t.target=this.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=d.u.ALL);const{clear:e,clearColor:n,target:i,mipLevel:o,layer:s}=t;r.Q.shared.setValue(n??this.background.colorRgba),this.renderTarget.clear(i,e,r.Q.shared.toArray(),o??0,s??0)}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach((t=>{this.runners[t]=new f.C(t)}))}_addSystems(t){let e;for(e in t){const n=t[e];this._addSystem(n.value,n.name)}}_addSystem(t,e){const n=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=n,this._systemsHash[e]=n;for(const t in this.runners)this.runners[t].add(n);return this}_addPipes(t,e){const n=e.reduce(((t,e)=>(t[e.name]=e.value,t)),{});t.forEach((t=>{const e=t.value,r=t.name,i=n[r];this.renderPipes[r]=new e(this,i?new i:null),this.runners.destroy.add(this.renderPipes[r])}))}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),(!0===t||"object"==typeof t&&t.releaseGlobalResources)&&u.L.release(),Object.values(this.runners).forEach((t=>{t.destroy()})),this._systemsHash=null,this.renderPipes=null,this.removeAllListeners()}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!(0,l.f)())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};y.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let g=y},7729:(t,e,n)=>{n.d(e,{C:()=>r});class r{constructor(t){this.items=[],this._name=t}emit(t,e,n,r,i,o,s,a){const{name:l,items:c}=this;for(let h=0,u=c.length;h<u;h++)c[h][l](t,e,n,r,i,o,s,a);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return-1!==e&&this.items.splice(e,1),this}contains(t){return-1!==this.items.indexOf(t)}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return 0===this.items.length}get name(){return this._name}}},7608:(t,e,n)=>{n.d(e,{N:()=>s});var r=n(1761),i=n(9939),o=n(6083);const s=new class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const n=r.e.get().createCanvas();n.width=t,n.height=e;const i=n.getContext("2d");return{canvas:n,context:i}}getOptimalCanvasAndContext(t,e,n=1){t=Math.ceil(t*n-1e-6),e=Math.ceil(e*n-1e-6);const r=((t=(0,i.U5)(t))<<17)+((e=(0,i.U5)(e))<<1);this._canvasPool[r]||(this._canvasPool[r]=[]);let o=this._canvasPool[r].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){const e=t.canvas,{width:n,height:r}=e,i=(n<<17)+(r<<1);t.context.resetTransform(),t.context.clearRect(0,0,n,r),this._canvasPool[i].push(t)}clear(){this._canvasPool={}}};o.L.register(s)},5589:(t,e,n)=>{n.d(e,{g:()=>d});var r=n(8875),i=n(2079),o=n(9252),s=n(133),a=n(4670);const l=()=>{};var c=n(4195),h=n(583),u=n(1196);class d extends r.A{constructor({source:t,label:e,frame:n,orig:r,trim:i,defaultAnchor:a,defaultBorders:l,rotate:c,dynamic:u}={}){if(super(),this.uid=(0,s.L)("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new o.M,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new h.v,this.noFrame=!n,n)this.frame.copyFrom(n);else{const{width:t,height:e}=this._source;this.frame.width=t,this.frame.height=e}this.orig=r||this.frame,this.trim=i,this.rotate=c??0,this.defaultAnchor=a,this.defaultBorders=l,this.destroyed=!1,this.dynamic=u||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new u.N(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:n,height:r}=this._source,o=e.x/n,s=e.y/r,a=e.width/n,l=e.height/r;let c=this.rotate;if(c){const e=a/2,n=l/2,r=o+e,h=s+n;c=i.E.add(c,i.E.NW),t.x0=r+e*i.E.uX(c),t.y0=h+n*i.E.uY(c),c=i.E.add(c,2),t.x1=r+e*i.E.uX(c),t.y1=h+n*i.E.uY(c),c=i.E.add(c,2),t.x2=r+e*i.E.uX(c),t.y2=h+n*i.E.uY(c),c=i.E.add(c,2),t.x3=r+e*i.E.uX(c),t.y3=h+n*i.E.uY(c)}else t.x0=o,t.y0=s,t.x1=o+a,t.y1=s,t.x2=o+a,t.y2=s+l,t.x3=o,t.y3=s+l}destroy(t=!1){this._source&&(this._source.off("resize",this.update,this),t&&(this._source.destroy(),this._source=null)),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return(0,a.t6)(a.lj,"Texture.baseTexture is now Texture.source"),this._source}}d.EMPTY=new d({label:"EMPTY",source:new h.v({label:"EMPTY"})}),d.EMPTY.destroy=l,d.WHITE=new d({source:new c.P({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),d.WHITE.destroy=l},1196:(t,e,n)=>{n.d(e,{N:()=>o});var r=n(9313);const i=new r.u;class o{constructor(t,e){this.mapCoord=new r.u,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===e?t.width<10?0:.5:e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){void 0===e&&(e=t);const n=this.mapCoord;for(let r=0;r<t.length;r+=2){const i=t[r],o=t[r+1];e[r]=i*n.a+o*n.c+n.tx,e[r+1]=i*n.b+o*n.d+n.ty}return e}update(){const t=this._texture;this._updateID++;const e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);const n=t.orig,r=t.trim;r&&(i.set(n.width/r.width,0,0,n.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(i));const o=t.source,s=this.uClampFrame,a=this.clampMargin/o._resolution,l=this.clampOffset/o._resolution;return s[0]=(t.frame.x+a+l)/o.width,s[1]=(t.frame.y+a+l)/o.height,s[2]=(t.frame.x+t.frame.width-a+l)/o.width,s[3]=(t.frame.y+t.frame.height-a+l)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=t.frame.width===o.width&&t.frame.height===o.height&&0===t.rotate,!0}}},2437:(t,e,n)=>{n.d(e,{W:()=>c});var r=n(9939),i=n(6083),o=n(583),s=n(5589),a=n(218);let l=0;const c=new class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new a.n(this.textureOptions)}createTexture(t,e,n,r){const i=new o.v({...this.textureOptions,width:t,height:e,resolution:1,antialias:n,autoGarbageCollect:!1,autoGenerateMipmaps:r});return new s.g({source:i,label:"texturePool_"+l++})}getOptimalTexture(t,e,n=1,i,o=!1){let s=Math.ceil(t*n-1e-6),a=Math.ceil(e*n-1e-6);s=(0,r.U5)(s),a=(0,r.U5)(a);const l=(s<<17)+(a<<2)+((o?1:0)<<1)+(i?1:0);this._texturePool[l]||(this._texturePool[l]=[]);let c=this._texturePool[l].pop();return c||(c=this.createTexture(s,a,i,o)),c.source._resolution=n,c.source.width=s/n,c.source.height=a/n,c.source.pixelWidth=s,c.source.pixelHeight=a,c.frame.x=0,c.frame.y=0,c.frame.width=t,c.frame.height=e,c.updateUvs(),this._poolKeyHash[c.uid]=l,c}getSameSizeTexture(t,e=!1){const n=t.source;return this.getOptimalTexture(t.width,t.height,n._resolution,e)}returnTexture(t,e=!1){const n=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[n].push(t)}clear(t){if(t=!1!==t)for(const t in this._texturePool){const e=this._texturePool[t];if(e)for(let t=0;t<e.length;t++)e[t].destroy(!0)}this._texturePool={}}};i.L.register(c)},218:(t,e,n)=>{n.d(e,{n:()=>l});var r=n(8875),i=n(133),o=n(4670);const s=Object.create(null);const a=class t extends r.A{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...t.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){(0,o.t6)(o.lj,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this._sharedResourceId=null,this.emit("change",this)}_generateResourceId(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=function(t){const e=s[t];return void 0===e&&(s[t]=(0,i.L)("resource")),e}(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};a.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let l=a},4195:(t,e,n)=>{n.d(e,{P:()=>o});var r=n(8507),i=n(583);class o extends i.v{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let n=t.format;n||(n=e instanceof Float32Array?"rgba32float":e instanceof Int32Array||e instanceof Uint32Array?"rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?"rgba16uint":(Int8Array,"bgra8unorm")),super({...t,resource:e,format:n}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}o.extension=r.Ag.TextureSource},4884:(t,e,n)=>{n.d(e,{q:()=>s});var r=n(1761),i=n(8507),o=n(583);class s extends o.v{constructor(t){t.resource||(t.resource=r.e.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),this.resource.width===this.pixelWidth&&this.resource.height===this.pixelHeight||(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,n=this._resolution){const r=super.resize(t,e,n);return r&&this.resizeCanvas(),r}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}s.extension=i.Ag.TextureSource},8293:(t,e,n)=>{n.d(e,{b:()=>o});var r=n(8507),i=n(583);class o extends i.v{constructor(t){super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}o.extension=r.Ag.TextureSource},583:(t,e,n)=>{n.d(e,{v:()=>c});var r=n(8875),i=n(9939),o=n(2698),s=n(133),a=n(218);const l=class t extends r.A{constructor(e={}){super(),this.options=e,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=(0,s.L)("textureSource"),this._resourceType="textureSource",this._resourceId=(0,s.L)("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.viewDimension="2d",this.arrayLayerCount=1,this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...t.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=e.format,this.dimension=e.dimensions,this.viewDimension=e.viewDimension??e.dimensions,this.arrayLayerCount=e.arrayLayerCount,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new a.n((0,o.S)(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(t){this._style.maxAnisotropy=t}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=(0,s.L)("resource"),this.emit("change",this),this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy?.();this._gpuData=Object.create(null)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,n){n||(n=this._resolution),t||(t=this.width),e||(e=this.height);const r=Math.round(t*n),i=Math.round(e*n);return this.width=r/n,this.height=i/n,this._resolution=n,(this.pixelWidth!==r||this.pixelHeight!==i)&&(this._refreshPOT(),this.pixelWidth=r,this.pixelHeight=i,this.emit("resize",this),this._resourceId=(0,s.L)("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=(0,i.f3)(this.pixelWidth)&&(0,i.f3)(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};l.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",viewDimension:"2d",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let c=l},9726:(t,e,n)=>{var r=n(268),i=n(2406);const o=new class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||(0,r.R)(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const n=(0,i.z)(t);let o;for(let t=0;t<this.parsers.length;t++){const r=this.parsers[t];if(r.test(e)){o=r.getCacheableAssets(n,e);break}}const s=new Map(Object.entries(o||{}));o||n.forEach((t=>{s.set(t,e)}));const a=[...s.keys()],l={cacheKeys:a,keys:n};n.forEach((t=>{this._cacheMap.set(t,l)})),a.forEach((t=>{const n=o?o[t]:e;this._cache.has(t)&&this._cache.get(t)!==n&&(0,r.R)("[Cache] already has key:",t),this._cache.set(t,s.get(t))}))}remove(t){if(!this._cacheMap.has(t))return void(0,r.R)(`[Assets] Asset id ${t} was not found in the Cache`);const e=this._cacheMap.get(t);e.cacheKeys.forEach((t=>{this._cache.delete(t)})),e.keys.forEach((t=>{this._cacheMap.delete(t)}))}get parsers(){return this._parsers}};var s=n(8507),a=n(583),l=n(5589);const c=[];function h(t={}){const e=t&&t.resource,n=e?t.resource:t,r=e?t:{resource:t};for(let t=0;t<c.length;t++){const e=c[t];if(e.test(n))return new e(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}s.XO.handleByList(s.Ag.TextureSource,c),l.g.from=function(t,e=!1){return"string"==typeof t?o.get(t):t instanceof a.v?new l.g({source:t}):function(t={},e=!1){const n=t&&t.resource,r=n?t.resource:t,i=n?t:{resource:t};if(!e&&o.has(r))return o.get(r);const s=new l.g({source:h(i)});return s.on("destroy",(()=>{o.has(r)&&o.remove(r)})),e||o.set(r,s),s}(t,e)},a.v.from=h},7952:(t,e,n)=>{n.d(e,{X:()=>o});const r=Object.create(null),i=Object.create(null);function o(t,e){let n=i[t];return void 0===n&&(void 0===r[e]&&(r[e]=1),i[t]=n=r[e]++),n}},5099:(t,e,n)=>{n.d(e,{W:()=>r});var r=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.CANVAS=4]="CANVAS",t[t.BOTH=3]="BOTH",t))(r||{})},5559:(t,e,n)=>{n.d(e,{mc:()=>H,u:()=>U,ig:()=>z,fR:()=>W});var r=n(8875),i=n(2577);var o=n(8507),s=n(9313),a=n(1652),l=n(2812),c=n(133),h=n(4670),u=n(268),d=n(8655);const f={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(t){"boolean"==typeof t&&!1===t?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(!0===t?{}:t))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(t){(0,h.t6)("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}};var p=n(9903);const m={allowChildren:!0,removeChildren(t=0,e){const n=e??this.children.length,r=n-t,i=[];if(r>0&&r<=n){for(let e=n-1;e>=t;e--){const t=this.children[e];t&&(i.push(t),t.parent=null)}(0,p.d)(this.children,t,n);const e=this.renderGroup||this.parentRenderGroup;e&&e.removeChildren(i);for(let t=0;t<i.length;++t){const e=i[t];e.parentRenderLayer?.detach(e),this.emit("childRemoved",e,this,t),i[t].emit("removed",this)}return i.length>0&&this._didViewChangeTick++,i}if(0===r&&0===this.children.length)return i;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(t){const e=this.getChildAt(t);return this.removeChild(e)},getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]},setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(t),this.addChildAt(t,e)},getChildIndex(t){const e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(t,e){this.allowChildren||(0,h.t6)(h.lj,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:n}=this;if(e<0||e>n.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${n.length}`);const r=t.parent===this;if(t.parent){const n=t.parent.children.indexOf(t);if(r){if(n===e)return t;t.parent.children.splice(n,1)}else t.removeFromParent()}e===n.length?n.push(t):n.splice(e,0,t),t.parent=this,t.didChange=!0,t._updateFlags=15;const i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(t),this.sortableChildren&&(this.sortDirty=!0),r||(this.emit("childAdded",t,this,e),t.emit("added",this)),t},swapChildren(t,e){if(t===e)return;const n=this.getChildIndex(t),r=this.getChildIndex(e);this.children[n]=e,this.children[r]=t;const i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...t){return 1===t.length?this.reparentChildAt(t[0],this.children.length):(t.forEach((t=>this.reparentChildAt(t,this.children.length))),t[0])},reparentChildAt(t,e){if(t.parent===this)return this.setChildIndex(t,e),t;const n=t.worldTransform.clone();t.removeFromParent(),this.addChildAt(t,e);const r=this.worldTransform.clone();return r.invert(),n.prepend(r),t.setFromMatrix(n),t},replaceChild(t,e){t.updateLocalTransform(),this.addChildAt(e,this.getChildIndex(t)),e.setFromMatrix(t.localTransform),e.updateLocalTransform(),this.removeChild(t)}},y={collectRenderables(t,e,n){this.parentRenderLayer&&this.parentRenderLayer!==n||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(t,e,n):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,t):this.collectRenderablesWithEffects(t,e,n))},collectRenderablesSimple(t,e,n){const r=this.children,i=r.length;for(let o=0;o<i;o++)r[o].collectRenderables(t,e,n)},collectRenderablesWithEffects(t,e,n){const{renderPipes:r}=e;for(let e=0;e<this.effects.length;e++){const n=this.effects[e];r[n.pipe].push(n,this,t)}this.collectRenderablesSimple(t,e,n);for(let e=this.effects.length-1;e>=0;e--){const n=this.effects[e];r[n.pipe].pop(n,this,t)}}};var g=n(9049);const v=new class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach((t=>{this.add({test:t.test,maskClass:t})})))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){const n=this._tests[e];if(n.test(t))return d.Z.get(n.maskClass,t)}return t}returnMaskEffect(t){d.Z.return(t)}};o.XO.handleByList(o.Ag.MaskEffect,v._effectClasses);const b={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){const t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0)},addEffect(t){-1===this.effects.indexOf(t)&&(this.effects.push(t),this.effects.sort(((t,e)=>t.priority-e.priority)),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(t){const e=this.effects.indexOf(t);-1!==e&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(t){const e=this._maskEffect;e?.mask!==t&&(e&&(this.removeEffect(e),v.returnMaskEffect(e),this._maskEffect=null),null!=t&&(this._maskEffect=v.getMaskEffect(t),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},setMask(t){this._maskOptions={...this._maskOptions,...t},t.mask&&(this.mask=t.mask),this._markStructureAsChanged()},set filters(t){!Array.isArray(t)&&t&&(t=[t]);const e=this._filterEffect||(this._filterEffect=new g.a),n=t?.length>0,r=n!==e.filters?.length>0;t=Array.isArray(t)?t.slice(0):t,e.filters=Object.freeze(t),r&&(n?this.addEffect(e):(this.removeEffect(e),e.filters=t??null))},get filters(){return this._filterEffect?.filters},set filterArea(t){this._filterEffect||(this._filterEffect=new g.a),this._filterEffect.filterArea=t},get filterArea(){return this._filterEffect?.filterArea}},x={label:null,get name(){return(0,h.t6)(h.lj,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){(0,h.t6)(h.lj,"Container.name property has been removed, use Container.label instead"),this.label=t},getChildByName(t,e=!1){return this.getChildByLabel(t,e)},getChildByLabel(t,e=!1){const n=this.children;for(let e=0;e<n.length;e++){const r=n[e];if(r.label===t||t instanceof RegExp&&t.test(r.label))return r}if(e)for(let e=0;e<n.length;e++){const r=n[e].getChildByLabel(t,!0);if(r)return r}return null},getChildrenByLabel(t,e=!1,n=[]){const r=this.children;for(let e=0;e<r.length;e++){const i=r[e];(i.label===t||t instanceof RegExp&&t.test(i.label))&&n.push(i)}if(e)for(let e=0;e<r.length;e++)r[e].getChildrenByLabel(t,!0,n);return n}};var _=n(9636),w=n(2208);const S=new s.u,C={getFastGlobalBounds(t,e){e||(e=new _.c),e.clear(),this._getGlobalBoundsRecursive(!!t,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);const n=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(n.worldTransform),e},_getGlobalBoundsRecursive(t,e,n){let r=e;if(t&&this.parentRenderLayer&&this.parentRenderLayer!==n)return;if(7!==this.localDisplayStatus||!this.measurable)return;const i=!!this.effects.length;if((this.renderGroup||i)&&(r=w.o.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const t=this.bounds;r.addFrame(t.minX,t.minY,t.maxX,t.maxY,this.groupTransform)}const e=this.children;for(let i=0;i<e.length;i++)e[i]._getGlobalBoundsRecursive(t,r,n)}if(i){let t=!1;const n=this.renderGroup||this.parentRenderGroup;for(let e=0;e<this.effects.length;e++)this.effects[e].addBounds&&(t||(t=!0,r.applyMatrix(n.worldTransform)),this.effects[e].addBounds(r,!0));t&&r.applyMatrix(n.worldTransform.copyTo(S).invert()),e.addBounds(r),w.o.return(r)}else this.renderGroup&&(e.addBounds(r,this.relativeGroupTransform),w.o.return(r))}};var E=n(198),k=n(9443),T=n(7269);function A(t,e){const n=t.children;for(let t=0;t<n.length;t++){const r=n[t],i=r.uid,o=(65535&r._didViewChangeTick)<<16|65535&r._didContainerChangeTick,s=e.index;e.data[s]===i&&e.data[s+1]===o||(e.data[e.index]=i,e.data[e.index+1]=o,e.didChange=!0),e.index=s+2,r.children.length&&A(r,e)}return e.didChange}const M=new s.u,P={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){const n=Math.sign(this.scale.x)||1;this.scale.x=0!==e?t/e*n:n},_setHeight(t,e){const n=Math.sign(this.scale.y)||1;this.scale.y=0!==e?t/e*n:n},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new _.c});const t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),A(this,t),t.didChange&&(0,T.n)(this,t.localBounds,M),t.localBounds},getBounds(t,e){return(0,k.f)(this,t,e||new _.c)}},O={_onRender:null,set onRender(t){const e=this.renderGroup||this.parentRenderGroup;if(!t)return this._onRender&&e?.removeOnRender(this),void(this._onRender=null);this._onRender||e?.addOnRender(this),this._onRender=t},get onRender(){return this._onRender}},I={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(L))}};function L(t,e){return t._zIndex-e._zIndex}var j=n(5101);const R={getGlobalPosition(t=new j.b,e=!1){return this.parent?this.parent.toGlobal(this._position,t,e):(t.x=this._position.x,t.y=this._position.y),t},toGlobal(t,e,n=!1){const r=this.getGlobalTransform(w.u.get(),n);return e=r.apply(t,e),w.u.return(r),e},toLocal(t,e,n,r){e&&(t=e.toGlobal(t,n,r));const i=this.getGlobalTransform(w.u.get(),r);return n=i.applyInverse(t,n),w.u.return(i),n}};var D=n(3284);const N=new l.o(null),F=new l.o(null),B=new l.o(null,1,1),G=new l.o(null),z=1,U=2,W=4;class H extends r.A{constructor(t={}){super(),this.uid=(0,c.L)("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new s.u,this.relativeGroupTransform=new s.u,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new l.o(this,0,0),this._scale=B,this._pivot=F,this._origin=G,this._skew=N,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],function(t,e,n={}){for(const r in e)n[r]||void 0===e[r]||(t[r]=e[r])}(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach((t=>this.addChild(t))),t.parent?.addChild(this)}static mixin(t){(0,h.t6)("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),o.XO.mixin(H,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=4095&t}get _didChangeId(){return 4095&this._didContainerChangeTick|(4095&this._didViewChangeTick)<<12}addChild(...t){if(this.allowChildren||(0,h.t6)(h.lj,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let e=0;e<t.length;e++)this.addChild(t[e]);return t[0]}const e=t[0],n=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),n&&(n.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,n&&n.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,0!==e._zIndex&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let e=0;e<t.length;e++)this.removeChild(t[e]);return t[0]}const e=t[0],n=this.children.indexOf(e);return n>-1&&(this._didViewChangeTick++,this.children.splice(n,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,n),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,this.didChange||(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=d.Z.get(D.m,this),this.groupTransform=s.u.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t?.removeChild(this),d.Z.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&0===this.effects.length}get worldTransform(){return this._worldTransform||(this._worldTransform=new s.u),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*a.bO}set angle(t){this.rotation=t*a.Td}get pivot(){return this._pivot===F&&(this._pivot=new l.o(this,0,0)),this._pivot}set pivot(t){this._pivot===F&&(this._pivot=new l.o(this,0,0),this._origin!==G&&(0,u.R)("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),"number"==typeof t?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===N&&(this._skew=new l.o(this,0,0)),this._skew}set skew(t){this._skew===N&&(this._skew=new l.o(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===B&&(this._scale=new l.o(this,1,1)),this._scale}set scale(t){this._scale===B&&(this._scale=new l.o(this,0,0)),"string"==typeof t&&(t=parseFloat(t)),"number"==typeof t?this._scale.set(t):this._scale.copyFrom(t)}get origin(){return this._origin===G&&(this._origin=new l.o(this,0,0)),this._origin}set origin(t){this._origin===G&&(this._origin=new l.o(this,0,0),this._pivot!==F&&(0,u.R)("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),"number"==typeof t?this._origin.set(t):this._origin.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){const n=this.getLocalBounds();"object"==typeof t?(e=t.height??t.width,t=t.width):e??(e=t),void 0!==t&&this._setWidth(t,n.width),void 0!==e&&this._setHeight(e,n.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set("number"==typeof t.x?t.x:this.position.x,"number"==typeof t.y?t.y:this.position.y),this.scale.set("number"==typeof t.scaleX?t.scaleX||1:this.scale.x,"number"==typeof t.scaleY?t.scaleY||1:this.scale.y),this.rotation="number"==typeof t.rotation?t.rotation:this.rotation,this.skew.set("number"==typeof t.skewX?t.skewX:this.skew.x,"number"==typeof t.skewY?t.skewY:this.skew.y),this.pivot.set("number"==typeof t.pivotX?t.pivotX:this.pivot.x,"number"==typeof t.pivotY?t.pivotY:this.pivot.y),this.origin.set("number"==typeof t.originX?t.originX:this.origin.x,"number"==typeof t.originY?t.originY:this.origin.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,n=this._scale,r=this._pivot,i=this._origin,o=this._position,s=n._x,a=n._y,l=r._x,c=r._y,h=-i._x,u=-i._y;e.a=this._cx*s,e.b=this._sx*s,e.c=this._cy*a,e.d=this._sy*a,e.tx=o._x-(l*e.a+c*e.c)+(h*e.a+u*e.c)-h,e.ty=o._y-(l*e.b+c*e.d)+(h*e.b+u*e.d)-u}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=z,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const e=i.Q.shared.setValue(t??16777215).toBgrNumber();e!==this.localColor&&(this.localColor=e,this._updateFlags|=z,this._onUpdate())}get tint(){return(0,E.D)(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=U,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(2&this.localDisplayStatus)}set visible(t){const e=t?2:0;(2&this.localDisplayStatus)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=W,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",t))}get culled(){return!(4&this.localDisplayStatus)}set culled(t){const e=t?0:4;(4&this.localDisplayStatus)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=W,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(1&this.localDisplayStatus)}set renderable(t){const e=t?1:0;(1&this.localDisplayStatus)!==e&&(this._updateFlags|=W,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return 7===this.localDisplayStatus&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;let e;this.destroyed=!0,this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners();if(("boolean"==typeof t?t:t?.children)&&e)for(let n=0;n<e.length;++n)e[n].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}}o.XO.mixin(H,m,C,R,O,P,b,x,I,{cullArea:null,cullable:!1,cullableChildren:!0},f,E.R,y)},3284:(t,e,n)=>{n.d(e,{m:()=>s});var r=n(9313),i=n(848),o=n(2437);class s{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new r.u,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new i.L,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let t=0;t<e.length;t++){const n=e[t];n._updateFlags=15,this.addChild(n)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(o.W.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const t=this._parentCacheAsTextureRenderGroup;t&&!t.textureNeedsUpdate&&t.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const t in this.childrenToUpdate){const e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){const e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup)return void this.addRenderGroupChild(t.renderGroup);t._onRender&&this.addOnRender(t);const e=t.children;for(let t=0;t<e.length;t++)this.addChild(e[t])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup)return void this._removeRenderGroupChild(t.renderGroup);const e=t.children;for(let t=0;t<e.length;t++)this.removeChild(e[t])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return 7===this.root.localDisplayStatus&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){const e=this.root.children;for(let n=0;n<e.length;n++)this._getChildren(e[n],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const n=t.children;for(let t=0;t<n.length;t++)this._getChildren(n[t],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return 1&this._matrixDirty?(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new r.u),this._inverseWorldTransform.copyFrom(this.worldTransform).invert()):this._inverseWorldTransform}get textureOffsetInverseTransform(){return 2&this._matrixDirty?(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new r.u),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y)):this._textureOffsetInverseTransform}get inverseParentTextureTransform(){if(!(4&this._matrixDirty))return this._inverseParentTextureTransform;this._matrixDirty&=-5;const t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new r.u),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}},9636:(t,e,n)=>{n.d(e,{c:()=>s});var r=n(9313),i=n(9252);const o=new r.u;class s{constructor(t=1/0,e=1/0,n=-1/0,r=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=o,this.minX=t,this.minY=e,this.maxX=n,this.maxY=r}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new i.M);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=o,this}set(t,e,n,r){this.minX=t,this.minY=e,this.maxX=n,this.maxY=r}addFrame(t,e,n,r,i){i||(i=this.matrix);const o=i.a,s=i.b,a=i.c,l=i.d,c=i.tx,h=i.ty;let u=this.minX,d=this.minY,f=this.maxX,p=this.maxY,m=o*t+a*e+c,y=s*t+l*e+h;m<u&&(u=m),y<d&&(d=y),m>f&&(f=m),y>p&&(p=y),m=o*n+a*e+c,y=s*n+l*e+h,m<u&&(u=m),y<d&&(d=y),m>f&&(f=m),y>p&&(p=y),m=o*t+a*r+c,y=s*t+l*r+h,m<u&&(u=m),y<d&&(d=y),m>f&&(f=m),y>p&&(p=y),m=o*n+a*r+c,y=s*n+l*r+h,m<u&&(u=m),y<d&&(d=y),m>f&&(f=m),y>p&&(p=y),this.minX=u,this.minY=d,this.maxX=f,this.maxY=p}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){const e=this.minX,n=this.minY,r=this.maxX,i=this.maxY,{a:o,b:s,c:a,d:l,tx:c,ty:h}=t;let u=o*e+a*n+c,d=s*e+l*n+h;this.minX=u,this.minY=d,this.maxX=u,this.maxY=d,u=o*r+a*n+c,d=s*r+l*n+h,this.minX=u<this.minX?u:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=u>this.maxX?u:this.maxX,this.maxY=d>this.maxY?d:this.maxY,u=o*e+a*i+c,d=s*e+l*i+h,this.minX=u<this.minX?u:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=u>this.maxX?u:this.maxX,this.maxY=d>this.maxY?d:this.maxY,u=o*r+a*i+c,d=s*r+l*i+h,this.minX=u<this.minX?u:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=u>this.maxX?u:this.maxX,this.maxY=d>this.maxY?d:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,n,r){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<n&&(this.minY=n),this.maxY>r&&(this.maxY=r),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new s(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,n,r){let i=this.minX,o=this.minY,s=this.maxX,a=this.maxY;r||(r=this.matrix);const l=r.a,c=r.b,h=r.c,u=r.d,d=r.tx,f=r.ty;for(let r=e;r<n;r+=2){const e=t[r],n=t[r+1],p=l*e+h*n+d,m=c*e+u*n+f;i=p<i?p:i,o=m<o?m:o,s=p>s?p:s,a=m>a?m:a}this.minX=i,this.minY=o,this.maxX=s,this.maxY=a}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}},9443:(t,e,n)=>{n.d(e,{E:()=>a,f:()=>o});var r=n(9313),i=n(2208);function o(t,e,n){let o,l;return n.clear(),t.parent?e?o=t.parent.worldTransform:(l=i.u.get().identity(),o=a(t,l)):o=r.u.IDENTITY,s(t,n,o,e),l&&i.u.return(l),n.isValid||n.set(0,0,0,0),n}function s(t,e,n,o){if(!t.visible||!t.measurable)return;let a;o?a=t.worldTransform:(t.updateLocalTransform(),a=i.u.get(),a.appendFrom(t.localTransform,n));const l=e,c=!!t.effects.length;if(c&&(e=i.o.get().clear()),t.boundsArea)e.addRect(t.boundsArea,a);else{const n=t.bounds;n&&!n.isEmpty()&&(e.matrix=a,e.addBounds(n));for(let n=0;n<t.children.length;n++)s(t.children[n],e,a,o)}if(c){for(let n=0;n<t.effects.length;n++)t.effects[n].addBounds?.(e);l.addBounds(e,r.u.IDENTITY),i.o.return(e)}o||i.u.return(a)}function a(t,e){const n=t.parent;return n&&(a(n,e),n.updateLocalTransform(),e.append(n.localTransform)),e}},7269:(t,e,n)=>{n.d(e,{n:()=>o});var r=n(9313),i=n(2208);function o(t,e,n){return e.clear(),n||(n=r.u.IDENTITY),s(t,e,n,t,!0),e.isValid||e.set(0,0,0,0),e}function s(t,e,n,o,a){let l;if(a)l=i.u.get(),l=n.copyTo(l);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();const e=t.localTransform;l=i.u.get(),l.appendFrom(e,n)}const c=e,h=!!t.effects.length;if(h&&(e=i.o.get().clear()),t.boundsArea)e.addRect(t.boundsArea,l);else{t.renderPipeId&&(e.matrix=l,e.addBounds(t.bounds));const n=t.children;for(let t=0;t<n.length;t++)s(n[t],e,l,o,!1)}if(h){for(let n=0;n<t.effects.length;n++)t.effects[n].addLocalBounds?.(e,o);c.addBounds(e,r.u.IDENTITY),i.o.return(e)}i.u.return(l)}},2208:(t,e,n)=>{n.d(e,{o:()=>a,u:()=>s});var r=n(9313),i=n(8655),o=n(9636);const s=i.Z.getPool(r.u),a=i.Z.getPool(o.c)},198:(t,e,n)=>{n.d(e,{D:()=>a,R:()=>l});var r=n(9313),i=n(9443),o=n(2208),s=n(753);function a(t){return((255&t)<<16)+(65280&t)+(t>>16&255)}const l={getGlobalAlpha(t){if(t)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,n=this.parent;for(;n;)e*=n.alpha,n=n.parent;return e},getGlobalTransform(t=new r.u,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();const n=(0,i.E)(this,o.u.get().identity());return t.appendFrom(this.localTransform,n),o.u.return(n),t},getGlobalTint(t){if(t)return this.renderGroup?a(this.renderGroup.worldColor):this.parentRenderGroup?a((0,s.j)(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,n=this.parent;for(;n;)e=(0,s.j)(e,n.localColor),n=n.parent;return a(e)}}},2698:(t,e,n)=>{function r(t){const e={};for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}n.d(e,{S:()=>r})},753:(t,e,n)=>{n.d(e,{j:()=>o});var r=n(4676);const i=16777215;function o(t,e){return t===i?e:e===i?t:(0,r.u)(t,e)}},4676:(t,e,n)=>{function r(t,e){if(16777215===t||!e)return e;if(16777215===e||!t)return t;return(((t>>16&255)*(e>>16&255)/255|0)<<16)+(((t>>8&255)*(e>>8&255)/255|0)<<8)+((255&t)*(255&e)/255|0)}n.d(e,{u:()=>r})},2760:(t,e,n)=>{function r(t,e,n){const r=(t>>24&255)/255;e[n++]=(255&t)/255*r,e[n++]=(t>>8&255)/255*r,e[n++]=(t>>16&255)/255*r,e[n++]=r}n.d(e,{V:()=>r})},6954:(t,e,n)=>{n.d(e,{G:()=>s});var r=n(9313),i=n(4676);const o=new r.u;class s{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const t=this.baseColor,e=t>>16|65280&t|(255&t)<<16,n=this.renderable;return n?(0,i.u)(e,n.groupColor)+(this.alpha*n.groupAlpha*255<<24):e+(255*this.alpha<<24)}get transform(){return this.renderable?.groupTransform||o}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}}},4663:(t,e,n)=>{n.d(e,{A:()=>_});var r=n(4670),i=n(4985),o=n(8393),s=n(8507),a=n(848),l=n(4334);class c{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class h{constructor(){this.instructions=new a.L}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const u=class t{constructor(t){this._renderer=t,this._managedContexts=new l.s({renderer:t,type:"resource",name:"graphicsContext"})}init(e){t.defaultOptions.bezierSmoothness=e?.bezierSmoothness??t.defaultOptions.bezierSmoothness}getContextRenderData(t){return this.getGpuContext(t).graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=t._gpuData,n=!!e[this._renderer.uid],r=e[this._renderer.uid]||this._initContext(t);return!t.dirty&&n||(n&&r.reset(),r.isBatchable=!1,t.dirty=!1),r}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=new h;return this.getGpuContext(t).graphicsData=e,e.init(),e}_initContext(t){const e=new c;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};u.extension={type:[s.Ag.CanvasSystem],name:"graphicsContext"},u.defaultOptions={bezierSmoothness:.5};let d=u;var f=n(7547);class p{constructor(t,e){this.state=f.U.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new l.s({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){return!1}addRenderable(t,e){this._managedGraphics.add(t),this.renderer.renderPipes.batch.break(e),e.add(t)}updateRenderable(t){}execute(t){t.isRenderable&&this._adaptor.execute(this,t)}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null}}p.extension={type:[s.Ag.CanvasPipes],name:"graphics"};var m=n(378),y=n(8655),g=n(2760),v=n(6954);class b{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach((t=>{y.Z.return(t)})),this.batches.length=0}}class x{constructor(t,e){this.state=f.U.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new l.s({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){const e=t.context,n=!!t._gpuData,r=this.renderer.graphicsContext.updateGpuContext(e);return!(!r.isBatchable&&n===r.isBatchable)}addRenderable(t,e){const n=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),n.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const e=this._getGpuDataForRenderable(t).batches;for(let t=0;t<e.length;t++){const n=e[t];n._batcher.updateElement(n)}}execute(t){if(!t.isRenderable)return;const e=this.renderer,n=t.context;if(!e.graphicsContext.getGpuContext(n).batches.length)return;const r=n.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;const i=r.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=e._roundPixels|t._roundPixels,(0,g.V)(t.groupColorAlpha,i.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=this._getGpuDataForRenderable(t),n=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),n.isBatchable&&this._updateBatchesForRenderable(t,e)}_addToBatcher(t,e){const n=this.renderer.renderPipes.batch,r=this._getGpuDataForRenderable(t).batches;for(let t=0;t<r.length;t++){const i=r[t];n.addToBatch(i,e)}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){const e=new b;return t._gpuData[this.renderer.uid]=e,this._managedGraphics.add(t),e}_updateBatchesForRenderable(t,e){const n=t.context,r=this.renderer.graphicsContext.getGpuContext(n),i=this.renderer._roundPixels|t._roundPixels;e.batches=r.batches.map((e=>{const n=y.Z.get(v.G);return e.copyTo(n),n.renderable=t,n.roundPixels=i,n}))}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}x.extension={type:[s.Ag.WebGLPipes,s.Ag.WebGPUPipes],name:"graphics"},s.XO.add(p),s.XO.add(x),s.XO.add(d),s.XO.add(m.GH);class _ extends i.l{constructor(t){t instanceof o.T&&(t={context:t});const{context:e,roundPixels:n,...r}=t||{};super({label:"Graphics",...r}),this.renderPipeId="graphics",e?this.context=e:(this.context=this._ownedContext=new o.T,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=n??!1}set context(t){t!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=t,this._context.on("update",this.onViewUpdate,this),this._context.on("unload",this.unload,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):!0!==t&&!0!==t?.context||this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_onTouch(t){this._gcLastUsed=t,this._context._gcLastUsed=t}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){if(t)return new _(this._context.clone());this._ownedContext=null;return new _(this._context)}lineStyle(t,e,n){(0,r.t6)(r.lj,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const i={};return t&&(i.width=t),e&&(i.color=e),n&&(i.alpha=n),this.context.strokeStyle=i,this}beginFill(t,e){(0,r.t6)(r.lj,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const n={};return void 0!==t&&(n.color=t),void 0!==e&&(n.alpha=e),this.context.fillStyle=n,this}endFill(){(0,r.t6)(r.lj,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const t=this.context.strokeStyle;return t.width===o.T.defaultStrokeStyle.width&&t.color===o.T.defaultStrokeStyle.color&&t.alpha===o.T.defaultStrokeStyle.alpha||this.context.stroke(),this}drawCircle(...t){return(0,r.t6)(r.lj,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return(0,r.t6)(r.lj,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return(0,r.t6)(r.lj,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return(0,r.t6)(r.lj,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return(0,r.t6)(r.lj,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return(0,r.t6)(r.lj,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}},8393:(t,e,n)=>{n.d(e,{T:()=>ct});var r=n(8875),i=n(2577),o=n(9313),s=n(5101),a=n(5589),l=n(133),c=n(4670),h=n(9636),u=n(268),d=n(8133);var f=n(6125),p=n(9252);class m{constructor(t=0,e=0,n=0,r=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=n,this.halfHeight=r}clone(){return new m(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let n=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return n*=n,r*=r,n+r<=1}strokeContains(t,e,n,r=.5){const{halfWidth:i,halfHeight:o}=this;if(i<=0||o<=0)return!1;const s=n*(1-r),a=n-s,l=i-a,c=o-a,h=i+s,u=o+s,d=t-this.x,f=e-this.y;return d*d/(l*l)+f*f/(c*c)>1&&d*d/(h*h)+f*f/(u*u)<=1}getBounds(t){return t||(t=new p.M),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=2*this.halfWidth,t.height=2*this.halfHeight,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function y(t,e,n,r,i,o){const s=i-n,a=o-r,l=s*s+a*a;let c,h,u=-1;0!==l&&(u=((t-n)*s+(e-r)*a)/l),u<0?(c=n,h=r):u>1?(c=i,h=o):(c=n+u*s,h=r+u*a);const d=t-c,f=e-h;return d*d+f*f}class g{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if("number"!=typeof e[0]){const t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n].x,e[n].y);e=t}this.points=e,this.closePath=!0}isClockwise(){let t=0;const e=this.points,n=e.length;for(let r=0;r<n;r+=2){const i=e[r],o=e[r+1];t+=(e[(r+2)%n]-i)*(e[(r+3)%n]+o)}return t<0}containsPolygon(t){const e=this.getBounds(undefined),n=t.getBounds(undefined);if(!e.containsRect(n))return!1;const r=t.points;for(let t=0;t<r.length;t+=2){const e=r[t],n=r[t+1];if(!this.contains(e,n))return!1}return!0}clone(){const t=this.points.slice(),e=new g(t);return e.closePath=this.closePath,e}contains(t,e){let n=!1;const r=this.points.length/2;for(let i=0,o=r-1;i<r;o=i++){const r=this.points[2*i],s=this.points[2*i+1],a=this.points[2*o],l=this.points[2*o+1];s>e!=l>e&&t<(e-s)/(l-s)*(a-r)+r&&(n=!n)}return n}strokeContains(t,e,n,r=.5){const i=n*n,o=i*(1-r),s=i-o,{points:a}=this,l=a.length-(this.closePath?0:2);for(let n=0;n<l;n+=2){const r=a[n],i=a[n+1],l=a[(n+2)%a.length],c=a[(n+3)%a.length];if(y(t,e,r,i,l,c)<=(Math.sign((l-r)*(e-i)-(c-i)*(t-r))<0?s:o))return!0}return!1}getBounds(t){t||(t=new p.M);const e=this.points;let n=1/0,r=-1/0,i=1/0,o=-1/0;for(let t=0,s=e.length;t<s;t+=2){const s=e[t],a=e[t+1];n=s<n?s:n,r=s>r?s:r,i=a<i?a:i,o=a>o?a:o}return t.x=n,t.width=r-n,t.y=i,t.height=o-i,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce(((t,e)=>`${t}, ${e}`),"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return(0,c.t6)("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return(0,c.t6)("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}const v=(t,e,n,r,i,o,s)=>{const a=t-n,l=e-r,c=Math.sqrt(a*a+l*l);return c>=i-o&&c<=i+s};class b{constructor(t=0,e=0,n=0,r=0,i=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=n,this.height=r,this.radius=i}getBounds(t){return t||(t=new p.M),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new b(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const n=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+n&&e<=this.y+this.height-n||t>=this.x+n&&t<=this.x+this.width-n)return!0;let r=t-(this.x+n),i=e-(this.y+n);const o=n*n;if(r*r+i*i<=o)return!0;if(r=t-(this.x+this.width-n),r*r+i*i<=o)return!0;if(i=e-(this.y+this.height-n),r*r+i*i<=o)return!0;if(r=t-(this.x+n),r*r+i*i<=o)return!0}return!1}strokeContains(t,e,n,r=.5){const{x:i,y:o,width:s,height:a,radius:l}=this,c=n*(1-r),h=n-c,u=i+l,d=o+l,f=i+s,p=o+a;return(t>=i-c&&t<=i+h||t>=f-h&&t<=f+c)&&e>=d&&e<=d+(a-2*l)||((e>=o-c&&e<=o+h||e>=p-h&&e<=p+c)&&t>=u&&t<=u+(s-2*l)||(t<u&&e<d&&v(t,e,u,d,l,h,c)||t>f-l&&e<d&&v(t,e,f-l,d,l,h,c)||t>f-l&&e>p-l&&v(t,e,f-l,p-l,l,h,c)||t<u&&e>p-l&&v(t,e,u,p-l,l,h,c)))}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}var x=n(378);const _=8,w=1.1920929e-7,S=1,C=.01,E=0,k=0;function T(t,e,n,r,i,o,s,a,l,c){const h=Math.min(.99,Math.max(0,c??x.GH.defaultOptions.bezierSmoothness));let u=(S-h)/1;return u*=u,function(t,e,n,r,i,o,s,a,l,c){A(t,e,n,r,i,o,s,a,l,c,0),l.push(s,a)}(e,n,r,i,o,s,a,l,t,u),t}function A(t,e,n,r,i,o,s,a,l,c,h){if(h>_)return;const u=Math.PI,d=(t+n)/2,f=(e+r)/2,p=(n+i)/2,m=(r+o)/2,y=(i+s)/2,g=(o+a)/2,v=(d+p)/2,b=(f+m)/2,x=(p+y)/2,S=(m+g)/2,T=(v+x)/2,M=(b+S)/2;if(h>0){let h=s-t,d=a-e;const f=Math.abs((n-s)*d-(r-a)*h),p=Math.abs((i-s)*d-(o-a)*h);let m,y;if(f>w&&p>w){if((f+p)*(f+p)<=c*(h*h+d*d)){if(E<C)return void l.push(T,M);const c=Math.atan2(o-r,i-n);if(m=Math.abs(c-Math.atan2(r-e,n-t)),y=Math.abs(Math.atan2(a-o,s-i)-c),m>=u&&(m=2*u-m),y>=u&&(y=2*u-y),m+y<E)return void l.push(T,M);if(0!==k){if(m>k)return void l.push(n,r);if(y>k)return void l.push(i,o)}}}else if(f>w){if(f*f<=c*(h*h+d*d)){if(E<C)return void l.push(T,M);if(m=Math.abs(Math.atan2(o-r,i-n)-Math.atan2(r-e,n-t)),m>=u&&(m=2*u-m),m<E)return l.push(n,r),void l.push(i,o);if(0!==k&&m>k)return void l.push(n,r)}}else if(p>w){if(p*p<=c*(h*h+d*d)){if(E<C)return void l.push(T,M);if(m=Math.abs(Math.atan2(a-o,s-i)-Math.atan2(o-r,i-n)),m>=u&&(m=2*u-m),m<E)return l.push(n,r),void l.push(i,o);if(0!==k&&m>k)return void l.push(i,o)}}else if(h=T-(t+s)/2,d=M-(e+a)/2,h*h+d*d<=c)return void l.push(T,M)}A(t,e,d,f,v,b,T,M,l,c,h+1),A(T,M,x,S,y,g,s,a,l,c,h+1)}const M=8,P=1.1920929e-7,O=.01,I=0;function L(t,e,n,r,i,o,s,a){let l=(1-Math.min(.99,Math.max(0,a??x.GH.defaultOptions.bezierSmoothness)))/1;return l*=l,function(t,e,n,r,i,o,s,a){j(s,t,e,n,r,i,o,a,0),s.push(i,o)}(e,n,r,i,o,s,t,l),t}function j(t,e,n,r,i,o,s,a,l){if(l>M)return;const c=Math.PI,h=(e+r)/2,u=(n+i)/2,d=(r+o)/2,f=(i+s)/2,p=(h+d)/2,m=(u+f)/2;let y=o-e,g=s-n;const v=Math.abs((r-o)*g-(i-s)*y);if(v>P){if(v*v<=a*(y*y+g*g)){if(I<O)return void t.push(p,m);let a=Math.abs(Math.atan2(s-i,o-r)-Math.atan2(i-n,r-e));if(a>=c&&(a=2*c-a),a<I)return void t.push(p,m)}}else if(y=p-(e+o)/2,g=m-(n+s)/2,y*y+g*g<=a)return void t.push(p,m);j(t,e,n,h,u,p,m,a,l+1),j(t,p,m,d,f,o,s,a,l+1)}function R(t,e,n,r,i,o,s,a){let l=Math.abs(i-o);(!s&&i>o||s&&o>i)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(l/Math.PI))));let c=l/(a=Math.max(a,3)),h=i;c*=s?-1:1;for(let i=0;i<a+1;i++){const i=e+Math.cos(h)*r,o=n+Math.sin(h)*r;t.push(i,o),h+=c}}const D=2*Math.PI,N={centerX:0,centerY:0,ang1:0,ang2:0},F=({x:t,y:e},n,r,i,o,s,a,l)=>{const c=i*(t*=n)-o*(e*=r),h=o*t+i*e;return l.x=c+s,l.y=h+a,l};function B(t,e){const n=-1.5707963267948966===e?-.551915024494:4/3*Math.tan(e/4),r=1.5707963267948966===e?.551915024494:n,i=Math.cos(t),o=Math.sin(t),s=Math.cos(t+e),a=Math.sin(t+e);return[{x:i-o*r,y:o+i*r},{x:s+a*r,y:a-s*r},{x:s,y:a}]}const G=(t,e,n,r)=>{let i=t*n+e*r;return i>1&&(i=1),i<-1&&(i=-1),(t*r-e*n<0?-1:1)*Math.acos(i)};function z(t,e,n,r,i,o,s,a=0,l=0,c=0){if(0===o||0===s)return;const h=Math.sin(a*D/360),u=Math.cos(a*D/360),d=u*(e-r)/2+h*(n-i)/2,f=-h*(e-r)/2+u*(n-i)/2;if(0===d&&0===f)return;o=Math.abs(o),s=Math.abs(s);const p=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(s,2);p>1&&(o*=Math.sqrt(p),s*=Math.sqrt(p)),((t,e,n,r,i,o,s,a,l,c,h,u,d)=>{const f=Math.pow(i,2),p=Math.pow(o,2),m=Math.pow(h,2),y=Math.pow(u,2);let g=f*p-f*y-p*m;g<0&&(g=0),g/=f*y+p*m,g=Math.sqrt(g)*(s===a?-1:1);const v=g*i/o*u,b=g*-o/i*h,x=c*v-l*b+(t+n)/2,_=l*v+c*b+(e+r)/2,w=(h-v)/i,S=(u-b)/o,C=(-h-v)/i,E=(-u-b)/o,k=G(1,0,w,S);let T=G(w,S,C,E);0===a&&T>0&&(T-=D),1===a&&T<0&&(T+=D),d.centerX=x,d.centerY=_,d.ang1=k,d.ang2=T})(e,n,r,i,o,s,l,c,h,u,d,f,N);let{ang1:m,ang2:y}=N;const{centerX:g,centerY:v}=N;let b=Math.abs(y)/(D/4);Math.abs(1-b)<1e-7&&(b=1);const x=Math.max(Math.ceil(b),1);y/=x;let _=t[t.length-2],w=t[t.length-1];const S={x:0,y:0};for(let e=0;e<x;e++){const e=B(m,y),{x:n,y:r}=F(e[0],o,s,u,h,g,v,S),{x:i,y:a}=F(e[1],o,s,u,h,g,v,S),{x:l,y:c}=F(e[2],o,s,u,h,g,v,S);T(t,_,w,n,r,i,a,l,c),_=l,w=c,m+=y}}const U=new p.M;class W{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new h.c,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const n=this._currentPoly.points,r=n[n.length-2],i=n[n.length-1];return r===t&&i===e||n.push(t,e),this}arc(t,e,n,r,i,o){this._ensurePoly(!1);return R(this._currentPoly.points,t,e,n,r,i,o),this}arcTo(t,e,n,r,i){this._ensurePoly();return function(t,e,n,r,i,o){const s=t[t.length-2],a=t[t.length-1]-n,l=s-e,c=i-n,h=r-e,u=Math.abs(a*h-l*c);if(u<1e-8||0===o)return void(t[t.length-2]===e&&t[t.length-1]===n||t.push(e,n));const d=a*a+l*l,f=c*c+h*h,p=a*c+l*h,m=o*Math.sqrt(d)/u,y=o*Math.sqrt(f)/u,g=m*p/d,v=y*p/f,b=m*h+y*l,x=m*c+y*a,_=l*(y+g),w=a*(y+g),S=h*(m+v),C=c*(m+v);R(t,b+e,x+n,o,Math.atan2(w-x,_-b),Math.atan2(C-x,S-b),l*c>h*a)}(this._currentPoly.points,t,e,n,r,i),this}arcToSvg(t,e,n,r,i,o,s){return z(this._currentPoly.points,this._currentPoly.lastX,this._currentPoly.lastY,o,s,t,e,n,r,i),this}bezierCurveTo(t,e,n,r,i,o,s){this._ensurePoly();const a=this._currentPoly;return T(this._currentPoly.points,a.lastX,a.lastY,t,e,n,r,i,o,s),this}quadraticCurveTo(t,e,n,r,i){this._ensurePoly();const o=this._currentPoly;return L(this._currentPoly.points,o.lastX,o.lastY,t,e,n,r,i),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0)).transform(e);const n=this.shapePrimitives,r=n.length;for(let e=0;e<t.instructions.length;e++){const n=t.instructions[e];this[n.action](...n.data)}if(t.checkForHoles&&n.length-r>1){let t=null;for(let e=r;e<n.length;e++){const r=n[e];if("polygon"===r.shape.type){const i=r.shape,o=t?.shape;o&&o.containsPolygon(i)?(t.holes||(t.holes=[]),t.holes.push(r),n.copyWithin(e,e+1),n.length--,e--):t=r}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,n,r,i){return this.drawShape(new p.M(t,e,n,r),i),this}circle(t,e,n,r){return this.drawShape(new f.j(t,e,n),r),this}poly(t,e,n){const r=new g(t);return r.closePath=e,this.drawShape(r,n),this}regularPoly(t,e,n,r,i=0,o){r=Math.max(0|r,3);const s=-1*Math.PI/2+i,a=2*Math.PI/r,l=[];for(let i=0;i<r;i++){const r=s-i*a;l.push(t+n*Math.cos(r),e+n*Math.sin(r))}return this.poly(l,!0,o),this}roundPoly(t,e,n,r,i,o=0,s){if(r=Math.max(0|r,3),i<=0)return this.regularPoly(t,e,n,r,o);const a=n*Math.sin(Math.PI/r)-.001;i=Math.min(i,a);const l=-1*Math.PI/2+o,c=2*Math.PI/r,h=(r-2)*Math.PI/r/2;for(let o=0;o<r;o++){const r=o*c+l,a=t+n*Math.cos(r),u=e+n*Math.sin(r),d=r+Math.PI+h,f=r-Math.PI-h,p=a+i*Math.cos(d),m=u+i*Math.sin(d),y=a+i*Math.cos(f),g=u+i*Math.sin(f);0===o?this.moveTo(p,m):this.lineTo(p,m),this.quadraticCurveTo(a,u,y,g,s)}return this.closePath()}roundShape(t,e,n=!1,r){return t.length<3?this:(n?function(t,e,n,r){const i=(t,e)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),o=(t,e,n)=>({x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n}),s=e.length;for(let a=0;a<s;a++){const l=e[(a+1)%s],c=l.radius??n;if(c<=0){0===a?t.moveTo(l.x,l.y):t.lineTo(l.x,l.y);continue}const h=e[a],u=e[(a+2)%s],d=i(h,l);let f;f=d<1e-4?l:o(l,h,Math.min(d/2,c)/d);const p=i(u,l);let m;m=p<1e-4?l:o(l,u,Math.min(p/2,c)/p),0===a?t.moveTo(f.x,f.y):t.lineTo(f.x,f.y),t.quadraticCurveTo(l.x,l.y,m.x,m.y,r)}}(this,t,e,r):function(t,e,n){const r=(t,e)=>{const n=e.x-t.x,r=e.y-t.y,i=Math.sqrt(n*n+r*r);return{len:i,nx:n/i,ny:r/i}},i=(e,n)=>{0===e?t.moveTo(n.x,n.y):t.lineTo(n.x,n.y)};let o=e[e.length-1];for(let s=0;s<e.length;s++){const a=e[s%e.length],l=a.radius??n;if(l<=0){i(s,a),o=a;continue}const c=e[(s+1)%e.length],h=r(a,o),u=r(a,c);if(h.len<1e-4||u.len<1e-4){i(s,a),o=a;continue}let d=Math.asin(h.nx*u.ny-h.ny*u.nx),f=1,p=!1;h.nx*u.nx-h.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,p=!0):d>0&&(f=-1,p=!0);const m=d/2;let y,g=Math.abs(Math.cos(m)*l/Math.sin(m));g>Math.min(h.len/2,u.len/2)?(g=Math.min(h.len/2,u.len/2),y=Math.abs(g*Math.sin(m)/Math.cos(m))):y=l;const v=a.x+u.nx*g+-u.ny*y*f,b=a.y+u.ny*g+u.nx*y*f,x=Math.atan2(h.ny,h.nx)+Math.PI/2*f,_=Math.atan2(u.ny,u.nx)-Math.PI/2*f;0===s&&t.moveTo(v+Math.cos(x)*y,b+Math.sin(x)*y),t.arc(v,b,y,x,_,p),o=a}}(this,t,e),this.closePath())}filletRect(t,e,n,r,i){if(0===i)return this.rect(t,e,n,r);const o=Math.min(n,r)/2,s=Math.min(o,Math.max(-o,i)),a=t+n,l=e+r,c=s<0?-s:0,h=Math.abs(s);return this.moveTo(t,e+h).arcTo(t+c,e+c,t+h,e,h).lineTo(a-h,e).arcTo(a-c,e+c,a,e+h,h).lineTo(a,l-h).arcTo(a-c,l-c,t+n-h,l,h).lineTo(t+h,l).arcTo(t+c,l-c,t,l-h,h).closePath()}chamferRect(t,e,n,r,i,o){if(i<=0)return this.rect(t,e,n,r);const s=Math.min(i,Math.min(n,r)/2),a=t+n,l=e+r,c=[t+s,e,a-s,e,a,e+s,a,l-s,a-s,l,t+s,l,t,l-s,t,e+s];for(let t=c.length-1;t>=2;t-=2)c[t]===c[t-2]&&c[t-1]===c[t-3]&&c.splice(t-1,2);return this.poly(c,!0,o)}ellipse(t,e,n,r,i){return this.drawShape(new m(t,e,n,r),i),this}roundRect(t,e,n,r,i,o){return this.drawShape(new b(t,e,n,r,i),o),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let n=this._currentPoly;return n&&this.endPoly(),n=new g,n.points.push(t,e),this._currentPoly=n,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new g,t)){const t=this.shapePrimitives[this.shapePrimitives.length-1];if(t){let e=t.shape.x,n=t.shape.y;if(t.transform&&!t.transform.isIdentity()){const r=t.transform,i=e;e=r.a*e+r.c*n+r.tx,n=r.b*i+r.d*n+r.ty}this._currentPoly.points.push(e,n)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const n=t.instructions[e];this[n.action](...n.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let n=0;n<e.length;n++){const r=e[n],i=r.shape.getBounds(U);r.transform?t.addRect(i,r.transform):t.addRect(i)}return t}}class H{constructor(t,e=!1){this.instructions=[],this.uid=(0,l.L)("graphicsPath"),this._dirty=!0,this.checkForHoles=e,"string"==typeof t?function(t,e){const n=d(t),r=[];let i=null,o=0,s=0;for(let t=0;t<n.length;t++){const a=n[t],l=a[0],c=a;switch(l){case"M":o=c[1],s=c[2],e.moveTo(o,s);break;case"m":o+=c[1],s+=c[2],e.moveTo(o,s);break;case"H":o=c[1],e.lineTo(o,s);break;case"h":o+=c[1],e.lineTo(o,s);break;case"V":s=c[1],e.lineTo(o,s);break;case"v":s+=c[1],e.lineTo(o,s);break;case"L":o=c[1],s=c[2],e.lineTo(o,s);break;case"l":o+=c[1],s+=c[2],e.lineTo(o,s);break;case"C":o=c[5],s=c[6],e.bezierCurveTo(c[1],c[2],c[3],c[4],o,s);break;case"c":e.bezierCurveTo(o+c[1],s+c[2],o+c[3],s+c[4],o+c[5],s+c[6]),o+=c[5],s+=c[6];break;case"S":o=c[3],s=c[4],e.bezierCurveToShort(c[1],c[2],o,s);break;case"s":e.bezierCurveToShort(o+c[1],s+c[2],o+c[3],s+c[4]),o+=c[3],s+=c[4];break;case"Q":o=c[3],s=c[4],e.quadraticCurveTo(c[1],c[2],o,s);break;case"q":e.quadraticCurveTo(o+c[1],s+c[2],o+c[3],s+c[4]),o+=c[3],s+=c[4];break;case"T":o=c[1],s=c[2],e.quadraticCurveToShort(o,s);break;case"t":o+=c[1],s+=c[2],e.quadraticCurveToShort(o,s);break;case"A":o=c[6],s=c[7],e.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,s);break;case"a":o+=c[6],s+=c[7],e.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,s);break;case"Z":case"z":e.closePath(),r.length>0&&(i=r.pop(),i?(o=i.startX,s=i.startY):(o=0,s=0)),i=null;break;default:(0,u.R)(`Unknown SVG path command: ${l}`)}"Z"!==l&&"z"!==l&&null===i&&(i={startX:o,startY:s},r.push(i))}}(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new W(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,n,r,i){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(s.b.shared);let l=0,c=0;if(o&&"bezierCurveTo"===o.action){l=o.data[2],c=o.data[3];const t=a.x,e=a.y;l=t+(t-l),c=e+(e-c)}else l=a.x,c=a.y;return this.instructions.push({action:"bezierCurveTo",data:[l,c,t,e,n,r,i]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,n){const r=this.instructions[this.instructions.length-1],i=this.getLastPoint(s.b.shared);let o=0,a=0;if(r&&"quadraticCurveTo"===r.action){o=r.data[0],a=r.data[1];const t=i.x,e=i.y;o=t+(t-o),a=e+(e-a)}else o=i.x,a=i.y;return this.instructions.push({action:"quadraticCurveTo",data:[o,a,t,e,n]}),this._dirty=!0,this}rect(t,e,n,r,i){return this.instructions.push({action:"rect",data:[t,e,n,r,i]}),this._dirty=!0,this}circle(t,e,n,r){return this.instructions.push({action:"circle",data:[t,e,n,r]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,n,r,i,o,s){i||(i=r/2);const a=-1*Math.PI/2+o,l=2*n,c=2*Math.PI/l,h=[];for(let n=0;n<l;n++){const o=n%2?i:r,s=n*c+a;h.push(t+o*Math.cos(s),e+o*Math.sin(s))}return this.poly(h,!0,s),this}clone(t=!1){const e=new H;if(e.checkForHoles=this.checkForHoles,t)for(let t=0;t<this.instructions.length;t++){const n=this.instructions[t];e.instructions.push({action:n.action,data:n.data.slice()})}else e.instructions=this.instructions.slice();return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;const e=t.a,n=t.b,r=t.c,i=t.d,o=t.tx,s=t.ty;let a=0,l=0,c=0,h=0,d=0,f=0,p=0,m=0;for(let y=0;y<this.instructions.length;y++){const g=this.instructions[y],v=g.data;switch(g.action){case"moveTo":case"lineTo":a=v[0],l=v[1],v[0]=e*a+r*l+o,v[1]=n*a+i*l+s;break;case"bezierCurveTo":c=v[0],h=v[1],d=v[2],f=v[3],a=v[4],l=v[5],v[0]=e*c+r*h+o,v[1]=n*c+i*h+s,v[2]=e*d+r*f+o,v[3]=n*d+i*f+s,v[4]=e*a+r*l+o,v[5]=n*a+i*l+s;break;case"quadraticCurveTo":c=v[0],h=v[1],a=v[2],l=v[3],v[0]=e*c+r*h+o,v[1]=n*c+i*h+s,v[2]=e*a+r*l+o,v[3]=n*a+i*l+s;break;case"arcToSvg":a=v[5],l=v[6],p=v[0],m=v[1],v[0]=e*p+r*m,v[1]=n*p+i*m,v[5]=e*a+r*l+o,v[6]=n*a+i*l+s;break;case"circle":v[4]=V(v[3],t);break;case"rect":v[4]=V(v[4],t);break;case"ellipse":v[8]=V(v[8],t);break;case"roundRect":v[5]=V(v[5],t);break;case"addPath":v[0].transform(t);break;case"poly":v[2]=V(v[2],t);break;default:(0,u.R)("unknown transform action",g.action)}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,n=this.instructions[e];if(!n)return t.x=0,t.y=0,t;for(;"closePath"===n.action;){if(e--,e<0)return t.x=0,t.y=0,t;n=this.instructions[e]}switch(n.action){case"moveTo":case"lineTo":t.x=n.data[0],t.y=n.data[1];break;case"quadraticCurveTo":t.x=n.data[2],t.y=n.data[3];break;case"bezierCurveTo":t.x=n.data[4],t.y=n.data[5];break;case"arc":case"arcToSvg":t.x=n.data[5],t.y=n.data[6];break;case"addPath":n.data[0].getLastPoint(t)}return t}}function V(t,e){return t?t.prepend(e):e.clone()}var Y=n(7276);function X(t,e,n){const r=t.getAttribute(e);return r?Number(r):n}function $(t){const e=X(t,"x1",0),n=X(t,"y1",0),r=X(t,"x2",1),o=X(t,"y2",0),s=t.getAttribute("gradientUnits")||"objectBoundingBox",a=new Y._(e,n,r,o,"objectBoundingBox"===s?"local":"global");for(let e=0;e<t.children.length;e++){const n=t.children[e],r=X(n,"offset",0),o=i.Q.shared.setValue(n.getAttribute("stop-color")).toNumber();a.addColorStop(r,o)}return a}function q(t){return(0,u.R)("[SVG Parser] Radial gradients are not yet supported"),new Y._(0,0,1,0)}function K(t){const e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}const Z={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}};function J(t,e){const n=t.getAttribute("style"),r={},i={},o={strokeStyle:r,fillStyle:i,useFill:!1,useStroke:!1};for(const n in Z){const r=t.getAttribute(n);r&&Q(e,o,n,r.trim())}if(n){const t=n.split(";");for(let n=0;n<t.length;n++){const r=t[n].trim(),[i,s]=r.split(":");Z[i]&&Q(e,o,i,s.trim())}}return{strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?i:null,useFill:o.useFill,useStroke:o.useStroke}}function Q(t,e,n,r){switch(n){case"stroke":if("none"!==r){if(r.startsWith("url(")){const n=K(r);e.strokeStyle.fill=t.defs[n]}else e.strokeStyle.color=i.Q.shared.setValue(r).toNumber();e.useStroke=!0}break;case"stroke-width":e.strokeStyle.width=Number(r);break;case"fill":if("none"!==r){if(r.startsWith("url(")){const n=K(r);e.fillStyle.fill=t.defs[n]}else e.fillStyle.color=i.Q.shared.setValue(r).toNumber();e.useFill=!0}break;case"fill-opacity":e.fillStyle.alpha=Number(r);break;case"stroke-opacity":e.strokeStyle.alpha=Number(r);break;case"opacity":e.fillStyle.alpha=Number(r),e.strokeStyle.alpha=Number(r)}}function tt(t){const e=t.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!e||e.length<4)return 0;const n=e.map(Number),r=[],i=[];for(let t=0;t<n.length;t+=2)t+1<n.length&&(r.push(n[t]),i.push(n[t+1]));if(0===r.length||0===i.length)return 0;const o=Math.min(...r),s=Math.max(...r),a=Math.min(...i);return(s-o)*(Math.max(...i)-a)}function et(t,e){const n=new H(t,!1);for(const t of n.instructions)e.instructions.push(t)}function nt(t,e){if("string"==typeof t){const e=document.createElement("div");e.innerHTML=t.trim(),t=e.querySelector("svg")}const n={context:e,defs:{},path:new H};!function(t,e){const n=t.querySelectorAll("defs");for(let t=0;t<n.length;t++){const r=n[t];for(let t=0;t<r.children.length;t++){const n=r.children[t];switch(n.nodeName.toLowerCase()){case"lineargradient":e.defs[n.id]=$(n);break;case"radialgradient":e.defs[n.id]=q()}}}}(t,n);const r=t.children,{fillStyle:i,strokeStyle:o}=J(t,n);for(let t=0;t<r.length;t++){const e=r[t];"defs"!==e.nodeName.toLowerCase()&&rt(e,n,i,o)}return e}function rt(t,e,n,r){const i=t.children,{fillStyle:o,strokeStyle:s}=J(t,e);o&&n?n={...n,...o}:o&&(n=o),s&&r?r={...r,...s}:s&&(r=s);const a=!n&&!r;let l,c,h,d,f,p,m,y,g,v,b,x,_,w,S,C,E;switch(a&&(n={color:0}),t.nodeName.toLowerCase()){case"path":{w=t.getAttribute("d");const i=t.getAttribute("fill-rule"),o=w.split(/(?=[Mm])/).filter((t=>t.trim().length>0)),s="evenodd"===i,a=o.length>1;if(s&&a){const t=o.map((t=>({path:t,area:tt(t)})));t.sort(((t,e)=>e.area-t.area));const i=o.length>3||!function(t){if(t.length<=2)return!0;const e=t.map((t=>t.area)).sort(((t,e)=>e-t)),[n,r]=e,i=e[e.length-1];return!(n/r>3&&r/i<2)}(t);if(i)for(let i=0;i<t.length;i++){const o=t[i],s=0===i;e.context.beginPath();const a=new H(void 0,!0);et(o.path,a),e.context.path(a),s?(n&&e.context.fill(n),r&&e.context.stroke(r)):e.context.cut()}else for(let i=0;i<t.length;i++){const o=t[i],s=i%2==1;e.context.beginPath();const a=new H(void 0,!0);et(o.path,a),e.context.path(a),s?e.context.cut():(n&&e.context.fill(n),r&&e.context.stroke(r))}}else{S=new H(w,!i||"evenodd"===i),e.context.path(S),n&&e.context.fill(n),r&&e.context.stroke(r)}break}case"circle":m=X(t,"cx",0),y=X(t,"cy",0),g=X(t,"r",0),e.context.ellipse(m,y,g,g),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"rect":l=X(t,"x",0),c=X(t,"y",0),C=X(t,"width",0),E=X(t,"height",0),v=X(t,"rx",0),b=X(t,"ry",0),v||b?e.context.roundRect(l,c,C,E,v||b):e.context.rect(l,c,C,E),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"ellipse":m=X(t,"cx",0),y=X(t,"cy",0),v=X(t,"rx",0),b=X(t,"ry",0),e.context.beginPath(),e.context.ellipse(m,y,v,b),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"line":h=X(t,"x1",0),d=X(t,"y1",0),f=X(t,"x2",0),p=X(t,"y2",0),e.context.beginPath(),e.context.moveTo(h,d),e.context.lineTo(f,p),r&&e.context.stroke(r);break;case"polygon":_=t.getAttribute("points"),x=_.match(/-?\d+/g).map((t=>parseInt(t,10))),e.context.poly(x,!0),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"polyline":_=t.getAttribute("points"),x=_.match(/-?\d+/g).map((t=>parseInt(t,10))),e.context.poly(x,!1),r&&e.context.stroke(r);break;case"g":case"svg":break;default:(0,u.R)(`[SVG parser] <${t.nodeName}> elements unsupported`)}a&&(n=null);for(let t=0;t<i.length;t++)rt(i[t],e,n,r)}var it=n(990);function ot(t,e){let n=1;const r=t.shapePath.shapePrimitives;for(let t=0;t<r.length;t++){const i=r[t].shape;if("polygon"!==i.type)continue;const o=i.points,s=o.length;if(s<6)continue;const a=i.closePath;for(let t=0;t<s;t+=2){if(!a&&(0===t||t===s-2))continue;const r=(t-2+s)%s,i=(t+2)%s,l=o[r],c=o[r+1],h=o[t],u=o[t+1],d=l-h,f=c-u,p=o[i]-h,m=o[i+1]-u,y=d*d+f*f,g=p*p+m*m;if(y<1e-12||g<1e-12)continue;let v=(d*p+f*m)/Math.sqrt(y*g);v<-1?v=-1:v>1&&(v=1);const b=Math.sqrt(.5*(1-v));if(b<1e-6)continue;const x=Math.min(1/b,e);x>n&&(n=x)}}return n}const st=new s.b,at=new o.u,lt=class t extends r.A{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=(0,l.L)("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new H,this._transform=new o.u,this._fillStyle={...t.defaultFillStyle},this._strokeStyle={...t.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new h.c,this._boundsDirty=!0}clone(){const e=new t;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=(0,it.w)(e,t.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=(0,it.T)(e,t.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=(0,it.w)(e,t.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=(0,it.w)(e,t.defaultStrokeStyle),this}texture(t,e,n,r,o,s){return this.instructions.push({action:"texture",data:{image:t,dx:n||0,dy:r||0,dw:o||t.frame.width,dh:s||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e||0===e?i.Q.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new H,this}fill(e,n){let r;const i=this.instructions[this.instructions.length-1];return r=0===this._tick&&"stroke"===i?.action?i.data.path:this._activePath.clone(),r?(null!=e&&(void 0!==n&&"number"==typeof e&&((0,c.t6)(c.lj,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:n}),this._fillStyle=(0,it.w)(e,t.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(s.b.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(e){let n;const r=this.instructions[this.instructions.length-1];return n=0===this._tick&&"fill"===r?.action?r.data.path:this._activePath.clone(),n?(null!=e&&(this._strokeStyle=(0,it.T)(e,t.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:n}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){const e=this.instructions[this.instructions.length-1-t],n=this._activePath.clone();if(e&&("stroke"===e.action||"fill"===e.action)){if(!e.data.hole){e.data.hole=n;break}e.data.hole.addPath(n)}}return this._initNextPathLocation(),this}arc(t,e,n,r,i,o){this._tick++;const s=this._transform;return this._activePath.arc(s.a*t+s.c*e+s.tx,s.b*t+s.d*e+s.ty,n,r,i,o),this}arcTo(t,e,n,r,i){this._tick++;const o=this._transform;return this._activePath.arcTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*n+o.c*r+o.tx,o.b*n+o.d*r+o.ty,i),this}arcToSvg(t,e,n,r,i,o,s){this._tick++;const a=this._transform;return this._activePath.arcToSvg(t,e,n,r,i,a.a*o+a.c*s+a.tx,a.b*o+a.d*s+a.ty),this}bezierCurveTo(t,e,n,r,i,o,s){this._tick++;const a=this._transform;return this._activePath.bezierCurveTo(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,a.a*n+a.c*r+a.tx,a.b*n+a.d*r+a.ty,a.a*i+a.c*o+a.tx,a.b*i+a.d*o+a.ty,s),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,n,r){return this._tick++,this._activePath.ellipse(t,e,n,r,this._transform.clone()),this}circle(t,e,n){return this._tick++,this._activePath.circle(t,e,n,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const n=this._transform;return this._activePath.lineTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty),this}moveTo(t,e){this._tick++;const n=this._transform,r=this._activePath.instructions,i=n.a*t+n.c*e+n.tx,o=n.b*t+n.d*e+n.ty;return 1===r.length&&"moveTo"===r[0].action?(r[0].data[0]=i,r[0].data[1]=o,this):(this._activePath.moveTo(i,o),this)}quadraticCurveTo(t,e,n,r,i){this._tick++;const o=this._transform;return this._activePath.quadraticCurveTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*n+o.c*r+o.tx,o.b*n+o.d*r+o.ty,i),this}rect(t,e,n,r){return this._tick++,this._activePath.rect(t,e,n,r,this._transform.clone()),this}roundRect(t,e,n,r,i){return this._tick++,this._activePath.roundRect(t,e,n,r,i,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,n,r,i=0,o){return this._tick++,this._activePath.regularPoly(t,e,n,r,i,o),this}roundPoly(t,e,n,r,i,o){return this._tick++,this._activePath.roundPoly(t,e,n,r,i,o),this}roundShape(t,e,n,r){return this._tick++,this._activePath.roundShape(t,e,n,r),this}filletRect(t,e,n,r,i){return this._tick++,this._activePath.filletRect(t,e,n,r,i),this}chamferRect(t,e,n,r,i,o){return this._tick++,this._activePath.chamferRect(t,e,n,r,i,o),this}star(t,e,n,r,i=0,o=0){return this._tick++,this._activePath.star(t,e,n,r,i,o,this._transform.clone()),this}svg(t){return this._tick++,nt(t,this),this}restore(){const t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,n,r,i,s){return t instanceof o.u?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,n,r,i,s),this)}transform(t,e,n,r,i,s){return t instanceof o.u?(this._transform.append(t),this):(at.set(t,e,n,r,i,s),this._transform.append(at),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this._boundsDirty=!0,this.dirty=!0,this.emit("update",this,16)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;const t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const n=this.instructions[e],r=n.action;if("fill"===r){const e=n.data;t.addBounds(e.path.bounds)}else if("texture"===r){const e=n.data;t.addFrame(e.dx,e.dy,e.dx+e.dw,e.dy+e.dh,e.transform)}if("stroke"===r){const e=n.data,r=e.style.alignment;let i=e.style.width*(1-r);"miter"===e.style.join&&(i*=ot(e.path,e.style.miterLimit));const o=e.path.bounds;t.addFrame(o.minX-i,o.minY-i,o.maxX+i,o.maxY+i)}}return t.isValid||t.set(0,0,0,0),t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;const e=this.instructions;let n=!1;for(let r=0;r<e.length;r++){const i=e[r],o=i.data,s=o.path;if(!i.action||!s)continue;const a=o.style,l=s.shapePath.shapePrimitives;for(let e=0;e<l.length;e++){const r=l[e].shape;if(!a||!r)continue;const s=l[e].transform,c=s?s.applyInverse(t,st):t;if("fill"===i.action)n=r.contains(c.x,c.y);else{const t=a;n=r.strokeContains(c.x,c.y,t.width,t.alignment)}const h=o.hole;if(h){const t=h.shapePath?.shapePrimitives;if(t)for(let e=0;e<t.length;e++)t[e].shape.contains(c.x,c.y)&&(n=!1)}if(n)return!0}}return n}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0,this._stateStack.length=0,this._transform=null,this.unload(),this.emit("destroy",this),this.removeAllListeners();if("boolean"==typeof t?t:t?.texture){const e="boolean"==typeof t?t:t?.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(e)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(e))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};lt.defaultFillStyle={color:16777215,alpha:1,texture:a.g.WHITE,matrix:null,fill:null,textureSpace:"local"},lt.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:a.g.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let ct=lt},378:(t,e,n)=>{n.d(e,{GH:()=>p});var r=n(8507),i=n(341),o=n(2043),s=n(848),a=n(4334),l=n(4670),c=n(8655),h=n(2801);class u{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach((t=>{c.Z.return(t)})),this.graphicsData&&c.Z.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}}class d{constructor(){this.instructions=new s.L}init(t){const e=t.maxTextures;this.batcher?this.batcher._updateMaxTextures(e):this.batcher=new o.J({maxTextures:e}),this.instructions.reset()}get geometry(){return(0,l.t6)(l.Ek,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}}const f=class t{constructor(t){this._renderer=t,this._managedContexts=new a.s({renderer:t,type:"resource",name:"graphicsContext"})}init(e){t.defaultOptions.bezierSmoothness=e?.bezierSmoothness??t.defaultOptions.bezierSmoothness}getContextRenderData(t){return t._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=!!t._gpuData[this._renderer.uid],n=t._gpuData[this._renderer.uid]||this._initContext(t);if(t.dirty||!e){e&&n.reset(),(0,h.M)(t,n);const r=t.batchMode;t.customShader||"no-batch"===r?n.isBatchable=!1:n.isBatchable="auto"!==r||n.geometryData.vertices.length<400,t.dirty=!1}return n}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=c.Z.get(d,{maxTextures:this._renderer.limits.maxBatchableTextures}),n=t._gpuData[this._renderer.uid],{batches:r,geometryData:o}=n;n.graphicsData=e;const s=o.vertices.length,a=o.indices.length;for(let t=0;t<r.length;t++)r[t].applyTransform=!1;const l=e.batcher;l.ensureAttributeBuffer(s),l.ensureIndexBuffer(a),l.begin();for(let t=0;t<r.length;t++){const e=r[t];l.add(e)}l.finish(e.instructions);const h=l.geometry;h.indexBuffer.setDataWithSize(l.indexBuffer,l.indexSize,!0),h.buffers[0].setDataWithSize(l.attributeBuffer.float32View,l.attributeSize,!0);const u=l.batches;for(let t=0;t<u.length;t++){const e=u[t];e.bindGroup=(0,i.w)(e.textures.textures,e.textures.count,this._renderer.limits.maxBatchableTextures)}return e}_initContext(t){const e=new u;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};f.extension={type:[r.Ag.WebGLSystem,r.Ag.WebGPUSystem],name:"graphicsContext"},f.defaultOptions={bezierSmoothness:.5};let p=f},115:(t,e,n)=>{n.d(e,{h:()=>a});var r=n(5101),i=n(4928);function o(t,e,n,r,i,o,s,a){let l,c;s?(l=r,c=-n):(l=-r,c=n);const h=t-n*i+l,u=e-r*i+c,d=t+n*o+l,f=e+r*o+c;return a.push(h,u),a.push(d,f),2}function s(t,e,n,r,i,o,s,a){const l=n-t,c=r-e;let h=Math.atan2(l,c),u=Math.atan2(i-t,o-e);a&&h<u?h+=2*Math.PI:!a&&h>u&&(u+=2*Math.PI);let d=h;const f=u-h,p=Math.abs(f),m=Math.sqrt(l*l+c*c),y=1+(15*p*Math.sqrt(m)/Math.PI|0),g=f/y;if(d+=g,a){s.push(t,e),s.push(n,r);for(let n=1,r=d;n<y;n++,r+=g)s.push(t,e),s.push(t+Math.sin(r)*m,e+Math.cos(r)*m);s.push(t,e),s.push(i,o)}else{s.push(n,r),s.push(t,e);for(let n=1,r=d;n<y;n++,r+=g)s.push(t+Math.sin(r)*m,e+Math.cos(r)*m),s.push(t,e);s.push(i,o),s.push(t,e)}return 2*y}function a(t,e,n,a,l,c){const h=i.B;if(0===t.length)return;const u=e;let d=u.alignment;if(.5!==e.alignment){let e=function(t){const e=t.length;if(e<6)return 1;let n=0;for(let r=0,i=t[e-2],o=t[e-1];r<e;r+=2){const e=t[r],s=t[r+1];n+=(e-i)*(s+o),i=e,o=s}return n<0?-1:1}(t);n&&(e*=-1),d=(d-.5)*e+.5}const f=new r.b(t[0],t[1]),p=new r.b(t[t.length-2],t[t.length-1]),m=a,y=Math.abs(f.x-p.x)<h&&Math.abs(f.y-p.y)<h;if(m){t=t.slice(),y&&(t.pop(),t.pop(),p.set(t[t.length-2],t[t.length-1]));const e=.5*(f.x+p.x),n=.5*(p.y+f.y);t.unshift(e,n),t.push(e,n)}const g=l,v=t.length/2;let b=t.length;const x=g.length/2,_=u.width/2,w=_*_,S=u.miterLimit*u.miterLimit;let C=t[0],E=t[1],k=t[2],T=t[3],A=0,M=0,P=-(E-T),O=C-k,I=0,L=0,j=Math.sqrt(P*P+O*O);P/=j,O/=j,P*=_,O*=_;const R=2*(1-d),D=2*d;m||("round"===u.cap?b+=s(C-P*(R-D)*.5,E-O*(R-D)*.5,C-P*R,E-O*R,C+P*D,E+O*D,g,!0)+2:"square"===u.cap&&(b+=o(C,E,P,O,R,D,!0,g))),g.push(C-P*R,E-O*R),g.push(C+P*D,E+O*D);for(let e=1;e<v-1;++e){C=t[2*(e-1)],E=t[2*(e-1)+1],k=t[2*e],T=t[2*e+1],A=t[2*(e+1)],M=t[2*(e+1)+1],P=-(E-T),O=C-k,j=Math.sqrt(P*P+O*O),P/=j,O/=j,P*=_,O*=_,I=-(T-M),L=k-A,j=Math.sqrt(I*I+L*L),I/=j,L/=j,I*=_,L*=_;const n=k-C,r=E-T,i=k-A,o=M-T,a=n*i+r*o,l=r*i-o*n,c=l<0;if(Math.abs(l)<.001*Math.abs(a)){g.push(k-P*R,T-O*R),g.push(k+P*D,T+O*D),a>=0&&("round"===u.join?b+=s(k,T,k-P*R,T-O*R,k-I*R,T-L*R,g,!1)+4:b+=2,g.push(k-I*D,T-L*D),g.push(k+I*R,T+L*R));continue}const h=(-P+C)*(-O+T)-(-P+k)*(-O+E),d=(-I+A)*(-L+T)-(-I+k)*(-L+M),f=(n*d-i*h)/l,p=(o*h-r*d)/l,m=(f-k)*(f-k)+(p-T)*(p-T),y=k+(f-k)*R,v=T+(p-T)*R,x=k-(f-k)*D,N=T-(p-T)*D,F=c?R:D;m<=Math.min(n*n+r*r,i*i+o*o)+F*F*w?"bevel"===u.join||m/w>S?(c?(g.push(y,v),g.push(k+P*D,T+O*D),g.push(y,v),g.push(k+I*D,T+L*D)):(g.push(k-P*R,T-O*R),g.push(x,N),g.push(k-I*R,T-L*R),g.push(x,N)),b+=2):"round"===u.join?c?(g.push(y,v),g.push(k+P*D,T+O*D),b+=s(k,T,k+P*D,T+O*D,k+I*D,T+L*D,g,!0)+4,g.push(y,v),g.push(k+I*D,T+L*D)):(g.push(k-P*R,T-O*R),g.push(x,N),b+=s(k,T,k-P*R,T-O*R,k-I*R,T-L*R,g,!1)+4,g.push(k-I*R,T-L*R),g.push(x,N)):(g.push(y,v),g.push(x,N)):(g.push(k-P*R,T-O*R),g.push(k+P*D,T+O*D),"round"===u.join?b+=c?s(k,T,k+P*D,T+O*D,k+I*D,T+L*D,g,!0)+2:s(k,T,k-P*R,T-O*R,k-I*R,T-L*R,g,!1)+2:"miter"===u.join&&m/w<=S&&(c?(g.push(x,N),g.push(x,N)):(g.push(y,v),g.push(y,v)),b+=2),g.push(k-I*R,T-L*R),g.push(k+I*D,T+L*D),b+=2)}C=t[2*(v-2)],E=t[2*(v-2)+1],k=t[2*(v-1)],T=t[2*(v-1)+1],P=-(E-T),O=C-k,j=Math.sqrt(P*P+O*O),P/=j,O/=j,P*=_,O*=_,g.push(k-P*R,T-O*R),g.push(k+P*D,T+O*D),m||("round"===u.cap?b+=s(k-P*(R-D)*.5,T-O*(R-D)*.5,k-P*R,T-O*R,k+P*D,T+O*D,g,!1)+2:"square"===u.cap&&(b+=o(k,T,P,O,R,D,!1,g)));const N=i.I*i.I;for(let t=x;t<b+x-2;++t)C=g[2*t],E=g[2*t+1],k=g[2*(t+1)],T=g[2*(t+1)+1],A=g[2*(t+2)],M=g[2*(t+2)+1],Math.abs(C*(T-M)+k*(M-E)+A*(E-T))<N||c.push(t,t+1,t+2)}},4928:(t,e,n)=>{n.d(e,{B:()=>r,I:()=>i});const r=1e-4,i=1e-4},7276:(t,e,n)=>{n.d(e,{_:()=>f});var r=n(2577),i=n(1761),o=n(9313),s=n(8293),a=n(5589),l=n(133),c=n(4670),h=n(2698);const u=[{offset:0,color:"white"},{offset:1,color:"black"}],d=class t{constructor(...e){this.uid=(0,l.L)("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let n=function(t){let e=t[0]??{};("number"==typeof e||t[1])&&((0,c.t6)("8.5.2","use options object instead"),e={type:"linear",start:{x:t[0],y:t[1]},end:{x:t[2],y:t[3]},textureSpace:t[4],textureSize:t[5]??f.defaultLinearOptions.textureSize});return e}(e);n={..."radial"===n.type?t.defaultRadialOptions:t.defaultLinearOptions,...(0,h.S)(n)},this._textureSize=n.textureSize,this._wrapMode=n.wrapMode,"radial"===n.type?(this.center=n.center,this.outerCenter=n.outerCenter??this.center,this.innerRadius=n.innerRadius,this.outerRadius=n.outerRadius,this.scale=n.scale,this.rotation=n.rotation):(this.start=n.start,this.end=n.end),this.textureSpace=n.textureSpace,this.type=n.type,n.colorStops.forEach((t=>{this.addColorStop(t.offset,t.color)}))}addColorStop(t,e){return this.colorStops.push({offset:t,color:r.Q.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:n,y:r}=this.end,i=n-t,l=r-e;const c=i<0||l<0;if("clamp-to-edge"===this._wrapMode){if(i<0){const e=t;t=n,n=e,i*=-1}if(l<0){const t=e;e=r,r=t,l*=-1}}const h=this.colorStops.length?this.colorStops:u,d=this._textureSize,{canvas:f,context:y}=m(d,1),g=c?y.createLinearGradient(this._textureSize,0,0,0):y.createLinearGradient(0,0,this._textureSize,0);p(g,h),y.fillStyle=g,y.fillRect(0,0,d,1),this.texture=new a.g({source:new s.b({resource:f,addressMode:this._wrapMode})});const v=Math.sqrt(i*i+l*l),b=Math.atan2(l,i),x=new o.u;x.scale(v/d,1),x.rotate(b),x.translate(t,e),"local"===this.textureSpace&&x.scale(d,d),this.transform=x}buildGradient(){this.texture||this._tick++,"linear"===this.type?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const t=this.colorStops.length?this.colorStops:u,e=this._textureSize,{canvas:n,context:r}=m(e,e),{x:i,y:l}=this.center,{x:c,y:h}=this.outerCenter,d=this.innerRadius,f=this.outerRadius,y=c-f,g=h-f,v=e/(2*f),b=(i-y)*v,x=(l-g)*v,_=r.createRadialGradient(b,x,d*v,(c-y)*v,(h-g)*v,f*v);p(_,t),r.fillStyle=t[t.length-1].color,r.fillRect(0,0,e,e),r.fillStyle=_,r.translate(b,x),r.rotate(this.rotation),r.scale(1,this.scale),r.translate(-b,-x),r.fillRect(0,0,e,e),this.texture=new a.g({source:new s.b({resource:n,addressMode:this._wrapMode})});const w=new o.u;w.scale(1/v,1/v),w.translate(y,g),"local"===this.textureSpace&&w.scale(e,e),this.transform=w}destroy(){this.texture?.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};d.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"},d.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let f=d;function p(t,e){for(let n=0;n<e.length;n++){const r=e[n];t.addColorStop(r.offset,r.color)}}function m(t,e){const n=i.e.get().createCanvas(t,e),r=n.getContext("2d");return{canvas:n,context:r}}},2806:(t,e,n)=>{n.d(e,{m:()=>s});var r=n(9313),i=n(133);const o={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};class s{constructor(t,e){this.uid=(0,i.L)("fillPattern"),this._tick=0,this.transform=new r.u,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=o[e].addressModeU,t.source.style.addressModeV=o[e].addressModeV)}setTransform(t){const e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._tick++}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture=t,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}},2801:(t,e,n)=>{n.d(e,{M:()=>J,y:()=>q});var r=n(8507),i=n(9313),o=n(9252);function s(t,e,n,r,i){const o=e.a,s=e.b,a=e.c,l=e.d,c=e.tx,h=e.ty;n||(n=0),r||(r=2),i||(i=t.length/r-n);let u=n*r;for(let e=0;e<i;e++){const e=t[u],n=t[u+1];t[u]=o*e+a*n+c,t[u+1]=s*e+l*n+h,u+=r}}var a=n(5589),l=n(8655),c=n(6954);const h={extension:{type:r.Ag.ShapeBuilder,name:"circle"},build(t,e){let n,r,i,o,s,a;if("circle"===t.type){const e=t;if(s=a=e.radius,s<=0)return!1;n=e.x,r=e.y,i=o=0}else if("ellipse"===t.type){const e=t;if(s=e.halfWidth,a=e.halfHeight,s<=0||a<=0)return!1;n=e.x,r=e.y,i=o=0}else{const e=t,l=e.width/2,c=e.height/2;n=e.x+l,r=e.y+c,s=a=Math.max(0,Math.min(e.radius,Math.min(l,c))),i=l-s,o=c-a}if(i<0||o<0)return!1;const l=Math.ceil(2.3*Math.sqrt(s+a)),c=8*l+(i?4:0)+(o?4:0);if(0===c)return!1;if(0===l)return e[0]=e[6]=n+i,e[1]=e[3]=r+o,e[2]=e[4]=n-i,e[5]=e[7]=r-o,!0;let h=0,u=4*l+(i?2:0)+2,d=u,f=c,p=i+s,m=o,y=n+p,g=n-p,v=r+m;if(e[h++]=y,e[h++]=v,e[--u]=v,e[--u]=g,o){const t=r-m;e[d++]=g,e[d++]=t,e[--f]=t,e[--f]=y}for(let t=1;t<l;t++){const c=Math.PI/2*(t/l),p=i+Math.cos(c)*s,m=o+Math.sin(c)*a,y=n+p,g=n-p,v=r+m,b=r-m;e[h++]=y,e[h++]=v,e[--u]=v,e[--u]=g,e[d++]=g,e[d++]=b,e[--f]=b,e[--f]=y}p=i,m=o+a,y=n+p,g=n-p,v=r+m;const b=r-m;return e[h++]=y,e[h++]=v,e[--f]=b,e[--f]=y,i&&(e[h++]=g,e[h++]=v,e[--f]=b,e[--f]=g),!0},triangulate(t,e,n,r,i,o){if(0===t.length)return;let s=0,a=0;for(let e=0;e<t.length;e+=2)s+=t[e],a+=t[e+1];s/=t.length/2,a/=t.length/2;let l=r;e[l*n]=s,e[l*n+1]=a;const c=l++;for(let r=0;r<t.length;r+=2)e[l*n]=t[r],e[l*n+1]=t[r+1],r>0&&(i[o++]=l,i[o++]=c,i[o++]=l-1),l++;i[o++]=c+1,i[o++]=c,i[o++]=l-1}},u={...h,extension:{...h.extension,name:"ellipse"}},d={...h,extension:{...h.extension,name:"roundedRectangle"}};var f=n(115),p=n(4928);function m(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let o=y(t,0,i,n,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,c;if(r&&(o=function(t,e,n,r){const i=[];for(let n=0,o=e.length;n<o;n++){const s=y(t,e[n]*r,n<o-1?e[n+1]*r:t.length,r,!1);s===s.next&&(s.steiner=!0),i.push(T(s))}i.sort(S);for(let t=0;t<i.length;t++)n=C(i[t],n);return n}(t,e,o,n)),t.length>80*n){a=t[0],l=t[1];let e=a,r=l;for(let o=n;o<i;o+=n){const n=t[o],i=t[o+1];n<a&&(a=n),i<l&&(l=i),n>e&&(e=n),i>r&&(r=i)}c=Math.max(e-a,r-l),c=0!==c?32767/c:0}return v(o,s,n,a,l,c,0),s}function y(t,e,n,r,i){let o;if(i===z(t,e,n,r)>0)for(let i=e;i<n;i+=r)o=F(i/r|0,t[i],t[i+1],o);else for(let i=n-r;i>=e;i-=r)o=F(i/r|0,t[i],t[i+1],o);return o&&I(o,o.next)&&(B(o),o=o.next),o}function g(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!I(r,r.next)&&0!==O(r.prev,r,r.next))r=r.next;else{if(B(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function v(t,e,n,r,i,o,s){if(!t)return;!s&&o&&function(t,e,n,r){let i=t;do{0===i.z&&(i.z=k(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n=1;do{let r,i=t;t=null;let o=null;for(e=0;i;){e++;let s=i,a=0;for(let t=0;t<n&&(a++,s=s.nextZ,s);t++);let l=n;for(;a>0||l>0&&s;)0!==a&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;i=s}o.nextZ=null,n*=2}while(e>1)}(i)}(t,r,i,o);let a=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(o?x(t,r,i,o):b(t))e.push(l.i,t.i,c.i),B(t),t=c.next,a=c.next;else if((t=c)===a){s?1===s?v(t=_(g(t),e),e,n,r,i,o,2):2===s&&w(t,e,n,r,i,o):v(g(t),e,n,r,i,o,1);break}}}function b(t){const e=t.prev,n=t,r=t.next;if(O(e,n,r)>=0)return!1;const i=e.x,o=n.x,s=r.x,a=e.y,l=n.y,c=r.y,h=Math.min(i,o,s),u=Math.min(a,l,c),d=Math.max(i,o,s),f=Math.max(a,l,c);let p=r.next;for(;p!==e;){if(p.x>=h&&p.x<=d&&p.y>=u&&p.y<=f&&M(i,a,o,l,s,c,p.x,p.y)&&O(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function x(t,e,n,r){const i=t.prev,o=t,s=t.next;if(O(i,o,s)>=0)return!1;const a=i.x,l=o.x,c=s.x,h=i.y,u=o.y,d=s.y,f=Math.min(a,l,c),p=Math.min(h,u,d),m=Math.max(a,l,c),y=Math.max(h,u,d),g=k(f,p,e,n,r),v=k(m,y,e,n,r);let b=t.prevZ,x=t.nextZ;for(;b&&b.z>=g&&x&&x.z<=v;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=y&&b!==i&&b!==s&&M(a,h,l,u,c,d,b.x,b.y)&&O(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,x.x>=f&&x.x<=m&&x.y>=p&&x.y<=y&&x!==i&&x!==s&&M(a,h,l,u,c,d,x.x,x.y)&&O(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;b&&b.z>=g;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=y&&b!==i&&b!==s&&M(a,h,l,u,c,d,b.x,b.y)&&O(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;x&&x.z<=v;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=y&&x!==i&&x!==s&&M(a,h,l,u,c,d,x.x,x.y)&&O(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function _(t,e){let n=t;do{const r=n.prev,i=n.next.next;!I(r,i)&&L(r,n,n.next,i)&&D(r,i)&&D(i,r)&&(e.push(r.i,n.i,i.i),B(n),B(n.next),n=t=i),n=n.next}while(n!==t);return g(n)}function w(t,e,n,r,i,o){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&P(s,t)){let a=N(s,t);return s=g(s,s.next),a=g(a,a.next),v(s,e,n,r,i,o,0),void v(a,e,n,r,i,o,0)}t=t.next}s=s.next}while(s!==t)}function S(t,e){let n=t.x-e.x;if(0===n&&(n=t.y-e.y,0===n)){n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return n}function C(t,e){const n=function(t,e){let n=e;const r=t.x,i=t.y;let o,s=-1/0;if(I(t,n))return n;do{if(I(t,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>s&&(s=t,o=n.x<n.next.x?n:n.next,t===r))return o}n=n.next}while(n!==e);if(!o)return null;const a=o,l=o.x,c=o.y;let h=1/0;n=o;do{if(r>=n.x&&n.x>=l&&r!==n.x&&A(i<c?r:s,i,l,c,i<c?s:r,i,n.x,n.y)){const e=Math.abs(i-n.y)/(r-n.x);D(n,t)&&(e<h||e===h&&(n.x>o.x||n.x===o.x&&E(o,n)))&&(o=n,h=e)}n=n.next}while(n!==a);return o}(t,e);if(!n)return e;const r=N(n,t);return g(r,r.next),g(n,n.next)}function E(t,e){return O(t.prev,t,e.prev)<0&&O(e.next,t,t.next)<0}function k(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function T(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function A(t,e,n,r,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function M(t,e,n,r,i,o,s,a){return!(t===s&&e===a)&&A(t,e,n,r,i,o,s,a)}function P(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&L(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(D(t,e)&&D(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(O(t.prev,t,e.prev)||O(t,e.prev,e))||I(t,e)&&O(t.prev,t,t.next)>0&&O(e.prev,e,e.next)>0)}function O(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function I(t,e){return t.x===e.x&&t.y===e.y}function L(t,e,n,r){const i=R(O(t,e,n)),o=R(O(t,e,r)),s=R(O(n,r,t)),a=R(O(n,r,e));return i!==o&&s!==a||(!(0!==i||!j(t,n,e))||(!(0!==o||!j(t,r,e))||(!(0!==s||!j(n,t,r))||!(0!==a||!j(n,e,r)))))}function j(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function R(t){return t>0?1:t<0?-1:0}function D(t,e){return O(t.prev,t,t.next)<0?O(t,e,t.next)>=0&&O(t,t.prev,e)>=0:O(t,e,t.prev)<0||O(t,t.next,e)<0}function N(t,e){const n=G(t.i,t.x,t.y),r=G(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function F(t,e,n,r){const i=G(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function B(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function G(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function z(t,e,n,r){let i=0;for(let o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}n(8875);const U=m.default||m;function W(t,e,n,r,i,o,s){const a=U(t,e,2);if(!a)return;for(let t=0;t<a.length;t+=3)o[s++]=a[t]+i,o[s++]=a[t+1]+i,o[s++]=a[t+2]+i;let l=i*r;for(let e=0;e<t.length;e+=2)n[l]=t[e],n[l+1]=t[e+1],l+=r}const H=[],V={extension:{type:r.Ag.ShapeBuilder,name:"polygon"},build(t,e){for(let n=0;n<t.points.length;n++)e[n]=t.points[n];return!0},triangulate(t,e,n,r,i,o){W(t,H,e,n,r,i,o)}},Y={extension:{type:r.Ag.ShapeBuilder,name:"rectangle"},build(t,e){const n=t,r=n.x,i=n.y,o=n.width,s=n.height;return o>0&&s>0&&(e[0]=r,e[1]=i,e[2]=r+o,e[3]=i,e[4]=r+o,e[5]=i+s,e[6]=r,e[7]=i+s,!0)},triangulate(t,e,n,r,i,o){let s=0;e[(r*=n)+s]=t[0],e[r+s+1]=t[1],s+=n,e[r+s]=t[2],e[r+s+1]=t[3],s+=n,e[r+s]=t[6],e[r+s+1]=t[7],s+=n,e[r+s]=t[4],e[r+s+1]=t[5],s+=n;const a=r/n;i[o++]=a,i[o++]=a+1,i[o++]=a+2,i[o++]=a+1,i[o++]=a+3,i[o++]=a+2}},X={extension:{type:r.Ag.ShapeBuilder,name:"triangle"},build:(t,e)=>(e[0]=t.x,e[1]=t.y,e[2]=t.x2,e[3]=t.y2,e[4]=t.x3,e[5]=t.y3,!0),triangulate(t,e,n,r,i,o){let s=0;e[(r*=n)+s]=t[0],e[r+s+1]=t[1],s+=n,e[r+s]=t[2],e[r+s+1]=t[3],s+=n,e[r+s]=t[4],e[r+s+1]=t[5];const a=r/n;i[o++]=a,i[o++]=a+1,i[o++]=a+2}};var $=n(2413);const q={};r.XO.handleByMap(r.Ag.ShapeBuilder,q),r.XO.add(Y,V,X,h,u,d);const K=new o.M,Z=new i.u;function J(t,e){const{geometryData:n,batches:r}=e;r.length=0,n.indices.length=0,n.vertices.length=0,n.uvs.length=0;for(let e=0;e<t.instructions.length;e++){const i=t.instructions[e];if("texture"===i.action)Q(i.data,r,n);else if("fill"===i.action||"stroke"===i.action){const t="stroke"===i.action,e=i.data.path.shapePath,o=i.data.style,s=i.data.hole;t&&s&&tt(s.shapePath,o,!0,r,n),s&&(e.shapePrimitives[e.shapePrimitives.length-1].holes=s.shapePath.shapePrimitives),tt(e,o,t,r,n)}}}function Q(t,e,n){const r=[],i=q.rectangle,o=K;o.x=t.dx,o.y=t.dy,o.width=t.dw,o.height=t.dh;const a=t.transform;if(!i.build(o,r))return;const{vertices:h,uvs:u,indices:d}=n,f=d.length,p=h.length/2;a&&s(r,a),i.triangulate(r,h,2,p,d,f);const m=t.image,y=m.uvs;u.push(y.x0,y.y0,y.x1,y.y1,y.x3,y.y3,y.x2,y.y2);const g=l.Z.get(c.G);g.indexOffset=f,g.indexSize=d.length-f,g.attributeOffset=p,g.attributeSize=h.length/2-p,g.baseColor=t.style,g.alpha=t.alpha,g.texture=m,g.geometryData=n,e.push(g)}function tt(t,e,n,r,i){const{vertices:o,uvs:h,indices:u}=i;t.shapePrimitives.forEach((({shape:t,transform:d,holes:m})=>{const y=[],g=q[t.type];if(!g.build(t,y))return;const v=u.length,b=o.length/2;let x="triangle-list";if(d&&s(y,d),n){const n=t.closePath??!0,r=e;r.pixelLine?(!function(t,e,n,r){const i=p.B;if(0===t.length)return;const o=t[0],s=t[1],a=t[t.length-2],l=t[t.length-1],c=e||Math.abs(o-a)<i&&Math.abs(s-l)<i,h=n,u=t.length/2,d=h.length/2;for(let e=0;e<u;e++)h.push(t[2*e]),h.push(t[2*e+1]);for(let t=0;t<u-1;t++)r.push(d+t,d+t+1);c&&r.push(d+u-1,d)}(y,n,o,u),x="line-list"):(0,f.h)(y,r,!1,n,o,u)}else if(m){const t=[],e=y.slice();(function(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n].shape,i=[];q[r.type].build(r,i)&&e.push(i)}return e})(m).forEach((n=>{t.push(e.length/2),e.push(...n)})),W(e,t,o,2,b,u,v)}else g.triangulate(y,o,2,b,u,v);const _=h.length/2,w=e.texture;if(w!==a.g.WHITE){const n=(0,$.Y)(Z,e,t,d);!function(t,e,n,r,i,o,s,a=null){let l=0;n*=e,i*=o;const c=a.a,h=a.b,u=a.c,d=a.d,f=a.tx,p=a.ty;for(;l<s;){const s=t[n],a=t[n+1];r[i]=c*s+u*a+f,r[i+1]=h*s+d*a+p,i+=o,n+=e,l++}}(o,2,b,h,_,2,o.length/2-b,n)}else!function(t,e,n,r){let i=0;for(e*=n;i<r;)t[e]=0,t[e+1]=0,e+=n,i++}(h,_,2,o.length/2-b);const S=l.Z.get(c.G);S.indexOffset=v,S.indexSize=u.length-v,S.attributeOffset=b,S.attributeSize=o.length/2-b,S.baseColor=e.color,S.alpha=e.alpha,S.texture=w,S.geometryData=i,S.topology=x,r.push(S)}))}},990:(t,e,n)=>{n.d(e,{T:()=>d,w:()=>u});var r=n(2577),i=n(5589),o=n(7276),s=n(2806);function a(t){return t instanceof s.m}function l(t){return t instanceof o._}function c(t,e,n){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,{...n,...t}}function h(t,e,n){return e.buildGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...n,...t}}function u(t,e){if(null==t)return null;const n={},o=t;return function(t){return r.Q.isColorLike(t)}(t)?function(t,e,n){const o=r.Q.shared.setValue(e??0);return t.color=o.toNumber(),t.alpha=1===o.alpha?n.alpha:o.alpha,t.texture=i.g.WHITE,{...n,...t}}(n,t,e):function(t){return t instanceof i.g}(t)?function(t,e,n){return t.texture=e,{...n,...t}}(n,t,e):a(t)?c(n,t,e):l(t)?h(n,t,e):o.fill&&a(o.fill)?c(o,o.fill,e):o.fill&&l(o.fill)?h(o,o.fill,e):function(t,e){const n={...e,...t},i=r.Q.shared.setValue(n.color);return n.alpha*=i.alpha,n.color=i.toNumber(),n}(o,e)}function d(t,e){const{width:n,alignment:r,miterLimit:i,cap:o,join:s,pixelLine:a,...l}=e,c=u(t,l);return c?{width:n,alignment:r,miterLimit:i,cap:o,join:s,pixelLine:a,...c}:null}},2413:(t,e,n)=>{n.d(e,{Y:()=>l});var r=n(9313),i=n(9252),o=n(7276);const s=new r.u,a=new i.M;function l(t,e,n,r){const i=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if("local"===e.textureSpace){const t=n.getBounds(a);e.width&&t.pad(e.width);const{x:r,y:o}=t,s=1/t.width,l=1/t.height,c=-r*s,h=-o*l,u=i.a,d=i.b,f=i.c,p=i.d;i.a*=s,i.b*=s,i.c*=l,i.d*=l,i.tx=c*u+h*f+i.tx,i.ty=c*d+h*p+i.ty}else i.translate(e.texture.frame.x,e.texture.frame.y),i.scale(1/e.texture.source.width,1/e.texture.source.height);const l=e.texture.source.style;return e.fill instanceof o._||"clamp-to-edge"!==l.addressMode||(l.addressMode="repeat",l.update()),r&&i.append(s.copyFrom(r).invert()),i}},8422:(t,e,n)=>{n.d(e,{K:()=>r});class r{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}destroy(){this.reset()}}},6844:(t,e,n)=>{n.d(e,{k:()=>l});var r=n(2812),i=n(5589),o=n(2048),s=n(4670),a=n(4985);class l extends a.l{constructor(t=i.g.EMPTY){t instanceof i.g&&(t={texture:t});const{texture:e=i.g.EMPTY,anchor:n,roundPixels:o,width:s,height:a,...l}=t;super({label:"Sprite",...l}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new r.o({_onUpdate:()=>{this.onViewUpdate()}}),n?this.anchor=n:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=o??!1,void 0!==s&&(this.width=s),void 0!==a&&(this.height=a)}static from(t,e=!1){return t instanceof i.g?new l(t):new l(i.g.from(t,e))}set texture(t){t||(t=i.g.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return(0,o.y)(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return(0,s.t6)("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const t=this._anchor,e=this._texture,n=this._bounds,{width:r,height:i}=e.orig;n.minX=-t._x*r,n.maxX=n.minX+r,n.minY=-t._y*i,n.maxY=n.minY+i}destroy(t=!1){super.destroy(t);if("boolean"==typeof t?t:t?.texture){const e="boolean"==typeof t?t:t?.textureSource;this._texture.destroy(e)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){"object"==typeof t?(e=t.height??t.width,t=t.width):e??(e=t),void 0!==t&&this._setWidth(t,this._texture.orig.width),void 0!==e&&this._setHeight(e,this._texture.orig.height)}}},4985:(t,e,n)=>{n.d(e,{l:()=>o});var r=n(9636),i=n(5559);class o extends i.mc{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this._bounds=new r.c(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=t.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){const e=this.bounds,{x:n,y:r}=t;return n>=e.minX&&n<=e.maxX&&r>=e.minY&&r<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(t){this.unload(),super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,n){const{renderPipes:r}=e;r.blendMode.pushBlendMode(this,this.groupBlendMode,t);const i=r[this.renderPipeId];i?.addRenderable&&i.addRenderable(this,t),this.didViewUpdate=!1;const o=this.children,s=o.length;for(let r=0;r<s;r++)o[r].collectRenderables(t,e,n);r.blendMode.popBlendMode(t)}}},6312:(t,e,n)=>{var r=n(8507),i=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(i||{}),o=n(268),s=n(1761);function a(t){if("string"!=typeof t)throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function l(t){return t.split("?")[0].split("#")[0]}const c={toPosix(t){return e="\\",n="/",t.replace(new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),n);var e,n},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl:t=>/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t),isBlobUrl:t=>t.startsWith("blob:"),hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){a(t),t=this.toPosix(t);const e=/^file:\/\/\//.exec(t);if(e)return e[0];const n=/^[^/:]+:\/{0,2}/.exec(t);return n?n[0]:""},toAbsolute(t,e,n){if(a(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;const r=l(this.toPosix(e??s.e.get().getBaseUrl())),i=l(this.toPosix(n??this.rootname(r)));if((t=this.toPosix(t)).startsWith("/"))return c.join(i,t.slice(1));return this.isAbsolute(t)?t:this.join(r,t)},normalize(t){if(a(t),0===t.length)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;let e="";const n=(t=this.toPosix(t)).startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));const r=t.endsWith("/");return(t=function(t,e){let n="",r=0,i=-1,o=0,s=-1;for(let a=0;a<=t.length;++a){if(a<t.length)s=t.charCodeAt(a);else{if(47===s)break;s=47}if(47===s){if(i===a-1||1===o);else if(i!==a-1&&2===o){if(n.length<2||2!==r||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){const t=n.lastIndexOf("/");if(t!==n.length-1){-1===t?(n="",r=0):(n=n.slice(0,t),r=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(2===n.length||1===n.length){n="",r=0,i=a,o=0;continue}e&&(n.length>0?n+="/..":n="..",r=2)}else n.length>0?n+=`/${t.slice(i+1,a)}`:n=t.slice(i+1,a),r=a-i-1;i=a,o=0}else 46===s&&-1!==o?++o:o=-1}return n}(t,!1)).length>0&&r&&(t+="/"),n?`/${t}`:e+t},isAbsolute(t){return a(t),t=this.toPosix(t),!!this.hasProtocol(t)||t.startsWith("/")},join(...t){if(0===t.length)return".";let e;for(let n=0;n<t.length;++n){const r=t[n];if(a(r),r.length>0)if(void 0===e)e=r;else{const i=t[n-1]??"";this.joinExtensions.includes(this.extname(i).toLowerCase())?e+=`/../${r}`:e+=`/${r}`}}return void 0===e?".":this.normalize(e)},dirname(t){if(a(t),0===t.length)return".";let e=(t=this.toPosix(t)).charCodeAt(0);const n=47===e;let r=-1,i=!0;const o=this.getProtocol(t),s=t;for(let n=(t=t.slice(o.length)).length-1;n>=1;--n)if(e=t.charCodeAt(n),47===e){if(!i){r=n;break}}else i=!1;return-1===r?n?"/":this.isUrl(s)?o+t:o:n&&1===r?"//":o+t.slice(0,r)},rootname(t){a(t);let e="";if(e=(t=this.toPosix(t)).startsWith("/")?"/":this.getProtocol(t),this.isUrl(t)){const n=t.indexOf("/",e.length);e=-1!==n?t.slice(0,n):t,e.endsWith("/")||(e+="/")}return e},basename(t,e){a(t),e&&a(e),t=l(this.toPosix(t));let n,r=0,i=-1,o=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let s=e.length-1,a=-1;for(n=t.length-1;n>=0;--n){const l=t.charCodeAt(n);if(47===l){if(!o){r=n+1;break}}else-1===a&&(o=!1,a=n+1),s>=0&&(l===e.charCodeAt(s)?-1==--s&&(i=n):(s=-1,i=a))}return r===i?i=a:-1===i&&(i=t.length),t.slice(r,i)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!o){r=n+1;break}}else-1===i&&(o=!1,i=n+1);return-1===i?"":t.slice(r,i)},extname(t){a(t);let e=-1,n=0,r=-1,i=!0,o=0;for(let s=(t=l(this.toPosix(t))).length-1;s>=0;--s){const a=t.charCodeAt(s);if(47!==a)-1===r&&(i=!1,r=s+1),46===a?-1===e?e=s:1!==o&&(o=1):-1!==e&&(o=-1);else if(!i){n=s+1;break}}return-1===e||-1===r||0===o||1===o&&e===r-1&&e===n+1?"":t.slice(e,r)},parse(t){a(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;let n=(t=l(this.toPosix(t))).charCodeAt(0);const r=this.isAbsolute(t);let i;e.root=this.rootname(t),i=r||this.hasProtocol(t)?1:0;let o=-1,s=0,c=-1,h=!0,u=t.length-1,d=0;for(;u>=i;--u)if(n=t.charCodeAt(u),47!==n)-1===c&&(h=!1,c=u+1),46===n?-1===o?o=u:1!==d&&(d=1):-1!==o&&(d=-1);else if(!h){s=u+1;break}return-1===o||-1===c||0===d||1===d&&o===c-1&&o===s+1?-1!==c&&(e.base=e.name=0===s&&r?t.slice(1,c):t.slice(s,c)):(0===s&&r?(e.name=t.slice(1,o),e.base=t.slice(1,c)):(e.name=t.slice(s,o),e.base=t.slice(s,c)),e.ext=t.slice(o,c)),e.dir=this.dirname(t),e},sep:"/",delimiter:":",joinExtensions:[".html"]};var h=n(2406);function u(t,e,n,r,i){const o=e[n];for(let s=0;s<o.length;s++){const a=o[s];n<e.length-1?u(t.replace(r[n],a),e,n+1,r,i):i.push(t.replace(r[n],a))}}function d(t){const e=t.match(/\{(.*?)\}/g),n=[];if(e){const r=[];e.forEach((t=>{const e=t.substring(1,t.length-1).split(",");r.push(e)})),u(t,r,0,e,n)}else n.push(t);return n}const f=t=>!Array.isArray(t);class p{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,"bar"!==this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar")))throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach((t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))})),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if("string"==typeof t)this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}}getAlias(t){const{alias:e,src:n}=t;return(0,h.z)(e||n,(t=>"string"==typeof t?t:Array.isArray(t)?t.map((t=>t?.src??t)):t?.src?t.src:t),!0)}removeAlias(t,e){this._assetMap[t]&&(e&&e!==this._resolverHash[t]||(delete this._resolverHash[t],delete this._assetMap[t]))}addManifest(t){this._manifest&&(0,o.R)("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach((t=>{this.addBundle(t.name,t.assets)}))}addBundle(t,e){const n=[];let r=e;Array.isArray(e)||(r=Object.entries(e).map((([t,e])=>"string"==typeof e||Array.isArray(e)?{alias:t,src:e}:{alias:t,...e}))),r.forEach((e=>{const r=e.src,i=e.alias;let o;if("string"==typeof i){const e=this._createBundleAssetId(t,i);n.push(e),o=[i,e]}else{const e=i.map((e=>this._createBundleAssetId(t,e)));n.push(...e),o=[...i,...e]}this.add({...e,alias:o,src:r})})),this._bundles[t]=n}add(t){const e=[];let n;Array.isArray(t)?e.push(...t):e.push(t),n=t=>{this.hasKey(t)&&(0,o.R)(`[Resolver] already has key: ${t} overwriting`)};(0,h.z)(e).forEach((t=>{const{src:e}=t;let{data:r,format:i,loadParser:o,parser:s}=t;const a=(0,h.z)(e).map((t=>"string"==typeof t?d(t):Array.isArray(t)?t:[t])),l=this.getAlias(t);Array.isArray(l)?l.forEach(n):n(l);const c=[],u=t=>{const e=this._parsers.find((e=>e.test(t)));return{src:t,...e?.parse(t)}};a.forEach((e=>{e.forEach((e=>{let n={};if("object"!=typeof e?n=u(e):(r=e.data??r,i=e.format??i,(e.loadParser||e.parser)&&(o=e.loadParser??o,s=e.parser??s),n={...u(e.src),...e}),!l)throw new Error(`[Resolver] alias is undefined for this asset: ${n.src}`);n=this._buildResolvedAsset(n,{aliases:l,data:r,format:i,loadParser:o,parser:s,progressSize:t.progressSize}),c.push(n)}))})),l.forEach((t=>{this._assetMap[t]=c}))}))}resolveBundle(t){const e=f(t);t=(0,h.z)(t);const n={};return t.forEach((t=>{const e=this._bundles[t];if(e){const r=this.resolve(e),i={};for(const e in r){const n=r[e];i[this._extractAssetIdFromBundle(t,e)]=n}n[t]=i}})),e?n[t[0]]:n}resolveUrl(t){const e=this.resolve(t);if("string"!=typeof t){const t={};for(const n in e)t[n]=e[n].src;return t}return e.src}resolve(t){const e=f(t);t=(0,h.z)(t);const n={};return t.forEach((t=>{if(!this._resolverHash[t])if(this._assetMap[t]){let e=this._assetMap[t];const n=this._getPreferredOrder(e);n?.priority.forEach((t=>{n.params[t].forEach((n=>{const r=e.filter((e=>!!e[t]&&e[t]===n));r.length&&(e=r)}))})),this._resolverHash[t]=e[0]}else this._resolverHash[t]=this._buildResolvedAsset({alias:[t],src:t},{});n[t]=this._resolverHash[t]})),e?n[t[0]]:n}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const n=t[e],r=this._preferredOrder.find((t=>t.params.format.includes(n.format)));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;return`${t}${/\?/.test(t)?"&":"?"}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){const{aliases:n,data:r,loadParser:i,parser:o,format:s,progressSize:a}=e;return(this._basePath||this._rootPath)&&(t.src=c.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=n??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=i??t.loadParser,t.parser=o??t.parser,t.format=s??t.format??t.src.split(".").pop().split("?").shift().split("#").shift(),void 0!==a&&(t.progressSize=a),t}}p.RETINA_PREFIX=/@([0-9\.]+)x/;const m=(t,e)=>{const n=e.split("?")[1];return n&&(t+=`?${n}`),t};var y=n(5589),g=n(9252),v=n(583);const b=class t{constructor(t,e){this.linkedSheets=[];let n=t;t?.source instanceof v.v&&(n={texture:t,data:e});const{texture:r,data:i,cachePrefix:o=""}=n;this.cachePrefix=o,this._texture=r instanceof y.g?r:null,this.textureSource=r.source,this.textures={},this.animations={},this.data=i;const s=parseFloat(i.meta.scale);s?(this.resolution=s,r.source.resolution=this.resolution):this.resolution=r.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise((e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=t.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()}))}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(e,n=!1){let r=e;const i=n?1/0:t.BATCH_SIZE;for(;r-e<i&&r<this._frameKeys.length;){const t=this._frameKeys[r],e=this._frames[t],n=e.frame;if(n){let r=null,i=null;const o=!1!==e.trimmed&&e.sourceSize?e.sourceSize:e.frame,s=new g.M(0,0,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution);r=e.rotated?new g.M(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):new g.M(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),!1!==e.trimmed&&e.spriteSourceSize&&(i=new g.M(Math.floor(e.spriteSourceSize.x)/this.resolution,Math.floor(e.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[t]=new y.g({source:this.textureSource,frame:r,orig:s,trim:i,rotate:e.rotated?2:0,defaultAnchor:e.anchor,defaultBorders:e.borders,label:t.toString()})}r++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let n=0;n<t[e].length;n++){const r=t[e][n];this.animations[e].push(this.textures[r])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*t.BATCH_SIZE),this._batchIndex++,setTimeout((()=>{this._batchIndex*t.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())}),0)}destroy(t=!1){for(const t in this.textures)this.textures[t].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};b.BATCH_SIZE=1e3;let x=b;const _=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function w(t,e,n){const r={};if(t.forEach((t=>{r[t]=e})),Object.keys(e.textures).forEach((t=>{r[`${e.cachePrefix}${t}`]=e.textures[t]})),!n){const n=c.dirname(t[0]);e.linkedSheets.forEach(((t,i)=>{const o=w([`${n}/${e.data.meta.related_multi_packs[i]}`],t,!0);Object.assign(r,o)}))}return r}const S={extension:r.Ag.Asset,cache:{test:t=>t instanceof x,getCacheableAssets:(t,e)=>w(t,e,!1)},resolver:{extension:{type:r.Ag.ResolveParser,name:"resolveSpritesheet"},test:t=>{const e=t.split("?")[0].split("."),n=e.pop(),r=e.pop();return"json"===n&&_.includes(r)},parse:t=>{const e=t.split(".");return{resolution:parseFloat(p.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:r.Ag.LoadParser,priority:i.Normal,name:"spritesheetLoader"},testParse:async(t,e)=>".json"===c.extname(e.src).toLowerCase()&&!!t.frames,async parse(t,e,n){const{texture:r,imageFilename:i,textureOptions:o,cachePrefix:s}=e?.data??{};let a,l=c.dirname(e.src);if(l&&l.lastIndexOf("/")!==l.length-1&&(l+="/"),r instanceof y.g)a=r;else{const r=m(l+(i??t.meta.image),e.src);a=(await n.load([{src:r,data:o}]))[r]}const h=new x({texture:a.source,data:t,cachePrefix:s});await h.parse();const u=t?.meta?.related_multi_packs;if(Array.isArray(u)){const t=[];for(const r of u){if("string"!=typeof r)continue;let i=l+r;e.data?.ignoreMultiPack||(i=m(i,e.src),t.push(n.load({src:i,data:{textureOptions:o,ignoreMultiPack:!0}})))}const r=await Promise.all(t);h.linkedSheets=r,r.forEach((t=>{t.linkedSheets=[h].concat(h.linkedSheets.filter((e=>e!==t)))}))}return h},async unload(t,e,n){await n.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}};r.XO.add(S)},7309:(t,e,n)=>{n.d(e,{R:()=>s});var r=n(4458);class i{constructor(t,e=null,n=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=n,this._once=r}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const o=class t{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new i(null,null,1/0),this.deltaMS=1/t.targetFPMS,this.elapsedMS=1/t.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&null===this._requestId&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,n=r.d.NORMAL){return this._addListener(new i(t,e,n))}addOnce(t,e,n=r.d.NORMAL){return this._addListener(new i(t,e,n,!0))}_addListener(t){let e=this._head.next,n=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(n);break}n=e,e=e.next}t.previous||t.connect(n)}else t.connect(n);return this._startIfPossible(),this}remove(t,e){let n=this._head.next;for(;n;)n=n.match(t,e)?n.destroy():n.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let n;if(e>this.lastTime){if(n=this.elapsedMS=e-this.lastTime,n>this._maxElapsedMS&&(n=this._maxElapsedMS),n*=this.speed,this._minElapsedMS){const t=e-this._lastFrame|0;if(t<this._minElapsedMS)return;this._lastFrame=e-t%this._minElapsedMS}this.deltaMS=n,this.deltaTime=this.deltaMS*t.targetFPMS;const r=this._head;let i=r.next;for(;i;)i=i.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const n=Math.min(Math.max(0,e)/1e3,t.targetFPMS);this._maxElapsedMS=1/n,this._minElapsedMS&&e>this.maxFPS&&(this.maxFPS=e)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){0===t?this._minElapsedMS=0:(t<this.minFPS&&(this.minFPS=t),this._minElapsedMS=1/(t/1e3))}static get shared(){if(!t._shared){const e=t._shared=new t;e.autoStart=!0,e._protected=!0}return t._shared}static get system(){if(!t._system){const e=t._system=new t;e.autoStart=!0,e._protected=!0}return t._system}};o.targetFPMS=.06;let s=o},4458:(t,e,n)=>{n.d(e,{d:()=>r});var r=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(r||{})},4577:(t,e,n)=>{let r;function i(){if("boolean"==typeof r)return r;try{const t=new Function("param1","param2","param3","return param1[param2] === param3;");r=!0===t({a:"b"},"a","b")}catch(t){r=!1}return r}n.d(e,{f:()=>i})},2571:(t,e,n)=>{n.d(e,{xv:()=>r});n(8875);const r="8.17.1"},4334:(t,e,n)=>{n.d(e,{s:()=>r});class r{constructor(t){this.items=Object.create(null);const{renderer:e,type:n,onUnload:r,priority:i,name:o}=t;this._renderer=e,e.gc.addResourceHash(this,"items",n,i??0),this._onUnload=r,this.name=o}add(t){return!this.items[t.uid]&&(this.items[t.uid]=t,t.once("unload",this.remove,this),t._gcLastUsed=this._renderer.gc.now,!0)}remove(t,...e){if(!this.items[t.uid])return;const n=t._gpuData[this._renderer.uid];n&&(this._onUnload?.(t,...e),n.destroy(),t._gpuData[this._renderer.uid]=null,this.items[t.uid]=null)}removeAll(...t){Object.values(this.items).forEach((e=>e&&this.remove(e,...t)))}destroy(...t){this.removeAll(...t),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}},9903:(t,e,n)=>{function r(t,e,n){const r=t.length;let i;if(e>=r||0===n)return;const o=r-(n=e+n>r?r-e:n);for(i=e;i<o;++i)t[i]=t[i+n];t.length=o}n.d(e,{d:()=>r})},133:(t,e,n)=>{n.d(e,{L:()=>i});const r={default:-1};function i(t="default"){return void 0===r[t]&&(r[t]=-1),++r[t]}},2048:(t,e,n)=>{function r(t,e,n){const{width:r,height:i}=n.orig,o=n.trim;if(o){const n=o.width,s=o.height;t.minX=o.x-e._x*r,t.maxX=t.minX+n,t.minY=o.y-e._y*i,t.maxY=t.minY+s}else t.minX=-e._x*r,t.maxX=t.minX+r,t.minY=-e._y*i,t.maxY=t.minY+i}n.d(e,{y:()=>r})},7073:(t,e,n)=>{n.d(e,{M:()=>o,d:()=>s});var r=n(8507),i=n(2571);class o{static init(){globalThis.__PIXI_APP_INIT__?.(this,i.xv)}static destroy(){}}o.extension=r.Ag.Application;class s{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,i.xv)}destroy(){this._renderer=null}}s.extension={type:[r.Ag.WebGLSystem,r.Ag.WebGPUSystem],name:"initHook",priority:-10}},4670:(t,e,n)=>{n.d(e,{Ek:()=>o,lj:()=>i,t6:()=>a});const r=new Set,i="8.0.0",o="8.3.4",s={quiet:!1,noColor:!1},a=(t,e,n=3)=>{if(s.quiet||r.has(e))return;let i=(new Error).stack;const o=`${e}\nDeprecated since v${t}`,a="function"==typeof console.groupCollapsed&&!s.noColor;void 0===i?console.warn("PixiJS Deprecation Warning: ",o):(i=i.split("\n").splice(n).join("\n"),a?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",o),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",o),console.warn(i))),r.add(e)};Object.defineProperties(a,{quiet:{get:()=>s.quiet,set:t=>{s.quiet=t},enumerable:!0,configurable:!1},noColor:{get:()=>s.noColor,set:t=>{s.noColor=t},enumerable:!0,configurable:!1}})},268:(t,e,n)=>{n.d(e,{R:()=>o});let r=0;const i=500;function o(...t){r!==i&&(r++,r===i?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}},6083:(t,e,n)=>{n.d(e,{L:()=>r});const r={_registeredResources:new Set,register(t){this._registeredResources.add(t)},unregister(t){this._registeredResources.delete(t)},release(){this._registeredResources.forEach((t=>t.clear()))},get registeredCount(){return this._registeredResources.size},isRegistered(t){return this._registeredResources.has(t)},reset(){this._registeredResources.clear()}}},8655:(t,e,n)=>{n.d(e,{Z:()=>o});var r=n(6083);class i{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?e=this._pool[--this._index]:(e=new this._classType,this._count++),e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){if(this._pool.length>0&&this._pool[0].destroy)for(let t=0;t<this._index;t++)this._pool[t].destroy();this._pool.length=0,this._count=0,this._index=0}}const o=new class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new i(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach((e=>{const n=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[n]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}})),t}clear(){this._poolsByClass.forEach((t=>t.clear())),this._poolsByClass.clear()}};r.L.register(o)},8875:(t,e,n)=>{n.d(e,{A:()=>r});const r=n(5585)}},r={};function i(t){var e=r[t];if(void 0!==e)return e.exports;var o=r[t]={id:t,exports:{}};return n[t](o,o.exports,i),o.exports}i.m=n,i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.f={},i.e=t=>Promise.all(Object.keys(i.f).reduce(((e,n)=>(i.f[n](t,e),e)),[])),i.u=t=>t+".vizor_2d.min.js",i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t={},e="vizor_2d:",i.l=(n,r,o,s)=>{if(t[n])t[n].push(r);else{var a,l;if(void 0!==o)for(var c=document.getElementsByTagName("script"),h=0;h<c.length;h++){var u=c[h];if(u.getAttribute("src")==n||u.getAttribute("data-webpack")==e+o){a=u;break}}a||(l=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.setAttribute("data-webpack",e+o),a.src=n),t[n]=[r];var d=(e,r)=>{a.onerror=a.onload=null,clearTimeout(f);var i=t[n];if(delete t[n],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((t=>t(r))),e)return e(r)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),l&&document.head.appendChild(a)}},i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;if("string"==typeof import.meta.url&&(t=import.meta.url),!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t})(),(()=>{i.b=document.baseURI||self.location.href;var t={792:0};i.f.j=(e,n)=>{var r=i.o(t,e)?t[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise(((n,i)=>r=t[e]=[n,i]));n.push(r[2]=o);var s=i.p+i.u(e),a=new Error;i.l(s,(n=>{if(i.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),s=n&&n.target&&n.target.src;a.message="Loading chunk "+e+" failed.\n("+o+": "+s+")",a.name="ChunkLoadError",a.type=o,a.request=s,r[1](a)}}),"chunk-"+e,e)}};var e=(e,n)=>{var r,o,[s,a,l]=n,c=0;if(s.some((e=>0!==t[e]))){for(r in a)i.o(a,r)&&(i.m[r]=a[r]);if(l)l(i)}for(e&&e(n);c<s.length;c++)o=s[c],i.o(t,o)&&t[o]&&t[o][0](),t[o]=0},n=self.webpackChunkvizor_2d=self.webpackChunkvizor_2d||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})(),i.nc=void 0;var o={};function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,l(r.key),r)}}function l(t){var e=function(t,e){if("object"!=s(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==s(e)?e:e+""}i.d(o,{A5:()=>fa,oY:()=>us,W_:()=>gs,vY:()=>mr,jz:()=>na,TI:()=>ca,ey:()=>ba,sV:()=>As,ut:()=>Na});var c=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return e=t,r=[{key:"build",value:function(e){if(!e)return function(){return!0};switch(e.op){case"and":var n=e.rules.map((function(e){return t.build(e)}));return function(t){return n.every((function(e){return e(t)}))};case"or":var r=e.rules.map((function(e){return t.build(e)}));return function(t){return r.some((function(e){return e(t)}))};case"not":var i=t.build(e.rule);return function(t){return!i(t)};case"eq":return function(t){var n;return(null===(n=t.data)||void 0===n?void 0:n[e.field])===e.value};case"neq":return function(t){var n;return(null===(n=t.data)||void 0===n?void 0:n[e.field])!==e.value};case"gt":return function(t){var n;return(null===(n=t.data)||void 0===n?void 0:n[e.field])>e.value};case"lt":return function(t){var n;return(null===(n=t.data)||void 0===n?void 0:n[e.field])<e.value};case"gte":return function(t){var n;return(null===(n=t.data)||void 0===n?void 0:n[e.field])>=e.value};case"lte":return function(t){var n;return(null===(n=t.data)||void 0===n?void 0:n[e.field])<=e.value};case"regex":var o=new RegExp(e.value);return function(t){var n,r=null===(n=t.data)||void 0===n?void 0:n[e.field];return o.test(String(null!=r?r:""))};case"in":return function(t){var n;return e.value.includes(null===(n=t.data)||void 0===n?void 0:n[e.field])};case"exists":return function(t){return e.field in(t.data||{})};default:return console.warn("Unknown rule:",e),function(){return!0}}}}],(n=null)&&a(e.prototype,n),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function h(t){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}function u(t){return function(t){if(Array.isArray(t))return p(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||f(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=f(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function f(t,e){if(t){if("string"==typeof t)return p(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(t,e):void 0}}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function m(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,y(r.key),r)}}function y(t){var e=function(t,e){if("object"!=h(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==h(e)?e:e+""}var g=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.attractionStrength=.15,this.repulsionStrength=200,this.damping=.98,this.minDist=20,this.planetRadius=60,this.planetRepulsion=2,this.orbitStrength=0,this.collisionPadding=2,this.collisionIterations=2,this.velocityEpsilon=.01,this.energyThreshold=.1,this.cooling=.999,this.minStrength=.001},e=[{key:"setModel",value:function(t){this.model=t}},{key:"resolveMoonCollisions",value:function(t){for(var e=0;e<this.collisionIterations;e++)for(var n=0;n<t.length;n++)for(var r=n+1;r<t.length;r++){var i=t[n],o=t[r],s=i.radius||10,a=o.radius||10,l=o.x-i.x,c=o.y-i.y,h=Math.sqrt(l*l+c*c)||1e-4,u=s+a+this.collisionPadding;if(h<u){var d=l/h,f=c/h,p=.5*(u-h);i.fixed||(i.x-=d*p,i.y-=f*p),o.fixed||(o.x+=d*p,o.y+=f*p)}}}},{key:"step",value:function(){var t,e=this,n=this.model.getNodes(),r=n.filter((function(t){return"moon"===t.type})),i=n.filter((function(t){return"planet"===t.type})),o=d(r);try{for(o.s();!(t=o.n()).done;){var s=t.value;s.vx*=this.damping,s.vy*=this.damping}}catch(t){o.e(t)}finally{o.f()}for(var a=0;a<r.length;a++)for(var l=a+1;l<r.length;l++){var c=r[a],h=r[l],f=c.x-h.x,p=c.y-h.y,m=Math.sqrt(f*f+p*p)||.01;m=Math.max(m,this.minDist);var y=this.repulsionStrength/(m*m),g=f/m*y,v=p/m*y;c.fixed||(c.vx+=g,c.vy+=v),h.fixed||(h.vx-=g,h.vy-=v)}var b,x=d(i);try{var _=function(){var t=b.value,n=r.filter((function(e){return t.rule(e)}));if(0===n.length)return 1;if(t.sumField?t.sumTotal=n.reduce((function(e,n){var r,i=Number(null===(r=n.data)||void 0===r?void 0:r[t.sumField]);return e+(isNaN(i)?0:i)}),0):t.sumTotal=null,t.vector){var i,o={x:t.x,y:t.y},s=t.direction,a=t.length,l=t.scalarField,c=n.map((function(t){return t.data[l]})).filter((function(t){return null!=t})),h=Math.min.apply(Math,u(c)),f=Math.max.apply(Math,u(c)),p=d(n);try{for(p.s();!(i=p.n()).done;){var m=i.value,y=m.data[l];null==y&&(y=h);var g=f>h?(y-h)/(f-h):.5;m.x=o.x+s.x*a*g,m.y=o.y+s.y*a*g}}catch(t){p.e(t)}finally{p.f()}}else{var v,x=d(n);try{for(x.s();!(v=x.n()).done;){var _=v.value,w=t.x-_.x,S=t.y-_.y,C=Math.sqrt(w*w+S*S)||.01;C=Math.max(C,e.minDist);var E=100,k=w/C,T=S/C,A=e.attractionStrength*(C-E)*.5+.05*C;_.fixed||(_.vx+=k*A,_.vy+=T*A,_.vx+=.5*k,_.vy+=.5*T);var M=.85+.15*Math.min(1,C/E);_.vx*=M,_.vy*=M,_.vx*k+_.vy*T<0&&(_.vx*=.7,_.vy*=.7),C<3&&(_.x=t.x+k*E,_.y=t.y+T*E,_.vx=0,_.vy=0),C<102&&Math.abs(_.vx)<.05&&Math.abs(_.vy)<.05&&(_.vx=0,_.vy=0),0!==e.orbitStrength&&(_.vx+=-S/C*e.orbitStrength,_.vy+=w/C*e.orbitStrength)}}catch(t){x.e(t)}finally{x.f()}}};for(x.s();!(b=x.n()).done;)_()}catch(t){x.e(t)}finally{x.f()}var w,S=d(i);try{for(S.s();!(w=S.n()).done;){var C,E=w.value,k=d(r);try{for(k.s();!(C=k.n()).done;){var T=C.value,A=T.x-E.x,M=T.y-E.y,P=Math.sqrt(A*A+M*M)||.01;if(P<this.planetRadius){var O=this.planetRadius-P,I=A/P*O*this.planetRepulsion,L=M/P*O*this.planetRepulsion;T.fixed||(T.vx+=I,T.vy+=L)}}}catch(t){k.e(t)}finally{k.f()}}}catch(t){S.e(t)}finally{S.f()}var j,R=this.bounds||{minX:-1/0,maxX:1/0,minY:-1/0,maxY:1/0},D=0,N=d(r);try{for(N.s();!(j=N.n()).done;){var F=j.value;F.fixed||(F.x+=F.vx,F.y+=F.vy,F.x=Math.max(R.minX,Math.min(R.maxX,F.x)),F.y=Math.max(R.minY,Math.min(R.maxY,F.y)),F.vx*=.9,F.vy*=.9,Math.abs(F.vx)<this.velocityEpsilon&&(F.vx=0),Math.abs(F.vy)<this.velocityEpsilon&&(F.vy=0),D+=Math.abs(F.vx)+Math.abs(F.vy))}}catch(t){N.e(t)}finally{N.f()}this.resolveMoonCollisions(r);var B,G=D>=this.energyThreshold,z=d(r);try{for(z.s();!(B=z.n()).done;)B.value.dirty=G}catch(t){z.e(t)}finally{z.f()}if(!G){var U,W=d(r);try{for(W.s();!(U=W.n()).done;){var H=U.value;H.vx=0,H.vy=0}}catch(t){W.e(t)}finally{W.f()}}D<5&&(this.attractionStrength=Math.max(this.minStrength,.95*this.attractionStrength),this.repulsionStrength=Math.max(this.minStrength,.95*this.repulsionStrength))}}],e&&m(t.prototype,e),n&&m(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function b(t){return function(t){if(Array.isArray(t))return w(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=_(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function _(t,e){if(t){if("string"==typeof t)return w(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(t,e):void 0}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function S(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,C(r.key),r)}}function C(t){var e=function(t,e){if("object"!=v(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==v(e)?e:e+""}var E=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.attractionStrength=.05,this.repulsionStrength=200,this.damping=.9,this.minDist=20,this.minDistSq=this.minDist*this.minDist,this.planetRadius=60,this.planetRepulsion=2,this.orbitStrength=0,this.cellSize=80,this.maxNeighbors=15},e=[{key:"setModel",value:function(t){this.model=t}},{key:"_buildGrid",value:function(t){var e,n=new Map,r=x(t);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=Math.floor(i.x/this.cellSize),s=Math.floor(i.y/this.cellSize),a=o+","+s;n.has(a)||n.set(a,[]),n.get(a).push(i),i._cellX=o,i._cellY=s}}catch(t){r.e(t)}finally{r.f()}return n}},{key:"_getNeighbors",value:function(t,e){for(var n=[],r=-1;r<=1;r++)for(var i=-1;i<=1;i++){var o=e._cellX+r+","+(e._cellY+i),s=t.get(o);if(s){var a,l=x(s);try{for(l.s();!(a=l.n()).done;){var c=a.value;if(c!==e&&(n.push(c),n.length>=this.maxNeighbors))return n}}catch(t){l.e(t)}finally{l.f()}}}return n}},{key:"step",value:function(){var t=this,e=this.model.getNodes(),n=e.filter((function(t){return"moon"===t.type})),r=e.filter((function(t){return"planet"===t.type})),i=this.bounds;if(i){var o,s=x(n);try{for(s.s();!(o=s.n()).done;){var a=o.value;a.vx*=this.damping,a.vy*=this.damping}}catch(t){s.e(t)}finally{s.f()}var l,c=this._buildGrid(n),h=x(n);try{for(h.s();!(l=h.n()).done;){var u,d=l.value,f=x(this._getNeighbors(c,d));try{for(f.s();!(u=f.n()).done;){var p=u.value,m=d.x-p.x,y=d.y-p.y,g=m*m+y*y;g<this.minDistSq&&(g=this.minDistSq);var v=this.repulsionStrength/g,_=Math.sqrt(g),w=m/_*v,S=y/_*v;d.fixed||(d.vx+=w,d.vy+=S)}}catch(t){f.e(t)}finally{f.f()}}}catch(t){h.e(t)}finally{h.f()}var C,E=x(r);try{var k=function(){var e=C.value,r=n.filter((function(t){return e.rule(t)}));if(0===r.length)return 1;if(e.vector){var i,o={x:e.x,y:e.y},s=e.direction,a=e.length,l=e.scalarField,c=r.map((function(t){return t.data[l]})).filter((function(t){return null!=t})),h=Math.min.apply(Math,b(c)),u=Math.max.apply(Math,b(c)),d=x(r);try{for(d.s();!(i=d.n()).done;){var f=i.value,p=f.data[l];null==p&&(p=h);var m=u>h?(p-h)/(u-h):.5;f.x=o.x+s.x*a*m,f.y=o.y+s.y*a*m}}catch(t){d.e(t)}finally{d.f()}}else{var y,g=x(r);try{for(g.s();!(y=g.n()).done;){var v=y.value,_=e.x-v.x,w=e.y-v.y,S=_*_+w*w;S<t.minDistSq&&(S=t.minDistSq);var E=Math.sqrt(S),k=t.attractionStrength*E;v.fixed||(v.vx+=_/E*k,v.vy+=w/E*k),0!==t.orbitStrength&&(v.vx+=-w/E*t.orbitStrength,v.vy+=_/E*t.orbitStrength)}}catch(t){g.e(t)}finally{g.f()}}};for(E.s();!(C=E.n()).done;)k()}catch(t){E.e(t)}finally{E.f()}var T,A=x(r);try{for(A.s();!(T=A.n()).done;){var M,P=T.value,O=x(n);try{for(O.s();!(M=O.n()).done;){var I=M.value,L=I.x-P.x,j=I.y-P.y,R=Math.sqrt(L*L+j*j)||.01;if(R<this.planetRadius){var D=this.planetRadius-R,N=L/R*D*this.planetRepulsion,F=j/R*D*this.planetRepulsion;I.fixed||(I.vx+=N,I.vy+=F)}}}catch(t){O.e(t)}finally{O.f()}}}catch(t){A.e(t)}finally{A.f()}var B,G=x(n);try{for(G.s();!(B=G.n()).done;){var z=B.value;z.fixed||(z.x+=z.vx,z.y+=z.vy,z.x=Math.max(i.minX,Math.min(i.maxX,z.x)),z.y=Math.max(i.minY,Math.min(i.maxY,z.y)))}}catch(t){G.e(t)}finally{G.f()}}}}],e&&S(t.prototype,e),n&&S(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function k(t){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(t)}function T(t){return function(t){if(Array.isArray(t))return P(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||M(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=M(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function M(t,e){if(t){if("string"==typeof t)return P(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?P(t,e):void 0}}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function O(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,I(r.key),r)}}function I(t){var e=function(t,e){if("object"!=k(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=k(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==k(e)?e:e+""}var L=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.innerRadius=20,this.outerRadius=300,this.turns=4,this.spread=1,this.smoothing=.15,this.angleOffset=0,this.arcStep=12,this.wobbleStrength=2,this.wobbleFrequency=2,this.wobbleSpeed=.02,this.wobbleThreshold=3e3},e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this,n=this.model.getNodes(),r=n.filter((function(t){return"moon"===t.type})),i=A(n.filter((function(t){return"planet"===t.type})));try{var o=function(){var n=t.value,i=n.scalarField;if(!i)return 0;var o=r.filter((function(t){return n.rule(t)}));if(0===o.length)return 0;var s,a=1/0,l=-1/0,c=A(o);try{for(c.s();!(s=c.n()).done;){var h=s.value.data[i];null!=h&&(h<a&&(a=h),h>l&&(l=h))}}catch(t){c.e(t)}finally{c.f()}if(a===1/0||l===-1/0)return 0;n._sorted&&!n._dirty||(n._sorted=T(o).sort((function(t,e){var n,r;return(null!==(n=t.data[i])&&void 0!==n?n:a)-(null!==(r=e.data[i])&&void 0!==r?r:a)})),n._sorted.forEach((function(t,e){t._spiralIndex=e})),n._dirty=!1);var u,d=n._sorted,f=d.length<e.wobbleThreshold,p=A(d);try{for(p.s();!(u=p.n()).done;){var m=u.value,y=m.data[i];null==y&&(y=a);var g=l>a?(y-a)/(l-a):.5,v=e.angleOffset+g*e.turns*Math.PI*2,b=e.innerRadius+g*(e.outerRadius-e.innerRadius)*e.spread,x=m._spiralIndex||0,_=v+x*(e.arcStep/(b+1)),w=b+.5*x,S=0;f&&(void 0===m._spiralPhase&&(m._spiralPhase=Math.random()*Math.PI*2),m._spiralPhase+=e.wobbleSpeed,S=Math.sin(m._spiralPhase*e.wobbleFrequency)*e.wobbleStrength);var C=n.x+Math.cos(_)*(w+S),E=n.y+Math.sin(_)*(w+S);m.x+=(C-m.x)*e.smoothing,m.y+=(E-m.y)*e.smoothing}}catch(t){p.e(t)}finally{p.f()}};for(i.s();!(t=i.n()).done;)o()}catch(t){i.e(t)}finally{i.f()}}}],e&&O(t.prototype,e),n&&O(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function j(t){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(t)}function R(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=N(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function D(t){return function(t){if(Array.isArray(t))return F(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||N(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(t,e){if(t){if("string"==typeof t)return F(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?F(t,e):void 0}}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function B(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function G(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,U(r.key),r)}}function z(t,e,n){return e&&G(t.prototype,e),n&&G(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function U(t){var e=function(t,e){if("object"!=j(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=j(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==j(e)?e:e+""}var W=function(){return z((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.min,r=void 0===n?0:n,i=e.max,o=void 0===i?1:i,s=e.start,a=void 0===s?0:s,l=e.end,c=void 0===l?100:l,h=e.invert,u=void 0!==h&&h;B(this,t),this.min=r,this.max=o,this.start=a,this.end=c,this.invert=u}),[{key:"map",value:function(t){var e=this.max>this.min?(t-this.min)/(this.max-this.min):.5;return this.invert&&(e=1-e),this.start+e*(this.end-this.start)}}])}(),H=function(){return z((function t(){B(this,t),this.smoothing=.2,this.padding=40,this.jitter=10}),[{key:"setModel",value:function(t){this.model=t}},{key:"_mapCategorical",value:function(t){var e=D(new Set(t)),n=new Map;return e.forEach((function(t,e){return n.set(t,e)})),n}},{key:"step",value:function(){var t=this,e=this.model.getNodes(),n=e.filter((function(t){return"moon"===t.type})),r=e.filter((function(t){return"vector"===t.type})),i=this.bounds;if(i){var o,s=i.minY+this.padding,a=i.maxY-this.padding,l=i.minX+this.padding,c=i.maxX-this.padding,h=R(r);try{var u=function(){var e,r,i=o.value,h=i.scalarField;if(!h)return 0;var u=n.filter((function(t){return i.rule(t)}));if(!u.length)return 0;var d,f,p,m,y=[],g=!0,v=R(u);try{for(v.s();!(d=v.n()).done;){var b=d.value,x=b.data[h];if(null!=x){var _=Number(x);isNaN(_)&&(g=!1),b._value=g?_:x,y.push(b._value)}}}catch(t){v.e(t)}finally{v.f()}if(!y.length)return 0;if(g)f=Math.min.apply(Math,y),p=Math.max.apply(Math,y);else{f=0,p=(m=t._mapCategorical(y)).size-1;var w,S=R(u);try{for(S.s();!(w=S.n()).done;){var C=w.value;C._value=m.get(C._value)}}catch(t){S.e(t)}finally{S.f()}}var E=new W({min:f,max:p,start:l,end:c}),k=new W({min:f,max:p,start:s,end:a});u.sort((function(t,e){var n,r;return(null!==(n=t._value)&&void 0!==n?n:0)-(null!==(r=e._value)&&void 0!==r?r:0)}));for(var T=0!==(null===(e=i.direction)||void 0===e?void 0:e.x),A=0!==(null===(r=i.direction)||void 0===r?void 0:r.y),M=u.length,P=(c-l)/Math.max(1,M-1),O=(a-s)/Math.max(1,M-1),I=0;I<M;I++){var L,j=u[I],D=null!==(L=j._value)&&void 0!==L?L:f,N=j.x,F=j.y;if(T)N=.7*(l+I*P)+.3*E.map(D),F=j.y+(Math.random()-.5)*t.jitter;if(A)F=.7*(s+I*O)+.3*k.map(D),N=j.x+(Math.random()-.5)*t.jitter;j.x+=(N-j.x)*t.smoothing,j.y+=(F-j.y)*t.smoothing}};for(h.s();!(o=h.n()).done;)u()}catch(t){h.e(t)}finally{h.f()}}}}])}();function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function Y(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=$(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function X(t){return function(t){if(Array.isArray(t))return q(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||$(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(t,e){if(t){if("string"==typeof t)return q(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(t,e):void 0}}function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function K(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Z(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Q(r.key),r)}}function J(t,e,n){return e&&Z(t.prototype,e),n&&Z(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Q(t){var e=function(t,e){if("object"!=V(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=V(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==V(e)?e:e+""}var tt=function(){return J((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.min,r=void 0===n?0:n,i=e.max,o=void 0===i?1:i,s=e.start,a=void 0===s?0:s,l=e.end,c=void 0===l?100:l,h=e.invert,u=void 0!==h&&h;K(this,t),this.min=r,this.max=o,this.start=a,this.end=c,this.invert=u}),[{key:"map",value:function(t){var e=this.max>this.min?(t-this.min)/(this.max-this.min):.5;return this.invert&&(e=1-e),this.start+e*(this.end-this.start)}}])}(),et=function(){return J((function t(){K(this,t),this.smoothing=.2,this.padding=40,this.jitter=10,this.repulsion=.8,this.minDist=25,this.iterations=1}),[{key:"setModel",value:function(t){this.model=t}},{key:"_mapCategorical",value:function(t){var e=X(new Set(t)),n=new Map;return e.forEach((function(t,e){return n.set(t,e)})),n}},{key:"step",value:function(){var t=this,e=this.model.getNodes(),n=e.filter((function(t){return"moon"===t.type})),r=e.filter((function(t){return"vector"===t.type})),i=this.bounds;if(i){var o,s=i.minY+this.padding,a=i.maxY-this.padding,l=i.minX+this.padding,c=i.maxX-this.padding,h=Y(r);try{var u=function(){var e,r,i=o.value,h=i.scalarField;if(!h)return 0;var u=n.filter((function(t){return i.rule(t)}));if(!u.length)return 0;var d,f,p,m,y=[],g=!0,v=Y(u);try{for(v.s();!(d=v.n()).done;){var b=d.value,x=b.data[h];if(null!=x){var _=Number(x);isNaN(_)&&(g=!1),b._value=g?_:x,y.push(b._value)}}}catch(t){v.e(t)}finally{v.f()}if(!y.length)return 0;if(g)f=Math.min.apply(Math,y),p=Math.max.apply(Math,y);else{f=0,p=(m=t._mapCategorical(y)).size-1;var w,S=Y(u);try{for(S.s();!(w=S.n()).done;){var C=w.value;C._value=m.get(C._value)}}catch(t){S.e(t)}finally{S.f()}}var E=new tt({min:f,max:p,start:l,end:c}),k=new tt({min:f,max:p,start:s,end:a});u.sort((function(t,e){var n,r;return(null!==(n=t._value)&&void 0!==n?n:0)-(null!==(r=e._value)&&void 0!==r?r:0)}));for(var T=0!==(null===(e=i.direction)||void 0===e?void 0:e.x),A=0!==(null===(r=i.direction)||void 0===r?void 0:r.y),M=u.length,P=(Math.max(1,M-1),Math.max(1,M-1),0);P<M;P++){var O,I=u[P],L=null!==(O=I._value)&&void 0!==O?O:f,j=I.x,R=I.y;if(T){j=E.map(L),R=I.y+(Math.random()-.5)*t.jitter}if(A){R=k.map(L),j=I.x+(Math.random()-.5)*t.jitter}I.x+=(j-I.x)*t.smoothing,I.y+=(R-I.y)*t.smoothing}for(var D=0;D<t.iterations;D++)for(var N=0;N<M-1;N++){var F=u[N],B=u[N+1],G=B.x-F.x,z=B.y-F.y;if(!(Math.abs(G)>t.minDist&&Math.abs(z)>t.minDist)){var U=Math.sqrt(G*G+z*z)||1e-4;if(U<t.minDist){var W=(t.minDist-U)/U;if(T){var H=z*W*.5*t.repulsion;F.y-=H,B.y+=H}if(A){var V=G*W*.5*t.repulsion;F.x-=V,B.x+=V}}}}};for(h.s();!(o=h.n()).done;)u()}catch(t){h.e(t)}finally{h.f()}}}}])}();function nt(t){return nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nt(t)}function rt(t){return function(t){if(Array.isArray(t))return ot(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||it(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){if(t){if("string"==typeof t)return ot(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ot(t,e):void 0}}function ot(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function st(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,at(r.key),r)}}function at(t){var e=function(t,e){if("object"!=nt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=nt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==nt(e)?e:e+""}var lt=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.innerRadius=20,this.outerRadius=300,this.turns=4,this.spread=1,this.smoothing=.15,this.angleOffset=0,this.jitter=.002,this.wobbleStrength=2,this.wobbleFrequency=2},e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this,n=this.model.getNodes(),r=n.filter((function(t){return"moon"===t.type})),i=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=it(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(n.filter((function(t){return"planet"===t.type})));try{var o=function(){var n=t.value,i=n.scalarField;if(!i)return 0;var o=r.filter((function(t){return n.rule(t)}));if(0===o.length)return 0;o.sort((function(t,e){var n,r;return(null!==(n=t.data[i])&&void 0!==n?n:0)-(null!==(r=e.data[i])&&void 0!==r?r:0)}));var s=o.map((function(t){return t.data[i]})).filter((function(t){return null!=t}));if(0===s.length)return 0;var a=Math.min.apply(Math,rt(s)),l=Math.max.apply(Math,rt(s));o.forEach((function(t,r){var o=t.data[i];null==o&&(o=a);var s=l>a?(o-a)/(l-a):.5,c=e.angleOffset+s*e.turns*Math.PI*2,h=e.innerRadius+s*(e.outerRadius-e.innerRadius)*e.spread;void 0===t._spiralPhase&&(t._spiralPhase=Math.random()*Math.PI*2),t._spiralPhase+=.02;var u=Math.sin(t._spiralPhase*e.wobbleFrequency)*e.wobbleStrength,d=n.x+Math.cos(c)*(h+u),f=n.y+Math.sin(c)*(h+u);Math.random(),e.jitter,t.x+=(d-t.x)*e.smoothing,t.y+=(f-t.y)*e.smoothing}))};for(i.s();!(t=i.n()).done;)o()}catch(t){i.e(t)}finally{i.f()}}}],e&&st(t.prototype,e),n&&st(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ut(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ut(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function ut(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function dt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ft(r.key),r)}}function ft(t){var e=function(t,e){if("object"!=ct(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ct(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ct(e)?e:e+""}var pt=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.innerRadius=50,this.outerRadius=240,this.angularSpeed=.002,this.smoothing=.15,this.wobbleStrength=2,this.wobbleFrequency=2,this.angleJitter=.002},e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this,n=this.model.getNodes(),r=n.filter((function(t){return"moon"===t.type})),i=ht(n.filter((function(t){return"planet"===t.type})));try{var o=function(){var n=t.value;n._orbits=[];var i=n.scalarField;if(!i)return 0;var o=r.filter((function(t){return n.rule(t)}));if(!o.length)return 0;var s={};o.forEach((function(t){var e=null!=t.data[i]?t.data[i]:"__null__";s[e]||(s[e]=[]),s[e].push(t)}));var a=Object.keys(s),l=a.length;a.forEach((function(t,r){var i=s[t],o=e.innerRadius+r/(l-1||1)*(e.outerRadius-e.innerRadius);n._orbits.push({value:t,radius:o,count:i.length}),i.forEach((function(t,r){void 0===t._orbitAngle&&(t._orbitAngle=Math.random()*Math.PI*2),t._orbitAngle+=e.angularSpeed;var i=Math.sin(t._orbitAngle*e.wobbleFrequency)*e.wobbleStrength,s=n.x+Math.cos(t._orbitAngle)*(o+i),a=n.y+Math.sin(t._orbitAngle)*(o+i);t._orbitAngle+=(Math.random()-.5)*e.angleJitter,t.x+=(s-t.x)*e.smoothing,t.y+=(a-t.y)*e.smoothing}))}))};for(i.s();!(t=i.n()).done;)o()}catch(t){i.e(t)}finally{i.f()}}}],e&&dt(t.prototype,e),n&&dt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function mt(t){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt(t)}function yt(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return gt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function gt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function vt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,bt(r.key),r)}}function bt(t){var e=function(t,e){if("object"!=mt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=mt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==mt(e)?e:e+""}var xt=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gravity=.05,this.damping=.999,this.restitution=.7,this.friction=.98,this.radius=10},(e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this.model.getNodes().filter((function(t){return"moon"===t.type})),n=this.bounds,r=n.maxY,i=yt(e);try{for(i.s();!(t=i.n()).done;){var o=t.value;if(!o.fixed){if(o.vy+=this.gravity,o.x+=o.vx,o.y+=o.vy,o.y+this.radius>r){o.y=r-this.radius,o.vy*=-this.restitution,o.vx*=this.friction;var s=.6*(Math.random()-.5),a=.4*Math.abs(o.vy);o.vx+=Math.sin(s)*a}o.x-this.radius<n.minX&&(o.x=n.minX+this.radius,o.vx*=-this.restitution),o.x+this.radius>n.maxX&&(o.x=n.maxX-this.radius,o.vx*=-this.restitution),o.vx*=this.damping,o.vy*=this.damping}}}catch(t){i.e(t)}finally{i.f()}}}])&&vt(t.prototype,e),n&&vt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function _t(t){return _t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_t(t)}function wt(t){return function(t){if(Array.isArray(t))return Ct(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||St(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function St(t,e){if(t){if("string"==typeof t)return Ct(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ct(t,e):void 0}}function Ct(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Et(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,kt(r.key),r)}}function kt(t){var e=function(t,e){if("object"!=_t(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_t(e)?e:e+""}var Tt=function(){return t=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.view=e,this.model=n,this.main=null,this.selected=new Set,this._bindViewEvents()},e=[{key:"_bindViewEvents",value:function(){var t=this;this.view.onNodeClick=function(e){t._inspectNode(e)},this.view.interaction.onNodeRightClick=function(e){var n=e.node,r=e.global,i=(e.ev,t.view.app.canvas.getBoundingClientRect());console.log("CLICKEDDD",n);var o=i.left+r.x,s=i.top+r.y;t.view.selectedNodes.size>1?t._showGroupContextMenu(o,s,n):t._showContextMenu(o,s,n)},this.view.interaction.onStageRightClick=function(e){var n=t.view.app.canvas.getBoundingClientRect();console.log("CLICKEDDD");var r=n.left+e.x,i=n.top+e.y;t.view.selectedNodes.size>1?t._showGroupContextMenu(r,i,null):t._showGraphContextMenu(r,i)},this.view.onNodeDragStart=function(t){t.vx=0,t.vy=0,t.fixed=!0},this.view.onNodeDragMove=function(t,e){t.x=e.x,t.y=e.y},this.view.onNodeDragEnd=function(t){t.fixed=!1},this.view.interaction.onBackgroundPointerDown=function(){t._hideContextMenu(),t._hideGraphContextMenu()},this.view.onSelectionChange=function(e){console.log("Selected nodes:",e),t._refreshFormulaNodes()}}},{key:"_showGraphContextMenu",value:function(t,e){var n=this;this._hideGraphContextMenu();var r=document.createElement("div");r.className="context-menu";var i=this.view.app.canvas.parentElement,o=i.getBoundingClientRect();r.style.position="absolute",r.style.left="".concat(t-o.left,"px"),r.style.top="".concat(e-o.top,"px"),r.style.background="#2b2b2b",r.style.color="#fff",r.style.padding="6px",r.style.borderRadius="8px",r.style.zIndex=1e3,r.style.minWidth="160px",r.style.boxShadow="0 4px 12px rgba(0,0,0,0.4)",r.style.fontSize="13px",r.style.userSelect="none";var s=function(t,e){var n=document.createElement("div");return n.textContent=t,n.style.padding="8px 12px",n.style.borderRadius="6px",n.style.cursor="pointer",n.style.transition="background 0.15s",n.addEventListener("mouseenter",(function(){n.style.background="#3a3a3a"})),n.addEventListener("mouseleave",(function(){n.style.background="transparent"})),n.addEventListener("click",e),n};r.appendChild(s("⏸ Freeze Graph",(function(){var t,e;null===(t=(e=n.main).pauseGraph)||void 0===t||t.call(e),n._hideGraphContextMenu()}))),r.appendChild(s("▶ Resume Graph",(function(){var t,e;null===(t=(e=n.main).resumeGraph)||void 0===t||t.call(e),n._hideGraphContextMenu()}))),r.appendChild(s("| Remove Y Axis",(function(){n.model.removeYVectors(),n._hideGraphContextMenu()}))),r.appendChild(s("- Remove X Axis",(function(){n.model.removeXVectors(),n._hideGraphContextMenu()}))),r.appendChild(s("hide this menu",(function(){n._hideGraphContextMenu()}))),i.appendChild(r);var a=r.getBoundingClientRect(),l=t-o.left,c=e-o.top;l+a.width>o.width&&(l=o.width-a.width-4),c+a.height>o.height&&(c=o.height-a.height-4),l=Math.max(4,l),c=Math.max(4,c),r.style.left="".concat(l,"px"),r.style.top="".concat(c,"px"),this._graphContextMenu=r}},{key:"_inspectNode",value:function(t){var e=document.getElementById("inspector");e||((e=document.createElement("div")).id="inspector",document.body.appendChild(e)),e.innerHTML="\n <pre>".concat(JSON.stringify(t.data,null,2),"</pre>\n ")}},{key:"_hideGraphContextMenu",value:function(){this._graphContextMenu&&(this._graphContextMenu.remove(),this._graphContextMenu=null)}},{key:"_showContextMenu",value:function(t,e,n){var r=this;this._hideContextMenu();var i=document.createElement("div");i.className="context-menu";var o=this.view.app.canvas.parentElement,s=o.getBoundingClientRect();i.style.position="absolute",i.style.left="".concat(t-s.left,"px"),i.style.top="".concat(e-s.top,"px"),i.style.background="#2b2b2b",i.style.color="#fff",i.style.padding="6px",i.style.borderRadius="8px",i.style.zIndex=1e3,i.style.minWidth="140px",i.style.boxShadow="0 4px 12px rgba(0,0,0,0.4)",i.style.fontSize="13px",i.style.userSelect="none";var a=function(t,e){var n=document.createElement("div");return n.textContent=t,n.style.padding="8px 12px",n.style.borderRadius="6px",n.style.cursor="pointer",n.style.transition="background 0.15s",n.addEventListener("mouseenter",(function(){n.style.background="#3a3a3a"})),n.addEventListener("mouseleave",(function(){n.style.background="transparent"})),n.addEventListener("click",e),n};i.appendChild(a("🗑 Delete Node",(function(){r._deleteNode(n),r._hideContextMenu()})));var l=document.createElement("div");l.style.height="1px",l.style.background="#444",l.style.margin="4px 0",i.appendChild(l),i.appendChild(a("🔍 Inspect",(function(){var t,e;null===(t=(e=r.main).onNodeInspect)||void 0===t||t.call(e,n),r._hideContextMenu()}))),o.appendChild(i),i.style.visibility="hidden",i.style.left="0px",i.style.top="0px";var c=i.getBoundingClientRect(),h=t-s.left,u=e-s.top,d=s.width,f=s.height;h+c.width>d&&(h=d-c.width-4),u+c.height>f&&(u=f-c.height-4),h=Math.max(4,h),u=Math.max(4,u),i.style.left="".concat(h,"px"),i.style.top="".concat(u,"px"),i.style.visibility="visible",this._contextMenu=i}},{key:"_hideContextMenu",value:function(){this._contextMenu&&(this._contextMenu.remove(),this._contextMenu=null),this._hideGroupContextMenu()}},{key:"_showGroupContextMenu",value:function(t,e,n){var r=this;this._hideGroupContextMenu();var i=document.createElement("div");i.className="context-menu";var o=this.view.app.canvas.parentElement,s=o.getBoundingClientRect();i.style.position="absolute",i.style.left="".concat(t-s.left,"px"),i.style.top="".concat(e-s.top,"px"),i.style.background="#2b2b2b",i.style.color="#fff",i.style.padding="6px",i.style.borderRadius="8px",i.style.zIndex=1e3,i.style.minWidth="140px",i.style.boxShadow="0 4px 12px rgba(0,0,0,0.4)",i.style.fontSize="13px",i.style.userSelect="none";var a=function(t,e){var n=document.createElement("div");return n.textContent=t,n.style.padding="8px 12px",n.style.borderRadius="6px",n.style.cursor="pointer",n.style.transition="background 0.15s",n.addEventListener("mouseenter",(function(){n.style.background="#3a3a3a"})),n.addEventListener("mouseleave",(function(){n.style.background="transparent"})),n.addEventListener("click",e),n};i.appendChild(a("🗑 Delete Selected Nodes",(function(){for(var t=0,e=wt(r.view.selectedNodes);t<e.length;t++){var n=e[t];r._deleteNode(n)}r.view.selectedNodes.clear(),r.view.renderer.updateSelection(r.view.selectedNodes),r._hideGroupContextMenu()})));var l=document.createElement("div");l.style.height="1px",l.style.background="#444",l.style.margin="4px 0",i.appendChild(l),i.appendChild(a("🔍 Inspect Selection",(function(){var t,e;null===(t=(e=r.main).onGroupInspect)||void 0===t||t.call(e,r.view.getSelectedMoons()),r._hideGroupContextMenu()}))),o.appendChild(i),this._groupContextMenu=i}},{key:"_hideGroupContextMenu",value:function(){this._groupContextMenu&&(this._groupContextMenu.remove(),this._groupContextMenu=null)}},{key:"_deleteNode",value:function(t){var e,n,r;this.model.deleteNode(t.id),this.view.renderer.remove(t.id),null===(e=this.view.selectedNodes)||void 0===e||e.delete(t),this.view.renderer.updateSelection(this.view.selectedNodes),null===(n=(r=this.view).onSelectionChange)||void 0===n||n.call(r,this.view.selectedNodes),this._hideContextMenu()}},{key:"_highlight",value:function(t){var e=this.view.graphicsMap.get(t);e&&(e.tint=16711680)}},{key:"_refreshFormulaNodes",value:function(){var t,e=this.model.getNodes(),n=e.filter((function(t){return"formula"!==t.type})),r=wt(this.view.selectedNodes).filter((function(t){return"formula"!==t.type})),i={sum:function(t,e){return t.reduce((function(t,n){var r;return t+Number((null===(r=n.data)||void 0===r?void 0:r[e])||0)}),0)},count:function(t){return t.length},avg:function(t,e){return t.length?i.sum(t,e)/t.length:0},min:function(t,e){return t.length?Math.min.apply(Math,wt(t.map((function(t){var n;return Number((null===(n=t.data)||void 0===n?void 0:n[e])||0)})))):0},max:function(t,e){return t.length?Math.max.apply(Math,wt(t.map((function(t){var n;return Number((null===(n=t.data)||void 0===n?void 0:n[e])||0)})))):0}},o=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=St(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(e);try{for(o.s();!(t=o.n()).done;){var s=t.value;if("formula"===s.type){console.log("refreshing".node);var a="selected"===s.scope?r:n,l=i[s.formula]||i.sum;s.value=l(a,s.scalarField)}}}catch(t){o.e(t)}finally{o.f()}}}],e&&Et(t.prototype,e),n&&Et(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}(),At=i(8507);const Mt={extension:{type:At.Ag.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.all([i.e(859),i.e(397)]).then(i.bind(i,8397))}},Pt={extension:{type:At.Ag.Environment,name:"webworker",priority:0},test:()=>"undefined"!=typeof self&&void 0!==self.WorkerGlobalScope,load:async()=>{await Promise.all([i.e(859),i.e(162)]).then(i.bind(i,2162))}};i(5753),i(6312);var Ot=i(1761),It=i(800);let Lt,jt;async function Rt(t={}){return void 0!==jt||(jt=await(async()=>{const e=Ot.e.get().getNavigator().gpu;if(!e)return!1;try{const n=await e.requestAdapter(t);return await n.requestDevice(),!0}catch(t){return!1}})()),jt}const Dt=["webgl","webgpu","canvas"];var Nt=i(5559),Ft=i(7073),Bt=i(4670);class Gt{static init(t){Object.defineProperty(this,"resizeTo",{configurable:!0,set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame((()=>this.resize())))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;let t,e;if(this._cancelResize(),this._resizeTo===globalThis.window)t=globalThis.innerWidth,e=globalThis.innerHeight;else{const{clientWidth:n,clientHeight:r}=this._resizeTo;t=n,e=r}this.renderer.resize(t,e),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Gt.extension=At.Ag.Application;var zt=i(4458),Ut=i(7309);class Wt{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{configurable:!0,set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,zt.d.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Ut.R.shared:new Ut.R,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Wt.extension=At.Ag.Application,At.XO.add(Gt),At.XO.add(Wt);const Ht=class t{constructor(...t){this.stage=new Nt.mc,void 0!==t[0]&&(0,Bt.t6)(Bt.lj,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.stage||(this.stage=new Nt.mc),this.renderer=await async function(t){let e,n=[];t.preference?(n.push(t.preference),Dt.forEach((e=>{e!==t.preference&&n.push(e)}))):n=Dt.slice();let r={};for(let s=0;s<n.length;s++){const a=n[s];if("webgpu"===a&&await Rt()){const{WebGPURenderer:n}=await Promise.all([i.e(468),i.e(866)]).then(i.bind(i,9866));e=n,r={...t,...t.webgpu};break}if("webgl"===a&&(o=t.failIfMajorPerformanceCaveat??It.k.defaultOptions.failIfMajorPerformanceCaveat,void 0!==Lt||(Lt=(()=>{const t={stencil:!0,failIfMajorPerformanceCaveat:o??It.k.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Ot.e.get().getWebGLRenderingContext())return!1;let e=Ot.e.get().createCanvas().getContext("webgl",t);const n=!!e?.getContextAttributes()?.stencil;if(e){const t=e.getExtension("WEBGL_lose_context");t&&t.loseContext()}return e=null,n}catch(t){return!1}})()),Lt)){const{WebGLRenderer:n}=await Promise.all([i.e(468),i.e(132)]).then(i.bind(i,4132));e=n,r={...t,...t.webgl};break}if("canvas"===a){const{CanvasRenderer:n}=await Promise.all([i.e(468),i.e(851)]).then(i.bind(i,6851));e=n,r={...t,...t.canvasOptions};break}}var o;if(delete r.webgpu,delete r.webgl,delete r.canvasOptions,!e)throw new Error("No available renderer for the current environment");const s=new e;return await s.init(r),s}(e),t._plugins.forEach((t=>{t.init.call(this,e)}))}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return(0,Bt.t6)(Bt.lj,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,n=!1){const r=t._plugins.slice(0);r.reverse(),r.forEach((t=>{t.destroy.call(this)})),this.stage.destroy(n),this.stage=null,this.renderer.destroy(e),this.renderer=null}};Ht._plugins=[];let Vt=Ht;At.XO.handleByList(At.Ag.Application,Vt._plugins),At.XO.add(Ft.M);var Yt=i(6125),Xt=i(9252),$t=(i(9726),i(4663)),qt=i(583),Kt=i(218),Zt=i(2812),Jt=i(4985);class Qt extends Jt.l{constructor(t,e){const{text:n,resolution:r,style:i,anchor:o,width:s,height:a,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=n??"",this.style=i,this.resolution=r??null,this.allowChildren=!1,this._anchor=new Zt.o({_onUpdate:()=>{this.onViewUpdate()}}),o&&(this.anchor=o),this.roundPixels=l??!1,void 0!==s&&(this.width=s),void 0!==a&&(this.height=a)}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=null===t,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){"object"==typeof t?(e=t.height??t.width,t=t.width):e??(e=t),void 0!==t&&this._setWidth(t,this.bounds.width),void 0!==e&&this._setHeight(e,this.bounds.height)}containsPoint(t){const e=this.bounds.width,n=this.bounds.height,r=-e*this.anchor.x;let i=0;return t.x>=r&&t.x<=r+e&&(i=-n*this.anchor.y,t.y>=i&&t.y<=i+n)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,("boolean"==typeof t?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}}var te=i(2577),ee=i(7608),ne=i(9939);let re=null,ie=null;function oe(t,e,n){for(let r=0,i=4*n*e;r<e;++r,i+=4)if(0!==t[i+3])return!1;return!0}function se(t,e,n,r,i){const o=4*e;for(let e=r,s=r*o+4*n;e<=i;++e,s+=o)if(0!==t[s+3])return!1;return!0}function ae(...t){let e=t[0];e.canvas||(e={canvas:t[0],resolution:t[1]});const{canvas:n}=e,r=Math.min(e.resolution??1,1),i=e.width??n.width,o=e.height??n.height;let s=e.output;if(function(t,e){re||(re=Ot.e.get().createCanvas(256,128),ie=re.getContext("2d",{willReadFrequently:!0}),ie.globalCompositeOperation="copy",ie.globalAlpha=1),(re.width<t||re.height<e)&&(re.width=(0,ne.U5)(t),re.height=(0,ne.U5)(e))}(i,o),!ie)throw new TypeError("Failed to get canvas 2D context");ie.drawImage(n,0,0,i,o,0,0,i*r,o*r);const a=ie.getImageData(0,0,i,o).data;let l=0,c=0,h=i-1,u=o-1;for(;c<o&&oe(a,i,c);)++c;if(c===o)return Xt.M.EMPTY;for(;oe(a,i,u);)--u;for(;se(a,i,l,c,u);)++l;for(;se(a,i,h,c,u);)--h;return++h,++u,ie.globalCompositeOperation="source-over",ie.strokeRect(l,c,h-l,u-c),ie.globalCompositeOperation="copy",s??(s=new Xt.M),s.set(l/r,c/r,(h-l)/r,(u-c)/r),s}class le{constructor(t=0,e=0,n=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=n,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,null!==e.prev&&(e.prev.next=e.next),null!==e.next&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){const e=new Array(t.length);for(let n=0;n<t.length;n++){const r=t[n];e[n]=[r,this.get(r)]}return e}evict(t=!1){if(t||this.size>0){const t=this.first;delete this.items[t.key],0==--this.size?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){const e=this.items[t];if(void 0!==e)return this.ttl>0&&e.expiry<=Date.now()?void this.delete(t):(this.moveToEnd(e),e.value)}has(t){return t in this.items}moveToEnd(t){this.last!==t&&(null!==t.prev&&(t.prev.next=t.next),null!==t.next&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),t.prev=this.last,t.next=null,null!==this.last&&(this.last.next=t),this.last=t,null===this.first&&(this.first=t))}keys(){const t=new Array(this.size);let e=this.first,n=0;for(;null!==e;)t[n++]=e.key,e=e.next;return t}setWithEvicted(t,e,n=this.resetTtl){let r=null;if(this.has(t))this.set(t,e,!0,n);else{this.max>0&&this.size===this.max&&(r={...this.first},this.evict(!0));let n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e};1==++this.size?this.first=n:this.last.next=n,this.last=n}return r}set(t,e,n=!1,r=this.resetTtl){let i=this.items[t];return n||void 0!==i?(i.value=e,!1===n&&r&&(i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(i)):(this.max>0&&this.size===this.max&&this.evict(!0),i=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},1==++this.size?this.first=i:this.last.next=i,this.last=i),this}values(t=this.keys()){const e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=this.get(t[n]);return e}}function ce(t){return!!t.tagStyles&&Object.keys(t.tagStyles).length>0}function he(t){return t.includes("<")}function ue(t,e){const n=[],r=e.tagStyles;if(!ce(e)||!he(t))return n.push({text:t,style:e}),n;const i=[e],o=[];let s="",a=0;for(;a<t.length;){const e=t[a];if("<"===e){const h=t.indexOf(">",a);if(-1===h){s+=e,a++;continue}const u=t.slice(a+1,h);if(u.startsWith("/")){const e=u.slice(1).trim();if(o.length>0&&o[o.length-1]===e){s.length>0&&(n.push({text:s,style:i[i.length-1]}),s=""),i.pop(),o.pop(),a=h+1;continue}s+=t.slice(a,h+1),a=h+1;continue}{const e=u.trim();if(r[e]){s.length>0&&(n.push({text:s,style:i[i.length-1]}),s="");const t=i[i.length-1],u=(l=t,c=r[e],l.clone().assign(c));i.push(u),o.push(e),a=h+1;continue}s+=t.slice(a,h+1),a=h+1;continue}}s+=e,a++}var l,c;return s.length>0&&n.push({text:s,style:i[i.length-1]}),n}const de=new Set([10,13]),fe=new Set([9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]),pe=(new Set([9,32]),new Set([45,8208,8211,8212,173])),me=/(\r\n|\r|\n)/,ye=/(?:\r\n|\r|\n)/;function ge(t){return"string"==typeof t&&de.has(t.charCodeAt(0))}function ve(t,e){return"string"==typeof t&&fe.has(t.charCodeAt(0))}function be(t){return"string"==typeof t&&pe.has(t.charCodeAt(0))}function xe(t){return"normal"===t||"pre-line"===t}function _e(t){return"normal"===t}function we(t){if("string"!=typeof t)return"";let e=t.length-1;for(;e>=0&&ve(t[e]);)e--;return e<t.length-1?t.slice(0,e+1):t}function Se(t){const e=[],n=[];if("string"!=typeof t)return e;for(let r=0;r<t.length;r++){const i=t[r],o=t[r+1];ve(i)||ge(i)?(n.length>0&&(e.push(n.join("")),n.length=0),"\r"===i&&"\n"===o?(e.push("\r\n"),r++):e.push(i)):(n.push(i),be(i)&&o&&!ve(o)&&!ge(o)&&(e.push(n.join("")),n.length=0))}return n.length>0&&e.push(n.join("")),e}function Ce(t,e,n,r){const i=n(t),o=[];for(let n=0;n<i.length;n++){let s=i[n],a=s,l=1;for(;i[n+l];){const o=i[n+l];if(r(a,o,t,n,e))break;s+=o,a=o,l++}n+=l-1,o.push(s)}return o}const Ee=/\r\n|\r|\n/g;function ke(t,e,n,r,i,o,s,a){const l=ue(t,e);if(_e(e.whiteSpace))for(let t=0;t<l.length;t++){const e=l[t];l[t]={text:e.text.replace(Ee," "),style:e.style}}const c=[];let h=[];for(const t of l){const e=t.text.split(me);for(let n=0;n<e.length;n++){const r=e[n];"\r\n"===r||"\r"===r||"\n"===r?(c.push(h),h=[]):r.length>0&&h.push({text:r,style:t.style})}}(h.length>0||0===c.length)&&c.push(h);const u=n?function(t,e,n,r,i,o){const{letterSpacing:s,whiteSpace:a,wordWrapWidth:l,breakWords:c}=e,h=xe(a),u=l+s,d={};let f="";const p=(t,e)=>{const i=`${t}|${e.styleKey}`;let o=d[i];if(void 0===o){const s=e._fontString;s!==f&&(n.font=s,f=s),o=r(t,e.letterSpacing,n)+e.letterSpacing,d[i]=o}return o},m=[];for(const e of t){const t=Te(e),n=m.length,r=e=>{let n=0,r=e;do{const{token:e,style:i}=t[r];n+=p(e,i),r++}while(r<t.length&&t[r].continuesFromPrevious);return n},s=e=>{const n=[];let r=e;do{n.push({token:t[r].token,style:t[r].style}),r++}while(r<t.length&&t[r].continuesFromPrevious);return n};let a=[],l=0,d=!h,f=null;const y=()=>{f&&f.text.length>0&&a.push(f),f=null},g=()=>{if(y(),a.length>0){const t=a[a.length-1];t.text=we(t.text),0===t.text.length&&a.pop()}m.push(a),a=[],l=0,d=!1};for(let e=0;e<t.length;e++){const{token:n,style:v,continuesFromPrevious:b}=t[e],x=p(n,v);if(h){const t=ve(n),e=f?.text[f.text.length-1]??a[a.length-1]?.text.slice(-1)??"",r=!!e&&ve(e);if(t&&r)continue}const _=!b,w=_?r(e):x;if(w>u&&_)if(l>0&&g(),c){const t=s(e);for(let e=0;e<t.length;e++){const n=t[e].token,r=t[e].style,s=Ce(n,c,o,i);for(const t of s){const e=p(t,r);e+l>u&&g(),f&&f.style===r?f.text+=t:(y(),f={text:t,style:r}),l+=e}}e+=t.length-1}else{const t=s(e);y(),m.push(t.map((t=>({text:t.token,style:t.style})))),d=!1,e+=t.length-1}else if(w+l>u&&_){if(ve(n)){d=!1;continue}g(),f={text:n,style:v},l=x}else if(b&&!c)f&&f.style===v?f.text+=n:(y(),f={text:n,style:v}),l+=x;else{const t=ve(n);if(0===l&&t&&!d)continue;f&&f.style===v?f.text+=n:(y(),f={text:n,style:v}),l+=x}}if(y(),a.length>0){const t=a[a.length-1];t.text=we(t.text),0===t.text.length&&a.pop()}(a.length>0||m.length===n)&&m.push(a)}return m}(c,e,r,i,s,a):c,d=[],f=[],p=[],m=[],y=[];let g=0;const v=o(e._fontString);0===v.fontSize&&(v.fontSize=e.fontSize,v.ascent=e.fontSize);let b="",x=!!e.dropShadow,_=e._stroke?.width||0;for(const t of u){let n=0,s=v.ascent,a=v.descent,l="";for(const e of t){const t=e.style._fontString,c=o(t);t!==b&&(r.font=t,b=t);n+=i(e.text,e.style.letterSpacing,r),s=Math.max(s,c.ascent),a=Math.max(a,c.descent),l+=e.text;const h=e.style._stroke?.width||0;h>_&&(_=h),!x&&e.style.dropShadow&&(x=!0)}0===t.length&&(s=v.ascent,a=v.descent),d.push(n),f.push(s),p.push(a),y.push(l);const c=e.lineHeight||s+a;m.push(c+e.leading),g=Math.max(g,n)}const w=_,S=(n&&"left"!==e.align?Math.max(g,e.wordWrapWidth):g)+w+(e.dropShadow?e.dropShadow.distance:0);let C=0;for(let t=0;t<m.length;t++)C+=m[t];C=Math.max(C,m[0]+w);return{width:S,height:C+(e.dropShadow?e.dropShadow.distance:0),lines:y,lineWidths:d,lineHeight:(e.lineHeight||v.fontSize)+e.leading,maxLineWidth:g,fontProperties:v,runsByLine:u,lineAscents:f,lineDescents:p,lineHeights:m,hasDropShadow:x}}function Te(t){const e=[];let n=!1;for(const r of t){const t=Se(r.text);let i=!0;for(const o of t){const t=ve(o)||ge(o),s=i&&n&&!t;e.push({token:o,style:r.style,continuesFromPrevious:s}),n=!t,i=!1}}return e}const Ae={willReadFrequently:!0};function Me(t,e,n,r,i){let o=n[t];return"number"!=typeof o&&(o=i(t,e,r)+e,n[t]=o),o}const Pe={willReadFrequently:!0},Oe=class t{static get experimentalLetterSpacingSupported(){let e=t._experimentalLetterSpacingSupported;if(void 0===e){const n=Ot.e.get().getCanvasRenderingContext2D().prototype;e=t._experimentalLetterSpacingSupported="letterSpacing"in n||"textLetterSpacing"in n}return e}constructor(t,e,n,r,i,o,s,a,l,c){this.text=t,this.style=e,this.width=n,this.height=r,this.lines=i,this.lineWidths=o,this.lineHeight=s,this.maxLineWidth=a,this.fontProperties=l,c&&(this.runsByLine=c.runsByLine,this.lineAscents=c.lineAscents,this.lineDescents=c.lineDescents,this.lineHeights=c.lineHeights,this.hasDropShadow=c.hasDropShadow)}static measureText(e=" ",n,r=t._canvas,i=n.wordWrap){const o=`${e}-${n.styleKey}-wordWrap-${i}`;if(t._measurementCache.has(o))return t._measurementCache.get(o);if(ce(n)&&he(e)){const r=ke(e,n,i,t._context,t._measureText,t.measureFont,t.canBreakChars,t.wordWrapSplit),s=new t(e,n,r.width,r.height,r.lines,r.lineWidths,r.lineHeight,r.maxLineWidth,r.fontProperties,{runsByLine:r.runsByLine,lineAscents:r.lineAscents,lineDescents:r.lineDescents,lineHeights:r.lineHeights,hasDropShadow:r.hasDropShadow});return t._measurementCache.set(o,s),s}const s=n._fontString,a=t.measureFont(s);0===a.fontSize&&(a.fontSize=n.fontSize,a.ascent=n.fontSize,a.descent=0);const l=t._context;l.font=s;const c=(i?t._wordWrap(e,n,r):e).split(ye),h=new Array(c.length);let u=0;for(let e=0;e<c.length;e++){const r=t._measureText(c[e],n.letterSpacing,l);h[e]=r,u=Math.max(u,r)}const d=n._stroke?.width??0,f=n.lineHeight||a.fontSize,p=t._getAlignWidth(u,n,i),m=t._adjustWidthForStyle(p,n),y=Math.max(f,a.fontSize+d)+(c.length-1)*(f+n.leading),g=t._adjustHeightForStyle(y,n),v=new t(e,n,m,g,c,h,f+n.leading,u,a);return t._measurementCache.set(o,v),v}static _adjustWidthForStyle(t,e){let n=t+(e._stroke?.width||0);return e.dropShadow&&(n+=e.dropShadow.distance),n}static _adjustHeightForStyle(t,e){let n=t;return e.dropShadow&&(n+=e.dropShadow.distance),n}static _getAlignWidth(t,e,n){return n&&"left"!==e.align?Math.max(t,e.wordWrapWidth):t}static _measureText(e,n,r){let i=!1;t.experimentalLetterSpacingSupported&&(t.experimentalLetterSpacing?(r.letterSpacing=`${n}px`,r.textLetterSpacing=`${n}px`,i=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));const o=r.measureText(e);let s=o.width;const a=-(o.actualBoundingBoxLeft??0);let l=(o.actualBoundingBoxRight??0)-a;if(s>0)if(i)s-=n,l-=n;else{const r=(t.graphemeSegmenter(e).length-1)*n;s+=r,l+=r}return Math.max(s,l)}static _wordWrap(e,n,r=t._canvas){return function(t,e,n,r,i,o,s){const a=n.getContext("2d",Ae);a.font=e._fontString;let l=0,c="";const h=[],u=Object.create(null),{letterSpacing:d,whiteSpace:f}=e,p=xe(f),m=_e(f);let y=!p;const g=e.wordWrapWidth+d,v=Se(t);for(let t=0;t<v.length;t++){let n=v[t];if(ge(n)){if(!m){h.push(we(c)),y=!p,c="",l=0;continue}n=" "}if(p){const t=ve(n),e=ve(c[c.length-1]);if(t&&e)continue}const f=Me(n,d,u,a,r);if(f>g)if(""!==c&&(h.push(we(c)),c="",l=0),i(n,e.breakWords)){const t=Ce(n,e.breakWords,s,o);for(const e of t){const t=Me(e,d,u,a,r);t+l>g&&(h.push(we(c)),y=!1,c="",l=0),c+=e,l+=t}}else c.length>0&&(h.push(we(c)),c="",l=0),h.push(we(n)),y=!1,c="",l=0;else f+l>g&&(y=!1,h.push(we(c)),c="",l=0),(c.length>0||!ve(n)||y)&&(c+=n,l+=f)}const b=we(c);return b.length>0&&h.push(b),h.join("\n")}(e,n,r,t._measureText,t.canBreakWords,t.canBreakChars,t.wordWrapSplit)}static isBreakingSpace(t,e){return ve(t)}static canBreakWords(t,e){return e}static canBreakChars(t,e,n,r,i){return!0}static wordWrapSplit(e){return t.graphemeSegmenter(e)}static measureFont(e){if(t._fonts[e])return t._fonts[e];const n=t._context;n.font=e;const r=n.measureText(t.METRICS_STRING+t.BASELINE_SYMBOL),i=r.actualBoundingBoxAscent??0,o=r.actualBoundingBoxDescent??0,s={ascent:i,descent:o,fontSize:i+o};return t._fonts[e]=s,s}static clearMetrics(e=""){e?delete t._fonts[e]:t._fonts={}}static get _canvas(){if(!t.__canvas){let e;try{const n=new OffscreenCanvas(0,0),r=n.getContext("2d",Pe);if(r?.measureText)return t.__canvas=n,n;e=Ot.e.get().createCanvas()}catch(t){e=Ot.e.get().createCanvas()}e.width=e.height=10,t.__canvas=e}return t.__canvas}static get _context(){return t.__context||(t.__context=t._canvas.getContext("2d",Pe)),t.__context}};Oe.METRICS_STRING="|ÉqÅ",Oe.BASELINE_SYMBOL="M",Oe.BASELINE_MULTIPLIER=1.4,Oe.HEIGHT_MULTIPLIER=2,Oe.graphemeSegmenter=(()=>{if("function"==typeof Intl?.Segmenter){const t=new Intl.Segmenter;return e=>{const n=t.segment(e),r=[];let i=0;for(const t of n)r[i++]=t.segment;return r}}return t=>[...t]})(),Oe.experimentalLetterSpacing=!1,Oe._fonts={},Oe._measurementCache=function(t=1e3,e=0,n=!1){if(isNaN(t)||t<0)throw new TypeError("Invalid max value");if(isNaN(e)||e<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof n)throw new TypeError("Invalid resetTtl value");return new le(t,e,n)}(1e3);let Ie=Oe;const Le=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function je(t){const e="number"==typeof t.fontSize?`${t.fontSize}px`:t.fontSize;let n=t.fontFamily;Array.isArray(t.fontFamily)||(n=t.fontFamily.split(","));for(let t=n.length-1;t>=0;t--){let e=n[t].trim();/([\"\'])[^\'\"]+\1/.test(e)||Le.includes(e)||(e=`"${e}"`),n[t]=e}return`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${e} ${n.join(",")}`}var Re=i(9313),De=i(5589),Ne=i(268),Fe=i(7276),Be=i(2806);const Ge=1e5;function ze(t,e,n,r=0,i=0,o=0){if(t.texture===De.g.WHITE&&!t.fill)return te.Q.shared.setValue(t.color).setAlpha(t.alpha??1).toHexa();if(!t.fill){const n=e.createPattern(t.texture.source.resource,"repeat"),r=t.matrix.copyTo(Re.u.shared);return r.scale(t.texture.source.pixelWidth,t.texture.source.pixelHeight),n.setTransform(r),n}if(t.fill instanceof Be.m){const n=t.fill,r=e.createPattern(n.texture.source.resource,"repeat"),i=n.transform.copyTo(Re.u.shared);return i.scale(n.texture.source.pixelWidth,n.texture.source.pixelHeight),r.setTransform(i),r}if(t.fill instanceof Fe._){const s=t.fill,a="linear"===s.type,l="local"===s.textureSpace;let c,h=1,u=1;l&&n&&(h=n.width+r,u=n.height+r);let d=!1;if(a){const{start:t,end:n}=s;c=e.createLinearGradient(t.x*h+i,t.y*u+o,n.x*h+i,n.y*u+o),d=Math.abs(n.x-t.x)<Math.abs(.1*(n.y-t.y))}else{const{center:t,innerRadius:n,outerCenter:r,outerRadius:a}=s;c=e.createRadialGradient(t.x*h+i,t.y*u+o,n*h,r.x*h+i,r.y*u+o,a*h)}if(d&&l&&n){const t=n.lineHeight/u;for(let e=0;e<n.lines.length;e++){const i=(e*n.lineHeight+r/2)/u;s.colorStops.forEach((e=>{let n=i+e.offset*t;n=Math.max(0,Math.min(1,n)),c.addColorStop(Math.floor(n*Ge)/Ge,te.Q.shared.setValue(e.color).toHex())}))}}else s.colorStops.forEach((t=>{c.addColorStop(t.offset,te.Q.shared.setValue(t.color).toHex())}));return c}return(0,Ne.R)("FillStyle not recognised",t),"red"}const Ue=new Xt.M;function We(t){let e=0;for(let n=0;n<t.length;n++)32===t.charCodeAt(n)&&e++;return e}const He=new class{getCanvasAndContext(t){const{text:e,style:n,resolution:r=1}=t,i=n._getFinalPadding(),o=Ie.measureText(e||" ",n),s=Math.ceil(Math.ceil(Math.max(1,o.width)+2*i)*r),a=Math.ceil(Math.ceil(Math.max(1,o.height)+2*i)*r),l=ee.N.getOptimalCanvasAndContext(s,a);this._renderTextToCanvas(n,i,r,l,o);return{canvasAndContext:l,frame:n.trim?ae({canvas:l.canvas,width:s,height:a,resolution:1,output:Ue}):Ue.set(0,0,s,a)}}returnCanvasAndContext(t){ee.N.returnCanvasAndContext(t)}_renderTextToCanvas(t,e,n,r,i){if(i.runsByLine&&i.runsByLine.length>0)return void this._renderTaggedTextToCanvas(i,t,e,n,r);const{canvas:o,context:s}=r,a=je(t),l=i.lines,c=i.lineHeight,h=i.lineWidths,u=i.maxLineWidth,d=i.fontProperties,f=o.height;if(s.resetTransform(),s.scale(n,n),s.textBaseline=t.textBaseline,t._stroke?.width){const e=t._stroke;s.lineWidth=e.width,s.miterLimit=e.miterLimit,s.lineJoin=e.join,s.lineCap=e.cap}let p,m;s.font=a;const y=t.dropShadow?2:1,g=t.wordWrap?Math.max(t.wordWrapWidth,u):u,v=(t._stroke?.width??0)/2;let b=(c-d.fontSize)/2;c-d.fontSize<0&&(b=0);for(let o=0;o<y;++o){const a=t.dropShadow&&0===o,u=a?Math.ceil(Math.max(1,f)+2*e):0,y=u*n;if(a)this._setupDropShadow(s,t,n,y);else{const n=t._gradientBounds,r=t._gradientOffset;if(n){const o={width:n.width,height:n.height,lineHeight:n.height,lines:i.lines};this._setFillAndStrokeStyles(s,t,o,e,v,r?.x??0,r?.y??0)}else r?this._setFillAndStrokeStyles(s,t,i,e,v,r.x,r.y):this._setFillAndStrokeStyles(s,t,i,e,v);s.shadowColor="rgba(0,0,0,0)"}for(let n=0;n<l.length;n++){p=v,m=v+n*c+d.ascent+b,p+=this._getAlignmentOffset(h[n],g,t.align);let i=0;if("justify"===t.align&&t.wordWrap&&n<l.length-1){const t=We(l[n]);t>0&&(i=(g-h[n])/t)}t._stroke?.width&&this._drawLetterSpacing(l[n],t,r,p+e,m+e-u,!0,i),void 0!==t._fill&&this._drawLetterSpacing(l[n],t,r,p+e,m+e-u,!1,i)}}}_renderTaggedTextToCanvas(t,e,n,r,i){const{canvas:o,context:s}=i,{runsByLine:a,lineWidths:l,maxLineWidth:c,lineAscents:h,lineHeights:u,hasDropShadow:d}=t,f=o.height;s.resetTransform(),s.scale(r,r),s.textBaseline=e.textBaseline;const p=d?2:1,m=e.wordWrap?Math.max(e.wordWrapWidth,c):c;let y=e._stroke?.width??0;for(const t of a)for(const e of t){const t=e.style._stroke?.width??0;t>y&&(y=t)}const g=y/2,v=[];for(let t=0;t<a.length;t++){const e=a[t],n=[];for(const t of e){const e=je(t.style);s.font=e,n.push({width:Ie._measureText(t.text,t.style.letterSpacing,s),font:e})}v.push(n)}for(let t=0;t<p;++t){const o=d&&0===t,c=o?Math.ceil(Math.max(1,f)+2*n):0,p=c*r;o||(s.shadowColor="rgba(0,0,0,0)");let y=g;for(let t=0;t<a.length;t++){const d=a[t],f=l[t],b=h[t],x=u[t],_=v[t];let w=g;w+=this._getAlignmentOffset(f,m,e.align);let S=0;if("justify"===e.align&&e.wordWrap&&t<a.length-1){let t=0;for(const e of d)t+=We(e.text);t>0&&(S=(m-f)/t)}const C=y+b;let E=w+n;for(let t=0;t<d.length;t++){const e=d[t],{width:a,font:l}=_[t];if(s.font=l,s.textBaseline=e.style.textBaseline,e.style._stroke?.width){const t=e.style._stroke;if(s.lineWidth=t.width,s.miterLimit=t.miterLimit,s.lineJoin=t.join,s.lineCap=t.cap,o){if(!e.style.dropShadow){E+=a+We(e.text)*S;continue}this._setupDropShadow(s,e.style,r,p)}else{const r=Ie.measureFont(l),i=e.style.lineHeight||r.fontSize,o={width:a,height:i,lineHeight:i,lines:[e.text]};s.strokeStyle=ze(t,s,o,2*n,E-n,y)}this._drawLetterSpacing(e.text,e.style,i,E,C+n-c,!0,S)}E+=a+We(e.text)*S}E=w+n;for(let t=0;t<d.length;t++){const e=d[t],{width:a,font:l}=_[t];if(s.font=l,s.textBaseline=e.style.textBaseline,void 0!==e.style._fill){if(o){if(!e.style.dropShadow){E+=a+We(e.text)*S;continue}this._setupDropShadow(s,e.style,r,p)}else{const t=Ie.measureFont(l),r=e.style.lineHeight||t.fontSize,i={width:a,height:r,lineHeight:r,lines:[e.text]};s.fillStyle=ze(e.style._fill,s,i,2*n,E-n,y)}this._drawLetterSpacing(e.text,e.style,i,E,C+n-c,!1,S)}E+=a+We(e.text)*S}y+=x}}}_setFillAndStrokeStyles(t,e,n,r,i,o=0,s=0){if(t.fillStyle=e._fill?ze(e._fill,t,n,2*r,o,s):null,e._stroke?.width){const a=i+2*r;t.strokeStyle=ze(e._stroke,t,n,a,o,s)}}_setupDropShadow(t,e,n,r){t.fillStyle="black",t.strokeStyle="black";const i=e.dropShadow,o=i.color,s=i.alpha;t.shadowColor=te.Q.shared.setValue(o).setAlpha(s).toRgbaString();const a=i.blur*n,l=i.distance*n;t.shadowBlur=a,t.shadowOffsetX=Math.cos(i.angle)*l,t.shadowOffsetY=Math.sin(i.angle)*l+r}_getAlignmentOffset(t,e,n){return"right"===n?e-t:"center"===n?(e-t)/2:0}_drawLetterSpacing(t,e,n,r,i,o=!1,s=0){const{context:a}=n,l=e.letterSpacing;let c=!1;if(Ie.experimentalLetterSpacingSupported&&(Ie.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,c=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),(0===l||c)&&0===s)return void(o?a.strokeText(t,r,i):a.fillText(t,r,i));if(0!==s&&(0===l||c)){const e=t.split(" ");let n=r;const l=a.measureText(" ").width;for(let t=0;t<e.length;t++)o?a.strokeText(e[t],n,i):a.fillText(e[t],n,i),n+=a.measureText(e[t]).width+l+s;return}let h=r;const u=Ie.graphemeSegmenter(t);let d=a.measureText(t).width,f=0;for(let t=0;t<u.length;++t){const e=u[t];o?a.strokeText(e,h,i):a.fillText(e,h,i);let n="";for(let e=t+1;e<u.length;++e)n+=u[e];f=a.measureText(n).width,h+=d-f+l," "===e&&(h+=s),d=f}}};var Ve=i(8875),Ye=i(133),Xe=i(8393),$e=i(990);const qe=class t extends Ve.A{constructor(e={}){super(),this.uid=(0,Ye.L)("textStyle"),this._tick=0,this._cachedFontString=null,function(t){const e=t;if("boolean"==typeof e.dropShadow&&e.dropShadow){const n=Ke.defaultDropShadow;t.dropShadow={alpha:e.dropShadowAlpha??n.alpha,angle:e.dropShadowAngle??n.angle,blur:e.dropShadowBlur??n.blur,color:e.dropShadowColor??n.color,distance:e.dropShadowDistance??n.distance}}if(void 0!==e.strokeThickness){(0,Bt.t6)(Bt.lj,"strokeThickness is now a part of stroke");const n=e.stroke;let r={};if(te.Q.isColorLike(n))r.color=n;else if(n instanceof Fe._||n instanceof Be.m)r.fill=n;else{if(!Object.hasOwnProperty.call(n,"color")&&!Object.hasOwnProperty.call(n,"fill"))throw new Error("Invalid stroke value.");r=n}t.stroke={...r,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){if((0,Bt.t6)(Bt.lj,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(e.fill)||0===e.fill.length)throw new Error("Invalid fill value. Expected an array of colors for gradient fill.");e.fill.length!==e.fillGradientStops.length&&(0,Ne.R)("The number of fill colors must match the number of fill gradient stops.");const n=new Fe._({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),r=e.fillGradientStops.slice(),i=e.fill.map((t=>te.Q.shared.setValue(t).toNumber()));r.forEach(((t,e)=>{n.addColorStop(t,i[e])})),t.fill={fill:n}}}(e);e instanceof t&&(e=e._toObject());const n={...t.defaultTextStyle,...e};for(const t in n){this[t]=n[t]}this._tagStyles=e.tagStyles??void 0,this.update(),this._tick=0}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.update())}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(e){this._dropShadow!==e&&(this._dropShadow=null!==e&&"object"==typeof e?this._createProxy({...t.defaultDropShadow,...e}):e?this._createProxy({...t.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.update())}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize="string"==typeof t?parseInt(t,10):t,this.update())}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.update())}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.update())}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.update())}get filters(){return this._filters}set filters(t){this._filters!==t&&(this._filters=Object.freeze(t),this.update())}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.update())}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Xe.T.defaultFillStyle,...t},(()=>{this._fill=(0,$e.w)({...this._originalFill},Xe.T.defaultFillStyle)}))),this._fill=(0,$e.w)(0===t?"black":t,Xe.T.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Xe.T.defaultStrokeStyle,...t},(()=>{this._stroke=(0,$e.T)({...this._originalStroke},Xe.T.defaultStrokeStyle)}))),this._stroke=(0,$e.T)(t,Xe.T.defaultStrokeStyle),this.update())}get tagStyles(){return this._tagStyles}set tagStyles(t){this._tagStyles!==t&&(this._tagStyles=t??void 0,this.update())}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){const e=t.defaultTextStyle;for(const t in e)this[t]=e[t]}assign(t){for(const e in t){this[e]=t[e]}return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return null===this._cachedFontString&&(this._cachedFontString=je(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new t(this._toObject())}_getFinalPadding(){let t=0;if(this._filters)for(let e=0;e<this._filters.length;e++)t+=this._filters[e].padding;return Math.max(this._padding,t)}destroy(t=!1){this.removeAllListeners();if("boolean"==typeof t?t:t?.texture){const e="boolean"==typeof t?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(e),this._originalFill?.texture&&this._originalFill.texture.destroy(e),this._stroke?.texture&&this._stroke.texture.destroy(e),this._originalStroke?.texture&&this._originalStroke.texture.destroy(e)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(t,n,r)=>(t[n]===r||(t[n]=r,e?.(n,r),this.update()),!0)})}_isFillStyle(t){return null!==(t??null)&&!(te.Q.isColorLike(t)||t instanceof Fe._||t instanceof Be.m)}};qe.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},qe.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let Ke=qe;var Ze=i(4334),Je=i(2048);var Qe=i(8422);class tn extends Qe.K{}class en{constructor(t){this._renderer=t,t.runners.resolutionChange.add(this),this._managedTexts=new Ze.s({renderer:t,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(const t in this._managedTexts.items){const e=this._managedTexts.items[t];e?._autoResolution&&e.onViewUpdate()}}validateRenderable(t){const e=this._getGpuText(t),n=t.styleKey;return e.currentKey!==n||t._didTextUpdate}addRenderable(t,e){const n=this._getGpuText(t);if(t._didTextUpdate){const e=t._autoResolution?this._renderer.resolution:t.resolution;n.currentKey===t.styleKey&&t._resolution===e||this._updateGpuText(t),t._didTextUpdate=!1,function(t,e){const{texture:n,bounds:r}=t,i=e._style._getFinalPadding();(0,Je.y)(r,e._anchor,n);const o=e._anchor._x*i*2,s=e._anchor._y*i*2;r.minX-=i-o,r.minY-=i-s,r.maxX-=i-o,r.maxY-=i-s}(n,t)}this._renderer.renderPipes.batch.addToBatch(n,e)}updateRenderable(t){const e=this._getGpuText(t);e._batcher.updateElement(e)}_updateGpuText(t){const e=this._getGpuText(t);e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,e.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t.styleKey}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){const e=new tn;return e.currentKey="--",e.renderable=t,e.transform=t.groupTransform,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,this._managedTexts.add(t),e}onTextUnload(t){const e=t._gpuData[this._renderer.uid];if(!e)return;const{canvasText:n}=this._renderer;n.getReferenceCount(e.currentKey)>0?n.decreaseReferenceCount(e.currentKey):e.texture&&n.returnTexture(e.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}en.extension={type:[At.Ag.WebGLPipes,At.Ag.WebGPUPipes,At.Ag.CanvasPipes],name:"text"};var nn=i(2437);const rn=new(i(9636).c);class on{constructor(t,e){this._activeTextures={},this._renderer=t,this._retainCanvasContext=e}getTexture(t,e,n,r){"string"==typeof t&&((0,Bt.t6)("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:n,resolution:e}),t.style instanceof Ke||(t.style=new Ke(t.style)),t.textureStyle instanceof Kt.n||(t.textureStyle=new Kt.n(t.textureStyle)),"string"!=typeof t.text&&(t.text=t.text.toString());const{text:i,style:o,textureStyle:s,autoGenerateMipmaps:a}=t,l=t.resolution??this._renderer.resolution,{frame:c,canvasAndContext:h}=He.getCanvasAndContext({text:i,style:o,resolution:l}),u=function(t,e,n,r,i=!1){const o=rn;o.minX=0,o.minY=0,o.maxX=t.width/r|0,o.maxY=t.height/r|0;const s=nn.W.getOptimalTexture(o.width,o.height,r,!1,i);return s.source.uploadMethodId="image",s.source.resource=t,s.source.alphaMode="premultiply-alpha-on-upload",s.frame.width=e/r,s.frame.height=n/r,s.source.emit("update",s.source),s.updateUvs(),s}(h.canvas,c.width,c.height,l,a);if(s&&(u.source.style=s),o.trim&&(c.pad(o.padding),u.frame.copyFrom(c),u.frame.scale(1/l),u.updateUvs()),o.filters){const t=this._applyFilters(u,o.filters);return this.returnTexture(u),He.returnCanvasAndContext(h),t}return this._renderer.texture.initSource(u._source),this._retainCanvasContext||He.returnCanvasAndContext(h),u}returnTexture(t){const e=t.source,n=e.resource;if(this._retainCanvasContext&&n?.getContext){const t=n.getContext("2d");t&&He.returnCanvasAndContext({canvas:n,context:t})}e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",nn.W.returnTexture(t,!0)}renderTextToCanvas(){(0,Bt.t6)("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;const e=t.styleKey;if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;const n=this.getTexture({text:t.text,style:t.style,resolution:t._resolution,textureStyle:t.textureStyle,autoGenerateMipmaps:t.autoGenerateMipmaps});return this._activeTextures[e]={texture:n,usageCount:1},n}decreaseReferenceCount(t){const e=this._activeTextures[t];e&&(e.usageCount--,0===e.usageCount&&(this.returnTexture(e.texture),this._activeTextures[t]=null))}getReferenceCount(t){return this._activeTextures[t]?.usageCount??0}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}_applyFilters(t,e){const n=this._renderer.renderTarget.renderTarget,r=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(n,!1),r}destroy(){this._renderer=null;for(const t in this._activeTextures)this._activeTextures[t]&&this.returnTexture(this._activeTextures[t].texture);this._activeTextures=null}}class sn extends on{constructor(t){super(t,!0)}}sn.extension={type:[At.Ag.CanvasSystem],name:"canvasText"};class an extends on{constructor(t){super(t,!1)}}an.extension={type:[At.Ag.WebGLSystem,At.Ag.WebGPUSystem],name:"canvasText"},At.XO.add(sn),At.XO.add(an),At.XO.add(en);class ln extends Qt{constructor(...t){const e=function(t,e){let n=t[0]??{};return("string"==typeof n||t[1])&&((0,Bt.t6)(Bt.lj,`use new ${e}({ text: "hi!", style }) instead`),n={text:n,style:t[1]}),n}(t,"Text");super(e,Ke),this.renderPipeId="text",e.textureStyle&&(this.textureStyle=e.textureStyle instanceof Kt.n?e.textureStyle:new Kt.n(e.textureStyle)),this.autoGenerateMipmaps=e.autoGenerateMipmaps??qt.v.defaultOptions.autoGenerateMipmaps}updateBounds(){const t=this._bounds,e=this._anchor;let n=0,r=0;if(this._style.trim){const{frame:t,canvasAndContext:e}=He.getCanvasAndContext({text:this.text,style:this._style,resolution:1});He.returnCanvasAndContext(e),n=t.width,r=t.height}else{const t=Ie.measureText(this._text,this._style);n=t.width,r=t.height}t.minX=-e._x*n,t.maxX=t.minX+n,t.minY=-e._y*r,t.maxY=t.minY+r}}function cn(t){return cn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cn(t)}function hn(t){return function(t){if(Array.isArray(t))return fn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||dn(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function un(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(t){c=!0,i=t}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(t,e)||dn(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dn(t,e){if(t){if("string"==typeof t)return fn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fn(t,e):void 0}}function fn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function pn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,mn(r.key),r)}}function mn(t){var e=function(t,e){if("object"!=cn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=cn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cn(e)?e:e+""}At.XO.add(Mt,Pt);var yn=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.map=new Map},e=[{key:"get",value:function(t){return this.map.get(t)}},{key:"set",value:function(t,e){this.map.set(t,e)}},{key:"has",value:function(t){return this.map.has(t)}},{key:"delete",value:function(t){var e,n=this.map.get(t);null!=n&&n.parent&&n.parent.removeChild(n),null==n||null===(e=n.destroy)||void 0===e||e.call(n),this.map.delete(t)}},{key:"clearDead",value:function(t){var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=dn(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(this.map);try{for(n.s();!(e=n.n()).done;){var r=un(e.value,1)[0],i=r.split("_")[0];t.has(i)||this.delete(r)}}catch(t){n.e(t)}finally{n.f()}}},{key:"forEach",value:function(t){this.map.forEach(t)}},{key:"deleteNode",value:function(t){for(var e=0,n=hn(this.map.keys());e<n.length;e++){var r=n[e];(r===t||r.startsWith(t+"_"))&&this.delete(r)}}}],e&&pn(t.prototype,e),n&&pn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function gn(t){return gn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gn(t)}function vn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,bn(r.key),r)}}function bn(t){var e=function(t,e){if("object"!=gn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=gn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==gn(e)?e:e+""}var xn=function(){return t=function t(e,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.registry=n,this.selection=r,this.interaction=o,this.labelRenderer=s,this.colorResolver="function"==typeof i?i:function(){return 16777215},this.formulaHitPadding=12},(e=[{key:"render",value:function(t){var e;this.ensure(t),this.ensureHalo(t),this.update(t),this.updateHalo(t),null===(e=this.labelRenderer)||void 0===e||e.render(t)}},{key:"ensure",value:function(t){var e=this.registry.get(t.id);return e||((e=new $t.A).eventMode="static",e.cursor="pointer",e.nodeRef=t,this.drawShape(e,t),this.world.addChild(e),this.interaction.bindNode(e,t),this.registry.set(t.id,e),e)}},{key:"ensureHalo",value:function(t){var e="".concat(t.id,"_halo"),n=this.registry.get(e);return n||((n=new $t.A).eventMode="none",n.visible=!1,n.nodeRef=t,this.world.addChildAt(n,0),this.registry.set(e,n),n)}},{key:"update",value:function(t){var e=this.registry.get(t.id);if(e){this.drawShape(e,t),e.x=t.x,e.y=t.y;var n=this.colorResolver(t);e.tint=null!=n?n:16777215,e.visible=!1!==t.visible}}},{key:"updateHalo",value:function(t){var e=this.registry.get("".concat(t.id,"_halo"));if(e){e.clear();var n=this.selection.has(t);if(e.visible=n,n){if("formula"===t.type){var r=this.getFormulaWidth(t),i=this.getFormulaHeight();e.roundRect(-r/2-6,-i/2-6,r+12,i+12,8).stroke({width:2,color:16777215,alpha:.9})}else{var o=this.getRadius(t)+6;e.circle(0,0,o).stroke({width:3,color:16777215,alpha:.9})}e.x=t.x,e.y=t.y}}}},{key:"drawShape",value:function(t,e){t.clear();var n="planet"===e.type?16763904:"formula"===e.type?1973790:16777215;if("formula"===e.type){var r=this.getFormulaWidth(e),i=this.getFormulaHeight(),o=this.formulaHitPadding;return t.roundRect(-r/2,-i/2,r,i,6).fill(n).stroke({color:16777215,width:1,alpha:.3}),void(t.hitArea=new Xt.M(-r/2-o,-i/2-o,r+2*o,i+2*o))}var s=this.getRadius(e);t.circle(0,0,s).fill(n),t.hitArea=new Yt.j(0,0,s+4)}},{key:"getFormulaWidth",value:function(t){var e=t.label||"";return Math.max(120,8*e.length+24)}},{key:"getFormulaHeight",value:function(){return 40}},{key:"getRadius",value:function(t){switch(t.type){case"planet":return 40;case"formula":return 20;default:return 6}}},{key:"updateSelection",value:function(t){this.selection=t}}])&&vn(t.prototype,e),n&&vn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function _n(t){return _n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_n(t)}function wn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Sn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Sn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Cn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,En(r.key),r)}}function En(t){var e=function(t,e){if("object"!=_n(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_n(e)?e:e+""}var kn=function(){return t=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.registry=n},(e=[{key:"render",value:function(t){var e;if("planet"===t.type){var n=t.id+"_orbits",r=this.registry.get(n);r||((r=new $t.A).eventMode="none",this.world.addChildAt(r,0),this.registry.set(n,r)),r.clear();var i,o=wn(null!==(e=t._orbits)&&void 0!==e?e:[]);try{for(o.s();!(i=o.n()).done;){var s=i.value;r.circle(0,0,s.radius).stroke({width:1,color:16777215,alpha:.2})}}catch(t){o.e(t)}finally{o.f()}r.x=t.x,r.y=t.y}}}])&&Cn(t.prototype,e),n&&Cn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function Tn(t){return Tn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tn(t)}function An(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Mn(r.key),r)}}function Mn(t){var e=function(t,e){if("object"!=Tn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Tn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Tn(e)?e:e+""}var Pn=function(){return t=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.uiLayer=e,this.registry=n},(e=[{key:"render",value:function(t){var e,n,r,i,o="".concat(t.id,"_axis"),s=this.registry.get(o);s||((s=new $t.A).nodeRef=t,s.eventMode="static",s.cursor="pointer",this.uiLayer.addChild(s),this.registry.set(o,s)),s.clear();var a=0===(null===(e=t.direction)||void 0===e?void 0:e.x)&&1===(null===(n=t.direction)||void 0===n?void 0:n.y),l=1===(null===(r=t.direction)||void 0===r?void 0:r.x)&&0===(null===(i=t.direction)||void 0===i?void 0:i.y);a?this.renderYAxis(s):l?this.renderXAxis(s):this.renderArrowVector(s,t)}},{key:"renderXAxis",value:function(t){var e,n,r=(null===(e=this.uiLayer.parent.renderer)||void 0===e?void 0:e.width)||800,i=(null===(n=this.uiLayer.parent.renderer)||void 0===n?void 0:n.height)||600,o=r-40;t.rect(0,0,o,2).fill(16777215),t.moveTo(o-10,-6).lineTo(o,1).lineTo(o-10,8).fill(16777215),t.x=20,t.y=i-20}},{key:"renderYAxis",value:function(t){var e,n=(null===(e=this.uiLayer.parent.renderer)||void 0===e?void 0:e.height)||600,r=n-40;t.rect(0,-r,2,r).fill(16777215),t.moveTo(-6,10-r).lineTo(1,-r).lineTo(8,10-r).fill(16777215),t.x=20,t.y=n-20}},{key:"renderArrowVector",value:function(t,e){var n=e.direction.x*e.length,r=e.direction.y*e.length,i=Math.sqrt(n*n+r*r),o=Math.atan2(r,n);t.rect(0,-1,i,2).fill(16755200),t.moveTo(i,0).lineTo(i-10,-5).lineTo(i-10,5).fill(16755200),t.x=e.x,t.y=e.y,t.rotation=o}}])&&An(t.prototype,e),n&&An(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function On(t){return On="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},On(t)}function In(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ln(r.key),r)}}function Ln(t){var e=function(t,e){if("object"!=On(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=On(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==On(e)?e:e+""}var jn=function(){return t=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.registry=n},(e=[{key:"render",value:function(t){if("planet"===t.type||"formula"===t.type){var e="".concat(t.id,"_label"),n=this.registry.get(e);if(n||((n=new ln({text:"",style:{fill:16777215,fontSize:"formula"===t.type?14:12,align:"center"}})).anchor.set(.5),this.world.addChild(n),this.registry.set(e,n)),"formula"===t.type){var r=t.label||t.id,i=Number(t.value||0).toLocaleString();n.text="".concat(r,": ").concat(i)}else n.text=t.label||t.id;n.x=t.x,n.y=t.y}}}])&&In(t.prototype,e),n&&In(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function Rn(t){return Rn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rn(t)}function Dn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Nn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Nn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Fn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Bn(r.key),r)}}function Bn(t){var e=function(t,e){if("object"!=Rn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Rn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Rn(e)?e:e+""}var Gn=function(){return t=function t(e){var n=e.world,r=e.uiLayer,i=e.registry,o=e.selection,s=e.interaction,a=e.colorResolver;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var l=new jn(n,i);this.nodeRenderer=new xn(n,i,o,a,s,l),this.orbitRenderer=new kn(n,i),this.vectorRenderer=new Pn(r,i),this.liveNodeIds=new Set,this.registry=i},(e=[{key:"render",value:function(t){var e,n=Dn(t.getNodes());try{for(n.s();!(e=n.n()).done;){var r=e.value;"vector"!==r.type?(this.nodeRenderer.render(r),"planet"===r.type&&(r.dirty=!0,this.orbitRenderer.render(r))):(r.dirty=!0,this.vectorRenderer.render(r))}}catch(t){n.e(t)}finally{n.f()}}},{key:"updateSelection",value:function(t){this.nodeRenderer.updateSelection(t)}},{key:"remove",value:function(t){var e="string"==typeof t?t:t.id;this.registry.deleteNode(e)}}])&&Fn(t.prototype,e),n&&Fn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function zn(t){return zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zn(t)}function Un(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Wn(r.key),r)}}function Wn(t){var e=function(t,e){if("object"!=zn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=zn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==zn(e)?e:e+""}var Hn=function(){return t=function t(e){var n,r,i,o=this,s=e.app,a=e.world,l=e.registry,c=e.selection,h=e.minScale,u=void 0===h?.1:h,d=e.maxScale,f=void 0===d?10:d;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),n=this,i=function(){var t,e,n,r,i=null===(t=o.dragTarget)||void 0===t?void 0:t.nodeRef;o.isRightClick||(o.dragging||!i||o.isBoxSelecting||((null===(e=o.lastPointer)||void 0===e||null===(e=e.originalEvent)||void 0===e?void 0:e.shiftKey)?o.selection.has(i)?o.selection.delete(i):o.selection.add(i):(o.selection.clear(),o.selection.add(i)),null===(n=o.onSelectionChange)||void 0===n||n.call(o,o.selection)),!o.pointerDownOnStage||o.didDrag||o.dragTarget||(o.selection.clear(),null===(r=o.onSelectionChange)||void 0===r||r.call(o,o.selection)),o.finishBoxSelect()),o.resetPointerState()},(r=Wn(r="onPointerUp"))in n?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i,this.app=s,this.world=a,this.registry=l,this.selection=c,this.dragTarget=null,this.startPos=null,this.dragging=!1,this.isRightClick=!1,this.isBoxSelecting=!1,this.boxStart=null,this.box=null,this.lastPointer=null,this.minScale=u,this.maxScale=f,this.isPanning=!1,this.panLast=null,this.pointers=new Map,this.lastDist=null,this.pointerDownOnStage=!1,this.didDrag=!1},e=[{key:"enable",value:function(){this.initBoxGraphics(),this.enablePointerSystem(),this.enableWheelZoom(),this.enablePinchZoom(),this.enableResize(),this.bindNodes()}},{key:"screenToWorld",value:function(t,e){return{x:(t-this.world.x)/this.world.scale.x,y:(e-this.world.y)/this.world.scale.y}}},{key:"initBoxGraphics",value:function(){this.box=new $t.A,this.app.stage.addChild(this.box)}},{key:"enablePointerSystem",value:function(){var t=this,e=this.app.stage;e.eventMode="static",e.hitArea=this.app.screen,e.on("pointerdown",(function(n){var r,i,o=n.target===e;if(t.lastPointer={x:n.global.x,y:n.global.y},o){if(t.pointerDownOnStage=!0,t.didDrag=!1,null===(r=n.originalEvent)||void 0===r?void 0:r.shiftKey)return t.isBoxSelecting=!0,t.boxStart={x:n.global.x,y:n.global.y},t.isPanning=!1,t.panLast=null,void t.box.clear();t.isPanning=!0,t.panLast={x:n.global.x,y:n.global.y},t.isBoxSelecting=!1,null===(i=t.onBackgroundPointerDown)||void 0===i||i.call(t)}})),e.on("pointermove",(function(e){if(t.lastPointer={x:e.global.x,y:e.global.y},t.isBoxSelecting){var n=Math.min(t.boxStart.x,e.global.x),r=Math.min(t.boxStart.y,e.global.y),i=Math.abs(e.global.x-t.boxStart.x),o=Math.abs(e.global.y-t.boxStart.y);return t.box.clear(),t.box.rect(n,r,i,o),t.box.fill({color:43775,alpha:.15}),void t.box.stroke({color:43775,width:1})}if(t.isPanning&&t.panLast&&!t.dragTarget){var s=e.global.x-t.panLast.x,a=e.global.y-t.panLast.y;return t.world.x+=s,t.world.y+=a,t.panLast={x:e.global.x,y:e.global.y},void(t.didDrag=!0)}if(t.dragTarget&&t.startPos){var l=e.global.x-t.startPos.x,c=e.global.y-t.startPos.y;if(Math.sqrt(l*l+c*c)>5&&(t.dragging=!0),t.dragging){var h=t.dragTarget.nodeRef;if(!h)return;var u=t.screenToWorld(e.global.x,e.global.y);h.x=u.x,h.y=u.y,t.didDrag=!0}}})),e.on("rightdown",(function(n){var r;n.target===e&&(t.isRightClick=!0,null===(r=t.onStageRightClick)||void 0===r||r.call(t,{x:n.global.x,y:n.global.y,world:t.screenToWorld(n.global.x,n.global.y),originalEvent:n.originalEvent}))})),e.on("pointerup",this.onPointerUp),e.on("pointerupoutside",this.onPointerUp)}},{key:"resetPointerState",value:function(){this.dragTarget=null,this.startPos=null,this.dragging=!1,this.isPanning=!1,this.panLast=null,this.pointerDownOnStage=!1,this.didDrag=!1,this.isRightClick=!1}},{key:"finishBoxSelect",value:function(){var t,e=this;if(this.isBoxSelecting){var n=this.lastPointer||this.boxStart,r=Math.min(this.boxStart.x,n.x),i=Math.max(this.boxStart.x,n.x),o=Math.min(this.boxStart.y,n.y),s=Math.max(this.boxStart.y,n.y),a=this.screenToWorld(r,o),l=this.screenToWorld(i,s),c=Math.min(a.x,l.x),h=Math.max(a.x,l.x),u=Math.min(a.y,l.y),d=Math.max(a.y,l.y);this.selection.clear(),this.registry.forEach((function(t){var n=t.nodeRef;n&&n.x>=c&&n.x<=h&&n.y>=u&&n.y<=d&&e.selection.add(n)})),this.box.clear(),this.isBoxSelecting=!1,null===(t=this.onSelectionChange)||void 0===t||t.call(this,this.selection)}}},{key:"enableWheelZoom",value:function(){var t=this,e=this.app.canvas;e.addEventListener("wheel",(function(n){n.preventDefault();var r=e.getBoundingClientRect(),i=n.clientX-r.left,o=n.clientY-r.top,s=n.deltaY>0?.9:1.1;t.zoomAt(i,o,s)}),{passive:!1})}},{key:"zoomAt",value:function(t,e,n){var r=this.screenToWorld(t,e);this.world.scale.x*=n,this.world.scale.y*=n,this.world.scale.x=Math.max(this.minScale,Math.min(this.maxScale,this.world.scale.x)),this.world.scale.y=Math.max(this.minScale,Math.min(this.maxScale,this.world.scale.y)),this.world.x=t-r.x*this.world.scale.x,this.world.y=e-r.y*this.world.scale.y}},{key:"enablePinchZoom",value:function(){var t=this;this.app.canvas.addEventListener("pointermove",(function(e){if(t.pointers.has(e.pointerId)&&(t.pointers.set(e.pointerId,e),2===t.pointers.size)){var n=Array.from(t.pointers.values()),r=n[0].clientX-n[1].clientX,i=n[0].clientY-n[1].clientY,o=Math.sqrt(r*r+i*i),s=(n[0].clientX+n[1].clientX)/2,a=(n[0].clientY+n[1].clientY)/2;t.lastDist?(t.zoomAt(s,a,o/t.lastDist),t.lastDist=o):t.lastDist=o}}))}},{key:"enableResize",value:function(){var t=this,e=this.app.canvas.parentElement;this.resizeObserver=new ResizeObserver((function(){var n=e.clientWidth,r=e.clientHeight;t.app.renderer.resize(n,r)})),this.resizeObserver.observe(e)}},{key:"bindNode",value:function(t){var e=this;t.eventMode="static",t.cursor="pointer",t.on("pointerdown",(function(n){n.stopPropagation(),e.dragTarget=t,e.startPos={x:n.global.x,y:n.global.y},e.dragging=!1,e.isBoxSelecting=!1,e.isPanning=!1,e.panLast=null,e.didDrag=!1,t.nodeRef.dirty=!0})),t.on("rightdown",(function(n){var r;n.stopPropagation(),e.isRightClick=!0;var i=t.nodeRef;null===(r=e.onNodeRightClick)||void 0===r||r.call(e,{node:i,global:n.global,ev:n.originalEvent})}))}},{key:"bindNodes",value:function(){var t=this;this.registry.forEach((function(e){t.bindNode(e)}))}}],e&&Un(t.prototype,e),n&&Un(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function Vn(t){return Vn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vn(t)}function Yn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Xn(r.key),r)}}function Xn(t){var e=function(t,e){if("object"!=Vn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Vn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Vn(e)?e:e+""}var $n=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.container=e,this.init()},e=[{key:"init",value:function(){var t=this,e=document.createElement("div");e.className="info-window",Object.assign(e.style,{position:"absolute",top:"0",right:"0",width:"250px",height:"100%",background:"rgba(30, 30, 30, 0.85)",color:"#fff",padding:"12px",boxSizing:"border-box",backdropFilter:"blur(6px)",borderLeft:"1px solid rgba(255,255,255,0.1)",display:"none",zIndex:"999"});var n=document.createElement("div");n.textContent="✕",Object.assign(n.style,{position:"absolute",top:"8px",right:"10px",cursor:"pointer",fontSize:"14px",opacity:"0.7",padding:"2px 6px",borderRadius:"4px",transition:"all 0.15s"}),n.addEventListener("mouseenter",(function(){n.style.background="#444",n.style.opacity="1"})),n.addEventListener("mouseleave",(function(){n.style.background="transparent",n.style.opacity="0.7"})),n.addEventListener("click",(function(){t.hide()})),e.appendChild(n);var r=document.createElement("div");r.style.marginTop="24px",e.appendChild(r),"static"===window.getComputedStyle(this.container).position&&(this.container.style.position="relative"),this.container.appendChild(e),this.panel=e,this.content=r}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.panel.style.display="block",t&&(this.content.innerHTML=t)}},{key:"showWithDrag",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return[]};this.show(),this.content.innerHTML="";var n=document.createElement("div");n.textContent="⠿ Drag selection",n.draggable=!0,Object.assign(n.style,{cursor:"grab",padding:"6px 8px",marginBottom:"8px",background:"#3a3a3a",borderRadius:"6px",fontSize:"12px",textAlign:"center"}),n.addEventListener("dragstart",(function(t){var r={type:"graph-nodes",data:e()};console.log("payload",r);var i=JSON.stringify(r);t.dataTransfer.setData("application/json",i),t.dataTransfer.setData("text/plain",i),n.style.opacity="0.5"})),n.addEventListener("dragend",(function(){n.style.opacity="1"}));var r=document.createElement("div");r.innerHTML=t,this.content.appendChild(n),this.content.appendChild(r)}},{key:"hide",value:function(){this.panel.style.display="none"}},{key:"clear",value:function(){this.content.innerHTML=""}},{key:"getElement",value:function(){return this.panel}}],e&&Yn(t.prototype,e),n&&Yn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function qn(t){return qn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qn(t)}function Kn(){Kn=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof g?e:g,s=Object.create(o.prototype),a=new P(r||[]);return i(s,"_invoke",{value:k(t,n,a)}),s}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",f="suspendedYield",p="executing",m="completed",y={};function g(){}function v(){}function b(){}var x={};c(x,s,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(O([])));w&&w!==n&&r.call(w,s)&&(x=w);var S=b.prototype=g.prototype=Object.create(x);function C(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,s,a){var l=u(t[i],t,o);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==qn(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(h).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(l.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function k(e,n,r){var i=d;return function(o,s){if(i===p)throw Error("Generator is already running");if(i===m){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var l=T(a,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var c=u(e,n,r);if("normal"===c.type){if(i=r.done?m:f,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=u(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function O(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(qn(e)+" is not iterable")}return v.prototype=b,i(S,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:v,configurable:!0}),v.displayName=c(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},C(E.prototype),c(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new E(h(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},C(S),c(S,l,"Generator"),c(S,s,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=O,P.prototype={constructor:P,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(M),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var l=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(l&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;M(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function Zn(t,e,n,r,i,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(r,i)}function Jn(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){Zn(o,r,i,s,a,"next",t)}function a(t){Zn(o,r,i,s,a,"throw",t)}s(void 0)}))}}function Qn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,er(r.key),r)}}function tr(t,e,n){return(e=er(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function er(t){var e=function(t,e){if("object"!=qn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=qn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==qn(e)?e:e+""}var nr=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),tr(this,"getSelectedMoons",(function(){return console.log("regresando seleccion"),n.selectedNodes})),tr(this,"getSelectedNodes",(function(){return Array.from(n.getSelectedMoons()).map((function(t){return t.data}))})),this.container=e,this.selectedNodes=new Set,this.minScale=.1,this.maxScale=10}return e=t,n=[{key:"init",value:(o=Jn(Kn().mark((function t(){var e=this;return Kn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.app=new Vt,t.next=3,this.app.init({resizeTo:this.container,background:1973790});case 3:this.container.appendChild(this.app.canvas),this.world=new Nt.mc,this.uiLayer=new Nt.mc,this.app.stage.addChild(this.world),this.app.stage.addChild(this.uiLayer),this.registry=new yn,this.interaction=new Hn({app:this.app,world:this.world,viewport:this.viewport,registry:this.registry,selection:this.selectedNodes}),this.interaction.enable(),this.renderer=new Gn({world:this.world,uiLayer:this.uiLayer,registry:this.registry,selection:this.selectedNodes,interaction:this.interaction,colorResolver:function(t){var n,r,i;return null!==(n=null===(r=e.model)||void 0===r||null===(i=r.getNodeColor)||void 0===i?void 0:i.call(r,t))&&void 0!==n?n:16777215}}),this.infoWindow=new $n(this.container),this.bindEvents();case 14:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{key:"bindEvents",value:function(){var t=this;this.interaction.onSelectionChange=function(e){var n;t.renderer.updateSelection(e),null===(n=t.onSelectionChange)||void 0===n||n.call(t,e)},this.interaction.onNodeClick=function(e){var n;null===(n=t.onNodeClick)||void 0===n||n.call(t,e)},this.interaction.onNodeRightClick=function(e){var n;null===(n=t.onNodeRightClick)||void 0===n||n.call(t,e)},this.interaction.onBackgroundRightClick=function(e){var n;null===(n=t.onBackgroundRightClick)||void 0===n||n.call(t,e)}}},{key:"render",value:function(t){this.renderer.render(t)}},{key:"renderGraph",value:function(t){this.render(t)}},{key:"center",value:function(t,e){this.viewport.center(t,e)}},{key:"screenToWorld",value:function(t,e){return this.interaction.screenToWorld(t,e)}},{key:"showInfo",value:function(t){this.infoWindow.show(t)}},{key:"showInfoWindow",value:function(t){this.infoWindow.show(t)}},{key:"hideInfo",value:function(){this.infoWindow.hide()}},{key:"toWorld",value:function(t,e){return this.interaction.screenToWorld(t,e)}},{key:"getWorldBounds",value:function(){var t=this.app.canvas,e=this.toWorld(0,0),n=this.toWorld(t.width,t.height);return{minX:e.x,minY:e.y,maxX:n.x,maxY:n.y}}},{key:"_getNodeAtPosition",value:function(t,e){var n=null;return this.registry.forEach((function(r){var i=r.nodeRef;if(i){var o=i.radius||("planet"===i.type?40:10),s=t-i.x,a=e-i.y;s*s+a*a<=o*o&&(n=i)}})),n}},{key:"showInfoWindowWithDrag",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.infoWindow.showWithDrag(t,this.getSelectedNodes)}}],r=[{key:"create",value:(i=Jn(Kn().mark((function e(n){var r;return Kn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new t(n),e.next=3,r.init();case 3:return e.abrupt("return",r);case 4:case"end":return e.stop()}}),e)}))),function(t){return i.apply(this,arguments)})}],n&&Qn(e.prototype,n),r&&Qn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r,i,o}();function rr(t){return rr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rr(t)}function ir(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,or(r.key),r)}}function or(t){var e=function(t,e){if("object"!=rr(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=rr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==rr(e)?e:e+""}var sr=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.nodes=new Map,this.edges=[]},(e=[{key:"addNode",value:function(t){this.nodes.set(t.id,{id:t.id,type:t.type||"moon",x:t.x||0,y:t.y||0,vx:0,vy:0,data:t.data||{},rule:t.rule||null})}},{key:"addMoon",value:function(t){var e=t.id,n=t.x,r=t.y,i=t.data;this.nodes.set(e,{id:e,type:"moon",x:n,y:r,vx:0,vy:0,data:i})}},{key:"addPlanet",value:function(t){var e=t.id,n=t.x,r=t.y,i=t.rule,o=t.scalarField,s=t.label;this.nodes.set(e,{id:e,type:"planet",x:n,y:r,vx:0,vy:0,rule:i,scalarField:o,label:s})}},{key:"addFormula",value:function(t){var e=t.id,n=t.x,r=t.y,i=t.scope,o=t.scalarField,s=t.label,a=t.formula;this.nodes.set(e,{id:e,type:"formula",x:n,y:r,vx:0,vy:0,scope:i,scalarField:o,label:s,formula:a})}},{key:"addVector",value:function(t){var e=t.id,n=t.x,r=t.y,i=t.direction,o=t.length,s=t.scalarField,a=t.rule,l=Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))||1,c={x:i.x/l,y:i.y/l};this.nodes.set(e,{id:e,type:"vector",vector:!0,x:n,y:r,direction:c,length:o||200,scalarField:s,rule:a,vx:0,vy:0})}},{key:"removeYVectors",value:function(){var t=this,e=[];this.nodes.forEach((function(t,n){"vector"===t.type&&t.direction&&Math.abs(t.direction.x)<1e-4&&Math.abs(t.direction.y)>1e-4&&e.push(n)})),e.forEach((function(e){return t.deleteNode(e)}))}},{key:"removeXVectors",value:function(){var t=this,e=[];this.nodes.forEach((function(t,n){"vector"===t.type&&t.direction&&Math.abs(t.direction.y)<1e-4&&Math.abs(t.direction.x)>1e-4&&e.push(n)})),e.forEach((function(e){return t.deleteNode(e)}))}},{key:"addEdge",value:function(t,e){this.edges.push({source:t,target:e})}},{key:"getNode",value:function(t){return this.nodes.get(t)}},{key:"getNodes",value:function(){return Array.from(this.nodes.values())}},{key:"deleteNode",value:function(t){this.nodes.delete(t),this.edges=this.edges.filter((function(e){return e.source!==t&&e.target!==t}))}},{key:"addColorRule",value:function(t){this.colorRules||(this.colorRules=[]),this.colorRules.push(t)}},{key:"getNodeColor",value:function(t){if(!this.colorRules||0===this.colorRules.length)return null;for(var e=this.colorRules.length-1;e>=0;e--){var n,r=this.colorRules[e],i=null===(n=t.data)||void 0===n?void 0:n[r.field];if(null!=i){if(void 0!==r.equals&&i===r.equals)return r.color;if(void 0!==r.gt&&Number(i)>r.gt)return r.color;if(void 0!==r.lt&&Number(i)<r.lt)return r.color}}return null}}])&&ir(t.prototype,e),n&&ir(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function ar(t){return ar="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ar(t)}function lr(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(t){c=!0,i=t}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return cr(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cr(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function cr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function hr(){hr=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof g?e:g,s=Object.create(o.prototype),a=new P(r||[]);return i(s,"_invoke",{value:k(t,n,a)}),s}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",f="suspendedYield",p="executing",m="completed",y={};function g(){}function v(){}function b(){}var x={};c(x,s,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(O([])));w&&w!==n&&r.call(w,s)&&(x=w);var S=b.prototype=g.prototype=Object.create(x);function C(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,s,a){var l=u(t[i],t,o);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==ar(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(h).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(l.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function k(e,n,r){var i=d;return function(o,s){if(i===p)throw Error("Generator is already running");if(i===m){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var l=T(a,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var c=u(e,n,r);if("normal"===c.type){if(i=r.done?m:f,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=u(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function O(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(ar(e)+" is not iterable")}return v.prototype=b,i(S,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:v,configurable:!0}),v.displayName=c(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},C(E.prototype),c(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new E(h(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},C(S),c(S,l,"Generator"),c(S,s,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=O,P.prototype={constructor:P,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(M),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var l=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(l&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;M(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function ur(t,e,n,r,i,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(r,i)}function dr(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){ur(o,r,i,s,a,"next",t)}function a(t){ur(o,r,i,s,a,"throw",t)}s(void 0)}))}}function fr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,pr(r.key),r)}}function pr(t){var e=function(t,e){if("object"!=ar(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ar(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ar(e)?e:e+""}var mr=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.container=e.contentContainer,this.algorithms={rule:g,rule_fast:E,gravity:xt,orbits:pt,spiral:lt,spiral_no:L,vertical:H,sorter_no_col:et}}return e=t,n=[{key:"_init",value:(o=dr(hr().mark((function t(){var e=this;return hr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,nr.create(this.container);case 2:this.view=t.sent,this.view.app.renderer.events.cursorStyles.default="default",this.view.app.renderer.events.domElement.addEventListener("contextmenu",(function(t){t.preventDefault()})),this.model=new sr,this.view.model=this.model,this.controller=new Tt(this.view,this.model),this.controller.main=this,this._enableDrop(),this.algo=new xt,this.algo.setModel(this.model),this.view.app.ticker.add((function(){e.algo.bounds=e.view.getWorldBounds(),e.algo.model.viewportWidth=e.view.width,e.algo.model.viewportHeight=e.view.height,e.isPaused||e.algo.step(),e.view.renderGraph(e.model)}));case 13:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{key:"pauseGraph",value:function(){this.isPaused=!0}},{key:"resumeGraph",value:function(){this.isPaused=!1}},{key:"setAlgorithm",value:function(t){this.algo=t}},{key:"addMoonData",value:function(t){var e=t.id,n=t.x,r=t.y,i=t.data,o=void 0===i?{}:i,s=t.fixed,a=void 0!==s&&s;if(this.model&&this.view){var l=this.view.app.screen.width,c=this.view.app.screen.height,h=void 0!==n?n:Math.random()*l,u=void 0!==r?r:Math.random()*c;this.model.addMoon({id:e,x:h,y:u,data:o,fixed:a}),this.view.renderGraph(this.model)}}},{key:"addRandomMoons",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=["male","female"],n=["a","b","c"],r=0;r<t;r++){var i=crypto.randomUUID(),o=e[Math.floor(Math.random()*e.length)],s=Math.floor(80*Math.random())+1,a=n[Math.floor(Math.random()*n.length)];this.addMoonData({id:i,data:{sex:o,age:s,class:a}})}}},{key:"_dropDataset",value:function(t,e){var n=this;t.forEach((function(t,r){var i=t.id||"moon_".concat(Date.now(),"_").concat(r),o=Math.random()*Math.PI*2,s=200*Math.random(),a=e.x+Math.cos(o)*s,l=e.y+Math.sin(o)*s;n.model.addMoon({id:i,x:a,y:l,data:t})})),this.model.changed=!0}},{key:"_setAlgorithmByName",value:function(t){var e=this.algorithms[t];if(e){var n=new e;n.setModel(this.model),this.setAlgorithm(n)}else console.warn("Unknown algorithm:",t)}},{key:"_enableDrop",value:function(){var t=this,e=this.view.app.view;e.addEventListener("dragover",(function(t){return t.preventDefault()})),e.addEventListener("drop",(function(n){n.preventDefault();var r=e.getBoundingClientRect(),i=n.clientX-r.left,o=n.clientY-r.top,s=t.view.toWorld(i,o),a=(t.view._getNodeAtPosition(s.x,s.y),n.dataTransfer.getData("application/json"));if(a){var l=JSON.parse(a);if("table"!==l.type&&"graph-nodes"!==l.type)if("algorithm"!==l.type){if("color-rule"===l.type)return console.log("dropped color",l),void t.model.addColorRule({field:l.field,equals:l.equals,gt:l.gt,lt:l.lt,color:l.color});if("planet"===l.type){var h=c.build(l.rule);t.model.addPlanet({id:"p_"+Date.now(),x:s.x,y:s.y,rule:h,label:l.label,scalarField:l.scalarField})}if("scalarField"===l.type){var u=t.view._getNodeAtPosition(s.x,s.y);if(u&&"planet"===u.type)return u.scalarFields=u.scalarFields||[],u.scalarFields.includes(l.field)||u.scalarFields.push(l.field),void(u.scalarField=l.field)}if("sumField"===l.type&&t.model.addFormula({id:"f_"+Date.now(),x:s.x,y:s.y,scope:"all",label:"Edad",scalarField:"Edad",formula:"count"}),t.controller._refreshFormulaNodes(),"vector"===l.type){var d=c.build(l.rule);t.model.addVector({id:"p_"+Date.now(),x:s.x,y:s.y,direction:l.direction,length:l.length,scalarField:l.scalarField,rule:d})}}else t._setAlgorithmByName(l.name);else t._dropDataset(l.data,s)}}))}},{key:"getFormatedNode",value:function(t){if("planet"==t.type){var e=t.sumField?"Sum of ".concat(t.sumField):"",n=t.sumTotal?"Sum of ".concat(t.sumField," : ").concat(this.view.formatMoney(t.sumTotal)," "):"";return'\n <h3 style="margin-top:0">ATTRACTOR</h3>\n <div style="font-size:12px; line-height:1.4">\n Attracts nodes with : '.concat(t.label," <br/>\n ").concat(e," </br>\n ").concat(n,"\n </div>\n ")}var r=Object.entries(t);return'\n <h3 style="margin-top:0">'.concat(t.nombre||t.name||t.label||"Node",'</h3>\n <div style="font-size:12px; line-height:1.4">\n ').concat(r.map((function(t){var e,n=lr(t,2),r=n[0],i=n[1];return'\n <div style="display:flex; justify-content:space-between; margin-bottom:4px;">\n <span style="opacity:0.7">'.concat(r,'</span>\n <span style="text-align:right; margin-left:10px;">').concat(null==(e=i)||""===e||"NULL"===e?"<span style='opacity:0.5'>—</span>":e,"</span>\n </div>\n ")})).join(""),"\n </div>\n ")}}],r=[{key:"create",value:(i=dr(hr().mark((function e(n){var r;return hr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new t(n),e.next=3,r._init();case 3:return e.abrupt("return",r);case 4:case"end":return e.stop()}}),e)}))),function(t){return i.apply(this,arguments)})}],n&&fr(e.prototype,n),r&&fr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r,i,o}(),yr=function(t,e){return yr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},yr(t,e)};function gr(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}yr(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var vr=function(){return vr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},vr.apply(this,arguments)};function br(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var xr,_r="ADD_CHOICE",wr="REMOVE_CHOICE",Sr="FILTER_CHOICES",Cr="ACTIVATE_CHOICES",Er="CLEAR_CHOICES",kr="ADD_GROUP",Tr="ADD_ITEM",Ar="REMOVE_ITEM",Mr="HIGHLIGHT_ITEM",Pr="showDropdown",Or="hideDropdown",Ir="change",Lr="choice",jr="search",Rr="addItem",Dr="removeItem",Nr="highlightItem",Fr="highlightChoice",Br="unhighlightItem",Gr=9,zr=16,Ur=46,Wr=8,Hr=13,Vr=65,Yr=27,Xr=38,$r=40,qr=33,Kr=34,Zr=["fuseOptions","classNames"],Jr="text",Qr="select-one",ti="select-multiple",ei=function(t){return{type:_r,choice:t}},ni=function(t){return{type:Tr,item:t}},ri=function(t){return{type:Ar,item:t}},ii=function(t,e){return{type:Mr,item:t,highlighted:e}},oi=function(t){return Array.from({length:t},(function(){return(t=0,e=36,Math.floor(Math.random()*(e-t)+t)).toString(36);var t,e})).join("")},si=function(t,e,n){return void 0===n&&(n=1),n>0?e.scrollTop+e.offsetHeight>=t.offsetTop+t.offsetHeight:t.offsetTop>=e.scrollTop},ai=function(t){if("string"!=typeof t){if(null==t)return"";if("object"==typeof t){if("raw"in t)return ai(t.raw);if("trusted"in t)return t.trusted}return t}return t.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/'/g,"'").replace(/"/g,""")},li=(xr=document.createElement("div"),function(t){xr.innerHTML=t.trim();for(var e=xr.children[0];xr.firstChild;)xr.removeChild(xr.firstChild);return e}),ci=function(t){return"function"==typeof t?t():t},hi=function(t){if("string"==typeof t)return t;if("object"==typeof t){if("trusted"in t)return t.trusted;if("raw"in t)return t.raw}return""},ui=function(t){if("string"==typeof t)return t;if("object"==typeof t){if("escaped"in t)return t.escaped;if("trusted"in t)return t.trusted}return""},di=function(t,e){return{id:t.id,highlighted:t.highlighted,labelClass:t.labelClass,labelDescription:hi(t.labelDescription),customProperties:t.customProperties,disabled:t.disabled,active:t.active,label:t.label,placeholder:t.placeholder,value:t.value,groupValue:t.group?t.group.label:void 0,element:t.element,keyCode:e}},fi=function(t,e,n){return"function"==typeof t?t(ai(e),hi(e),n):t},pi=function(t,e){return t?ui(e):ai(e)},mi=function(t,e,n){t.innerHTML=pi(e,n)},yi=function(t,e){return t.rank-e.rank},gi=function(t){return Array.isArray(t)?t:[t]},vi=function(t){return t&&Array.isArray(t)?t.map((function(t){return".".concat(t)})).join(""):".".concat(t)},bi=function(t,e){var n;(n=t.classList).add.apply(n,gi(e))},xi=function(t,e){var n;(n=t.classList).remove.apply(n,gi(e))},_i=function(t){if(void 0!==t)try{return JSON.parse(t)}catch(e){return t}return{}},wi=function(){function t(t){var e=t.element,n=t.type,r=t.classNames;this.element=e,this.classNames=r,this.type=n,this.isActive=!1}return t.prototype.show=function(){return bi(this.element,this.classNames.activeState),this.element.setAttribute("aria-expanded","true"),this.isActive=!0,this},t.prototype.hide=function(){return xi(this.element,this.classNames.activeState),this.element.setAttribute("aria-expanded","false"),this.isActive=!1,this},t}(),Si=function(){function t(t){var e=t.element,n=t.type,r=t.classNames,i=t.position;this.element=e,this.classNames=r,this.type=n,this.position=i,this.isOpen=!1,this.isFlipped=!1,this.isDisabled=!1,this.isLoading=!1}return t.prototype.shouldFlip=function(t,e){var n=!1;return"auto"===this.position?n=this.element.getBoundingClientRect().top-e>=0&&!window.matchMedia("(min-height: ".concat(t+1,"px)")).matches:"top"===this.position&&(n=!0),n},t.prototype.setActiveDescendant=function(t){this.element.setAttribute("aria-activedescendant",t)},t.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},t.prototype.open=function(t,e){bi(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(t,e)&&(bi(this.element,this.classNames.flippedState),this.isFlipped=!0)},t.prototype.close=function(){xi(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(xi(this.element,this.classNames.flippedState),this.isFlipped=!1)},t.prototype.addFocusState=function(){bi(this.element,this.classNames.focusState)},t.prototype.removeFocusState=function(){xi(this.element,this.classNames.focusState)},t.prototype.addInvalidState=function(){bi(this.element,this.classNames.invalidState)},t.prototype.removeInvalidState=function(){xi(this.element,this.classNames.invalidState)},t.prototype.enable=function(){xi(this.element,this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),this.type===Qr&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1},t.prototype.disable=function(){bi(this.element,this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),this.type===Qr&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0},t.prototype.wrap=function(t){var e=this.element,n=t.parentNode;n&&(t.nextSibling?n.insertBefore(e,t.nextSibling):n.appendChild(e)),e.appendChild(t)},t.prototype.unwrap=function(t){var e=this.element,n=e.parentNode;n&&(n.insertBefore(t,e),n.removeChild(e))},t.prototype.addLoadingState=function(){bi(this.element,this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0},t.prototype.removeLoadingState=function(){xi(this.element,this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1},t}(),Ci=function(){function t(t){var e=t.element,n=t.type,r=t.classNames,i=t.preventPaste;this.element=e,this.type=n,this.classNames=r,this.preventPaste=i,this.isFocussed=this.element.isEqualNode(document.activeElement),this.isDisabled=e.disabled,this._onPaste=this._onPaste.bind(this),this._onInput=this._onInput.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this)}return Object.defineProperty(t.prototype,"placeholder",{set:function(t){this.element.placeholder=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.element.value},set:function(t){this.element.value=t},enumerable:!1,configurable:!0}),t.prototype.addEventListeners=function(){var t=this.element;t.addEventListener("paste",this._onPaste),t.addEventListener("input",this._onInput,{passive:!0}),t.addEventListener("focus",this._onFocus,{passive:!0}),t.addEventListener("blur",this._onBlur,{passive:!0})},t.prototype.removeEventListeners=function(){var t=this.element;t.removeEventListener("input",this._onInput),t.removeEventListener("paste",this._onPaste),t.removeEventListener("focus",this._onFocus),t.removeEventListener("blur",this._onBlur)},t.prototype.enable=function(){this.element.removeAttribute("disabled"),this.isDisabled=!1},t.prototype.disable=function(){this.element.setAttribute("disabled",""),this.isDisabled=!0},t.prototype.focus=function(){this.isFocussed||this.element.focus()},t.prototype.blur=function(){this.isFocussed&&this.element.blur()},t.prototype.clear=function(t){return void 0===t&&(t=!0),this.element.value="",t&&this.setWidth(),this},t.prototype.setWidth=function(){var t=this.element;t.style.minWidth="".concat(t.placeholder.length+1,"ch"),t.style.width="".concat(t.value.length+1,"ch")},t.prototype.setActiveDescendant=function(t){this.element.setAttribute("aria-activedescendant",t)},t.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},t.prototype._onInput=function(){this.type!==Qr&&this.setWidth()},t.prototype._onPaste=function(t){this.preventPaste&&t.preventDefault()},t.prototype._onFocus=function(){this.isFocussed=!0},t.prototype._onBlur=function(){this.isFocussed=!1},t}(),Ei=function(){function t(t){var e=t.element;this.element=e,this.scrollPos=this.element.scrollTop,this.height=this.element.offsetHeight}return t.prototype.prepend=function(t){var e=this.element.firstElementChild;e?this.element.insertBefore(t,e):this.element.append(t)},t.prototype.scrollToTop=function(){this.element.scrollTop=0},t.prototype.scrollToChildElement=function(t,e){var n=this;if(t){var r=this.element.offsetHeight,i=this.element.scrollTop+r,o=t.offsetHeight,s=t.offsetTop+o,a=e>0?this.element.scrollTop+s-i:t.offsetTop;requestAnimationFrame((function(){n._animateScroll(a,e)}))}},t.prototype._scrollDown=function(t,e,n){var r=(n-t)/e,i=r>1?r:1;this.element.scrollTop=t+i},t.prototype._scrollUp=function(t,e,n){var r=(t-n)/e,i=r>1?r:1;this.element.scrollTop=t-i},t.prototype._animateScroll=function(t,e){var n=this,r=this.element.scrollTop,i=!1;e>0?(this._scrollDown(r,4,t),r<t&&(i=!0)):(this._scrollUp(r,4,t),r>t&&(i=!0)),i&&requestAnimationFrame((function(){n._animateScroll(t,e)}))},t}(),ki=function(){function t(t){var e=t.element,n=t.classNames;this.element=e,this.classNames=n,this.isDisabled=!1}return Object.defineProperty(t.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.element.value},set:function(t){this.element.setAttribute("value",t),this.element.value=t},enumerable:!1,configurable:!0}),t.prototype.conceal=function(){var t=this.element;bi(t,this.classNames.input),t.hidden=!0,t.tabIndex=-1;var e=t.getAttribute("style");e&&t.setAttribute("data-choice-orig-style",e),t.setAttribute("data-choice","active")},t.prototype.reveal=function(){var t=this.element;xi(t,this.classNames.input),t.hidden=!1,t.removeAttribute("tabindex");var e=t.getAttribute("data-choice-orig-style");e?(t.removeAttribute("data-choice-orig-style"),t.setAttribute("style",e)):t.removeAttribute("style"),t.removeAttribute("data-choice")},t.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},t.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},t.prototype.triggerEvent=function(t,e){!function(t,e,n){void 0===n&&(n=null);var r=new CustomEvent(e,{detail:n,bubbles:!0,cancelable:!0});t.dispatchEvent(r)}(this.element,t,e||{})},t}(),Ti=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return gr(e,t),e}(ki),Ai=function(t,e){return void 0===e&&(e=!0),void 0===t?e:!!t},Mi=function(t){if("string"==typeof t&&(t=t.split(" ").filter((function(t){return t.length}))),Array.isArray(t)&&t.length)return t},Pi=function(t,e,n){if(void 0===n&&(n=!0),"string"==typeof t){var r=ai(t);return Pi({value:t,label:n||r===t?t:{escaped:r,raw:t},selected:!0},!1)}var i=t;if("choices"in i){if(!e)throw new TypeError("optGroup is not allowed");var o=i,s=o.choices.map((function(t){return Pi(t,!1)}));return{id:0,label:hi(o.label)||o.value,active:!!s.length,disabled:!!o.disabled,choices:s}}var a=i;return{id:0,group:null,score:0,rank:0,value:a.value,label:a.label||a.value,active:Ai(a.active),selected:Ai(a.selected,!1),disabled:Ai(a.disabled,!1),placeholder:Ai(a.placeholder,!1),highlighted:!1,labelClass:Mi(a.labelClass),labelDescription:a.labelDescription,customProperties:a.customProperties}},Oi=function(t){return"SELECT"===t.tagName},Ii=function(t){function e(e){var n=e.element,r=e.classNames,i=e.template,o=e.extractPlaceholder,s=t.call(this,{element:n,classNames:r})||this;return s.template=i,s.extractPlaceholder=o,s}return gr(e,t),Object.defineProperty(e.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),e.prototype.addOptions=function(t){var e=this,n=document.createDocumentFragment();t.forEach((function(t){var r=t;if(!r.element){var i=e.template(r);n.appendChild(i),r.element=i}})),this.element.appendChild(n)},e.prototype.optionsAsChoices=function(){var t=this,e=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach((function(n){!function(t){return"OPTION"===t.tagName}(n)?function(t){return"OPTGROUP"===t.tagName}(n)&&e.push(t._optgroupToChoice(n)):e.push(t._optionToChoice(n))})),e},e.prototype._optionToChoice=function(t){return!t.hasAttribute("value")&&t.hasAttribute("placeholder")&&(t.setAttribute("value",""),t.value=""),{id:0,group:null,score:0,rank:0,value:t.value,label:t.label,element:t,active:!0,selected:this.extractPlaceholder?t.selected:t.hasAttribute("selected"),disabled:t.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(!t.value||t.hasAttribute("placeholder")),labelClass:void 0!==t.dataset.labelClass?Mi(t.dataset.labelClass):void 0,labelDescription:void 0!==t.dataset.labelDescription?{trusted:t.dataset.labelDescription}:void 0,customProperties:_i(t.dataset.customProperties)}},e.prototype._optgroupToChoice=function(t){var e=this,n=t.querySelectorAll("option"),r=Array.from(n).map((function(t){return e._optionToChoice(t)}));return{id:0,label:t.label||"",element:t,active:!!r.length,disabled:t.disabled,choices:r}},e}(ki),Li={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,closeDropdownOnSelect:"auto",singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(t){return!!t&&""!==t},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!1,duplicateItemsAllowed:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchDisabledChoices:!1,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,shouldSort:!0,shouldSortItems:!1,sorter:function(t,e){var n=t.value,r=t.label,i=void 0===r?n:r,o=e.value,s=e.label,a=void 0===s?o:s;return hi(i).localeCompare(hi(a),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,placeholder:!0,placeholderValue:null,searchPlaceholderValue:null,prependValue:null,appendValue:null,renderSelectedChoices:"auto",searchRenderSelectedChoices:!0,loadingText:"Loading...",noResultsText:"No results found",noChoicesText:"No choices to choose from",itemSelectText:"Press to select",uniqueItemText:"Only unique values can be added",customAddItemText:"Only values matching specific conditions can be added",addItemText:function(t){return'Press Enter to add <b>"'.concat(t,'"</b>')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(t,e,n){return"Remove item: ".concat(n?ai(n.label):t)},maxItemText:function(t){return"Only ".concat(t," values can be added")},valueComparer:function(t,e){return t===e},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:["choices"],containerInner:["choices__inner"],input:["choices__input"],inputCloned:["choices__input--cloned"],list:["choices__list"],listItems:["choices__list--multiple"],listSingle:["choices__list--single"],listDropdown:["choices__list--dropdown"],item:["choices__item"],itemSelectable:["choices__item--selectable"],itemDisabled:["choices__item--disabled"],itemChoice:["choices__item--choice"],description:["choices__description"],placeholder:["choices__placeholder"],group:["choices__group"],groupHeading:["choices__heading"],button:["choices__button"],activeState:["is-active"],focusState:["is-focused"],openState:["is-open"],disabledState:["is-disabled"],highlightedState:["is-highlighted"],selectedState:["is-selected"],flippedState:["is-flipped"],loadingState:["is-loading"],invalidState:["is-invalid"],notice:["choices__notice"],addChoice:["choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},ji=function(t){var e=t.itemEl;e&&(e.remove(),t.itemEl=void 0)};var Ri={groups:function(t,e){var n=t,r=!0;switch(e.type){case kr:n.push(e.group);break;case Er:n=[];break;default:r=!1}return{state:n,update:r}},items:function(t,e,n){var r=t,i=!0;switch(e.type){case Tr:e.item.selected=!0,(o=e.item.element)&&(o.selected=!0,o.setAttribute("selected","")),r.push(e.item);break;case Ar:var o;if(e.item.selected=!1,o=e.item.element){o.selected=!1,o.removeAttribute("selected");var s=o.parentElement;s&&Oi(s)&&s.type===Qr&&(s.value="")}ji(e.item),r=r.filter((function(t){return t.id!==e.item.id}));break;case wr:ji(e.choice),r=r.filter((function(t){return t.id!==e.choice.id}));break;case Mr:var a=e.highlighted,l=r.find((function(t){return t.id===e.item.id}));l&&l.highlighted!==a&&(l.highlighted=a,n&&function(t,e,n){var r=t.itemEl;r&&(xi(r,n),bi(r,e))}(l,a?n.classNames.highlightedState:n.classNames.selectedState,a?n.classNames.selectedState:n.classNames.highlightedState));break;default:i=!1}return{state:r,update:i}},choices:function(t,e,n){var r=t,i=!0;switch(e.type){case _r:r.push(e.choice);break;case wr:e.choice.choiceEl=void 0,e.choice.group&&(e.choice.group.choices=e.choice.group.choices.filter((function(t){return t.id!==e.choice.id}))),r=r.filter((function(t){return t.id!==e.choice.id}));break;case Tr:case Ar:e.item.choiceEl=void 0;break;case Sr:var o=[];e.results.forEach((function(t){o[t.item.id]=t})),r.forEach((function(t){var e=o[t.id];void 0!==e?(t.score=e.score,t.rank=e.rank,t.active=!0):(t.score=0,t.rank=0,t.active=!1),n&&n.appendGroupInSearch&&(t.choiceEl=void 0)}));break;case Cr:r.forEach((function(t){t.active=e.active,n&&n.appendGroupInSearch&&(t.choiceEl=void 0)}));break;case Er:r=[];break;default:i=!1}return{state:r,update:i}}},Di=function(){function t(t){this._state=this.defaultState,this._listeners=[],this._txn=0,this._context=t}return Object.defineProperty(t.prototype,"defaultState",{get:function(){return{groups:[],items:[],choices:[]}},enumerable:!1,configurable:!0}),t.prototype.changeSet=function(t){return{groups:t,items:t,choices:t}},t.prototype.reset=function(){this._state=this.defaultState;var t=this.changeSet(!0);this._txn?this._changeSet=t:this._listeners.forEach((function(e){return e(t)}))},t.prototype.subscribe=function(t){return this._listeners.push(t),this},t.prototype.dispatch=function(t){var e=this,n=this._state,r=!1,i=this._changeSet||this.changeSet(!1);Object.keys(Ri).forEach((function(o){var s=Ri[o](n[o],t,e._context);s.update&&(r=!0,i[o]=!0,n[o]=s.state)})),r&&(this._txn?this._changeSet=i:this._listeners.forEach((function(t){return t(i)})))},t.prototype.withTxn=function(t){this._txn++;try{t()}finally{if(this._txn=Math.max(0,this._txn-1),!this._txn){var e=this._changeSet;e&&(this._changeSet=void 0,this._listeners.forEach((function(t){return t(e)})))}}},Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"items",{get:function(){return this.state.items},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"highlightedActiveItems",{get:function(){return this.items.filter((function(t){return t.active&&t.highlighted}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"choices",{get:function(){return this.state.choices},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"activeChoices",{get:function(){return this.choices.filter((function(t){return t.active}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"searchableChoices",{get:function(){var t=this._context;return this.choices.filter((function(e){return!e.placeholder&&(t.searchDisabledChoices||!e.disabled)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"groups",{get:function(){return this.state.groups},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"activeGroups",{get:function(){var t=this;return this.state.groups.filter((function(e){var n=e.active&&!e.disabled,r=t.state.choices.some((function(t){return t.active&&!t.disabled}));return n&&r}),[])},enumerable:!1,configurable:!0}),t.prototype.inTxn=function(){return this._txn>0},t.prototype.getChoiceById=function(t){return this.activeChoices.find((function(e){return e.id===t}))},t.prototype.getGroupById=function(t){return this.groups.find((function(e){return e.id===t}))},t}(),Ni="no-choices",Fi="no-results",Bi="add-choice",Gi="";function zi(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ui(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Wi(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ui(Object(n),!0).forEach((function(e){zi(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ui(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Hi(t){return Array.isArray?Array.isArray(t):"[object Array]"===Zi(t)}function Vi(t){return"string"==typeof t}function Yi(t){return"number"==typeof t}function Xi(t){return!0===t||!1===t||function(t){return $i(t)&&null!==t}(t)&&"[object Boolean]"==Zi(t)}function $i(t){return"object"==typeof t}function qi(t){return null!=t}function Ki(t){return!t.trim().length}function Zi(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Ji=t=>`Missing ${t} property in key`,Qi=t=>`Property 'weight' in key '${t}' must be a positive integer`,to=Object.prototype.hasOwnProperty;class eo{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach((t=>{let n=no(t);this._keys.push(n),this._keyMap[n.id]=n,e+=n.weight})),this._keys.forEach((t=>{t.weight/=e}))}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function no(t){let e=null,n=null,r=null,i=1,o=null;if(Vi(t)||Hi(t))r=t,e=ro(t),n=io(t);else{if(!to.call(t,"name"))throw new Error(Ji("name"));const s=t.name;if(r=s,to.call(t,"weight")&&(i=t.weight,i<=0))throw new Error(Qi(s));e=ro(s),n=io(s),o=t.getFn}return{path:e,id:n,weight:i,src:r,getFn:o}}function ro(t){return Hi(t)?t:t.split(".")}function io(t){return Hi(t)?t.join("."):t}const oo={useExtendedSearch:!1,getFn:function(t,e){let n=[],r=!1;const i=(t,e,o)=>{if(qi(t))if(e[o]){const s=t[e[o]];if(!qi(s))return;if(o===e.length-1&&(Vi(s)||Yi(s)||Xi(s)))n.push(function(t){return null==t?"":function(t){if("string"==typeof t)return t;let e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(t)}(s));else if(Hi(s)){r=!0;for(let t=0,n=s.length;t<n;t+=1)i(s[t],e,o+1)}else e.length&&i(s,e,o+1)}else n.push(t)};return i(t,Vi(e)?e.split("."):e,0),r?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var so=Wi(Wi(Wi(Wi({},{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1}),{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1}),{location:0,threshold:.6,distance:100}),oo);const ao=/[^ ]+/g;class lo{constructor({getFn:t=so.getFn,fieldNormWeight:e=so.fieldNormWeight}={}){this.norm=function(t=1,e=3){const n=new Map,r=Math.pow(10,e);return{get(e){const i=e.match(ao).length;if(n.has(i))return n.get(i);const o=1/Math.pow(i,.5*t),s=parseFloat(Math.round(o*r)/r);return n.set(i,s),s},clear(){n.clear()}}}(e,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach(((t,e)=>{this._keysMap[t.id]=e}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,Vi(this.docs[0])?this.docs.forEach(((t,e)=>{this._addString(t,e)})):this.docs.forEach(((t,e)=>{this._addObject(t,e)})),this.norm.clear())}add(t){const e=this.size();Vi(t)?this._addString(t,e):this._addObject(t,e)}removeAt(t){this.records.splice(t,1);for(let e=t,n=this.size();e<n;e+=1)this.records[e].i-=1}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_addString(t,e){if(!qi(t)||Ki(t))return;let n={v:t,i:e,n:this.norm.get(t)};this.records.push(n)}_addObject(t,e){let n={i:e,$:{}};this.keys.forEach(((e,r)=>{let i=e.getFn?e.getFn(t):this.getFn(t,e.path);if(qi(i))if(Hi(i)){let t=[];const e=[{nestedArrIndex:-1,value:i}];for(;e.length;){const{nestedArrIndex:n,value:r}=e.pop();if(qi(r))if(Vi(r)&&!Ki(r)){let e={v:r,i:n,n:this.norm.get(r)};t.push(e)}else Hi(r)&&r.forEach(((t,n)=>{e.push({nestedArrIndex:n,value:t})}))}n.$[r]=t}else if(Vi(i)&&!Ki(i)){let t={v:i,n:this.norm.get(i)};n.$[r]=t}})),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function co(t,e,{getFn:n=so.getFn,fieldNormWeight:r=so.fieldNormWeight}={}){const i=new lo({getFn:n,fieldNormWeight:r});return i.setKeys(t.map(no)),i.setSources(e),i.create(),i}function ho(t,{errors:e=0,currentLocation:n=0,expectedLocation:r=0,distance:i=so.distance,ignoreLocation:o=so.ignoreLocation}={}){const s=e/t.length;if(o)return s;const a=Math.abs(r-n);return i?s+a/i:a?1:s}const uo=32;function fo(t,e,n,{location:r=so.location,distance:i=so.distance,threshold:o=so.threshold,findAllMatches:s=so.findAllMatches,minMatchCharLength:a=so.minMatchCharLength,includeMatches:l=so.includeMatches,ignoreLocation:c=so.ignoreLocation}={}){if(e.length>uo)throw new Error(`Pattern length exceeds max of ${uo}.`);const h=e.length,u=t.length,d=Math.max(0,Math.min(r,u));let f=o,p=d;const m=a>1||l,y=m?Array(u):[];let g;for(;(g=t.indexOf(e,p))>-1;){let t=ho(e,{currentLocation:g,expectedLocation:d,distance:i,ignoreLocation:c});if(f=Math.min(t,f),p=g+h,m){let t=0;for(;t<h;)y[g+t]=1,t+=1}}p=-1;let v=[],b=1,x=h+u;const _=1<<h-1;for(let r=0;r<h;r+=1){let o=0,a=x;for(;o<a;){ho(e,{errors:r,currentLocation:d+a,expectedLocation:d,distance:i,ignoreLocation:c})<=f?o=a:x=a,a=Math.floor((x-o)/2+o)}x=a;let l=Math.max(1,d-a+1),g=s?u:Math.min(d+a,u)+h,w=Array(g+2);w[g+1]=(1<<r)-1;for(let o=g;o>=l;o-=1){let s=o-1,a=n[t.charAt(s)];if(m&&(y[s]=+!!a),w[o]=(w[o+1]<<1|1)&a,r&&(w[o]|=(v[o+1]|v[o])<<1|1|v[o+1]),w[o]&_&&(b=ho(e,{errors:r,currentLocation:s,expectedLocation:d,distance:i,ignoreLocation:c}),b<=f)){if(f=b,p=s,p<=d)break;l=Math.max(1,2*d-p)}}if(ho(e,{errors:r+1,currentLocation:d,expectedLocation:d,distance:i,ignoreLocation:c})>f)break;v=w}const w={isMatch:p>=0,score:Math.max(.001,b)};if(m){const t=function(t=[],e=so.minMatchCharLength){let n=[],r=-1,i=-1,o=0;for(let s=t.length;o<s;o+=1){let s=t[o];s&&-1===r?r=o:s||-1===r||(i=o-1,i-r+1>=e&&n.push([r,i]),r=-1)}return t[o-1]&&o-r>=e&&n.push([r,o-1]),n}(y,a);t.length?l&&(w.indices=t):w.isMatch=!1}return w}function po(t){let e={};for(let n=0,r=t.length;n<r;n+=1){const i=t.charAt(n);e[i]=(e[i]||0)|1<<r-n-1}return e}class mo{constructor(t,{location:e=so.location,threshold:n=so.threshold,distance:r=so.distance,includeMatches:i=so.includeMatches,findAllMatches:o=so.findAllMatches,minMatchCharLength:s=so.minMatchCharLength,isCaseSensitive:a=so.isCaseSensitive,ignoreLocation:l=so.ignoreLocation}={}){if(this.options={location:e,threshold:n,distance:r,includeMatches:i,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:a,ignoreLocation:l},this.pattern=a?t:t.toLowerCase(),this.chunks=[],!this.pattern.length)return;const c=(t,e)=>{this.chunks.push({pattern:t,alphabet:po(t),startIndex:e})},h=this.pattern.length;if(h>uo){let t=0;const e=h%uo,n=h-e;for(;t<n;)c(this.pattern.substr(t,uo),t),t+=uo;if(e){const t=h-uo;c(this.pattern.substr(t),t)}}else c(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,includeMatches:n}=this.options;if(e||(t=t.toLowerCase()),this.pattern===t){let e={isMatch:!0,score:0};return n&&(e.indices=[[0,t.length-1]]),e}const{location:r,distance:i,threshold:o,findAllMatches:s,minMatchCharLength:a,ignoreLocation:l}=this.options;let c=[],h=0,u=!1;this.chunks.forEach((({pattern:e,alphabet:d,startIndex:f})=>{const{isMatch:p,score:m,indices:y}=fo(t,e,d,{location:r+f,distance:i,threshold:o,findAllMatches:s,minMatchCharLength:a,includeMatches:n,ignoreLocation:l});p&&(u=!0),h+=m,p&&y&&(c=[...c,...y])}));let d={isMatch:u,score:u?h/this.chunks.length:1};return u&&n&&(d.indices=c),d}}class yo{constructor(t){this.pattern=t}static isMultiMatch(t){return go(t,this.multiRegex)}static isSingleMatch(t){return go(t,this.singleRegex)}search(){}}function go(t,e){const n=t.match(e);return n?n[1]:null}class vo extends yo{constructor(t,{location:e=so.location,threshold:n=so.threshold,distance:r=so.distance,includeMatches:i=so.includeMatches,findAllMatches:o=so.findAllMatches,minMatchCharLength:s=so.minMatchCharLength,isCaseSensitive:a=so.isCaseSensitive,ignoreLocation:l=so.ignoreLocation}={}){super(t),this._bitapSearch=new mo(t,{location:e,threshold:n,distance:r,includeMatches:i,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:a,ignoreLocation:l})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class bo extends yo{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e,n=0;const r=[],i=this.pattern.length;for(;(e=t.indexOf(this.pattern,n))>-1;)n=e+i,r.push([e,n-1]);const o=!!r.length;return{isMatch:o,score:o?0:1,indices:r}}}const xo=[class extends yo{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const e=t===this.pattern;return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}},bo,class extends yo{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const e=t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}},class extends yo{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const e=!t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends yo{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const e=!t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends yo{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const e=t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[t.length-this.pattern.length,t.length-1]}}},class extends yo{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const e=-1===t.indexOf(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},vo],_o=xo.length,wo=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const So=new Set([vo.type,bo.type]);class Co{constructor(t,{isCaseSensitive:e=so.isCaseSensitive,includeMatches:n=so.includeMatches,minMatchCharLength:r=so.minMatchCharLength,ignoreLocation:i=so.ignoreLocation,findAllMatches:o=so.findAllMatches,location:s=so.location,threshold:a=so.threshold,distance:l=so.distance}={}){this.query=null,this.options={isCaseSensitive:e,includeMatches:n,minMatchCharLength:r,findAllMatches:o,ignoreLocation:i,location:s,threshold:a,distance:l},this.pattern=e?t:t.toLowerCase(),this.query=function(t,e={}){return t.split("|").map((t=>{let n=t.trim().split(wo).filter((t=>t&&!!t.trim())),r=[];for(let t=0,i=n.length;t<i;t+=1){const i=n[t];let o=!1,s=-1;for(;!o&&++s<_o;){const t=xo[s];let n=t.isMultiMatch(i);n&&(r.push(new t(n,e)),o=!0)}if(!o)for(s=-1;++s<_o;){const t=xo[s];let n=t.isSingleMatch(i);if(n){r.push(new t(n,e));break}}}return r}))}(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:r}=this.options;t=r?t:t.toLowerCase();let i=0,o=[],s=0;for(let r=0,a=e.length;r<a;r+=1){const a=e[r];o.length=0,i=0;for(let e=0,r=a.length;e<r;e+=1){const r=a[e],{isMatch:l,indices:c,score:h}=r.search(t);if(!l){s=0,i=0,o.length=0;break}if(i+=1,s+=h,n){const t=r.constructor.type;So.has(t)?o=[...o,...c]:o.push(c)}}if(i){let t={isMatch:!0,score:s/i};return n&&(t.indices=o),t}}return{isMatch:!1,score:1}}}const Eo=[];function ko(t,e){for(let n=0,r=Eo.length;n<r;n+=1){let r=Eo[n];if(r.condition(t,e))return new r(t,e)}return new mo(t,e)}const To="$and",Ao="$or",Mo="$path",Po="$val",Oo=t=>!(!t[To]&&!t[Ao]),Io=t=>({[To]:Object.keys(t).map((e=>({[e]:t[e]})))});function Lo(t,e,{auto:n=!0}={}){const r=t=>{let i=Object.keys(t);const o=(t=>!!t[Mo])(t);if(!o&&i.length>1&&!Oo(t))return r(Io(t));if((t=>!Hi(t)&&$i(t)&&!Oo(t))(t)){const r=o?t[Mo]:i[0],s=o?t[Po]:t[r];if(!Vi(s))throw new Error((t=>`Invalid value for key ${t}`)(r));const a={keyId:io(r),pattern:s};return n&&(a.searcher=ko(s,e)),a}let s={children:[],operator:i[0]};return i.forEach((e=>{const n=t[e];Hi(n)&&n.forEach((t=>{s.children.push(r(t))}))})),s};return Oo(t)||(t=Io(t)),r(t)}function jo(t,e){const n=t.matches;e.matches=[],qi(n)&&n.forEach((t=>{if(!qi(t.indices)||!t.indices.length)return;const{indices:n,value:r}=t;let i={indices:n,value:r};t.key&&(i.key=t.key.src),t.idx>-1&&(i.refIndex=t.idx),e.matches.push(i)}))}function Ro(t,e){e.score=t.score}class Do{constructor(t,e={},n){this.options=Wi(Wi({},so),e),this.options.useExtendedSearch,this._keyStore=new eo(this.options.keys),this.setCollection(t,n)}setCollection(t,e){if(this._docs=t,e&&!(e instanceof lo))throw new Error("Incorrect 'index' type");this._myIndex=e||co(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){qi(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const e=[];for(let n=0,r=this._docs.length;n<r;n+=1){const i=this._docs[n];t(i,n)&&(this.removeAt(n),n-=1,r-=1,e.push(i))}return e}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:e=-1}={}){const{includeMatches:n,includeScore:r,shouldSort:i,sortFn:o,ignoreFieldNorm:s}=this.options;let a=Vi(t)?Vi(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return function(t,{ignoreFieldNorm:e=so.ignoreFieldNorm}){t.forEach((t=>{let n=1;t.matches.forEach((({key:t,norm:r,score:i})=>{const o=t?t.weight:null;n*=Math.pow(0===i&&o?Number.EPSILON:i,(o||1)*(e?1:r))})),t.score=n}))}(a,{ignoreFieldNorm:s}),i&&a.sort(o),Yi(e)&&e>-1&&(a=a.slice(0,e)),function(t,e,{includeMatches:n=so.includeMatches,includeScore:r=so.includeScore}={}){const i=[];return n&&i.push(jo),r&&i.push(Ro),t.map((t=>{const{idx:n}=t,r={item:e[n],refIndex:n};return i.length&&i.forEach((e=>{e(t,r)})),r}))}(a,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(t){const e=ko(t,this.options),{records:n}=this._myIndex,r=[];return n.forEach((({v:t,i:n,n:i})=>{if(!qi(t))return;const{isMatch:o,score:s,indices:a}=e.searchIn(t);o&&r.push({item:t,idx:n,matches:[{score:s,value:t,norm:i,indices:a}]})})),r}_searchLogical(t){const e=Lo(t,this.options),n=(t,e,r)=>{if(!t.children){const{keyId:n,searcher:i}=t,o=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(e,n),searcher:i});return o&&o.length?[{idx:r,item:e,matches:o}]:[]}const i=[];for(let o=0,s=t.children.length;o<s;o+=1){const s=t.children[o],a=n(s,e,r);if(a.length)i.push(...a);else if(t.operator===To)return[]}return i},r=this._myIndex.records,i={},o=[];return r.forEach((({$:t,i:r})=>{if(qi(t)){let s=n(e,t,r);s.length&&(i[r]||(i[r]={idx:r,item:t,matches:[]},o.push(i[r])),s.forEach((({matches:t})=>{i[r].matches.push(...t)})))}})),o}_searchObjectList(t){const e=ko(t,this.options),{keys:n,records:r}=this._myIndex,i=[];return r.forEach((({$:t,i:r})=>{if(!qi(t))return;let o=[];n.forEach(((n,r)=>{o.push(...this._findMatches({key:n,value:t[r],searcher:e}))})),o.length&&i.push({idx:r,item:t,matches:o})})),i}_findMatches({key:t,value:e,searcher:n}){if(!qi(e))return[];let r=[];if(Hi(e))e.forEach((({v:e,i,n:o})=>{if(!qi(e))return;const{isMatch:s,score:a,indices:l}=n.searchIn(e);s&&r.push({score:a,key:t,value:e,idx:i,norm:o,indices:l})}));else{const{v:i,n:o}=e,{isMatch:s,score:a,indices:l}=n.searchIn(i);s&&r.push({score:a,key:t,value:i,norm:o,indices:l})}return r}}Do.version="7.0.0",Do.createIndex=co,Do.parseIndex=function(t,{getFn:e=so.getFn,fieldNormWeight:n=so.fieldNormWeight}={}){const{keys:r,records:i}=t,o=new lo({getFn:e,fieldNormWeight:n});return o.setKeys(r),o.setIndexRecords(i),o},Do.config=so,Do.parseQuery=Lo,function(...t){Eo.push(...t)}(Co);var No=function(){function t(t){this._haystack=[],this._fuseOptions=vr(vr({},t.fuseOptions),{keys:br([],t.searchFields,!0),includeMatches:!0})}return t.prototype.index=function(t){this._haystack=t,this._fuse&&this._fuse.setCollection(t)},t.prototype.reset=function(){this._haystack=[],this._fuse=void 0},t.prototype.isEmptyIndex=function(){return!this._haystack.length},t.prototype.search=function(t){return this._fuse||(this._fuse=new Do(this._haystack,this._fuseOptions)),this._fuse.search(t).map((function(t,e){return{item:t.item,score:t.score||0,rank:e+1}}))},t}();var Fo=function(t,e,n){var r=t.dataset,i=e.customProperties,o=e.labelClass,s=e.labelDescription;o&&(r.labelClass=gi(o).join(" ")),s&&(r.labelDescription=hi(s)),n&&i&&("string"==typeof i?r.customProperties=i:"object"!=typeof i||function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(i)||(r.customProperties=JSON.stringify(i)))},Bo=function(t,e,n){var r=e&&t.querySelector("label[for='".concat(e,"']")),i=r&&r.innerText;i&&n.setAttribute("aria-label",i)},Go={containerOuter:function(t,e,n,r,i,o,s){var a=t.classNames.containerOuter,l=document.createElement("div");return bi(l,a),l.dataset.type=o,e&&(l.dir=e),r&&(l.tabIndex=0),n&&(l.setAttribute("role",i?"combobox":"listbox"),i?l.setAttribute("aria-autocomplete","list"):s||Bo(this._docRoot,this.passedElement.element.id,l),l.setAttribute("aria-haspopup","true"),l.setAttribute("aria-expanded","false")),s&&l.setAttribute("aria-labelledby",s),l},containerInner:function(t){var e=t.classNames.containerInner,n=document.createElement("div");return bi(n,e),n},itemList:function(t,e){var n=t.searchEnabled,r=t.classNames,i=r.list,o=r.listSingle,s=r.listItems,a=document.createElement("div");return bi(a,i),bi(a,e?o:s),this._isSelectElement&&n&&a.setAttribute("role","listbox"),a},placeholder:function(t,e){var n=t.allowHTML,r=t.classNames.placeholder,i=document.createElement("div");return bi(i,r),mi(i,n,e),i},item:function(t,e,n){var r=t.allowHTML,i=t.removeItemButtonAlignLeft,o=t.removeItemIconText,s=t.removeItemLabelText,a=t.classNames,l=a.item,c=a.button,h=a.highlightedState,u=a.itemSelectable,d=a.placeholder,f=hi(e.value),p=document.createElement("div");if(bi(p,l),e.labelClass){var m=document.createElement("span");mi(m,r,e.label),bi(m,e.labelClass),p.appendChild(m)}else mi(p,r,e.label);if(p.dataset.item="",p.dataset.id=e.id,p.dataset.value=f,Fo(p,e,!0),(e.disabled||this.containerOuter.isDisabled)&&p.setAttribute("aria-disabled","true"),this._isSelectElement&&(p.setAttribute("aria-selected","true"),p.setAttribute("role","option")),e.placeholder&&(bi(p,d),p.dataset.placeholder=""),bi(p,e.highlighted?h:u),n){e.disabled&&xi(p,u),p.dataset.deletable="";var y=document.createElement("button");y.type="button",bi(y,c);var g=di(e);mi(y,!0,fi(o,e.value,g));var v=fi(s,e.value,g);v&&y.setAttribute("aria-label",v),y.dataset.button="",i?p.insertAdjacentElement("afterbegin",y):p.appendChild(y)}return p},choiceList:function(t,e){var n=t.classNames.list,r=document.createElement("div");return bi(r,n),e||r.setAttribute("aria-multiselectable","true"),r.setAttribute("role","listbox"),r},choiceGroup:function(t,e){var n=t.allowHTML,r=t.classNames,i=r.group,o=r.groupHeading,s=r.itemDisabled,a=e.id,l=e.label,c=e.disabled,h=hi(l),u=document.createElement("div");bi(u,i),c&&bi(u,s),u.setAttribute("role","group"),u.dataset.group="",u.dataset.id=a,u.dataset.value=h,c&&u.setAttribute("aria-disabled","true");var d=document.createElement("div");return bi(d,o),mi(d,n,l||""),u.appendChild(d),u},choice:function(t,e,n,r){var i=t.allowHTML,o=t.classNames,s=o.item,a=o.itemChoice,l=o.itemSelectable,c=o.selectedState,h=o.itemDisabled,u=o.description,d=o.placeholder,f=e.label,p=hi(e.value),m=document.createElement("div");m.id=e.elementId,bi(m,s),bi(m,a),r&&"string"==typeof f&&(f=pi(i,f),f={trusted:f+=" (".concat(r,")")});var y=m;if(e.labelClass){var g=document.createElement("span");mi(g,i,f),bi(g,e.labelClass),y=g,m.appendChild(g)}else mi(m,i,f);if(e.labelDescription){var v="".concat(e.elementId,"-description");y.setAttribute("aria-describedby",v);var b=document.createElement("span");mi(b,i,e.labelDescription),b.id=v,bi(b,u),m.appendChild(b)}return e.selected&&bi(m,c),e.placeholder&&bi(m,d),m.setAttribute("role",e.group?"treeitem":"option"),m.dataset.choice="",m.dataset.id=e.id,m.dataset.value=p,n&&(m.dataset.selectText=n),e.group&&(m.dataset.groupId="".concat(e.group.id)),Fo(m,e,!1),e.disabled?(bi(m,h),m.dataset.choiceDisabled="",m.setAttribute("aria-disabled","true")):(bi(m,l),m.dataset.choiceSelectable="",m.setAttribute("aria-selected",e.selected?"true":"false")),m},input:function(t,e){var n=t.classNames,r=n.input,i=n.inputCloned,o=t.labelId,s=document.createElement("input");return s.type="search",bi(s,r),bi(s,i),s.autocomplete="off",s.autocapitalize="off",s.spellcheck=!1,s.setAttribute("aria-autocomplete","list"),e?s.setAttribute("aria-label",e):o||Bo(this._docRoot,this.passedElement.element.id,s),s},dropdown:function(t){var e=t.classNames,n=e.list,r=e.listDropdown,i=document.createElement("div");return bi(i,n),bi(i,r),i.setAttribute("aria-expanded","false"),i},notice:function(t,e,n){var r=t.classNames,i=r.item,o=r.itemChoice,s=r.addChoice,a=r.noResults,l=r.noChoices,c=r.notice;void 0===n&&(n=Gi);var h=document.createElement("div");switch(mi(h,!0,e),bi(h,i),bi(h,o),bi(h,c),n){case Bi:bi(h,s);break;case Fi:bi(h,a);break;case Ni:bi(h,l)}return n===Bi&&(h.dataset.choiceSelectable="",h.dataset.choice=""),h},option:function(t){var e=hi(t.label),n=new Option(e,t.value,!1,t.selected);return Fo(n,t,!0),n.disabled=t.disabled,t.selected&&n.setAttribute("selected",""),n}},zo="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,Uo={},Wo=function(t){if(t)return t.dataset.id?parseInt(t.dataset.id,10):void 0},Ho="[data-choice-selectable]",Vo=function(){function t(e,n){void 0===e&&(e="[data-choice]"),void 0===n&&(n={});var r=this;this.initialisedOK=void 0,this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0;var i=t.defaults;this.config=vr(vr(vr({},i.allOptions),i.options),n),Zr.forEach((function(t){r.config[t]=vr(vr(vr({},i.allOptions[t]),i.options[t]),n[t])}));var o=this.config;o.silent||this._validateConfig();var s=o.shadowRoot||document.documentElement;this._docRoot=s;var a="string"==typeof e?s.querySelector(e):e;if(!a||"object"!=typeof a||"INPUT"!==a.tagName&&!Oi(a)){if(!a&&"string"==typeof e)throw TypeError("Selector ".concat(e," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}var l=a.type,c=l===Jr;(c||1!==o.maxItemCount)&&(o.singleModeForMultiSelect=!1),o.singleModeForMultiSelect&&(l=ti);var h=l===Qr,u=l===ti,d=h||u;if(this._elementType=l,this._isTextElement=c,this._isSelectOneElement=h,this._isSelectMultipleElement=u,this._isSelectElement=h||u,this._canAddUserChoices=c&&o.addItems||d&&o.addChoices,"boolean"!=typeof o.renderSelectedChoices&&(o.renderSelectedChoices="always"===o.renderSelectedChoices||h),"auto"===o.closeDropdownOnSelect?o.closeDropdownOnSelect=c||h||o.singleModeForMultiSelect:o.closeDropdownOnSelect=Ai(o.closeDropdownOnSelect),o.placeholder&&(o.placeholderValue?this._hasNonChoicePlaceholder=!0:a.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,o.placeholderValue=a.dataset.placeholder)),n.addItemFilter&&"function"!=typeof n.addItemFilter){var f=n.addItemFilter instanceof RegExp?n.addItemFilter:new RegExp(n.addItemFilter);o.addItemFilter=f.test.bind(f)}if(this._isTextElement)this.passedElement=new Ti({element:a,classNames:o.classNames});else{var p=a;this.passedElement=new Ii({element:p,classNames:o.classNames,template:function(t){return r._templates.option(t)},extractPlaceholder:o.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new Di(o),this._currentValue="",o.searchEnabled=!c&&o.searchEnabled,this._canSearch=o.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(t,e){var n=t.id||t.name&&"".concat(t.name,"-").concat(oi(2))||oi(4);return n=n.replace(/(:|\.|\[|\]|,)/g,""),"".concat(e,"-").concat(n)}(a,"choices-"),this._direction=a.dir,!this._direction){var m=window.getComputedStyle(a).direction;m!==window.getComputedStyle(document.documentElement).direction&&(this._direction=m)}if(this._idNames={itemChoice:"item-choice"},this._templates=i.templates,this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onInput=this._onInput.bind(this),this._onClick=this._onClick.bind(this),this._onTouchMove=this._onTouchMove.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseOver=this._onMouseOver.bind(this),this._onFormReset=this._onFormReset.bind(this),this._onSelectKey=this._onSelectKey.bind(this),this._onEnterKey=this._onEnterKey.bind(this),this._onEscapeKey=this._onEscapeKey.bind(this),this._onDirectionKey=this._onDirectionKey.bind(this),this._onDeleteKey=this._onDeleteKey.bind(this),this._onChange=this._onChange.bind(this),this._onInvalid=this._onInvalid.bind(this),this.passedElement.isActive)return o.silent||console.warn("Trying to initialise Choices on element already initialised",{element:e}),this.initialised=!0,void(this.initialisedOK=!1);this.init(),this._initialItems=this._store.items.map((function(t){return t.value}))}return Object.defineProperty(t,"defaults",{get:function(){return Object.preventExtensions({get options(){return Uo},get allOptions(){return Li},get templates(){return Go}})},enumerable:!1,configurable:!0}),t.prototype.init=function(){if(!this.initialised&&void 0===this.initialisedOK){var t;this._searcher=(t=this.config,new No(t)),this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),this._isTextElement&&!this.config.addItems||this.passedElement.element.hasAttribute("disabled")||this.passedElement.element.closest("fieldset:disabled")?this.disable():(this.enable(),this._addEventListeners()),this._initStore(),this.initialised=!0,this.initialisedOK=!0;var e=this.config.callbackOnInit;"function"==typeof e&&e.call(this)}},t.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this._store._listeners=[],this.clearStore(!1),this._stopSearch(),this._templates=t.defaults.templates,this.initialised=!1,this.initialisedOK=void 0)},t.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},t.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},t.prototype.highlightItem=function(t,e){if(void 0===e&&(e=!0),!t||!t.id)return this;var n=this._store.items.find((function(e){return e.id===t.id}));return!n||n.highlighted||(this._store.dispatch(ii(n,!0)),e&&this.passedElement.triggerEvent(Nr,di(n))),this},t.prototype.unhighlightItem=function(t,e){if(void 0===e&&(e=!0),!t||!t.id)return this;var n=this._store.items.find((function(e){return e.id===t.id}));return n&&n.highlighted?(this._store.dispatch(ii(n,!1)),e&&this.passedElement.triggerEvent(Br,di(n)),this):this},t.prototype.highlightAll=function(){var t=this;return this._store.withTxn((function(){t._store.items.forEach((function(e){e.highlighted||(t._store.dispatch(ii(e,!0)),t.passedElement.triggerEvent(Nr,di(e)))}))})),this},t.prototype.unhighlightAll=function(){var t=this;return this._store.withTxn((function(){t._store.items.forEach((function(e){e.highlighted&&(t._store.dispatch(ii(e,!1)),t.passedElement.triggerEvent(Nr,di(e)))}))})),this},t.prototype.removeActiveItemsByValue=function(t){var e=this;return this._store.withTxn((function(){e._store.items.filter((function(e){return e.value===t})).forEach((function(t){return e._removeItem(t)}))})),this},t.prototype.removeActiveItems=function(t){var e=this;return this._store.withTxn((function(){e._store.items.filter((function(e){return e.id!==t})).forEach((function(t){return e._removeItem(t)}))})),this},t.prototype.removeHighlightedItems=function(t){var e=this;return void 0===t&&(t=!1),this._store.withTxn((function(){e._store.highlightedActiveItems.forEach((function(n){e._removeItem(n),t&&e._triggerChange(n.value)}))})),this},t.prototype.showDropdown=function(t){var e=this;return this.dropdown.isActive||(void 0===t&&(t=!this._canSearch),requestAnimationFrame((function(){e.dropdown.show();var n=e.dropdown.element.getBoundingClientRect();e.containerOuter.open(n.bottom,n.height),t||e.input.focus(),e.passedElement.triggerEvent(Pr);var r=e.choiceList.element.querySelector(vi(e.config.classNames.selectedState));null===r||si(r,e.choiceList.element)||r.scrollIntoView()}))),this},t.prototype.hideDropdown=function(t){var e=this;return this.dropdown.isActive?(this._removeHighlightedChoices(),requestAnimationFrame((function(){e.dropdown.hide(),e.containerOuter.close(),!t&&e._canSearch&&(e.input.removeActiveDescendant(),e.input.blur()),e.passedElement.triggerEvent(Or)})),this):this},t.prototype.getValue=function(t){var e=this._store.items.map((function(e){return t?e.value:di(e)}));return this._isSelectOneElement||this.config.singleModeForMultiSelect?e[0]:e},t.prototype.setValue=function(t){var e=this;return this.initialisedOK?(this._store.withTxn((function(){t.forEach((function(t){t&&e._addChoice(Pi(t,!1))}))})),this._searcher.reset(),this):(this._warnChoicesInitFailed("setValue"),this)},t.prototype.setChoiceByValue=function(t){var e=this;return this.initialisedOK?(this._isTextElement||(this._store.withTxn((function(){(Array.isArray(t)?t:[t]).forEach((function(t){return e._findAndSelectChoiceByValue(t)})),e.unhighlightAll()})),this._searcher.reset()),this):(this._warnChoicesInitFailed("setChoiceByValue"),this)},t.prototype.setChoices=function(t,e,n,r,i,o){var s=this;if(void 0===t&&(t=[]),void 0===e&&(e="value"),void 0===n&&(n="label"),void 0===r&&(r=!1),void 0===i&&(i=!0),void 0===o&&(o=!1),!this.initialisedOK)return this._warnChoicesInitFailed("setChoices"),this;if(!this._isSelectElement)throw new TypeError("setChoices can't be used with INPUT based Choices");if("string"!=typeof e||!e)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if("function"==typeof t){var a=t(this);if("function"==typeof Promise&&a instanceof Promise)return new Promise((function(t){return requestAnimationFrame(t)})).then((function(){return s._handleLoadingState(!0)})).then((function(){return a})).then((function(t){return s.setChoices(t,e,n,r,i,o)})).catch((function(t){s.config.silent||console.error(t)})).then((function(){return s._handleLoadingState(!1)})).then((function(){return s}));if(!Array.isArray(a))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof a));return this.setChoices(a,e,n,!1)}if(!Array.isArray(t))throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices");return this.containerOuter.removeLoadingState(),this._store.withTxn((function(){i&&(s._isSearching=!1),r&&s.clearChoices(!0,o);var a="value"===e,l="label"===n;t.forEach((function(t){if("choices"in t){var r=t;l||(r=vr(vr({},r),{label:r[n]})),s._addGroup(Pi(r,!0))}else{var i=t;l&&a||(i=vr(vr({},i),{value:i[e],label:i[n]}));var o=Pi(i,!1);s._addChoice(o),o.placeholder&&!s._hasNonChoicePlaceholder&&(s._placeholderValue=ui(o.label))}})),s.unhighlightAll()})),this._searcher.reset(),this},t.prototype.refresh=function(t,e,n){var r=this;return void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===n&&(n=!1),this._isSelectElement?(this._store.withTxn((function(){var i=r.passedElement.optionsAsChoices(),o={};n||r._store.items.forEach((function(t){t.id&&t.active&&t.selected&&(o[t.value]=!0)})),r.clearStore(!1);var s=function(t){n?r._store.dispatch(ri(t)):o[t.value]&&(t.selected=!0)};i.forEach((function(t){"choices"in t?t.choices.forEach(s):s(t)})),r._addPredefinedChoices(i,e,t),r._isSearching&&r._searchChoices(r.input.value)})),this):(this.config.silent||console.warn("refresh method can only be used on choices backed by a <select> element"),this)},t.prototype.removeChoice=function(t){var e=this._store.choices.find((function(e){return e.value===t}));return e?(this._clearNotice(),this._store.dispatch(function(t){return{type:wr,choice:t}}(e)),this._searcher.reset(),e.selected&&this.passedElement.triggerEvent(Dr,di(e)),this):this},t.prototype.clearChoices=function(t,e){var n=this;return void 0===t&&(t=!0),void 0===e&&(e=!1),t&&(e?this.passedElement.element.replaceChildren(""):this.passedElement.element.querySelectorAll(":not([selected])").forEach((function(t){t.remove()}))),this.itemList.element.replaceChildren(""),this.choiceList.element.replaceChildren(""),this._clearNotice(),this._store.withTxn((function(){var t=e?[]:n._store.items;n._store.reset(),t.forEach((function(t){n._store.dispatch(ei(t)),n._store.dispatch(ni(t))}))})),this._searcher.reset(),this},t.prototype.clearStore=function(t){return void 0===t&&(t=!0),this.clearChoices(t,!0),this._stopSearch(),this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this},t.prototype.clearInput=function(){var t=!this._isSelectOneElement;return this.input.clear(t),this._stopSearch(),this},t.prototype._validateConfig=function(){var t,e,n,r,i=this.config,o=(t=i,e=Li,n=Object.keys(t).sort(),r=Object.keys(e).sort(),n.filter((function(t){return r.indexOf(t)<0})));o.length&&console.warn("Unknown config option(s) passed",o.join(", ")),i.allowHTML&&i.allowHtmlUserInput&&(i.addItems&&console.warn("Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks"),i.addChoices&&console.warn("Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks"))},t.prototype._render=function(t){void 0===t&&(t={choices:!0,groups:!0,items:!0}),this._store.inTxn()||(this._isSelectElement&&(t.choices||t.groups)&&this._renderChoices(),t.items&&this._renderItems())},t.prototype._renderChoices=function(){var t=this;if(this._canAddItems()){var e=this.config,n=this._isSearching,r=this._store,i=r.activeGroups,o=r.activeChoices,s=n?e.searchResultLimit:e.renderChoiceLimit;if(this._isSelectElement){var a=o.filter((function(t){return!t.element}));a.length&&this.passedElement.addOptions(a)}var l=document.createDocumentFragment(),c=function(t){return t.filter((function(t){return!t.placeholder&&(n?(e.searchRenderSelectedChoices||!t.selected)&&!!t.rank:e.renderSelectedChoices||!t.selected)}))},h=e.appendGroupInSearch&&n,u=!1,d=null,f=function(r,i){n?r.sort(yi):e.shouldSort&&r.sort(e.sorter);var o=r.length;o=!i&&s>0&&o>s?s:o,o--,r.every((function(r,i){var s=r.choiceEl||t._templates.choice(e,r,e.itemSelectText,h&&r.group?r.group.label:void 0);return r.choiceEl=s,l.appendChild(s),n||!r.selected?u=!0:d||(d=s),i<o}))};o.length&&(e.resetScrollPosition&&requestAnimationFrame((function(){return t.choiceList.scrollToTop()})),this._hasNonChoicePlaceholder||n||!this._isSelectOneElement||f(o.filter((function(t){return t.placeholder&&!t.group})),!1),i.length&&!n?(e.shouldSort&&i.sort(e.sorter),f(o.filter((function(t){return!t.placeholder&&!t.group})),!1),i.forEach((function(e){var n=c(e.choices);if(n.length){if(e.label){var r=e.groupEl||t._templates.choiceGroup(t.config,e);e.groupEl=r,r.remove(),l.appendChild(r)}f(n,!0)}}))):f(c(o),!1)),u||!n&&l.children.length&&e.renderSelectedChoices||(this._notice||(this._notice={text:ci(n?e.noResultsText:e.noChoicesText),type:n?Fi:Ni}),l.replaceChildren("")),this._renderNotice(l),this.choiceList.element.replaceChildren(l),this._highlightChoice(d)}},t.prototype._renderItems=function(){var t=this,e=this._store.items||[],n=this.itemList.element,r=this.config,i=document.createDocumentFragment(),o=function(t){return n.querySelector('[data-item][data-id="'.concat(t.id,'"]'))},s=function(e){var n=e.itemEl;n&&n.parentElement||(n=o(e)||t._templates.item(r,e,r.removeItemButton),e.itemEl=n,i.appendChild(n))};e.forEach(s);var a=!!i.childNodes.length;if(this._isSelectOneElement){var l=n.children.length;if(a||l>1){var c=n.querySelector(vi(r.classNames.placeholder));c&&c.remove()}else a||l||!this._placeholderValue||(a=!0,s(Pi({selected:!0,value:"",label:this._placeholderValue,placeholder:!0},!1)))}a&&(n.append(i),r.shouldSortItems&&!this._isSelectOneElement&&(e.sort(r.sorter),e.forEach((function(t){var e=o(t);e&&(e.remove(),i.append(e))})),n.append(i))),this._isTextElement&&(this.passedElement.value=e.map((function(t){return t.value})).join(r.delimiter))},t.prototype._displayNotice=function(t,e,n){void 0===n&&(n=!0);var r=this._notice;r&&(r.type===e&&r.text===t||r.type===Bi&&(e===Fi||e===Ni))?n&&this.showDropdown(!0):(this._clearNotice(),this._notice=t?{text:t,type:e}:void 0,this._renderNotice(),n&&t&&this.showDropdown(!0))},t.prototype._clearNotice=function(){if(this._notice){var t=this.choiceList.element.querySelector(vi(this.config.classNames.notice));t&&t.remove(),this._notice=void 0}},t.prototype._renderNotice=function(t){var e=this._notice;if(e){var n=this._templates.notice(this.config,e.text,e.type);t?t.append(n):this.choiceList.prepend(n)}},t.prototype._getChoiceForOutput=function(t,e){return di(t,e)},t.prototype._triggerChange=function(t){null!=t&&this.passedElement.triggerEvent(Ir,{value:t})},t.prototype._handleButtonAction=function(t){var e=this,n=this._store.items;if(n.length&&this.config.removeItems&&this.config.removeItemButton){var r=t&&Wo(t.closest("[data-id]")),i=r&&n.find((function(t){return t.id===r}));i&&this._store.withTxn((function(){if(e._removeItem(i),e._triggerChange(i.value),e._isSelectOneElement&&!e._hasNonChoicePlaceholder){var t=(e.config.shouldSort?e._store.choices.reverse():e._store.choices).find((function(t){return t.placeholder}));t&&(e._addItem(t),e.unhighlightAll(),t.value&&e._triggerChange(t.value))}}))}},t.prototype._handleItemAction=function(t,e){var n=this;void 0===e&&(e=!1);var r=this._store.items;if(r.length&&this.config.removeItems&&!this._isSelectOneElement){var i=Wo(t);i&&(r.forEach((function(t){t.id!==i||t.highlighted?!e&&t.highlighted&&n.unhighlightItem(t):n.highlightItem(t)})),this.input.focus())}},t.prototype._handleChoiceAction=function(t){var e=this,n=Wo(t),r=n&&this._store.getChoiceById(n);if(!r||r.disabled)return!1;var i=this.dropdown.isActive;if(!r.selected){if(!this._canAddItems())return!0;this._store.withTxn((function(){e._addItem(r,!0,!0),e.clearInput(),e.unhighlightAll()})),this._triggerChange(r.value)}return i&&this.config.closeDropdownOnSelect&&(this.hideDropdown(!0),this.containerOuter.element.focus()),!0},t.prototype._handleBackspace=function(t){var e=this.config;if(e.removeItems&&t.length){var n=t[t.length-1],r=t.some((function(t){return t.highlighted}));e.editItems&&!r&&n?(this.input.value=n.value,this.input.setWidth(),this._removeItem(n),this._triggerChange(n.value)):(r||this.highlightItem(n,!1),this.removeHighlightedItems(!0))}},t.prototype._loadChoices=function(){var t,e=this,n=this.config;if(this._isTextElement){if(this._presetChoices=n.items.map((function(t){return Pi(t,!1)})),this.passedElement.value){var r=this.passedElement.value.split(n.delimiter).map((function(t){return Pi(t,!1,e.config.allowHtmlUserInput)}));this._presetChoices=this._presetChoices.concat(r)}this._presetChoices.forEach((function(t){t.selected=!0}))}else if(this._isSelectElement){this._presetChoices=n.choices.map((function(t){return Pi(t,!0)}));var i=this.passedElement.optionsAsChoices();i&&(t=this._presetChoices).push.apply(t,i)}},t.prototype._handleLoadingState=function(t){void 0===t&&(t=!0);var e=this.itemList.element;t?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?e.replaceChildren(this._templates.placeholder(this.config,this.config.loadingText)):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?(e.replaceChildren(""),this._render()):this.input.placeholder=this._placeholderValue||"")},t.prototype._handleSearch=function(t){if(this.input.isFocussed)if(null!=t&&t.length>=this.config.searchFloor){var e=this.config.searchChoices?this._searchChoices(t):0;null!==e&&this.passedElement.triggerEvent(jr,{value:t,resultCount:e})}else this._store.choices.some((function(t){return!t.active}))&&this._stopSearch()},t.prototype._canAddItems=function(){var t=this.config,e=t.maxItemCount,n=t.maxItemText;return!t.singleModeForMultiSelect&&e>0&&e<=this._store.items.length?(this.choiceList.element.replaceChildren(""),this._notice=void 0,this._displayNotice("function"==typeof n?n(e):n,Bi),!1):(this._notice&&this._notice.type===Bi&&this._clearNotice(),!0)},t.prototype._canCreateItem=function(t){var e=this.config,n=!0,r="";if((n&&"function"==typeof e.addItemFilter&&!e.addItemFilter(t)&&(n=!1,r=fi(e.customAddItemText,t,void 0)),n)&&this._store.choices.find((function(n){return e.valueComparer(n.value,t)}))){if(this._isSelectElement)return this._displayNotice("",Bi),!1;e.duplicateItemsAllowed||(n=!1,r=fi(e.uniqueItemText,t,void 0))}return n&&(r=fi(e.addItemText,t,void 0)),r&&this._displayNotice(r,Bi),n},t.prototype._searchChoices=function(t){var e=t.trim().replace(/\s{2,}/," ");if(!e.length||e===this._currentValue)return null;var n=this._searcher;n.isEmptyIndex()&&n.index(this._store.searchableChoices);var r=n.search(e);this._currentValue=e,this._highlightPosition=0,this._isSearching=!0;var i=this._notice;return(i&&i.type)!==Bi&&(r.length?this._clearNotice():this._displayNotice(ci(this.config.noResultsText),Fi)),this._store.dispatch(function(t){return{type:Sr,results:t}}(r)),r.length},t.prototype._stopSearch=function(){this._isSearching&&(this._currentValue="",this._isSearching=!1,this._clearNotice(),this._store.dispatch({type:Cr,active:!0}),this.passedElement.triggerEvent(jr,{value:"",resultCount:0}))},t.prototype._addEventListeners=function(){var t=this._docRoot,e=this.containerOuter.element,n=this.input.element,r=this.passedElement.element;t.addEventListener("touchend",this._onTouchEnd,!0),e.addEventListener("keydown",this._onKeyDown,!0),e.addEventListener("mousedown",this._onMouseDown,!0),t.addEventListener("click",this._onClick,{passive:!0}),t.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(e.addEventListener("focus",this._onFocus,{passive:!0}),e.addEventListener("blur",this._onBlur,{passive:!0})),n.addEventListener("keyup",this._onKeyUp,{passive:!0}),n.addEventListener("input",this._onInput,{passive:!0}),n.addEventListener("focus",this._onFocus,{passive:!0}),n.addEventListener("blur",this._onBlur,{passive:!0}),n.form&&n.form.addEventListener("reset",this._onFormReset,{passive:!0}),r.hasAttribute("required")&&(r.addEventListener("change",this._onChange,{passive:!0}),r.addEventListener("invalid",this._onInvalid,{passive:!0})),this.input.addEventListeners()},t.prototype._removeEventListeners=function(){var t=this._docRoot,e=this.containerOuter.element,n=this.input.element,r=this.passedElement.element;t.removeEventListener("touchend",this._onTouchEnd,!0),e.removeEventListener("keydown",this._onKeyDown,!0),e.removeEventListener("mousedown",this._onMouseDown,!0),t.removeEventListener("click",this._onClick),t.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),this._isSelectOneElement&&(e.removeEventListener("focus",this._onFocus),e.removeEventListener("blur",this._onBlur)),n.removeEventListener("keyup",this._onKeyUp),n.removeEventListener("input",this._onInput),n.removeEventListener("focus",this._onFocus),n.removeEventListener("blur",this._onBlur),n.form&&n.form.removeEventListener("reset",this._onFormReset),r.hasAttribute("required")&&(r.removeEventListener("change",this._onChange),r.removeEventListener("invalid",this._onInvalid)),this.input.removeEventListeners()},t.prototype._onKeyDown=function(t){var e=t.keyCode,n=this.dropdown.isActive,r=1===t.key.length||2===t.key.length&&t.key.charCodeAt(0)>=55296||"Unidentified"===t.key;switch(this._isTextElement||n||e===Yr||e===Gr||e===zr||(this.showDropdown(),!this.input.isFocussed&&r&&(this.input.value+=t.key," "===t.key&&t.preventDefault())),e){case Vr:return this._onSelectKey(t,this.itemList.element.hasChildNodes());case Hr:return this._onEnterKey(t,n);case Yr:return this._onEscapeKey(t,n);case Xr:case qr:case $r:case Kr:return this._onDirectionKey(t,n);case Wr:case Ur:return this._onDeleteKey(t,this._store.items,this.input.isFocussed)}},t.prototype._onKeyUp=function(){this._canSearch=this.config.searchEnabled},t.prototype._onInput=function(){var t=this.input.value;t?this._canAddItems()&&(this._canSearch&&this._handleSearch(t),this._canAddUserChoices&&(this._canCreateItem(t),this._isSelectElement&&(this._highlightPosition=0,this._highlightChoice()))):this._isTextElement?this.hideDropdown(!0):this._stopSearch()},t.prototype._onSelectKey=function(t,e){(t.ctrlKey||t.metaKey)&&e&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},t.prototype._onEnterKey=function(t,e){var n=this,r=this.input.value,i=t.target;if(t.preventDefault(),i&&i.hasAttribute("data-button"))this._handleButtonAction(i);else if(e){var o=this.dropdown.element.querySelector(vi(this.config.classNames.highlightedState));if(!o||!this._handleChoiceAction(o))if(i&&r){if(this._canAddItems()){var s=!1;this._store.withTxn((function(){if(!(s=n._findAndSelectChoiceByValue(r,!0))){if(!n._canAddUserChoices)return;if(!n._canCreateItem(r))return;n._addChoice(Pi(r,!1,n.config.allowHtmlUserInput),!0,!0),s=!0}n.clearInput(),n.unhighlightAll()})),s&&(this._triggerChange(r),this.config.closeDropdownOnSelect&&this.hideDropdown(!0))}}else this.hideDropdown(!0)}else(this._isSelectElement||this._notice)&&this.showDropdown()},t.prototype._onEscapeKey=function(t,e){e&&(t.stopPropagation(),this.hideDropdown(!0),this._stopSearch(),this.containerOuter.element.focus())},t.prototype._onDirectionKey=function(t,e){var n=t.keyCode;if(e||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var r=n===$r||n===Kr?1:-1,i=void 0;if(t.metaKey||n===Kr||n===qr)i=r>0?this.dropdown.element.querySelector("".concat(Ho,":last-of-type")):this.dropdown.element.querySelector(Ho);else{var o=this.dropdown.element.querySelector(vi(this.config.classNames.highlightedState));i=o?function(t,e,n){void 0===n&&(n=1);for(var r="".concat(n>0?"next":"previous","ElementSibling"),i=t[r];i;){if(i.matches(e))return i;i=i[r]}return null}(o,Ho,r):this.dropdown.element.querySelector(Ho)}i&&(si(i,this.choiceList.element,r)||this.choiceList.scrollToChildElement(i,r),this._highlightChoice(i)),t.preventDefault()}},t.prototype._onDeleteKey=function(t,e,n){this._isSelectOneElement||t.target.value||!n||(this._handleBackspace(e),t.preventDefault())},t.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},t.prototype._onTouchEnd=function(t){var e=(t||t.touches[0]).target;this._wasTap&&this.containerOuter.element.contains(e)&&((e===this.containerOuter.element||e===this.containerInner.element)&&(this._isTextElement?this.input.focus():this._isSelectMultipleElement&&this.showDropdown()),t.stopPropagation());this._wasTap=!0},t.prototype._onMouseDown=function(t){var e=t.target;if(e instanceof Element){if(zo&&this.choiceList.element.contains(e)){var n=this.choiceList.element.firstElementChild;this._isScrollingOnIe="ltr"===this._direction?t.offsetX>=n.offsetWidth:t.offsetX<n.offsetLeft}if(e!==this.input.element){var r=e.closest("[data-button],[data-item],[data-choice]");r instanceof HTMLElement&&("button"in r.dataset?this._handleButtonAction(r):"item"in r.dataset?this._handleItemAction(r,t.shiftKey):"choice"in r.dataset&&this._handleChoiceAction(r)),t.preventDefault()}}},t.prototype._onMouseOver=function(t){var e=t.target;e instanceof HTMLElement&&"choice"in e.dataset&&this._highlightChoice(e)},t.prototype._onClick=function(t){var e=t.target,n=this.containerOuter;n.element.contains(e)?this.dropdown.isActive||n.isDisabled?this._isSelectOneElement&&e!==this.input.element&&!this.dropdown.element.contains(e)&&this.hideDropdown():this._isTextElement?document.activeElement!==this.input.element&&this.input.focus():(this.showDropdown(),n.element.focus()):(n.removeFocusState(),this.hideDropdown(!0),this.unhighlightAll())},t.prototype._onFocus=function(t){var e=t.target,n=this.containerOuter;if(e&&n.element.contains(e)){var r=e===this.input.element;this._isTextElement?r&&n.addFocusState():this._isSelectMultipleElement?r&&(this.showDropdown(!0),n.addFocusState()):(n.addFocusState(),r&&this.showDropdown(!0))}},t.prototype._onBlur=function(t){var e=t.target,n=this.containerOuter;e&&n.element.contains(e)&&!this._isScrollingOnIe?e===this.input.element?(n.removeFocusState(),this.hideDropdown(!0),(this._isTextElement||this._isSelectMultipleElement)&&this.unhighlightAll()):e===this.containerOuter.element&&(n.removeFocusState(),this.config.searchEnabled||this.hideDropdown(!0)):(this._isScrollingOnIe=!1,this.input.element.focus())},t.prototype._onFormReset=function(){var t=this;this._store.withTxn((function(){t.clearInput(),t.hideDropdown(),t.refresh(!1,!1,!0),t._initialItems.length&&t.setChoiceByValue(t._initialItems)}))},t.prototype._onChange=function(t){t.target.checkValidity()&&this.containerOuter.removeInvalidState()},t.prototype._onInvalid=function(){this.containerOuter.addInvalidState()},t.prototype._removeHighlightedChoices=function(){var t=this.config.classNames.highlightedState;Array.from(this.dropdown.element.querySelectorAll(vi(t))).forEach((function(e){xi(e,t),e.setAttribute("aria-selected","false")}))},t.prototype._highlightChoice=function(t){void 0===t&&(t=null);var e=Array.from(this.dropdown.element.querySelectorAll(Ho));if(e.length){var n=t,r=this.config.classNames.highlightedState;this._removeHighlightedChoices(),n?this._highlightPosition=e.indexOf(n):(n=e.length>this._highlightPosition?e[this._highlightPosition]:e[e.length-1])||(n=e[0]),bi(n,r),n.setAttribute("aria-selected","true"),this.passedElement.triggerEvent(Fr,{el:n}),this.dropdown.isActive&&(this.input.setActiveDescendant(n.id),this.containerOuter.setActiveDescendant(n.id))}},t.prototype._addItem=function(t,e,n){if(void 0===e&&(e=!0),void 0===n&&(n=!1),!t.id)throw new TypeError("item.id must be set before _addItem is called for a choice/item");if((this.config.singleModeForMultiSelect||this._isSelectOneElement)&&this.removeActiveItems(t.id),this._store.dispatch(ni(t)),e){var r=di(t);this.passedElement.triggerEvent(Rr,r),n&&this.passedElement.triggerEvent(Lr,r)}},t.prototype._removeItem=function(t){if(t.id){this._store.dispatch(ri(t));var e=this._notice;e&&e.type===Ni&&this._clearNotice(),this.passedElement.triggerEvent(Dr,di(t))}},t.prototype._addChoice=function(t,e,n){if(void 0===e&&(e=!0),void 0===n&&(n=!1),t.id)throw new TypeError("Can not re-add a choice which has already been added");var r=this.config;if(r.duplicateItemsAllowed||!this._store.choices.find((function(e){return r.valueComparer(e.value,t.value)}))){this._lastAddedChoiceId++,t.id=this._lastAddedChoiceId,t.elementId="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(t.id);var i=r.prependValue,o=r.appendValue;i&&(t.value=i+t.value),o&&(t.value+=o.toString()),(i||o)&&t.element&&(t.element.value=t.value),this._clearNotice(),this._store.dispatch(ei(t)),t.selected&&this._addItem(t,e,n)}},t.prototype._addGroup=function(t,e){var n=this;if(void 0===e&&(e=!0),t.id)throw new TypeError("Can not re-add a group which has already been added");this._store.dispatch(function(t){return{type:kr,group:t}}(t)),t.choices&&(this._lastAddedGroupId++,t.id=this._lastAddedGroupId,t.choices.forEach((function(r){r.group=t,t.disabled&&(r.disabled=!0),n._addChoice(r,e)})))},t.prototype._createTemplates=function(){var t=this,e=this.config.callbackOnCreateTemplates,n={};"function"==typeof e&&(n=e.call(this,li,pi,gi));var r={};Object.keys(this._templates).forEach((function(e){r[e]=e in n?n[e].bind(t):t._templates[e].bind(t)})),this._templates=r},t.prototype._createElements=function(){var t=this._templates,e=this.config,n=this._isSelectOneElement,r=e.position,i=e.classNames,o=this._elementType;this.containerOuter=new Si({element:t.containerOuter(e,this._direction,this._isSelectElement,n,e.searchEnabled,o,e.labelId),classNames:i,type:o,position:r}),this.containerInner=new Si({element:t.containerInner(e),classNames:i,type:o,position:r}),this.input=new Ci({element:t.input(e,this._placeholderValue),classNames:i,type:o,preventPaste:!e.paste}),this.choiceList=new Ei({element:t.choiceList(e,n)}),this.itemList=new Ei({element:t.itemList(e,n)}),this.dropdown=new wi({element:t.dropdown(e),classNames:i,type:o})},t.prototype._createStructure=function(){var t=this,e=t.containerInner,n=t.containerOuter,r=t.passedElement,i=this.dropdown.element;r.conceal(),e.wrap(r.element),n.wrap(e.element),n.element.appendChild(e.element),n.element.appendChild(i),e.element.appendChild(this.itemList.element),i.appendChild(this.choiceList.element),this._isSelectOneElement?(this.input.placeholder=this.config.searchPlaceholderValue||"",this.config.searchEnabled&&i.insertBefore(this.input.element,i.firstChild)):(this._isSelectMultipleElement&&!this.config.searchEnabled||e.element.appendChild(this.input.element),this._placeholderValue&&(this.input.placeholder=this._placeholderValue),this.input.setWidth()),this._highlightPosition=0,this._isSearching=!1},t.prototype._initStore=function(){var t=this;this._store.subscribe(this._render).withTxn((function(){t._addPredefinedChoices(t._presetChoices,t._isSelectOneElement&&!t._hasNonChoicePlaceholder,!1)})),(!this._store.choices.length||this._isSelectOneElement&&this._hasNonChoicePlaceholder)&&this._render()},t.prototype._addPredefinedChoices=function(t,e,n){var r=this;(void 0===e&&(e=!1),void 0===n&&(n=!0),e)&&(-1===t.findIndex((function(t){return t.selected}))&&t.some((function(t){return!t.disabled&&!("choices"in t)&&(t.selected=!0,!0)})));t.forEach((function(t){"choices"in t?r._isSelectElement&&r._addGroup(t,n):r._addChoice(t,n)}))},t.prototype._findAndSelectChoiceByValue=function(t,e){var n=this;void 0===e&&(e=!1);var r=this._store.choices.find((function(e){return n.config.valueComparer(e.value,t)}));return!(!r||r.disabled||r.selected)&&(this._addItem(r,!0,e),!0)},t.prototype._generatePlaceholderValue=function(){var t=this.config;if(!t.placeholder)return null;if(this._hasNonChoicePlaceholder)return t.placeholderValue;if(this._isSelectElement){var e=this.passedElement.placeholderOption;return e?e.text:null}return null},t.prototype._warnChoicesInitFailed=function(t){if(!this.config.silent){if(!this.initialised)throw new TypeError("".concat(t," called on a non-initialised instance of Choices"));if(!this.initialisedOK)throw new TypeError("".concat(t," called for an element which has multiple instances of Choices initialised on it"))}},t.version="11.2.1",t}(),Yo=i(5072),Xo=i.n(Yo),$o=i(7825),qo=i.n($o),Ko=i(7659),Zo=i.n(Ko),Jo=i(5056),Qo=i.n(Jo),ts=i(540),es=i.n(ts),ns=i(1113),rs=i.n(ns),is=i(5870),os={};os.styleTagTransform=rs(),os.setAttributes=Qo(),os.insert=Zo().bind(null,"head"),os.domAPI=qo(),os.insertStyleElement=es();Xo()(is.A,os);is.A&&is.A.locals&&is.A.locals;function ss(t){return ss="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ss(t)}function as(t){return function(t){if(Array.isArray(t))return ls(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ls(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ls(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ls(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function cs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,hs(r.key),r)}}function hs(t){var e=function(t,e){if("object"!=ss(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ss(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ss(e)?e:e+""}var us=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP JSON HERE",this._initDrop(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"120px"})}},{key:"_createToolbox",value:function(){var t=this;this.toolbox=document.createElement("div"),Object.assign(this.toolbox.style,{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"}),this.counter=document.createElement("div"),this.counter.textContent="Records: 0",Object.assign(this.counter.style,{fontFamily:"sans-serif",fontSize:"13px",color:"#555"});var e=document.createElement("div");this.clearBtn=document.createElement("button"),this.clearBtn.textContent="Clear",this.clearBtn.disabled=!0,this.clearBtn.addEventListener("click",(function(){t._renderBase()})),e.appendChild(this.clearBtn),this.toolbox.appendChild(this.counter),this.toolbox.appendChild(e),this.container.appendChild(this.toolbox)}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888",fontFamily:"sans-serif",pointerEvents:"none",userSelect:"none"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"_hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"_initDrop",value:function(){var t=this;this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background=""})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="";var n=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain");if(n)try{var r=JSON.parse(n).data;Array.isArray(r)?t.render(r):t._showPlaceholder()}catch(e){console.error("Invalid JSON dropped",e),t._showPlaceholder()}else t._showPlaceholder()}))}},{key:"render",value:function(t){var e=this;if(Array.isArray(t)&&0!==t.length){this.data=t,this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._hidePlaceholder(),this.clearBtn.disabled=!1,this.counter.textContent="Records: ".concat(t.length);var n=document.createElement("table");Object.assign(n.style,{borderCollapse:"separate",borderSpacing:"0 4px",width:"100%",fontFamily:"sans-serif",fontSize:"14px"});var r=document.createElement("thead"),i=document.createElement("tr");["Field","# Variants","Values","Attractor",,"Orbit","Sum","Split UP","Split Right","Histogram","Color"].forEach((function(t){var e=document.createElement("th");e.textContent=t,Object.assign(e.style,{border:"none",padding:"6px",background:"#eaeaea",textAlign:"left"}),i.appendChild(e)})),r.appendChild(i),n.appendChild(r);var o=document.createElement("tbody");Object.keys(t[0]).forEach((function(n,r){var i=t.map((function(t){return t[n]})).filter((function(t){return null!=t}));if(i.length){var s=e._detectType(i),a=as(new Set(i)),l=document.createElement("tr"),c=document.createElement("td");c.textContent=n,Object.assign(c.style,{border:"none",padding:"6px",fontWeight:"bold"});var h=document.createElement("td");h.textContent=a.length,Object.assign(h.style,{border:"none",padding:"6px",textAlign:"center"});var u=document.createElement("td");Object.assign(u.style,{border:"none",padding:"6px"});var d=null;if("categorical"===s){var f=document.createElement("select");a.forEach((function(t){var e=document.createElement("option");e.value=t,e.textContent=t,f.appendChild(e)})),u.appendChild(f),new Vo(f,{searchEnabled:!0,itemSelectText:"",shouldSort:!1});var p=f.closest(".choices");if(p){Object.assign(p.style,{minWidth:"180px",maxWidth:"220px"});var m=p.querySelector(".choices__inner");m&&Object.assign(m.style,{background:"#f8fafc",border:"1px solid #cbd5e1",borderRadius:"8px",minHeight:"34px",padding:"4px 8px",fontSize:"13px"});var y=p.querySelector(".choices__list--dropdown");y&&Object.assign(y.style,{border:"1px solid #cbd5e1",borderRadius:"8px",background:"#ffffff",boxShadow:"0 4px 10px rgba(0,0,0,0.08)"})}d=a[0],f.addEventListener("change",(function(t){d=f.value,console.log("SELECTED V",d)}))}else{var g=i.map((function(t){return Number(t)})).filter((function(t){return!isNaN(t)}));u.textContent=g.length?"min: ".concat(Math.min.apply(Math,as(g))," | max: ").concat(Math.max.apply(Math,as(g))):"No numeric data"}var v=function(t,e){var n=document.createElement("td"),r=document.createElement("div");r.setAttribute("draggable","true"),Object.assign(r.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",border:"none",borderRadius:"6px",cursor:"grab"});var i=document.createElement("i");return i.className=t,i.style.pointerEvents="none",r.appendChild(i),r.addEventListener("dragstart",(function(t){var n=e(),r=JSON.stringify(n,null,2);t.dataTransfer.setData("application/json",r),t.dataTransfer.setData("text/plain",r)})),n.appendChild(r),n},b=document.createElement("td");Object.assign(b.style,{border:"none",padding:"6px",textAlign:"center"});var x="#ff0000",_=document.createElement("input");_.type="color",_.value=x,_.addEventListener("input",(function(t){x=t.target.value}));var w=document.createElement("div");w.setAttribute("draggable","true"),Object.assign(w.style,{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"6px",cursor:"grab",marginLeft:"6px"});var S=document.createElement("i");S.className="fa-solid fa-palette",S.style.pointerEvents="none",w.appendChild(S),w.addEventListener("dragstart",(function(t){var e,r={type:"color-rule",field:n,equals:d,color:(e=x,parseInt(e.replace("#","0x"),16))},i=JSON.stringify(r,null,2);t.dataTransfer.setData("application/json",i),t.dataTransfer.setData("text/plain",i)})),b.appendChild(_),b.appendChild(w);var C=v("fa-solid fa-magnet",(function(){return e._buildAttractorPayload(n,d)})),E=document.createElement("td"),k=document.createElement("div");k.setAttribute("draggable","true"),k.textContent="🪐",Object.assign(k.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"6px",cursor:"grab",fontSize:"14px",userSelect:"none"}),k.addEventListener("dragstart",(function(t){var e={type:"scalarField",field:n},r=JSON.stringify(e);t.dataTransfer.setData("application/json",r),t.dataTransfer.setData("text/plain",r)})),E.appendChild(k);var T=document.createElement("td"),A=document.createElement("div");A.setAttribute("draggable","true"),A.textContent="∑",Object.assign(A.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"6px",cursor:"grab",fontSize:"14px",userSelect:"none"}),A.addEventListener("dragstart",(function(t){var e={type:"sumField",field:n},r=JSON.stringify(e);t.dataTransfer.setData("application/json",r),t.dataTransfer.setData("text/plain",r)})),T.appendChild(A);var M=v("fa-solid fa-arrow-up",(function(){return e._buildSplitterPayload(n,"up")})),P=v("fa-solid fa-arrow-right",(function(){return e._buildSplitterPayload(n,"right")})),O=v("fa-solid fa-chart-column",(function(){return e._buildHistogramPayload(n)}));l.appendChild(c),l.appendChild(h),l.appendChild(u),l.appendChild(C),l.appendChild(E),l.appendChild(T),l.appendChild(M),l.appendChild(P),l.appendChild(O),l.appendChild(b);var I=l.querySelectorAll("td"),L=r%2==0?"#dbeafe":"#ffffff";I.forEach((function(t){t.style.background=L})),o.appendChild(l)}})),n.appendChild(o);var s=document.createElement("div");Object.assign(s.style,{position:"absolute",top:"42px",left:"0",right:"0",bottom:"0",overflow:"auto",padding:"10px",boxSizing:"border-box"}),s.appendChild(n),this.container.appendChild(s)}else this._showPlaceholder()}},{key:"_buildAttractorPayload",value:function(t,e){return{type:"planet",label:e,rule:{op:"and",rules:[{field:t,op:"eq",value:e}]}}}},{key:"_buildSplitterPayload",value:function(t,e){var n={type:"vector",vector:!0,scalarField:t,direction:"up"==e?{x:0,y:1}:{x:1,y:0},length:1200,rule:{op:"and",rules:[]}};return console.log("vector",n),n}},{key:"_buildHistogramPayloadOLD",value:function(t){var e={};return this.data.forEach((function(n){var r=n[t];r||(r="EMPTY"),e[r]=(e[r]||0)+1})),{type:"histogram",field:t,data:Object.keys(e).map((function(t){return{value:t,count:e[t]}}))}}},{key:"_buildHistogramPayload",value:function(t){return{type:"histogram",field:t,data:this.data}}},{key:"_detectType",value:function(t){var e=t.filter((function(t){return""!==t&&null!=t}));return e.length&&e.map(Number).filter((function(t){return!isNaN(t)})).length===e.length?"scalar":"categorical"}}],e&&cs(t.prototype,e),n&&cs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function ds(t){return ds="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ds(t)}function fs(t){return function(t){if(Array.isArray(t))return ps(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ps(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ps(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ps(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ms(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ys(r.key),r)}}function ys(t){var e=function(t,e){if("object"!=ds(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ds(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ds(e)?e:e+""}var gs=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP JSON HERE",this._initDrop(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"120px"})}},{key:"_createToolbox",value:function(){var t=this;this.toolbox=document.createElement("div"),Object.assign(this.toolbox.style,{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"}),this.counter=document.createElement("div"),this.counter.textContent="Records: 0",Object.assign(this.counter.style,{fontFamily:"sans-serif",fontSize:"13px",color:"#555"});var e=document.createElement("div");this.clearBtn=document.createElement("button"),this.clearBtn.textContent="Clear",this.clearBtn.disabled=!0,this.clearBtn.addEventListener("click",(function(){t._renderBase()})),e.appendChild(this.clearBtn),this.toolbox.appendChild(this.counter),this.toolbox.appendChild(e),this.container.appendChild(this.toolbox)}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888",fontFamily:"sans-serif",pointerEvents:"none",userSelect:"none"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"_hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"_initDrop",value:function(){var t=this;this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background=""})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="";var n=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain");if(n)try{var r=JSON.parse(n).data;Array.isArray(r)?t.render(r):t._showPlaceholder()}catch(e){console.error("Invalid JSON dropped",e),t._showPlaceholder()}else t._showPlaceholder()}))}},{key:"render",value:function(t){var e=this;if(Array.isArray(t)&&0!==t.length){this.data=t,this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._hidePlaceholder(),this.clearBtn.disabled=!1,this.counter.textContent="Records: ".concat(t.length);var n=document.createElement("table");Object.assign(n.style,{borderCollapse:"separate",borderSpacing:"0 4px",width:"100%",fontFamily:"sans-serif",fontSize:"14px"});var r=document.createElement("thead"),i=document.createElement("tr");["Field","# Variants","Values"].forEach((function(t){var e=document.createElement("th");e.textContent=t,Object.assign(e.style,{border:"none",padding:"6px",background:"#eaeaea",textAlign:"left"}),i.appendChild(e)})),r.appendChild(i),n.appendChild(r);var o=document.createElement("tbody");Object.keys(t[0]).forEach((function(n,r){var i=t.map((function(t){return t[n]})).filter((function(t){return null!=t}));if(i.length){var s=e._detectType(i),a=fs(new Set(i)),l=document.createElement("tr"),c=document.createElement("td");c.textContent=n,c.setAttribute("draggable","true"),Object.assign(c.style,{border:"none",padding:"6px 10px",fontWeight:"bold",cursor:"grab",userSelect:"none"}),c.addEventListener("dragstart",(function(t){var r=e._buildHistogramPayload(n),i=JSON.stringify(r,null,2);t.dataTransfer.setData("application/json",i),t.dataTransfer.setData("text/plain",i),t.dataTransfer.effectAllowed="copy",c.style.opacity="0.5"})),c.addEventListener("dragend",(function(){c.style.opacity="1"})),c.addEventListener("mouseenter",(function(){c.style.textDecoration="underline"})),c.addEventListener("mouseleave",(function(){c.style.textDecoration="none"}));var h=document.createElement("td");h.textContent=a.length,Object.assign(h.style,{border:"none",padding:"6px",textAlign:"center"});var u=document.createElement("td");if(Object.assign(u.style,{border:"none",padding:"6px"}),"categorical"===s){var d=document.createElement("select");a.forEach((function(t){var e=document.createElement("option");e.value=t,e.textContent=t,d.appendChild(e)})),u.appendChild(d),new Vo(d,{searchEnabled:!0,itemSelectText:"",shouldSort:!1});var f=d.closest(".choices");if(f){Object.assign(f.style,{minWidth:"180px",maxWidth:"220px",marginBottom:"0"});var p=f.querySelector(".choices__inner");p&&Object.assign(p.style,{background:"#f8fafc",border:"1px solid #cbd5e1",borderRadius:"8px",minHeight:"34px",padding:"4px 8px",fontSize:"13px"});var m=f.querySelector(".choices__list--dropdown");m&&Object.assign(m.style,{border:"1px solid #cbd5e1",borderRadius:"8px",background:"#ffffff",boxShadow:"0 4px 10px rgba(0,0,0,0.08)"})}d.addEventListener("change",(function(){console.log("SELECTED V",d.value)}))}else{var y=i.map((function(t){return Number(t)})).filter((function(t){return!isNaN(t)}));u.textContent=y.length?"min: ".concat(Math.min.apply(Math,fs(y))," | max: ").concat(Math.max.apply(Math,fs(y))):"No numeric data"}l.appendChild(c),l.appendChild(h),l.appendChild(u);var g=r%2==0?"#dbeafe":"#ffffff";l.querySelectorAll("td").forEach((function(t){t.style.background=g})),c.title='Drag "'.concat(n,'"'),o.appendChild(l)}})),n.appendChild(o);var s=document.createElement("div");Object.assign(s.style,{position:"absolute",top:"42px",left:"0",right:"0",bottom:"0",overflow:"auto",padding:"10px",boxSizing:"border-box"}),s.appendChild(n),this.container.appendChild(s)}else this._showPlaceholder()}},{key:"_buildHistogramPayload",value:function(t){var e=fs(new Set(this.data.map((function(e){return e[t]})).filter((function(t){return null!=t&&""!==t}))));return{type:"histogram",field:t,data:e}}},{key:"_detectType",value:function(t){var e=t.filter((function(t){return""!==t&&null!=t}));return e.length&&e.map(Number).filter((function(t){return!isNaN(t)})).length===e.length?"scalar":"categorical"}}],e&&ms(t.prototype,e),n&&ms(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function vs(t){return vs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vs(t)}function bs(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function xs(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?bs(Object(n),!0).forEach((function(e){_s(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bs(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function _s(t,e,n){return(e=Ts(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ws(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(t){c=!0,i=t}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(t,e)||Cs(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ss(t){return function(t){if(Array.isArray(t))return Es(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Cs(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cs(t,e){if(t){if("string"==typeof t)return Es(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Es(t,e):void 0}}function Es(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ks(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ts(r.key),r)}}function Ts(t){var e=function(t,e){if("object"!=vs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=vs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vs(e)?e:e+""}var As=function(){return t=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container element is required");this.container=e,this.placeholderText=n.placeholder||"PASTE DATA HERE",this.data=[],this.sortState={field:null,direction:"asc"},this.filters={},this.handlePaste=this.handlePaste.bind(this),this._initStyles(),this.init()},e=[{key:"init",value:function(){var t=this;this.container.setAttribute("contenteditable","true"),this.container.style.display="flex",this.container.style.flexDirection="column",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.container.style.background="#fff",this.container.style.border="1px solid #e5e7eb",this.container.style.borderRadius="8px",this.createPlaceholder(),this.showPlaceholder(),this.container.addEventListener("paste",this.handlePaste),this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background="#fff"})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="#fff",t.handleDrop(e)})),this.container.addEventListener("mousedown",(function(t){t.target.closest("[draggable='true']")&&t.stopPropagation()}))}},{key:"_initStyles",value:function(){this.styles={table:{width:"max-content",minwidth:"100%",height:"90%",borderCollapse:"separate",borderSpacing:"0",fontFamily:"system-ui, sans-serif",fontSize:"13px"},th:{padding:"10px 8px",background:"#f9fafb",borderBottom:"1px solid #e5e7eb",textAlign:"left",fontWeight:"600",color:"#374151",position:"sticky",top:"0",zIndex:"5"},td:{padding:"8px",borderBottom:"1px solid #f1f5f9",color:"#111827"},trHover:{background:"#f9fafb"},trAlt:{background:"#fcfcfd"},input:{width:"100%",border:"1px solid #d1d5db",borderRadius:"4px",padding:"4px",fontSize:"13px"},select:{marginTop:"4px",border:"1px solid #d1d5db",borderRadius:"4px",fontSize:"11px",padding:"2px"}}}},{key:"_setStyle",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.assign(t.style,e)}},{key:"handlePaste",value:function(t){t.preventDefault();var e=(t.clipboardData||window.clipboardData).getData("text");if(e){var n=this.parseTSV(e),r=this.toJSON(n);this.data=this.mergeData(this.data,r),this.render()}}},{key:"handleDrop",value:function(t){var e=t.dataTransfer.getData("application/json")||t.dataTransfer.getData("text/plain");if(e){var n;console.log("dropping");try{n=JSON.parse(e)}catch(t){return void console.error("Invalid JSON dropped",t)}("table"===n.type&&Array.isArray(n.data)||"graph-nodes"===n.type&&Array.isArray(n.data))&&this._dropTableData(n.data)}}},{key:"_dropTableData",value:function(t){this.data=this.mergeData(this.data,t),this.render()}},{key:"render",value:function(){this.container.innerHTML="",this.container.style.display="grid",this.container.style.gridTemplateRows="auto 1fr",this.container.style.height="100%",this.container.style.minWidth="0",this.container.style.overflow="hidden";var t=this.createToolbox();t.style.gridRow="1";var e=document.createElement("div");e.style.gridRow="2",e.style.width="100%",e.style.height="90%",e.style.overflowX="auto",e.style.overflowY="auto",e.style.minWidth="0",e.style.minHeight="0";var n=this.createTableFromJSON(this.getProcessedData());n.style.width="max-content",e.appendChild(n),this.container.appendChild(t),this.container.appendChild(e),this.hidePlaceholder()}},{key:"getProcessedData",value:function(){var t=Ss(this.data);return Object.entries(this.filters).forEach((function(e){var n=ws(e,2),r=n[0],i=n[1];i&&(t=t.filter((function(t){return(t[r]||"")===i})))})),this.sortState.field&&(t=this._sortData(t,this.sortState.field,this.sortState.direction)),t}},{key:"_sortData",value:function(t,e,n){var r="asc"===n?1:-1;return Ss(t).map((function(t,e){return{item:t,index:e}})).sort((function(t,n){var i,o,s=null!==(i=t.item[e])&&void 0!==i?i:"",a=null!==(o=n.item[e])&&void 0!==o?o:"",l=parseFloat(s),c=parseFloat(a);return isNaN(l)||isNaN(c)?s.toString().localeCompare(a.toString())*r:(l-c)*r})).map((function(t){return t.item}))}},{key:"createTableFromJSON",value:function(t){var e=this,n=document.createElement("table");this._setStyle(n,this.styles.table);var r=document.createElement("thead"),i=document.createElement("tbody"),o=Array.from(this.data.reduce((function(t,e){return Object.keys(e).forEach((function(e){return t.add(e)})),t}),new Set)),s=document.createElement("tr");return o.forEach((function(t){var n=document.createElement("th"),r=e.sortState.field===t?"asc"===e.sortState.direction?" ▲":" ▼":"",i=document.createElement("div");i.textContent=t+r;var o=document.createElement("select"),a=Ss(new Set(e.data.map((function(e){return e[t]})).filter((function(t){return""!==t})))),l=document.createElement("option");l.value="",l.textContent="All",o.appendChild(l),a.forEach((function(t){var e=document.createElement("option");e.value=t,e.textContent=t,o.appendChild(e)})),o.value=e.filters[t]||"";var c=Math.min(120,Math.max(60,8*t.length));o.style.width=c+"px",e._setStyle(o,e.styles.select),o.onchange=function(n){e.filters[t]=n.target.value,e.render()},i.onclick=function(){e.sortState.field===t?e.sortState.direction="asc"===e.sortState.direction?"desc":"asc":(e.sortState.field=t,e.sortState.direction="asc"),e.render()},n.appendChild(i),n.appendChild(o),e._setStyle(n,e.styles.th),s.appendChild(n)})),r.appendChild(s),t.forEach((function(t,n){var r=document.createElement("tr");n%2==0&&e._setStyle(r,e.styles.trAlt),r.onmouseenter=function(){return e._setStyle(r,e.styles.trHover)},r.onmouseleave=function(){return r.style.background=n%2==0?"#fcfcfd":""},o.forEach((function(n){var i=document.createElement("td");e._setStyle(i,e.styles.td),i.textContent=t[n]||"",i.onclick=function(){var r=document.createElement("input");e._setStyle(r,e.styles.input),r.value=t[n]||"",i.innerHTML="",i.appendChild(r),r.focus();var o=function(){t[n]=r.value,e.render()};r.onblur=o,r.onkeydown=function(t){"Enter"===t.key&&o()}},r.appendChild(i)})),i.appendChild(r)})),n.appendChild(r),n.appendChild(i),n}},{key:"createToolbox",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{display:"flex",gap:"10px",padding:"8px",borderBottom:"1px solid #e5e7eb",background:"#fafafa",alignItems:"center"});var n=document.createElement("button");n.textContent="Clear",Object.assign(n.style,{padding:"4px 8px",border:"1px solid #d1d5db",borderRadius:"4px",background:"#fff",cursor:"pointer"}),n.onclick=function(){return t.clear()};var r=document.createElement("div");r.setAttribute("draggable","true"),r.title="Drag JSON",Object.assign(r.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"1px solid #d1d5db",borderRadius:"6px",background:"#fff",cursor:"grab",userSelect:"none"});var i=document.createElement("span");i.textContent="⤴",i.style.pointerEvents="none",r.appendChild(i),r.addEventListener("mousedown",(function(){r.style.cursor="grabbing"})),r.addEventListener("mouseup",(function(){r.style.cursor="grab"})),r.addEventListener("dragstart",(function(e){var n={type:"table",data:t.getProcessedData()},i=JSON.stringify(n);e.dataTransfer.effectAllowed="copy",e.dataTransfer.setData("application/json",i),e.dataTransfer.setData("text/plain",i);var o=r.cloneNode(!0);o.style.position="absolute",o.style.top="-1000px",document.body.appendChild(o),e.dataTransfer.setDragImage(o,16,16),setTimeout((function(){return document.body.removeChild(o)}),0)}));var o=document.createElement("button");return o.textContent="Copy",Object.assign(o.style,{padding:"4px 8px",border:"1px solid #d1d5db",borderRadius:"4px",background:"#fff",cursor:"pointer"}),o.onclick=function(){return t.copyToClipboard()},e.appendChild(n),e.appendChild(o),e.appendChild(r),e}},{key:"parseTSV",value:function(t){return t.trim().split("\n").map((function(t){return t.split("\t")}))}},{key:"toJSON",value:function(t){var e=t[0];return t.slice(1).map((function(t){var n={};return e.forEach((function(e,r){return n[e]=t[r]||""})),n}))}},{key:"mergeData",value:function(t,e){if(!t.length)return e;var n=new Map;return t.forEach((function(t){return t.id&&n.set(t.id,xs({},t))})),e.forEach((function(t){t.id&&(n.has(t.id)?Object.assign(n.get(t.id),t):n.set(t.id,xs({},t)))})),Array.from(n.values())}},{key:"createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"10px",left:"10px",color:"#9ca3af"}),this.container.appendChild(this.placeholder)}},{key:"showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"clear",value:function(){this.data=[],this.filters={},this.sortState={field:null,direction:"asc"},this.container.innerHTML="",this.createPlaceholder(),this.showPlaceholder()}},{key:"copyToClipboard",value:function(){var t=this.getProcessedData();if(t.length){var e=Array.from(t.reduce((function(t,e){return Object.keys(e).forEach((function(e){return t.add(e)})),t}),new Set)),n=[e.join("\t")].concat(Ss(t.map((function(t){return e.map((function(e){var n;return null!==(n=t[e])&&void 0!==n?n:""})).join("\t")})))).join("\n");navigator.clipboard.writeText(n).then((function(){console.log("Copied to clipboard")})).catch((function(t){console.error("Clipboard copy failed",t)}))}}}],e&&ks(t.prototype,e),n&&ks(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}(),Ms=i(228),Ps=i.n(Ms);function Os(t){return Os="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Os(t)}function Is(t){return function(t){if(Array.isArray(t))return Ls(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ls(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ls(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ls(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function js(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Rs(r.key),r)}}function Rs(t){var e=function(t,e){if("object"!=Os(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Os(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Os(e)?e:e+""}function Ds(t,e,n){return e=Fs(e),function(t,e){if(e&&("object"==Os(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ns()?Reflect.construct(e,n||[],Fs(t).constructor):e.apply(t,n))}function Ns(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ns=function(){return!!t})()}function Fs(t){return Fs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fs(t)}function Bs(t,e){return Bs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Bs(t,e)}var Gs=function(){function t(e,n){var r;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=Ds(this,t),"string"==typeof e&&(e=document.querySelector(e)),!e)throw new Error("vi_TableCombo requires a valid container");if(!n)throw new Error("vi_TableCombo requires a vi_CollectionsManager");return r.container=e,r.manager=n,r.mode="select",r.onTablesChanged=r.handleTablesChanged.bind(r),r.onTableSelected=r.handleTableSelected.bind(r),r.onTableCreated=r.handleTableCreated.bind(r),r.manager.on("tables_changed",r.onTablesChanged),r.manager.on("table_selected",r.onTableSelected),r.manager.on("table_created",r.onTableCreated),r.render(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Bs(t,e)}(t,Ps()),e=t,(n=[{key:"render",value:function(){"create"===this.mode?this.renderCreate():this.renderSelect()}},{key:"renderSelect",value:function(){var t=this,e=this.manager.getSelectedTable()||"",n=Is(new Set([].concat(Is(this.manager.getTables()),Is(e?[e]:[]))));this.container.innerHTML='\n <select class="vi-table-combo">\n\n <option value="">\n Select table...\n </option>\n\n '.concat(n.map((function(e){return'\n <option value="'.concat(t.escapeHTML(e),'">\n ').concat(t.escapeHTML(e),"\n </option>\n ")})).join(""),'\n\n <option value="__create__">\n + Create new table...\n </option>\n\n </select>\n ');var r=this.container.querySelector(".vi-table-combo");r.value=e,r.addEventListener("change",(function(){var e=r.value;"__create__"!==e?e?(t.manager.selectTable(e),t.emit("change",{table:e})):r.value=t.manager.getSelectedTable()||"":t.showCreate()}))}},{key:"renderCreate",value:function(){var t=this;this.container.innerHTML='\n <div class="vi-table-create">\n\n <input\n type="text"\n class="vi-table-name"\n placeholder="New table name"\n autocomplete="off"\n />\n\n <button\n type="button"\n class="vi-table-create-ok"\n >\n Add\n </button>\n\n <button\n type="button"\n class="vi-table-create-cancel"\n >\n Cancel\n </button>\n\n </div>\n ';var e=this.container.querySelector(".vi-table-name"),n=this.container.querySelector(".vi-table-create-ok"),r=this.container.querySelector(".vi-table-create-cancel");n.addEventListener("click",(function(){t.createTable()})),r.addEventListener("click",(function(){t.showSelect()})),e.addEventListener("keydown",(function(e){"Enter"===e.key&&(e.preventDefault(),t.createTable()),"Escape"===e.key&&(e.preventDefault(),t.showSelect())})),e.focus()}},{key:"showCreate",value:function(){this.mode="create",this.render()}},{key:"showSelect",value:function(){this.mode="select",this.render()}},{key:"createTable",value:function(){var t=this.container.querySelector(".vi-table-name");if(t){var e=t.value.trim();if(e){if("__create__"===e)return alert("This table name is reserved."),void t.focus();if(this.manager.getTables().includes(e))return alert('Table "'.concat(e,'" already exists')),void t.focus();try{if(!1===this.manager.createTable(e))throw new Error('Unable to create table "'.concat(e,'".'));this.mode="select",this.render(),this.emit("create",{table:e})}catch(t){var n;console.error("Unable to create table:",t),alert(t.message||"Unable to create table."),null===(n=this.container.querySelector(".vi-table-name"))||void 0===n||n.focus()}}else t.focus()}}},{key:"handleTablesChanged",value:function(){"select"===this.mode&&this.render()}},{key:"handleTableSelected",value:function(t){var e=t.table;this.mode="select",this.render(),this.emit("selected",{table:e})}},{key:"handleTableCreated",value:function(){this.mode="select",this.render()}},{key:"getValue",value:function(){return this.manager.getSelectedTable()}},{key:"setValue",value:function(t){this.manager.selectTable(t)}},{key:"escapeHTML",value:function(t){return String(t).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}},{key:"destroy",value:function(){this.manager.off("tables_changed",this.onTablesChanged),this.manager.off("table_selected",this.onTableSelected),this.manager.off("table_created",this.onTableCreated),this.container.innerHTML="",this.removeAllListeners(),this.manager=null,this.container=null}}])&&js(e.prototype,n),r&&js(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function zs(t){return function(t){if(Array.isArray(t))return Us(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Us(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Us(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Us(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ws(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Hs(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ws(Object(n),!0).forEach((function(e){Vs(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ws(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Vs(t,e,n){return(e=Zs(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ys(t){return Ys="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ys(t)}function Xs(){Xs=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof g?e:g,s=Object.create(o.prototype),a=new P(r||[]);return i(s,"_invoke",{value:k(t,n,a)}),s}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",f="suspendedYield",p="executing",m="completed",y={};function g(){}function v(){}function b(){}var x={};c(x,s,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(O([])));w&&w!==n&&r.call(w,s)&&(x=w);var S=b.prototype=g.prototype=Object.create(x);function C(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,s,a){var l=u(t[i],t,o);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==Ys(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(h).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(l.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function k(e,n,r){var i=d;return function(o,s){if(i===p)throw Error("Generator is already running");if(i===m){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var l=T(a,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var c=u(e,n,r);if("normal"===c.type){if(i=r.done?m:f,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=u(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function O(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(Ys(e)+" is not iterable")}return v.prototype=b,i(S,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:v,configurable:!0}),v.displayName=c(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},C(E.prototype),c(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new E(h(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},C(S),c(S,l,"Generator"),c(S,s,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=O,P.prototype={constructor:P,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(M),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var l=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(l&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;M(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function $s(t,e,n,r,i,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(r,i)}function qs(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){$s(o,r,i,s,a,"next",t)}function a(t){$s(o,r,i,s,a,"throw",t)}s(void 0)}))}}function Ks(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Zs(r.key),r)}}function Zs(t){var e=function(t,e){if("object"!=Ys(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ys(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ys(e)?e:e+""}function Js(t,e,n){return e=ta(e),function(t,e){if(e&&("object"==Ys(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Qs()?Reflect.construct(e,n||[],ta(t).constructor):e.apply(t,n))}function Qs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Qs=function(){return!!t})()}function ta(t){return ta=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ta(t)}function ea(t,e){return ea=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ea(t,e)}var na=function(){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),(n=Js(this,t,[e,r])).datasetName=r.name||"",n.jsonLoader=r.jsonLoader||null,n.onSave=r.onSave||null,n.onInspect=r.onInspect||null,n.onDesign=r.onDesign||null,n.activeSource="paste",n.render(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ea(t,e)}(t,As),e=t,n=[{key:"render",value:function(){this.container.innerHTML="",Object.assign(this.container.style,{display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",width:"100%",height:"100%",minWidth:"0",minHeight:"0",position:"relative",overflow:"hidden",background:"#1e1e1e",border:"1px solid #555555",borderRadius:"8px",boxSizing:"border-box"});var t=this.createSourceBar(),e=this.createDatasetBar(),n=document.createElement("div");if(Object.assign(n.style,{width:"100%",height:"100%",minWidth:"0",minHeight:"0",overflowX:"auto",overflowY:"auto",background:"#ffffff",position:"relative"}),this.data&&this.data.length){var r=this.createTableFromJSON(this.getProcessedData());r.style.width="max-content",r.style.minWidth="100%",n.appendChild(r)}else{var i=document.createElement("div");i.innerHTML='\n <div style="\n display:flex;\n flex-direction:column;\n align-items:center;\n justify-content:center;\n gap:10px;\n height:100%;\n color:#888;\n font-family:system-ui,sans-serif;\n ">\n\n <i\n class="fa-solid fa-table"\n style="font-size:32px">\n </i>\n\n <div style="\n font-size:14px;\n color:#666;\n ">\n PASTE DATA HERE\n </div>\n\n <div style="\n font-size:11px;\n color:#999;\n ">\n or load JSON / Google Sheet\n </div>\n\n </div>\n ',n.appendChild(i)}this.container.append(t,e,n)}},{key:"createSourceBar",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",boxSizing:"border-box",padding:"4px",gap:"10px",background:"#3b3b3b",borderBottom:"1px solid #555555"});var n=document.createElement("div");n.innerHTML="\n <div>Data Sources:</div>\n ",Object.assign(n.style,{width:"120px",height:"36px",color:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center",gap:"7px",fontSize:"15px",flexShrink:"0"});var r=this.createToolbarButton({icon:"fa-solid fa-copy",text:"Paste Data",active:"paste"===this.activeSource});r.onclick=function(){t.activeSource="paste",t.updateSourceButtons(e,r),t.container.focus()};var i=this.createToolbarButton({icon:"fa-solid fa-link",text:"Json URL",active:"json"===this.activeSource});i.onclick=function(){t.activeSource="json",t.updateSourceButtons(e,i),t.showURLInput({title:"Load JSON URL",placeholder:"https://server.com/data.json",buttonText:"Load JSON",onLoad:function(e){return t.loadJSON(e)}})};var o=this.createToolbarButton({icon:"fa-solid fa-table",text:"Google Sheet",active:"sheet"===this.activeSource});return o.onclick=function(){t.activeSource="sheet",t.updateSourceButtons(e,o),t.showGoogleSheetInput()},e.append(n,r,i,o),e}},{key:"extractSpreadsheetId",value:function(t){if(!t)return"";var e=t.trim(),n=e.match(/\/spreadsheets\/d\/([^/]+)/);return n&&n[1]?n[1]:e}},{key:"showGoogleSheetInput",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{position:"absolute",inset:"0",background:"rgba(0,0,0,.65)",zIndex:"1000",display:"flex",alignItems:"center",justifyContent:"center"});var n=document.createElement("div");Object.assign(n.style,{width:"500px",maxWidth:"90%",padding:"16px",boxSizing:"border-box",background:"#3b3b3b",border:"1px solid #666666",borderRadius:"10px",boxShadow:"0 10px 30px rgba(0,0,0,.5)"});var r=document.createElement("div");r.textContent="Load Google Sheet",Object.assign(r.style,{color:"#ffffff",fontSize:"14px",marginBottom:"14px"});var i=function(t){var e=document.createElement("input");return e.type="text",e.placeholder=t,Object.assign(e.style,{width:"100%",height:"36px",boxSizing:"border-box",padding:"8px 12px",marginBottom:"10px",color:"#ffffff",background:"#1e1e1e",border:"1px solid #555555",borderRadius:"8px",outline:"none",fontSize:"12px"}),e.addEventListener("paste",(function(t){return t.stopPropagation()})),e.addEventListener("mousedown",(function(t){return t.stopPropagation()})),e},o=i("Spreadsheet ID or Google Sheet URL"),s=i("Sheet Name (example: clientes)"),a=document.createElement("div");Object.assign(a.style,{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"4px"});var l=this.createToolbarButton({icon:"fa-solid fa-xmark",text:"Cancel",width:"90px"}),c=this.createToolbarButton({icon:"fa-solid fa-download",text:"Load Sheet",width:"110px",active:!0});l.onclick=function(){e.remove()},c.onclick=qs(Xs().mark((function n(){var r,i;return Xs().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=o.value.trim(),i=s.value.trim(),r){n.next=5;break}return alert("Enter a Spreadsheet ID or URL."),n.abrupt("return");case 5:if(i){n.next=8;break}return alert("Enter the Sheet Name."),n.abrupt("return");case 8:return c.disabled=!0,c.style.opacity="0.5",n.prev=10,n.next=13,t.loadSheet(r,i);case 13:e.remove(),n.next=20;break;case 16:n.prev=16,n.t0=n.catch(10),console.error("Google Sheet error:",n.t0),alert(n.t0.message||"Unable to load Google Sheet.");case 20:return n.prev=20,c.disabled=!1,c.style.opacity="1",n.finish(20);case 24:case"end":return n.stop()}}),n,null,[[10,16,20,24]])}))),s.onkeydown=function(t){"Enter"===t.key&&c.click(),"Escape"===t.key&&e.remove()},o.onkeydown=function(t){"Escape"===t.key&&e.remove()},a.append(l,c),n.append(r,o,s,a),e.appendChild(n),this.container.appendChild(e),o.focus()}},{key:"createDatasetBar",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",boxSizing:"border-box",padding:"4px",gap:"10px",background:"#3b3b3b",borderBottom:"1px solid #555555"});var n=document.createElement("input");n.type="text",n.placeholder="Data Set Name",n.value=this.datasetName||"",Object.assign(n.style,{flex:"1",minWidth:"0",boxSizing:"border-box",padding:"8px 12px",height:"36px",fontSize:"12px",color:"#ffffff",backgroundColor:"#1e1e1e",border:"1px solid #555555",borderRadius:"9px",outline:"none"}),n.oninput=function(e){t.datasetName=e.target.value},n.addEventListener("paste",(function(t){t.stopPropagation()})),n.addEventListener("mousedown",(function(t){t.stopPropagation()}));var r=document.createElement("div");Object.assign(r.style,{display:"flex",flexDirection:"row",alignItems:"center",gap:"6px",flexShrink:"0"});var i=this.createToolbarButton({icon:"fa-solid fa-trash",text:"Clear",width:"80px",active:!0});i.title="Clear table",i.onclick=function(){t.clear()};var o=this.createToolbarButton({icon:"fa-solid fa-copy",text:"Copy",width:"80px",active:!0});o.title="Copy table data",o.onclick=function(){t.copyToClipboard()};var s=this.createToolbarButton({icon:"fa-solid fa-up-right-from-square",text:"Drag",width:"80px",active:!0});s.title="Drag table data",s.setAttribute("draggable","true"),s.addEventListener("mousedown",(function(t){t.stopPropagation(),s.style.cursor="grabbing"})),s.addEventListener("mouseup",(function(){s.style.cursor="grab"})),s.addEventListener("dragend",(function(){s.style.cursor="grab"})),s.addEventListener("dragstart",(function(e){var n={type:"table",name:t.datasetName,data:t.getProcessedData()},r=JSON.stringify(n);e.dataTransfer.effectAllowed="copy",e.dataTransfer.setData("application/json",r),e.dataTransfer.setData("text/plain",r);var i=s.cloneNode(!0);Object.assign(i.style,{position:"absolute",top:"-1000px",left:"-1000px",pointerEvents:"none"}),document.body.appendChild(i),e.dataTransfer.setDragImage(i,16,16),setTimeout((function(){i.parentNode&&i.parentNode.removeChild(i)}),0)}));var a=this.createToolbarButton({icon:"fa-solid fa-floppy-disk",text:"Save",width:"80px",active:!0});a.onclick=function(){t.saveDataset()};var l=this.createToolbarButton({icon:"fa-solid fa-magnifying-glass-chart",text:"Inspect",width:"100px",active:!0});return l.onclick=function(){t.onInspect&&t.onInspect({name:t.datasetName,data:t.data,processedData:t.getProcessedData(),table:t})},r.append(i,o,s,a,l),e.append(n,r),e}},{key:"createToolbarButton",value:function(t){var e=t.icon,n=t.text,r=t.width,i=void 0===r?"120px":r,o=t.active,s=void 0!==o&&o,a=document.createElement("button");return a.innerHTML='\n\n <span style="\n font-size:16px;\n pointer-events:none;\n ">\n\n <i class="'.concat(e,'"></i>\n\n </span>\n\n <span style="\n pointer-events:none;\n ">\n ').concat(n,"\n </span>\n\n "),Object.assign(a.style,{width:i,height:"36px",backgroundColor:s?"#000000":"#3d3d3d",color:s?"#ffffff":"#949494",border:"1px solid #666666",borderRadius:"9px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"7px",fontSize:"11px",flexShrink:"0",boxSizing:"border-box"}),a.dataset.sourceButton="true",a}},{key:"updateSourceButtons",value:function(t,e){t.querySelectorAll("[data-source-button]").forEach((function(t){var n=t===e;t.style.backgroundColor=n?"#000000":"#3d3d3d",t.style.color=n?"#ffffff":"#949494"}))}},{key:"showURLInput",value:function(t){var e=t.title,n=t.placeholder,r=t.buttonText,i=void 0===r?"Load":r,o=t.onLoad,s=document.createElement("div");Object.assign(s.style,{position:"absolute",inset:"0",background:"rgba(0,0,0,.65)",zIndex:"1000",display:"flex",alignItems:"center",justifyContent:"center"});var a=document.createElement("div");Object.assign(a.style,{width:"500px",maxWidth:"90%",padding:"16px",boxSizing:"border-box",background:"#3b3b3b",border:"1px solid #666666",borderRadius:"10px",boxShadow:"0 10px 30px rgba(0,0,0,.5)"});var l=document.createElement("div");l.textContent=e,Object.assign(l.style,{color:"#ffffff",fontSize:"14px",marginBottom:"10px"});var c=document.createElement("input");c.type="text",c.placeholder=n,Object.assign(c.style,{width:"100%",height:"36px",boxSizing:"border-box",padding:"8px 12px",color:"#ffffff",background:"#1e1e1e",border:"1px solid #555555",borderRadius:"8px",outline:"none",fontSize:"12px"}),c.addEventListener("paste",(function(t){return t.stopPropagation()})),c.addEventListener("mousedown",(function(t){return t.stopPropagation()}));var h=document.createElement("div");Object.assign(h.style,{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"12px"});var u=this.createToolbarButton({icon:"fa-solid fa-xmark",text:"Cancel",width:"90px"}),d=this.createToolbarButton({icon:"fa-solid fa-download",text:i,width:"110px",active:!0});u.onclick=function(){s.remove()},d.onclick=qs(Xs().mark((function t(){var e;return Xs().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=c.value.trim()){t.next=3;break}return t.abrupt("return");case 3:return d.disabled=!0,d.style.opacity="0.5",t.prev=5,t.next=8,o(e);case 8:s.remove(),t.next=15;break;case 11:t.prev=11,t.t0=t.catch(5),console.error("Data loading error:",t.t0),alert(t.t0.message||"Unable to load data");case 15:return t.prev=15,d.disabled=!1,d.style.opacity="1",t.finish(15);case 19:case"end":return t.stop()}}),t,null,[[5,11,15,19]])}))),c.onkeydown=function(t){"Enter"===t.key&&d.click(),"Escape"===t.key&&s.remove()},h.append(u,d),a.append(l,c,h),s.appendChild(a),this.container.appendChild(s),c.focus()}},{key:"handlePaste",value:function(t){var e=t.target;if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)){t.preventDefault();var n=(t.clipboardData||window.clipboardData).getData("text");if(n){var r=this.parseTSV(n);if(r.length){var i=this.toJSON(r);this.appendData(i)}}}}},{key:"setData",value:function(t){var e=this.normalizeData(t);return this.data=e,this.filters={},this.sortState={field:null,direction:"asc"},this.render(),this.data}},{key:"appendData",value:function(t){var e=this.normalizeData(t);return this.data=this.mergeData(this.data||[],e),this.render(),this.data}},{key:"normalizeData",value:function(t){if(null==t)return[];var e=t;if(!Array.isArray(e)&&e&&Array.isArray(e.data)&&(e=e.data),!Array.isArray(e)&&e&&Array.isArray(e.rows)&&(e=e.rows),!Array.isArray(e))throw new Error("Data source must return an array of objects.");return e.length&&Array.isArray(e[0])?this.toJSON(e):e.map((function(t){return t&&"object"===Ys(t)&&!Array.isArray(t)?Hs({},t):{value:t}}))}},{key:"loadJSON",value:(s=qs(Xs().mark((function t(e){var n,r;return Xs().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.jsonLoader){t.next=6;break}return t.next=3,this.jsonLoader(e,this);case 3:n=t.sent,t.next=14;break;case 6:return t.next=8,fetch(e);case 8:if((r=t.sent).ok){t.next=11;break}throw new Error("HTTP ".concat(r.status," - ").concat(r.statusText));case 11:return t.next=13,r.json();case 13:n=t.sent;case 14:return this.activeSource="json",t.abrupt("return",this.setData(n));case 16:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"loadSheet",value:(o=qs(Xs().mark((function t(e,n){var r,i,o,s,a,l,c,h;return Xs().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this.extractSpreadsheetId(e),i={data:{data_source:{config:{SPREADSHEET_ID:r,SHEET_NAME:n}}}},console.log("Google Sheet request:",i),t.next=5,fetch("https://server.vizor.studio/api/get_data",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});case 5:if((o=t.sent).ok){t.next=11;break}return t.next=9,o.text();case 9:throw s=t.sent,new Error("Google Sheet request failed (".concat(o.status,"): ").concat(s));case 11:return t.next=13,o.json();case 13:if(a=t.sent,console.log("Google Sheet response:",a),!a||"error"!==a.status){t.next=18;break}throw h=(null===(l=a.data)||void 0===l?void 0:l.message)||(null===(c=a.data)||void 0===c?void 0:c.error)||"Unable to load Google Sheet.",new Error(h);case 18:return this.activeSource="sheet",t.abrupt("return",this.setData(a));case 20:case"end":return t.stop()}}),t,this)}))),function(t,e){return o.apply(this,arguments)})},{key:"mergeData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t.length)return e.map((function(t){return Hs({},t)}));if(!e.length)return t.map((function(t){return Hs({},t)}));var n=t.every((function(t){return void 0!==t.id&&null!==t.id&&""!==t.id})),r=e.every((function(t){return void 0!==t.id&&null!==t.id&&""!==t.id}));if(!n||!r)return[].concat(zs(t.map((function(t){return Hs({},t)}))),zs(e.map((function(t){return Hs({},t)}))));var i=new Map;return t.forEach((function(t){i.set(t.id,Hs({},t))})),e.forEach((function(t){i.has(t.id)?Object.assign(i.get(t.id),t):i.set(t.id,Hs({},t))})),Array.from(i.values())}},{key:"saveDataset",value:(i=qs(Xs().mark((function t(){var e;return Xs().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.datasetName.trim()){t.next=4;break}return alert("Please enter a Data Set Name."),t.abrupt("return",null);case 4:if(e=this.getDataset(),!this.onSave){t.next=8;break}return t.next=8,this.onSave(e,this);case 8:return t.abrupt("return",e);case 9:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)})},{key:"getDataset",value:function(){return{name:this.datasetName,source:this.activeSource,data:this.data,processedData:this.getProcessedData(),columns:this.getColumns(),rowCount:this.data.length}}},{key:"getColumns",value:function(){return Array.from((this.data||[]).reduce((function(t,e){return Object.keys(e).forEach((function(e){return t.add(e)})),t}),new Set))}},{key:"setDatasetName",value:function(t){this.datasetName=t||"",this.render()}},{key:"getDatasetName",value:function(){return this.datasetName}},{key:"clear",value:function(){this.data=[],this.filters={},this.sortState={field:null,direction:"asc"},this.activeSource="paste",this.render()}}],n&&Ks(e.prototype,n),r&&Ks(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r,i,o,s}();function ra(t){return ra="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ra(t)}function ia(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function oa(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ia(Object(n),!0).forEach((function(e){sa(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ia(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function sa(t,e,n){return(e=la(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,la(r.key),r)}}function la(t){var e=function(t,e){if("object"!=ra(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ra(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ra(e)?e:e+""}var ca=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP HISTOGRAM HERE",this.currentPayload=null,this.sortAscending=!1,this._initDrop(),this._initResize(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._createTooltip(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"200px"})}},{key:"_createToolbox",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{display:"flex",justifyContent:"flex-end",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"});var n=document.createElement("button");n.textContent="Clear",n.addEventListener("click",(function(){t.currentPayload=null,t._renderBase()}));var r=document.createElement("button");r.textContent="Sort ↑",r.addEventListener("click",(function(){t.sortAscending=!t.sortAscending,r.textContent=t.sortAscending?"Sort ↓":"Sort ↑",t.currentPayload&&t._drawChart(t.currentPayload)})),e.appendChild(r),e.appendChild(n),this.container.appendChild(e)}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888",fontFamily:"sans-serif",pointerEvents:"none"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"_hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"_aggregateData",value:function(t,e,n){var r=this,i={};return t.forEach((function(t){var o=t[e];if(o||(o="EMPTY"),i[o]||(i[o]=0),n){var s=r._parseNumber(t[n]);i[o]+=s}else i[o]+=1})),Object.keys(i).map((function(t){return{value:t,count:i[t]}}))}},{key:"_createTooltip",value:function(){this.tooltip=document.createElement("div"),Object.assign(this.tooltip.style,{position:"absolute",pointerEvents:"none",background:"rgba(0,0,0,0.75)",color:"#fff",padding:"6px 8px",borderRadius:"4px",fontSize:"12px",fontFamily:"sans-serif",opacity:"0",transition:"opacity 0.2s"}),this.container.appendChild(this.tooltip)}},{key:"_showTooltip",value:function(t,e,n){this.tooltip.innerHTML=n,this.tooltip.style.left=t+10+"px",this.tooltip.style.top=e+10+"px",this.tooltip.style.opacity="1"}},{key:"_hideTooltip",value:function(){this.tooltip.style.opacity="0"}},{key:"_initResize",value:function(){var t=this;this._handleResize=function(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:150;return function(){for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];clearTimeout(n),n=setTimeout((function(){return e.apply(t,o)}),r)}}((function(){t.currentPayload&&t._drawChart(t.currentPayload)})),this.resizeObserver=new ResizeObserver(this._handleResize),this.resizeObserver.observe(this.container)}},{key:"_initDrop",value:function(){var t=this;this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background=""})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="";var n=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain");if(n)try{var r=JSON.parse(n);if("histogram"===r.type&&Array.isArray(r.data))return void t.render(oa(oa({},r),{},{sumField:null}));if("sumField"===r.type&&t.currentPayload)return console.log("Dropped ",r),t.currentPayload.sumField=r.field,void t._drawChart(t.currentPayload)}catch(t){console.error("Invalid drop JSON",t)}}))}},{key:"render",value:function(t){this.currentPayload=oa(oa({},t),{},{sumField:t.sumField||null}),this.container.innerHTML="",this._createToolbox(),this._createTooltip(),this._hidePlaceholder(),this.chartWrapper=document.createElement("div"),this.chartWrapper.style.width="100%",this.chartWrapper.style.height="100%",this.chartWrapper.style.padding="10px",this.container.appendChild(this.chartWrapper),this._drawChart(this.currentPayload)}},{key:"_parseNumber",value:function(t){if(null==t)return 0;var e=String(t).replace(/,/g,""),n=Number(e);return isNaN(n)?0:n}},{key:"_drawChart",value:function(t){var e=this;if(this.chartWrapper){this.chartWrapper.innerHTML="";var n=this.container.getBoundingClientRect(),r=n.width-20,i=Math.max(200,n.height-60),o=30,s=20,a=80,l=50,c=d3.select(this.chartWrapper).append("svg").attr("width",r).attr("height",i),h=r-l-s,u=i-o-a,d=c.append("g").attr("transform","translate(".concat(l,",").concat(o,")")),f=this._aggregateData(t.data,t.field,t.sumField);this.sortAscending&&f.sort((function(t,e){return t.count-e.count}));var p=d3.scaleBand().domain(f.map((function(t){return t.value}))).range([0,h]).padding(.1),m=d3.scaleLinear().domain([0,d3.max(f,(function(t){return t.count}))]).nice().range([u,0]);d.selectAll(".bar").data(f,(function(t){return t.value})).enter().append("rect").attr("class","bar").attr("x",(function(t){return p(t.value)})).attr("width",p.bandwidth()).attr("y",u).attr("height",0).attr("fill","#69b3a2").on("mousemove",(function(n,r){e._showTooltip(n.offsetX,n.offsetY,"<b>".concat(r.value,"</b><br/>").concat(t.sumField?"Sum":"Count",": ").concat(r.count))})).on("mouseleave",(function(){return e._hideTooltip()})).transition().duration(600).attr("y",(function(t){return m(t.count)})).attr("height",(function(t){return u-m(t.count)})),d.append("g").attr("transform","translate(0, ".concat(u,")")).call(d3.axisBottom(p).tickFormat((function(t){var e,n=f.find((function(e){return e.value===t}));return"".concat(t," (").concat(null!==(e=null==n?void 0:n.count)&&void 0!==e?e:0,")")}))).selectAll("text").attr("transform","rotate(-30)").style("text-anchor","end"),d.append("g").call(d3.axisLeft(m)),c.append("text").attr("x",r/2).attr("y",20).attr("text-anchor","middle").style("font-family","sans-serif").style("font-size","14px").text("Histogram: ".concat(t.field))}}}],e&&aa(t.prototype,e),n&&aa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function ha(t){return ha="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ha(t)}function ua(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,da(r.key),r)}}function da(t){var e=function(t,e){if("object"!=ha(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ha(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ha(e)?e:e+""}var fa=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container required");this.container=e,this.days=["Lun","Mar","Mie","Jue","Vie","Sab","Dom"],this.hours=["09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00"],this.selected={},this._injectStyles(),this._render(),this._buildGrid(),this._bindEvents()},(e=[{key:"_injectStyles",value:function(){if(!document.getElementById("availability-survey-styles")){var t=document.createElement("style");t.id="availability-survey-styles",t.textContent="\n .as-card {\n max-width: 900px;\n margin: auto;\n background: white;\n padding: 20px;\n border-radius: 16px;\n box-shadow: 0 8px 24px rgba(0,0,0,0.08);\n font-family: sans-serif;\n\n display: flex;\n flex-direction: column;\n height: 100%; /* 🔥 important */\n }\n\n .as-title {\n margin-bottom: 6px;\n }\n\n .as-subtitle {\n color: #666;\n margin-bottom: 16px;\n font-size: 14px;\n }\n\n .as-input-group {\n margin-bottom: 16px;\n }\n\n .as-card input {\n padding: 8px 10px;\n border: 1px solid #ddd;\n border-radius: 8px;\n width: 220px;\n font-size: 14px;\n }\n\n .as-grid-wrapper {\n overflow: auto;\n border-radius: 12px;\n -webkit-overflow-scrolling: touch;\n\n flex: 1; /* 🔥 fills space */\n min-height: 0; /* 🔥 required for iOS */\n }\n\n .as-grid {\n display: grid;\n grid-template-columns: 80px repeat(7, minmax(70px, 1fr));\n min-width: 600px;\n border: 1px solid #e5e7eb;\n }\n\n .as-cell {\n border: 1px solid #eef0f4;\n height: 42px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 13px;\n transition: all 0.12s ease;\n user-select: none;\n }\n\n .as-header {\n font-weight: 600;\n background: #f1f5f9;\n cursor: default;\n }\n\n .as-time {\n background: #f9fafb;\n color: #555;\n font-size: 12px;\n cursor: default;\n }\n\n /* hover only when NOT clicking */\n body:not(.as-clicking) .as-cell:not(.as-active):hover {\n background: #eef4ff;\n }\n\n .as-active {\n background: #1e40af;\n color: white;\n font-weight: bold;\n }\n\n .as-cell:active {\n transform: scale(0.96);\n }\n\n .as-card button {\n margin-top: 16px;\n padding: 10px 16px;\n border: none;\n border-radius: 10px;\n background: #3b82f6;\n color: white;\n font-size: 14px;\n cursor: pointer;\n box-shadow: 0 4px 12px rgba(59,130,246,0.3);\n margin-top: 12px;\n flex-shrink: 0; \n }\n\n .as-card button:hover {\n background: #2563eb;\n }\n\n .as-header {\n position: sticky;\n top: 0;\n z-index: 2;\n }\n\n\n .as-time {\n position: sticky;\n left: 0;\n z-index: 1;\n background: #f9fafb;\n }\n\n ",document.head.appendChild(t)}}},{key:"_render",value:function(){this.container.innerHTML="",this.card=document.createElement("div"),this.card.className="as-card",this.title=document.createElement("h1"),this.title.className="as-title",this.title.textContent="Encuesta de Disponibilidad 🎶",this.subtitle=document.createElement("div"),this.subtitle.className="as-subtitle",this.subtitle.textContent="Pon tu nombre y da click en los horarios que te acomoden para el ensayo",this.inputGroup=document.createElement("div"),this.inputGroup.className="as-input-group",this.input=document.createElement("input"),this.input.placeholder="Pon tu Nombre",this.gridWrapper=document.createElement("div"),this.gridWrapper.className="as-grid-wrapper",this.grid=document.createElement("div"),this.grid.className="as-grid",this.gridWrapper.appendChild(this.grid),this.button=document.createElement("button"),this.button.textContent="Enviar",this.inputGroup.appendChild(this.input),this.card.appendChild(this.title),this.card.appendChild(this.subtitle),this.card.appendChild(this.inputGroup),this.card.appendChild(this.gridWrapper),this.card.appendChild(this.button),this.container.appendChild(this.card)}},{key:"_buildGrid",value:function(){var t=this;this.grid.appendChild(document.createElement("div")),this.days.forEach((function(e){var n=document.createElement("div");n.textContent=e,n.className="as-cell as-header",t.grid.appendChild(n)})),this.hours.forEach((function(e){var n=document.createElement("div");n.textContent=e,n.className="as-cell as-time",t.grid.appendChild(n),t.days.forEach((function(n){var r="".concat(n,"-").concat(e),i=document.createElement("div");i.className="as-cell",i.addEventListener("click",(function(){var e=!t.selected[r];t.selected[r]=e,i.classList.toggle("as-active",e),i.textContent=e?"✓":""})),t.grid.appendChild(i)}))}))}},{key:"_bindEvents",value:function(){var t=this;document.addEventListener("mousedown",(function(){document.body.classList.add("as-clicking")})),document.addEventListener("mouseup",(function(){document.body.classList.remove("as-clicking")})),this.button.addEventListener("click",(function(){var e=t.input.value||"Anonymous";if(0!==Object.values(t.selected).filter(Boolean).length){var n={name:e,availability:t.selected};alert("Gracias !!!"),t.onSubmit&&t.onSubmit(n)}else alert("Please select at least one time slot")}))}}])&&ua(t.prototype,e),n&&ua(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function pa(t){return pa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pa(t)}function ma(t){return function(t){if(Array.isArray(t))return ya(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ya(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ya(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ya(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ga(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,va(r.key),r)}}function va(t){var e=function(t,e){if("object"!=pa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=pa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pa(e)?e:e+""}var ba=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP DATA HERE",this.currentPayload=null,this.selectedFields=[],this.sortAscending=!1,this.zoomLevel=1,this.minZoom=.6,this.maxZoom=2,this.panX=0,this.panY=0,this.isPanning=!1,this._initDrop(),this._initResize(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._createTooltip(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"200px",overflow:"hidden"})}},{key:"_createToolbox",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{display:"flex",justifyContent:"space-between",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"}),this.fieldsContainer=document.createElement("div"),this.fieldsContainer.style.display="flex",this.fieldsContainer.style.gap="6px";var n=document.createElement("div"),r=document.createElement("button");r.textContent="Sort ↑",r.onclick=function(){t.sortAscending=!t.sortAscending,r.textContent=t.sortAscending?"Sort ↓":"Sort ↑",t.currentPayload&&t._drawChart(t.currentPayload)};var i=document.createElement("button");i.textContent="Clear",i.onclick=function(){t.currentPayload=null,t.selectedFields=[],t._renderBase()},n.appendChild(r),n.appendChild(i),e.appendChild(this.fieldsContainer),e.appendChild(n),this.container.appendChild(e)}},{key:"_renderFieldChips",value:function(){var t=this;this.fieldsContainer.innerHTML="",this.selectedFields.forEach((function(e,n){var r=document.createElement("div");Object.assign(r.style,{padding:"2px 6px",background:"#e0e0e0",borderRadius:"4px",fontSize:"11px",display:"flex",alignItems:"center",gap:"4px"}),r.innerHTML="".concat(e," ✕"),r.onclick=function(){t.selectedFields.splice(n,1),t._renderFieldChips(),t._drawChart(t.currentPayload)},t.fieldsContainer.appendChild(r)}))}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder.style.display="block"}},{key:"_hidePlaceholder",value:function(){this.placeholder.style.display="none"}},{key:"_createTooltip",value:function(){this.tooltip=document.createElement("div"),Object.assign(this.tooltip.style,{position:"absolute",background:"#000",color:"#fff",padding:"4px 6px",fontSize:"11px",borderRadius:"4px",opacity:0,pointerEvents:"none"}),this.container.appendChild(this.tooltip)}},{key:"_showTooltip",value:function(t,e,n){this.tooltip.innerHTML=n,this.tooltip.style.left=t+10+"px",this.tooltip.style.top=e+10+"px",this.tooltip.style.opacity=1}},{key:"_hideTooltip",value:function(){this.tooltip.style.opacity=0}},{key:"_initResize",value:function(){var t=this;new ResizeObserver((function(){t.currentPayload&&t._drawChart(t.currentPayload)})).observe(this.container)}},{key:"_initInteractions",value:function(){var t=this;this.container.onwheel=function(e){e.preventDefault(),t.zoomLevel+=.0015*-e.deltaY,t.zoomLevel=Math.max(t.minZoom,Math.min(t.maxZoom,t.zoomLevel)),t._applyTransform()},this.container.onmousedown=function(e){t.isPanning=!0,t.startX=e.clientX-t.panX,t.startY=e.clientY-t.panY,t.container.style.cursor="grabbing"},window.onmousemove=function(e){t.isPanning&&(t.panX=e.clientX-t.startX,t.panY=e.clientY-t.startY,t._applyTransform())},window.onmouseup=function(){t.isPanning=!1,t.container.style.cursor="default"}}},{key:"_applyTransform",value:function(){this.grid.style.transform="translate(".concat(this.panX,"px, ").concat(this.panY,"px) scale(").concat(this.zoomLevel,")")}},{key:"_initDrop",value:function(){var t=this;this.container.ondragover=function(t){return t.preventDefault()},this.container.ondrop=function(e){e.preventDefault();var n=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain"),r=JSON.parse(n);"histogram"===r.type&&(t.selectedFields=[],t.render(r)),"sumField"===r.type&&(t.selectedFields.includes(r.field)||t.selectedFields.push(r.field),t._renderFieldChips(),t._drawChart(t.currentPayload))}}},{key:"render",value:function(t){this.currentPayload=t,this.container.innerHTML="",this._createToolbox(),this._createTooltip(),this.chartWrapper=document.createElement("div"),this.chartWrapper.style.height="100%",this.chartWrapper.style.background="#f5f7fa",this.chartWrapper.style.padding="12px",this.container.appendChild(this.chartWrapper),this._drawChart(t)}},{key:"_parseNumber",value:function(t){return Number(String(t).replace(/,/g,""))||0}},{key:"_buildSeries",value:function(t){var e=this;return this.selectedFields.map((function(n){return{field:n,value:e._parseNumber(t[n])}}))}},{key:"_drawChart",value:function(t){var e=this;if(this.chartWrapper.innerHTML="",this.selectedFields.length){var n=ma(t.data);if(this.sortAscending){var r=this.selectedFields.at(-1);n.sort((function(t,n){return e._parseNumber(t[r])-e._parseNumber(n[r])}))}this.grid=document.createElement("div"),Object.assign(this.grid.style,{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:"12px",transformOrigin:"0 0"}),this.chartWrapper.appendChild(this.grid),this._initInteractions(),n.forEach((function(n){var r,i,o=document.createElement("div");o.onmouseenter=function(){o.style.transform="translateY(-2px)",o.style.boxShadow="0 4px 14px rgba(0,0,0,0.12)"},o.onmouseleave=function(){o.style.transform="translateY(0)",o.style.boxShadow="0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06)"};var s=e._buildSeries(n),a=(null===(r=s[0])||void 0===r?void 0:r.value)||0,l=(null===(i=s.at(-1))||void 0===i?void 0:i.value)||0,c=0===a?0:(l-a)/a*100,h=document.createElement("div");Object.assign(h.style,{display:"flex",justifyContent:"space-between",alignItems:"center"});var u=document.createElement("div");u.textContent=n[t.field],u.style.fontSize="12px",u.style.fontWeight="600",u.style.color="#333",u.style.letterSpacing="0.2px";var d=document.createElement("div");d.textContent="".concat(c.toFixed(1),"%"),d.style.fontSize="10px",d.style.padding="3px 8px",d.style.borderRadius="999px",d.style.fontWeight="600",d.style.border="1px solid rgba(0,0,0,0.05)",d.style.background=c>=0?"#e3f2fd":"#ffebee",d.style.color=c>=0?"#1976d2":"#e53935",h.appendChild(u),h.appendChild(d),Object.assign(o.style,{background:"#ffffff",padding:"10px 12px",borderRadius:"10px",border:"1px solid rgba(0,0,0,0.06)",borderTop:"3px solid ".concat(c>=0?"#1976d2":"#e53935"),boxShadow:"0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06)",display:"flex",flexDirection:"column",gap:"6px",transition:"all 0.15s ease",cursor:"pointer"}),o.appendChild(h);for(var f=d3.select(o).append("svg").attr("width","100%").attr("height",100).append("g").attr("transform","translate(30,10)"),p=d3.scalePoint().domain(e.selectedFields).range([0,160]),m=d3.scaleLinear().domain([0,d3.max(s,(function(t){return t.value}))]).range([70,0]),y=0;y<s.length-1;y++){var g=s[y],v=s[y+1],b=v.value>=g.value?"#1976d2":"#e53935";f.append("line").attr("x1",p(g.field)).attr("y1",m(g.value)).attr("x2",p(v.field)).attr("y2",m(v.value)).attr("stroke",b).attr("stroke-width",2)}f.selectAll("circle").data(s).enter().append("circle").attr("cx",(function(t){return p(t.field)})).attr("cy",(function(t){return m(t.value)})).attr("r",2).attr("fill","#333"),e.grid.appendChild(o)}))}}}],e&&ga(t.prototype,e),n&&ga(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function xa(t){return function(t){if(Array.isArray(t))return _a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return _a(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_a(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function wa(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Sa(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?wa(Object(n),!0).forEach((function(e){Ca(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wa(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Ca(t,e,n){return(e=Pa(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ea(t){return Ea="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ea(t)}function ka(){ka=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof g?e:g,s=Object.create(o.prototype),a=new P(r||[]);return i(s,"_invoke",{value:k(t,n,a)}),s}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",f="suspendedYield",p="executing",m="completed",y={};function g(){}function v(){}function b(){}var x={};c(x,s,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(O([])));w&&w!==n&&r.call(w,s)&&(x=w);var S=b.prototype=g.prototype=Object.create(x);function C(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,s,a){var l=u(t[i],t,o);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==Ea(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(h).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(l.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function k(e,n,r){var i=d;return function(o,s){if(i===p)throw Error("Generator is already running");if(i===m){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var l=T(a,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var c=u(e,n,r);if("normal"===c.type){if(i=r.done?m:f,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=u(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function O(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(Ea(e)+" is not iterable")}return v.prototype=b,i(S,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:v,configurable:!0}),v.displayName=c(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},C(E.prototype),c(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new E(h(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},C(S),c(S,l,"Generator"),c(S,s,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=O,P.prototype={constructor:P,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(M),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var l=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(l&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;M(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function Ta(t,e,n,r,i,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(r,i)}function Aa(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){Ta(o,r,i,s,a,"next",t)}function a(t){Ta(o,r,i,s,a,"throw",t)}s(void 0)}))}}function Ma(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Pa(r.key),r)}}function Pa(t){var e=function(t,e){if("object"!=Ea(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ea(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ea(e)?e:e+""}function Oa(t,e,n){return e=Ra(e),function(t,e){if(e&&("object"==Ea(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ia()?Reflect.construct(e,n||[],Ra(t).constructor):e.apply(t,n))}function Ia(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ia=function(){return!!t})()}function La(t,e,n,r){var i=ja(Ra(1&r?t.prototype:t),e,n);return 2&r?function(t){return i.apply(n,t)}:i}function ja(){return ja="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Ra(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},ja.apply(null,arguments)}function Ra(t){return Ra=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ra(t)}function Da(t,e){return Da=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Da(t,e)}var Na=function(){function t(e){var n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),(i=Oa(this,t,[e,o])).collectionsManager=o.collectionsManager||null,i.datasetName=(null===(n=i.collectionsManager)||void 0===n||null===(r=n.getSelectedTable)||void 0===r?void 0:r.call(n))||o.name||"",i.jsonLoader=o.jsonLoader||null,i.onSave=o.onSave||null,i.onInspect=o.onInspect||null,i.onDesign=o.onDesign||null,i.activeSource="paste",i.isSaving=!1,i.tableCombo=null,i.tableComboHost=null,i._onTableSelected=function(t){var e=t.table;i.datasetName=e||""},i._onRecordsChanged=function(t){var e,n;i.datasetName=(null===(e=i.collectionsManager)||void 0===e||null===(n=e.getSelectedTable)||void 0===n?void 0:n.call(e))||i.datasetName,i.setData(t||[])},i.bindCollectionsManager(),i.render(),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Da(t,e)}(t,As),e=t,n=[{key:"bindCollectionsManager",value:function(){this.collectionsManager&&(this.collectionsManager.on("table_selected",this._onTableSelected),this.collectionsManager.on("records_changed",this._onRecordsChanged))}},{key:"unbindCollectionsManager",value:function(){this.collectionsManager&&(this.collectionsManager.off("table_selected",this._onTableSelected),this.collectionsManager.off("records_changed",this._onRecordsChanged))}},{key:"mountTableCombo",value:function(){var t,e=this;this.collectionsManager&&this.tableComboHost&&(null===(t=this.tableCombo)||void 0===t||t.destroy(),this.tableCombo=new Gs(this.tableComboHost,this.collectionsManager),this.tableCombo.on("selected",(function(t){var n=t.table;e.datasetName=n||""})),this.tableCombo.on("create",(function(t){var n="string"==typeof t?t:null==t?void 0:t.table;n&&(e.datasetName=n)})))}},{key:"render",value:function(){this.tableCombo&&(this.tableCombo.destroy(),this.tableCombo=null),this.tableComboHost=null,this.container.innerHTML="",Object.assign(this.container.style,{display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",width:"100%",height:"100%",minWidth:"0",minHeight:"0",position:"relative",overflow:"hidden",background:"#1e1e1e",border:"1px solid #555555",borderRadius:"8px",boxSizing:"border-box"});var t=this.createSourceBar(),e=this.createDatasetBar(),n=document.createElement("div");if(Object.assign(n.style,{width:"100%",height:"100%",minWidth:"0",minHeight:"0",overflowX:"auto",overflowY:"auto",background:"#ffffff",position:"relative"}),this.data&&this.data.length){var r=this.createTableFromJSON(this.getProcessedData());r.style.width="max-content",r.style.minWidth="100%",n.appendChild(r)}else{var i=document.createElement("div");i.innerHTML='\n <div style="\n display:flex;\n flex-direction:column;\n align-items:center;\n justify-content:center;\n gap:10px;\n height:100%;\n color:#888;\n font-family:system-ui,sans-serif;\n ">\n\n <i\n class="fa-solid fa-table"\n style="font-size:32px">\n </i>\n\n <div style="\n font-size:14px;\n color:#666;\n ">\n PASTE DATA HERE\n </div>\n\n <div style="\n font-size:11px;\n color:#999;\n ">\n or load JSON / Google Sheet / RTDB table\n </div>\n\n </div>\n ',n.appendChild(i)}this.container.append(t,e,n),this.mountTableCombo()}},{key:"createSourceBar",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",boxSizing:"border-box",padding:"4px",gap:"10px",background:"#3b3b3b",borderBottom:"1px solid #555555"});var n=document.createElement("div");n.innerHTML="\n <div>Data Sources:</div>\n ",Object.assign(n.style,{width:"120px",height:"36px",color:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center",gap:"7px",fontSize:"15px",flexShrink:"0"});var r=this.createToolbarButton({icon:"fa-solid fa-copy",text:"Paste Data",active:"paste"===this.activeSource});r.onclick=function(){t.activeSource="paste",t.updateSourceButtons(e,r),t.container.focus()};var i=this.createToolbarButton({icon:"fa-solid fa-link",text:"Json URL",active:"json"===this.activeSource});i.onclick=function(){t.activeSource="json",t.updateSourceButtons(e,i),t.showURLInput({title:"Load JSON URL",placeholder:"https://server.com/data.json",buttonText:"Load JSON",onLoad:function(e){return t.loadJSON(e)}})};var o=this.createToolbarButton({icon:"fa-solid fa-table",text:"Google Sheet",active:"sheet"===this.activeSource});return o.onclick=function(){t.activeSource="sheet",t.updateSourceButtons(e,o),t.showGoogleSheetInput()},e.append(n,r,i,o),e}},{key:"updateSourceButtons",value:function(t,e){t.querySelectorAll("button").forEach((function(t){t.style.backgroundColor=t===e?"#000000":"#3d3d3d"}))}},{key:"extractSpreadsheetId",value:function(t){if(!t)return"";var e=t.trim(),n=e.match(/\/spreadsheets\/d\/([^/]+)/);return n&&n[1]?n[1]:e}},{key:"showGoogleSheetInput",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{position:"absolute",inset:"0",background:"rgba(0,0,0,.65)",zIndex:"1000",display:"flex",alignItems:"center",justifyContent:"center"});var n=document.createElement("div");Object.assign(n.style,{width:"500px",maxWidth:"90%",padding:"16px",boxSizing:"border-box",background:"#3b3b3b",border:"1px solid #666666",borderRadius:"10px",boxShadow:"0 10px 30px rgba(0,0,0,.5)"});var r=document.createElement("div");r.textContent="Load Google Sheet",Object.assign(r.style,{color:"#ffffff",fontSize:"14px",marginBottom:"14px"});var i=function(t){var e=document.createElement("input");return e.type="text",e.placeholder=t,Object.assign(e.style,{width:"100%",height:"36px",boxSizing:"border-box",padding:"8px 12px",marginBottom:"10px",color:"#ffffff",background:"#1e1e1e",border:"1px solid #555555",borderRadius:"8px",outline:"none",fontSize:"12px"}),e.addEventListener("paste",(function(t){return t.stopPropagation()})),e.addEventListener("mousedown",(function(t){return t.stopPropagation()})),e},o=i("Spreadsheet ID or Google Sheet URL"),s=i("Sheet Name (example: clientes)"),a=document.createElement("div");Object.assign(a.style,{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"4px"});var l=this.createToolbarButton({icon:"fa-solid fa-xmark",text:"Cancel",width:"90px"}),c=this.createToolbarButton({icon:"fa-solid fa-download",text:"Load Sheet",width:"110px",active:!0});l.onclick=function(){e.remove()},c.onclick=Aa(ka().mark((function n(){var r,i;return ka().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=o.value.trim(),i=s.value.trim(),r){n.next=5;break}return alert("Enter a Spreadsheet ID or URL."),n.abrupt("return");case 5:if(i){n.next=8;break}return alert("Enter the Sheet Name."),n.abrupt("return");case 8:return c.disabled=!0,c.style.opacity="0.5",n.prev=10,n.next=13,t.loadSheet(r,i);case 13:e.remove(),n.next=20;break;case 16:n.prev=16,n.t0=n.catch(10),console.error("Google Sheet error:",n.t0),alert(n.t0.message||"Unable to load Google Sheet.");case 20:return n.prev=20,c.disabled=!1,c.style.opacity="1",n.finish(20);case 24:case"end":return n.stop()}}),n,null,[[10,16,20,24]])}))),s.onkeydown=function(t){"Enter"===t.key&&c.click(),"Escape"===t.key&&e.remove()},o.onkeydown=function(t){"Escape"===t.key&&e.remove()},a.append(l,c),n.append(r,o,s,a),e.appendChild(n),this.container.appendChild(e),o.focus()}},{key:"createDatasetBar",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",boxSizing:"border-box",padding:"4px",gap:"10px",background:"#3b3b3b",borderBottom:"1px solid #555555"});var n=document.createElement("div");Object.assign(n.style,{flex:"1",minWidth:"0",height:"36px"}),this.tableComboHost=n;var r=document.createElement("div");Object.assign(r.style,{display:"flex",flexDirection:"row",alignItems:"center",gap:"6px",flexShrink:"0"});var i=this.createToolbarButton({icon:"fa-solid fa-trash",text:"Clear",width:"80px"});i.onclick=function(){t.clear()};var o=this.createToolbarButton({icon:"fa-solid fa-copy",text:"Copy",width:"80px"});o.onclick=Aa(ka().mark((function e(){var n,r;return ka().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.getProcessedData(),r=JSON.stringify(n,null,2),e.prev=2,e.next=5,navigator.clipboard.writeText(r);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(2),console.error("Unable to copy table:",e.t0);case 10:case"end":return e.stop()}}),e,null,[[2,7]])})));var s=this.createToolbarButton({icon:"fa-solid fa-up-down-left-right",text:"Drag",width:"80px"});s.draggable=!0,s.style.cursor="grab",s.addEventListener("mousedown",(function(){s.style.cursor="grabbing"})),s.addEventListener("mouseup",(function(){s.style.cursor="grab"})),s.addEventListener("dragend",(function(){s.style.cursor="grab"})),s.addEventListener("dragstart",(function(e){var n={type:"table",name:t.datasetName,data:t.getProcessedData()},r=JSON.stringify(n);e.dataTransfer.effectAllowed="copy",e.dataTransfer.setData("application/json",r),e.dataTransfer.setData("text/plain",r);var i=s.cloneNode(!0);Object.assign(i.style,{position:"absolute",top:"-1000px",left:"-1000px",pointerEvents:"none"}),document.body.appendChild(i),e.dataTransfer.setDragImage(i,16,16),setTimeout((function(){i.parentNode&&i.parentNode.removeChild(i)}),0)}));var a=this.createToolbarButton({icon:"fa-solid fa-floppy-disk",text:"Save",width:"80px",active:!0});a.onclick=function(){t.saveDataset()};var l=this.createToolbarButton({icon:"fa-solid fa-magnifying-glass-chart",text:"Inspect",width:"100px",active:!0});return l.onclick=function(){t.onInspect&&t.onInspect({name:t.datasetName,data:t.data,processedData:t.getProcessedData(),table:t})},r.append(i,o,s,a,l),e.append(n,r),e}},{key:"createToolbarButton",value:function(t){var e=t.icon,n=t.text,r=t.width,i=void 0===r?"120px":r,o=t.active,s=void 0!==o&&o,a=document.createElement("button");return a.innerHTML='\n <span style="\n font-size:16px;\n pointer-events:none;\n ">\n <i class="'.concat(e,'"></i>\n </span>\n\n <span style="\n pointer-events:none;\n ">\n ').concat(n,"\n </span>\n "),Object.assign(a.style,{width:i,height:"36px",backgroundColor:s?"#000000":"#3d3d3d",color:"#ffffff",border:"1px solid #555555",borderRadius:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"7px",fontSize:"12px",flexShrink:"0"}),a.addEventListener("mouseenter",(function(){a.disabled||(a.style.borderColor="#888888")})),a.addEventListener("mouseleave",(function(){a.style.borderColor="#555555"})),a}},{key:"showURLInput",value:function(t){var e=t.title,n=t.placeholder,r=t.buttonText,i=t.onLoad,o=document.createElement("div");Object.assign(o.style,{position:"absolute",inset:"0",background:"rgba(0,0,0,.65)",zIndex:"1000",display:"flex",alignItems:"center",justifyContent:"center"});var s=document.createElement("div");Object.assign(s.style,{width:"500px",maxWidth:"90%",padding:"16px",boxSizing:"border-box",background:"#3b3b3b",border:"1px solid #666666",borderRadius:"10px",boxShadow:"0 10px 30px rgba(0,0,0,.5)"});var a=document.createElement("div");a.textContent=e,Object.assign(a.style,{color:"#ffffff",fontSize:"14px",marginBottom:"14px"});var l=document.createElement("input");l.type="text",l.placeholder=n,Object.assign(l.style,{width:"100%",height:"36px",boxSizing:"border-box",padding:"8px 12px",color:"#ffffff",background:"#1e1e1e",border:"1px solid #555555",borderRadius:"8px",outline:"none",fontSize:"12px"}),l.addEventListener("paste",(function(t){return t.stopPropagation()})),l.addEventListener("mousedown",(function(t){return t.stopPropagation()}));var c=document.createElement("div");Object.assign(c.style,{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"12px"});var h=this.createToolbarButton({icon:"fa-solid fa-xmark",text:"Cancel",width:"90px"}),u=this.createToolbarButton({icon:"fa-solid fa-download",text:r,width:"110px",active:!0});h.onclick=function(){o.remove()},u.onclick=Aa(ka().mark((function t(){var e;return ka().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=l.value.trim()){t.next=3;break}return t.abrupt("return");case 3:return u.disabled=!0,u.style.opacity="0.5",t.prev=5,t.next=8,i(e);case 8:o.remove(),t.next=15;break;case 11:t.prev=11,t.t0=t.catch(5),console.error("Data loading error:",t.t0),alert(t.t0.message||"Unable to load data");case 15:return t.prev=15,u.disabled=!1,u.style.opacity="1",t.finish(15);case 19:case"end":return t.stop()}}),t,null,[[5,11,15,19]])}))),l.onkeydown=function(t){"Enter"===t.key&&u.click(),"Escape"===t.key&&o.remove()},c.append(h,u),s.append(a,l,c),o.appendChild(s),this.container.appendChild(o),l.focus()}},{key:"handlePaste",value:function(t){var e=t.target;if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)){t.preventDefault();var n=(t.clipboardData||window.clipboardData).getData("text");if(n){var r=this.parseTSV(n);if(r.length){var i=this.toJSON(r);this.activeSource="paste",this.appendData(i)}}}}},{key:"setData",value:function(t){var e=this.normalizeData(t);return this.data=e,this.filters={},this.sortState={field:null,direction:"asc"},this.render(),this.data}},{key:"appendData",value:function(t){var e=this.normalizeData(t);return this.data=this.mergeData(this.data||[],e),this.render(),this.data}},{key:"normalizeData",value:function(t){if(null==t)return[];var e=t;if(!Array.isArray(e)&&e&&Array.isArray(e.data)&&(e=e.data),!Array.isArray(e)&&e&&Array.isArray(e.rows)&&(e=e.rows),!Array.isArray(e))throw new Error("Data source must return an array of objects.");return e.length&&Array.isArray(e[0])?this.toJSON(e):e.map((function(t){return t&&"object"===Ea(t)&&!Array.isArray(t)?Sa({},t):{value:t}}))}},{key:"loadJSON",value:(s=Aa(ka().mark((function t(e){var n,r;return ka().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.jsonLoader){t.next=6;break}return t.next=3,this.jsonLoader(e,this);case 3:n=t.sent,t.next=14;break;case 6:return t.next=8,fetch(e);case 8:if((r=t.sent).ok){t.next=11;break}throw new Error("HTTP ".concat(r.status," - ").concat(r.statusText));case 11:return t.next=13,r.json();case 13:n=t.sent;case 14:return this.activeSource="json",t.abrupt("return",this.setData(n));case 16:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"loadSheet",value:(o=Aa(ka().mark((function t(e,n){var r,i,o,s,a,l,c,h;return ka().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this.extractSpreadsheetId(e),i={data:{data_source:{config:{SPREADSHEET_ID:r,SHEET_NAME:n}}}},console.log("Google Sheet request:",i),t.next=5,fetch("https://server.vizor.studio/api/get_data",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});case 5:if((o=t.sent).ok){t.next=11;break}return t.next=9,o.text();case 9:throw s=t.sent,new Error("Google Sheet request failed (".concat(o.status,"): ").concat(s));case 11:return t.next=13,o.json();case 13:if(a=t.sent,console.log("Google Sheet response:",a),!a||"error"!==a.status){t.next=18;break}throw h=(null===(l=a.data)||void 0===l?void 0:l.message)||(null===(c=a.data)||void 0===c?void 0:c.error)||"Unable to load Google Sheet.",new Error(h);case 18:return this.activeSource="sheet",t.abrupt("return",this.setData(a));case 20:case"end":return t.stop()}}),t,this)}))),function(t,e){return o.apply(this,arguments)})},{key:"mergeData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t.length)return e.map((function(t){return Sa({},t)}));if(!e.length)return t.map((function(t){return Sa({},t)}));var n=t.every((function(t){return void 0!==t.id&&null!==t.id&&""!==t.id})),r=e.every((function(t){return void 0!==t.id&&null!==t.id&&""!==t.id}));if(!n||!r)return[].concat(xa(t.map((function(t){return Sa({},t)}))),xa(e.map((function(t){return Sa({},t)}))));var i=new Map;return t.forEach((function(t){i.set(t.id,Sa({},t))})),e.forEach((function(t){i.has(t.id)?Object.assign(i.get(t.id),t):i.set(t.id,Sa({},t))})),Array.from(i.values())}},{key:"saveDataset",value:(i=Aa(ka().mark((function t(){var e,n,r,i,o,s,a;return ka().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.isSaving){t.next=2;break}return t.abrupt("return");case 2:if(n=null===(e=this.collectionsManager)||void 0===e?void 0:e.getSelectedTable()){t.next=6;break}return alert("Please select or create a table first."),t.abrupt("return");case 6:if((r=this.getProcessedData()).length){t.next=10;break}return alert("There are no records to save."),t.abrupt("return");case 10:return this.isSaving=!0,t.prev=11,i=this.collectionsManager.saveRecords(r,n),o=i.records,s=i.confirmation,this.setData(o),t.next=16,s;case 16:a=t.sent,console.log("Saved ".concat(a.count," records to ").concat(n)),t.next=24;break;case 20:t.prev=20,t.t0=t.catch(11),console.error("Save failed:",t.t0),alert(t.t0.message);case 24:return t.prev=24,this.isSaving=!1,t.finish(24);case 27:case"end":return t.stop()}}),t,this,[[11,20,24,27]])}))),function(){return i.apply(this,arguments)})},{key:"getDataset",value:function(){return{name:this.datasetName,table:this.getSelectedTable(),source:this.activeSource,data:this.data,processedData:this.getProcessedData(),columns:this.getColumns(),rowCount:(this.data||[]).length}}},{key:"getColumns",value:function(){return Array.from((this.data||[]).reduce((function(t,e){return Object.keys(e).forEach((function(e){return t.add(e)})),t}),new Set))}},{key:"setDatasetName",value:function(t){var e=t||"";this.collectionsManager&&e?this.collectionsManager.selectTable(e):(this.datasetName=e,this.render())}},{key:"getDatasetName",value:function(){return this.datasetName}},{key:"getSelectedTable",value:function(){var t,e;return(null===(t=this.collectionsManager)||void 0===t||null===(e=t.getSelectedTable)||void 0===e?void 0:e.call(t))||this.datasetName||null}},{key:"clear",value:function(){this.data=[],this.filters={},this.sortState={field:null,direction:"asc"},this.activeSource="paste",this.render()}},{key:"destroy",value:function(){this.tableCombo&&(this.tableCombo.destroy(),this.tableCombo=null),this.unbindCollectionsManager(),this.tableComboHost=null,this.collectionsManager=null,"function"==typeof La(t,"destroy",this,1)?La(t,"destroy",this,3)([]):this.container&&(this.container.innerHTML="")}}],n&&Ma(e.prototype,n),r&&Ma(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r,i,o,s}(),Fa=o.A5,Ba=o.oY,Ga=o.W_,za=o.vY,Ua=o.jz,Wa=o.TI,Ha=o.ey,Va=o.sV,Ya=o.ut;export{Fa as AvailabilitySurvey,Ba as DataInspector,Ga as DataInspectorBasic,za as vi_2dGRAP,Ua as vi_ExtendedPasteTable,Wa as vi_HistogramViewer,Ha as vi_MiniChartViewer,Va as vi_PasteTable,Ya as vi_TableDataEditor};
|
|
2
|
+
var t,e,n={5870:(t,e,n)=>{n.d(e,{A:()=>p});var r=n(1601),i=n.n(r),o=n(6314),s=n.n(o),a=n(4417),l=n.n(a),c=new URL(n(4002),n.b),h=new URL(n(2653),n.b),u=s()(i()),d=l()(c),f=l()(h);u.push([t.id,`.choices{position:relative;overflow:hidden;margin-bottom:var(--choices-guttering, 24px);font-size:var(--choices-font-size-lg, 16px)}.choices:focus{outline:0}.choices:last-child{margin-bottom:0}.choices.is-open{overflow:visible}.choices.is-disabled :is(.choices__inner,.choices__input){background-color:var(--choices-bg-color-disabled, #eaeaea);cursor:not-allowed!important;-webkit-user-select:none;user-select:none}.choices.is-disabled .choices__item{cursor:not-allowed;color:var(--choices-item-disabled-color, #fff)}.choices [hidden]{position:absolute;inset:0;pointer-events:none;opacity:0}.choices[data-type*=select-one]{cursor:pointer}.choices[data-type*=select-one] .choices__inner{padding-bottom:var(--choices-inner-one-padding, 7.5px)}.choices[data-type*=select-one] .choices__input{display:block;width:var(--choices-width, 100%);padding:var(--choices-dropdown-item-padding, 10px);border-bottom:var(--choices-base-border, 1px solid) var(--choices-keyline-color, #ddd);background-color:var(--choices-bg-color-dropdown, #fff);margin:0}.choices[data-type*=select-one] .choices__button{background-image:var(--choices-icon-cross-inverse, url(${d}));padding:0;background-size:8px;position:absolute;top:50%;right:0;margin-top:-10px;margin-right:25px;height:20px;width:20px;border-radius:10em;opacity:.25}.choices[data-type*=select-one] .choices__button:is(:hover,:focus){opacity:var(--choices-button-opacity-hover, 1)}.choices[data-type*=select-one] .choices__button:focus{box-shadow:0 0 0 2px var(--choices-highlight-color, #005F75)}.choices[data-type*=select-one] .choices__item[data-placeholder] .choices__button{display:none}.choices[data-type*=select-one]::after{content:"";height:0;width:0;border-style:solid;border-color:var(--choices-text-color, #333) transparent transparent transparent;border-width:var(--choices-arrow-size, 5px);position:absolute;right:var(--choices-arrow-right, 11.5px);top:50%;margin-top:var(--choices-arrow-margin-top, -2.5px);pointer-events:none}.choices[data-type*=select-one].is-open::after{border-color:transparent transparent var(--choices-text-color, #333);margin-top:var(--choices-arrow-margin-top-open, -7.5px)}.choices[data-type*=select-one][dir=rtl]::after{left:11.5px;right:auto}.choices[data-type*=select-one][dir=rtl] .choices__button{right:auto;left:0;margin-left:25px;margin-right:0}.choices:is([data-type*=select-multiple],[data-type*=text]) .choices__inner{cursor:text}.choices:is([data-type*=select-multiple],[data-type*=text]) .choices__button{position:relative;display:inline-block;margin:0 calc(var(--choices-button-offset, 8px)*-.5)0 var(--choices-button-offset, 8px);padding-left:calc(var(--choices-button-offset, 8px)*2);border-left:1px solid color-mix(in srgb,var(--choices-primary-color, #005F75) 90%,var(--choices-darken, black));background-image:var(--choices-icon-cross, url(${f}));background-size:var(--choices-button-dimension, 8px);width:var(--choices-button-dimension, 8px);line-height:var(--choices-button-line-height, 1);border-radius:var(--choices-button-border-radius, 0);opacity:var(--choices-button-opacity, 0.75)}.choices:is([data-type*=select-multiple],[data-type*=text]) .choices__button:is(:hover,:focus){--choices-button-opacity:var(--choices-button-opacity-hover, 1)}.choices__inner{display:inline-block;vertical-align:top;width:var(--choices-width, 100%);background-color:var(--choices-bg-color, #f9f9f9);padding:var(--choices-inner-padding, 7.5px 7.5px 3.75px);border:var(--choices-base-border, 1px solid) var(--choices-keyline-color, #ddd);border-radius:var(--choices-border-radius, 2.5px);font-size:var(--choices-font-size-md, 14px);min-height:var(--choices-input-height, 44px);overflow:hidden}.is-focused .choices__inner,.is-open .choices__inner{border-color:color-mix(in srgb,var(--choices-keyline-color, #ddd) 85%,var(--choices-darken, black))}.is-open .choices__inner{border-radius:var(--choices-border-radius, 2.5px) var(--choices-border-radius, 2.5px)0 0}.is-invalid .choices__inner{border-color:var(--choices-invalid-color, #d33141)}.is-flipped.is-open .choices__inner{border-radius:0 0 var(--choices-border-radius, 2.5px) var(--choices-border-radius, 2.5px)}.choices__list{margin:0;padding-left:0;list-style:none}.choices__list--single{display:inline-block;padding:var(--choices-list-single-padding, 4px 16px 4px 4px)}[dir=rtl] .choices__list--single{padding-right:4px;padding-left:16px}.choices__list--single,.choices__list--single .choices__item{width:var(--choices-width, 100%)}.choices__list--multiple{display:inline}.choices__list--multiple .choices__item{display:inline-block;vertical-align:middle;border-radius:var(--choices-border-radius-item, 20px);padding:var(--choices-multiple-item-padding, 4px 10px);font-size:var(--choices-font-size-sm, 12px);font-weight:500;margin-right:var(--choices-multiple-item-margin, 3.75px);margin-bottom:var(--choices-multiple-item-margin, 3.75px);background-color:var(--choices-primary-color, #005F75);border:1px solid color-mix(in srgb,var(--choices-primary-color, #005F75) 95%,var(--choices-darken, black));color:var(--choices-item-color, #fff);word-break:break-all;box-sizing:border-box}.choices__list--multiple .choices__item[data-deletable]{padding-right:5px}[dir=rtl] .choices__list--multiple .choices__item{margin-right:0;margin-left:var(--choices-multiple-item-margin, 3.75px)}.choices__list--multiple .choices__item.is-highlighted{background-color:color-mix(in srgb,var(--choices-primary-color, #005F75) 95%,var(--choices-darken, black));border:1px solid color-mix(in srgb,var(--choices-primary-color, #005F75) 90%,var(--choices-darken, black))}.is-disabled .choices__list--multiple .choices__item{background-color:color-mix(in srgb,var(--choices-disabled-color, #eaeaea) 75%,var(--choices-darken, black));border:1px solid color-mix(in srgb,var(--choices-disabled-color, #eaeaea) 65%,var(--choices-darken, black))}.choices__list--dropdown,.choices__list[aria-expanded]{display:none;z-index:var(--choices-z-index, 1);position:absolute;width:var(--choices-width, 100%);background-color:var(--choices-bg-color-dropdown, #fff);border:var(--choices-base-border, 1px solid) var(--choices-keyline-color, #ddd);top:100%;margin-top:-1px;border-bottom-left-radius:var(--choices-border-radius, 2.5px);border-bottom-right-radius:var(--choices-border-radius, 2.5px);overflow:hidden;word-break:break-all}.is-active.choices__list--dropdown,.is-active.choices__list[aria-expanded]{display:block}.is-open .choices__list--dropdown,.is-open .choices__list[aria-expanded]{border-color:color-mix(in srgb,var(--choices-keyline-color, #ddd) 85%,var(--choices-darken, black))}.is-flipped .choices__list--dropdown,.is-flipped .choices__list[aria-expanded]{top:auto;bottom:100%;margin-top:0;margin-bottom:-1px;border-radius:.25rem .25rem 0 0}.choices__list--dropdown .choices__list,.choices__list[aria-expanded] .choices__list{position:relative;max-height:300px;overflow:auto;-webkit-overflow-scrolling:touch;will-change:scroll-position}.choices__list--dropdown .choices__item,.choices__list[aria-expanded] .choices__item{position:relative;padding:var(--choices-dropdown-item-padding, 10px);font-size:var(--choices-font-size-md, 14px)}[dir=rtl] .choices__list--dropdown .choices__item,[dir=rtl] .choices__list[aria-expanded] .choices__item{text-align:right}@media (min-width:640px){.choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text],.choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]{padding-right:100px}.choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text]::after,.choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]::after{content:attr(data-select-text);font-size:var(--choices-font-size-sm, 12px);position:absolute;right:10px;top:50%;transform:translateY(-50%)}[dir=rtl] .choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text],[dir=rtl] .choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]{text-align:right;padding-left:100px;padding-right:10px}[dir=rtl] .choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text]::after,[dir=rtl] .choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]::after{right:auto;left:10px}}.choices__list--dropdown .choices__item--selectable.is-selected::after,.choices__list[aria-expanded] .choices__item--selectable.is-selected::after{content:none!important}.choices__list--dropdown .choices__item--selectable.is-highlighted,.choices__list--dropdown .choices__item--selectable.is-selected,.choices__list[aria-expanded] .choices__item--selectable.is-highlighted,.choices__list[aria-expanded] .choices__item--selectable.is-selected{background-color:var(--choices-highlighted-color, #f2f2f2)}.choices__item{cursor:default}.choices__item--selectable{cursor:pointer}.choices__item--disabled{cursor:not-allowed;-webkit-user-select:none;user-select:none;opacity:.5}.choices__heading{font-weight:600;font-size:12px;padding:10px;border-bottom:1px solid color-mix(in srgb,var(--choices-keyline-color, #ddd) 90%,var(--choices-lighten, white));color:gray}.choices__button{text-indent:-9999px;appearance:none;border:0;background-color:transparent;background-repeat:no-repeat;background-position:center;cursor:pointer}.choices__button:focus,.choices__input:focus{outline:0}.choices__input{display:inline-block;vertical-align:baseline;background-color:var(--choices-bg-color, #f9f9f9);font-size:var(--choices-font-size-md, 14px);margin-bottom:var(--choices-input-margin-bottom, 5px);border:0;border-radius:0;max-width:var(--choices-width, 100%);padding:var(--choices-input-padding, 4px 0 4px 2px)}.choices__input::-webkit-search-cancel-button,.choices__input::-webkit-search-decoration,.choices__input::-webkit-search-results-button,.choices__input::-webkit-search-results-decoration{display:none}.choices__input::-ms-clear,.choices__input::-ms-reveal{display:none;width:0;height:0}[dir=rtl] .choices__input{padding-right:2px;padding-left:0}.choices__placeholder{opacity:var(--choices-placeholder-opacity, 0.5)}`,""]);const p=u},6314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,i,o){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(r)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var c=0;c<t.length;c++){var h=[].concat(t[c]);r&&s[h[0]]||(void 0!==o&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=o),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),i&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=i):h[4]="".concat(i)),e.push(h))}},e}},4417:t=>{t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]|(%20)/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t):t}},1601:t=>{t.exports=function(t){return t[1]}},228:t=>{var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||t,s),l=n?n+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},a.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i<o;i++)s[i]=r[i].fn;return s},a.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,i,o,s){var a=n?n+t:t;if(!this._events[a])return!1;var l,c,h=this._events[a],u=arguments.length;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),u){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,i),!0;case 5:return h.fn.call(h.context,e,r,i,o),!0;case 6:return h.fn.call(h.context,e,r,i,o,s),!0}for(c=1,l=new Array(u-1);c<u;c++)l[c-1]=arguments[c];h.fn.apply(h.context,l)}else{var d,f=h.length;for(c=0;c<f;c++)switch(h[c].once&&this.removeListener(t,h[c].fn,void 0,!0),u){case 1:h[c].fn.call(h[c].context);break;case 2:h[c].fn.call(h[c].context,e);break;case 3:h[c].fn.call(h[c].context,e,r);break;case 4:h[c].fn.call(h[c].context,e,r,i);break;default:if(!l)for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];h[c].fn.apply(h[c].context,l)}}return!0},a.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},a.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},a.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||i&&!a.once||r&&a.context!==r||s(this,o);else{for(var l=0,c=[],h=a.length;l<h;l++)(a[l].fn!==e||i&&!a[l].once||r&&a[l].context!==r)&&c.push(a[l]);c.length?this._events[o]=1===c.length?c[0]:c:s(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a},8133:t=>{t.exports=function(t){var i=[];return t.replace(n,(function(t,n,o){var s=n.toLowerCase();for(o=function(t){var e=t.match(r);return e?e.map(Number):[]}(o),"m"==s&&o.length>2&&(i.push([n].concat(o.splice(0,2))),s="l",n="m"==n?"l":"L");;){if(o.length==e[s])return o.unshift(n),i.push(o);if(o.length<e[s])throw new Error("malformed path data");i.push([n].concat(o.splice(0,e[s])))}})),i};var e={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},n=/([astvzqmhlc])([^astvzqmhlc]*)/gi;var r=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi},5585:t=>{var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||t,s),l=n?n+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},a.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i<o;i++)s[i]=r[i].fn;return s},a.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},a.prototype.emit=function(t,e,r,i,o,s){var a=n?n+t:t;if(!this._events[a])return!1;var l,c,h=this._events[a],u=arguments.length;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),u){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,i),!0;case 5:return h.fn.call(h.context,e,r,i,o),!0;case 6:return h.fn.call(h.context,e,r,i,o,s),!0}for(c=1,l=new Array(u-1);c<u;c++)l[c-1]=arguments[c];h.fn.apply(h.context,l)}else{var d,f=h.length;for(c=0;c<f;c++)switch(h[c].once&&this.removeListener(t,h[c].fn,void 0,!0),u){case 1:h[c].fn.call(h[c].context);break;case 2:h[c].fn.call(h[c].context,e);break;case 3:h[c].fn.call(h[c].context,e,r);break;case 4:h[c].fn.call(h[c].context,e,r,i);break;default:if(!l)for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];h[c].fn.apply(h[c].context,l)}}return!0},a.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},a.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},a.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||i&&!a.once||r&&a.context!==r||s(this,o);else{for(var l=0,c=[],h=a.length;l<h;l++)(a[l].fn!==e||i&&!a[l].once||r&&a[l].context!==r)&&c.push(a[l]);c.length?this._events[o]=1===c.length?c[0]:c:s(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a},5072:t=>{var e=[];function n(t){for(var n=-1,r=0;r<e.length;r++)if(e[r].identifier===t){n=r;break}return n}function r(t,r){for(var o={},s=[],a=0;a<t.length;a++){var l=t[a],c=r.base?l[0]+r.base:l[0],h=o[c]||0,u="".concat(c," ").concat(h);o[c]=h+1;var d=n(u),f={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(f);else{var p=i(f,r);r.byIndex=a,e.splice(a,0,{identifier:u,updater:p,references:1})}s.push(u)}return s}function i(t,e){var n=e.domAPI(e);n.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,i){var o=r(t=t||[],i=i||{});return function(t){t=t||[];for(var s=0;s<o.length;s++){var a=n(o[s]);e[a].references--}for(var l=r(t,i),c=0;c<o.length;c++){var h=n(o[c]);0===e[h].references&&(e[h].updater(),e.splice(h,1))}o=l}}},7659:t=>{var e={};t.exports=function(t,n){var r=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},5056:(t,e,n)=>{t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},7825:t=>{t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,i&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},1113:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},4002:t=>{t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg=="},2653:t=>{t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg=="},2406:(t,e,n)=>{n.d(e,{z:()=>r});const r=(t,e,n=!1)=>(Array.isArray(t)||(t=[t]),e?t.map((t=>"string"==typeof t||n?e(t):t)):t)},2577:(t,e,n)=>{n.d(e,{Q:()=>I});var r={grad:.9,turn:360,rad:360/(2*Math.PI)},i=function(t){return"string"==typeof t?t.length>0:"number"==typeof t},o=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},s=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=1),t>n?n:t>e?t:e},a=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},l=function(t){return{r:s(t.r,0,255),g:s(t.g,0,255),b:s(t.b,0,255),a:s(t.a)}},c=function(t){return{r:o(t.r),g:o(t.g),b:o(t.b),a:o(t.a,3)}},h=/^#([0-9a-f]{3,8})$/i,u=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},d=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,o=Math.max(e,n,r),s=o-Math.min(e,n,r),a=s?o===e?(n-r)/s:o===n?2+(r-e)/s:4+(e-n)/s:0;return{h:60*(a<0?a+6:a),s:o?s/o*100:0,v:o/255*100,a:i}},f=function(t){var e=t.h,n=t.s,r=t.v,i=t.a;e=e/360*6,n/=100,r/=100;var o=Math.floor(e),s=r*(1-n),a=r*(1-(e-o)*n),l=r*(1-(1-e+o)*n),c=o%6;return{r:255*[r,a,s,s,l,r][c],g:255*[l,r,r,a,s,s][c],b:255*[s,s,l,r,r,a][c],a:i}},p=function(t){return{h:a(t.h),s:s(t.s,0,100),l:s(t.l,0,100),a:s(t.a)}},m=function(t){return{h:o(t.h),s:o(t.s),l:o(t.l),a:o(t.a,3)}},y=function(t){return f((n=(e=t).s,{h:e.h,s:(n*=((r=e.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:e.a}));var e,n,r},g=function(t){return{h:(e=d(t)).h,s:(i=(200-(n=e.s))*(r=e.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,n,r,i},v=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,b=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,x=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,w={string:[[function(t){var e=h.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:4===t.length?o(parseInt(t[3]+t[3],16)/255,2):1}:6===t.length||8===t.length?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:8===t.length?o(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=x.exec(t)||_.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:l({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:void 0===e[7]?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=v.exec(t)||b.exec(t);if(!e)return null;var n,i,o=p({h:(n=e[1],i=e[2],void 0===i&&(i="deg"),Number(n)*(r[i]||1)),s:Number(e[3]),l:Number(e[4]),a:void 0===e[5]?1:Number(e[5])/(e[6]?100:1)});return y(o)},"hsl"]],object:[[function(t){var e=t.r,n=t.g,r=t.b,o=t.a,s=void 0===o?1:o;return i(e)&&i(n)&&i(r)?l({r:Number(e),g:Number(n),b:Number(r),a:Number(s)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,o=t.a,s=void 0===o?1:o;if(!i(e)||!i(n)||!i(r))return null;var a=p({h:Number(e),s:Number(n),l:Number(r),a:Number(s)});return y(a)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,o=t.a,l=void 0===o?1:o;if(!i(e)||!i(n)||!i(r))return null;var c=function(t){return{h:a(t.h),s:s(t.s,0,100),v:s(t.v,0,100),a:s(t.a)}}({h:Number(e),s:Number(n),v:Number(r),a:Number(l)});return f(c)},"hsv"]]},S=function(t,e){for(var n=0;n<e.length;n++){var r=e[n][0](t);if(r)return[r,e[n][1]]}return[null,void 0]},C=function(t){return"string"==typeof t?S(t.trim(),w.string):"object"==typeof t&&null!==t?S(t,w.object):[null,void 0]},E=function(t,e){var n=g(t);return{h:n.h,s:s(n.s+100*e,0,100),l:n.l,a:n.a}},k=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},T=function(t,e){var n=g(t);return{h:n.h,s:n.s,l:s(n.l+100*e,0,100),a:n.a}},A=function(){function t(t){this.parsed=C(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return null!==this.parsed},t.prototype.brightness=function(){return o(k(this.rgba),2)},t.prototype.isDark=function(){return k(this.rgba)<.5},t.prototype.isLight=function(){return k(this.rgba)>=.5},t.prototype.toHex=function(){return e=(t=c(this.rgba)).r,n=t.g,r=t.b,s=(i=t.a)<1?u(o(255*i)):"","#"+u(e)+u(n)+u(r)+s;var t,e,n,r,i,s},t.prototype.toRgb=function(){return c(this.rgba)},t.prototype.toRgbString=function(){return e=(t=c(this.rgba)).r,n=t.g,r=t.b,(i=t.a)<1?"rgba("+e+", "+n+", "+r+", "+i+")":"rgb("+e+", "+n+", "+r+")";var t,e,n,r,i},t.prototype.toHsl=function(){return m(g(this.rgba))},t.prototype.toHslString=function(){return e=(t=m(g(this.rgba))).h,n=t.s,r=t.l,(i=t.a)<1?"hsla("+e+", "+n+"%, "+r+"%, "+i+")":"hsl("+e+", "+n+"%, "+r+"%)";var t,e,n,r,i},t.prototype.toHsv=function(){return t=d(this.rgba),{h:o(t.h),s:o(t.s),v:o(t.v),a:o(t.a,3)};var t},t.prototype.invert=function(){return M({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},t.prototype.saturate=function(t){return void 0===t&&(t=.1),M(E(this.rgba,t))},t.prototype.desaturate=function(t){return void 0===t&&(t=.1),M(E(this.rgba,-t))},t.prototype.grayscale=function(){return M(E(this.rgba,-1))},t.prototype.lighten=function(t){return void 0===t&&(t=.1),M(T(this.rgba,t))},t.prototype.darken=function(t){return void 0===t&&(t=.1),M(T(this.rgba,-t))},t.prototype.rotate=function(t){return void 0===t&&(t=15),this.hue(this.hue()+t)},t.prototype.alpha=function(t){return"number"==typeof t?M({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):o(this.rgba.a,3);var e},t.prototype.hue=function(t){var e=g(this.rgba);return"number"==typeof t?M({h:t,s:e.s,l:e.l,a:e.a}):o(e.h)},t.prototype.isEqual=function(t){return this.toHex()===M(t).toHex()},t}(),M=function(t){return t instanceof A?t:new A(t)},P=[];!function(t){t.forEach((function(t){P.indexOf(t)<0&&(t(A,w),P.push(t))}))}([function(t,e){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var i in n)r[n[i]]=i;var o={};t.prototype.toName=function(e){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var i,s,a=r[this.toHex()];if(a)return a;if(null==e?void 0:e.closest){var l=this.toRgb(),c=1/0,h="black";if(!o.length)for(var u in n)o[u]=new t(n[u]).toRgb();for(var d in n){var f=(i=l,s=o[d],Math.pow(i.r-s.r,2)+Math.pow(i.g-s.g,2)+Math.pow(i.b-s.b,2));f<c&&(c=f,h=d)}return h}},e.string.push([function(e){var r=e.toLowerCase(),i="transparent"===r?"#0000":n[r];return i?new t(i).toRgb():null},"name"])}]);const O=class t{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(e){if(e instanceof t)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(null===e)throw new Error("Cannot set Color#value to null");null!==this._value&&this._isSourceEqual(this._value,e)||(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return"string"==typeof t||"number"==typeof t||t instanceof Number||null===t?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):"object"==typeof t&&null!==t?{...t}:t}_isSourceEqual(t,e){const n=typeof t;if(n!==typeof e)return!1;if("number"===n||"string"===n||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length===e.length&&t.every(((t,n)=>t===e[n]));if(null!==t&&null!==e){const n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every((n=>t[n]===e[n]))}return t===e}toRgba(){const[t,e,n,r]=this._components;return{r:t,g:e,b:n,a:r}}toRgb(){const[t,e,n]=this._components;return{r:t,g:e,b:n}}toRgbaString(){const[t,e,n]=this.toUint8RgbArray();return`rgba(${t},${e},${n},${this.alpha})`}toUint8RgbArray(t){const[e,n,r]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(255*e),t[1]=Math.round(255*n),t[2]=Math.round(255*r),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);const[e,n,r,i]=this._components;return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);const[e,n,r]=this._components;return t[0]=e,t[1]=n,t[2]=r,t}toNumber(){return this._int}toBgrNumber(){const[t,e,n]=this.toUint8RgbArray();return(n<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(65280&t)+((255&t)<<16)}multiply(e){const[n,r,i,o]=t._temp.setValue(e)._components;return this._components[0]*=n,this._components[1]*=r,this._components[2]*=i,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(1===t)return(255<<24)+this._int;if(0===t)return e?0:this._int;let n=this._int>>16&255,r=this._int>>8&255,i=255&this._int;return e&&(n=n*t+.5|0,r=r*t+.5|0,i=i*t+.5|0),(255*t<<24)+(n<<16)+(r<<8)+i}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(255*this._components[3]).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this._value=null,this}_normalize(e){let n,r,i,o;if(("number"==typeof e||e instanceof Number)&&e>=0&&e<=16777215){n=(e>>16&255)/255,r=(e>>8&255)/255,i=(255&e)/255,o=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[n,r,i,o=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[n,r,i,o=255]=e,n/=255,r/=255,i/=255,o/=255;else if("string"==typeof e||"object"==typeof e){if("string"==typeof e){const n=t.HEX_PATTERN.exec(e);n&&(e=`#${n[2]}`)}const s=M(e);s.isValid()&&(({r:n,g:r,b:i,a:o}=s.rgba),n/=255,r/=255,i/=255)}if(void 0===n)throw new Error(`Unable to convert color ${e}`);this._components[0]=n,this._components[1]=r,this._components[2]=i,this._components[3]=o,this._refreshInt()}_refreshInt(){this._clamp(this._components);const[t,e,n]=this._components;this._int=(255*t<<16)+(255*e<<8)+(255*n|0)}_clamp(t,e=0,n=1){return"number"==typeof t?Math.min(Math.max(t,e),n):(t.forEach(((r,i)=>{t[i]=Math.min(Math.max(r,e),n)})),t)}static isColorLike(e){return"number"==typeof e||"string"==typeof e||e instanceof Number||e instanceof t||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||void 0!==e.r&&void 0!==e.g&&void 0!==e.b||void 0!==e.r&&void 0!==e.g&&void 0!==e.b&&void 0!==e.a||void 0!==e.h&&void 0!==e.s&&void 0!==e.l||void 0!==e.h&&void 0!==e.s&&void 0!==e.l&&void 0!==e.a||void 0!==e.h&&void 0!==e.s&&void 0!==e.v||void 0!==e.h&&void 0!==e.s&&void 0!==e.v&&void 0!==e.a}};O.shared=new O,O._temp=new O,O.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let I=O},1761:(t,e,n)=>{n.d(e,{e:()=>o});const r={createCanvas:(t,e)=>{const n=document.createElement("canvas");return n.width=t,n.height=e,n},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>(new DOMParser).parseFromString(t,"text/xml")};let i=r;const o={get:()=>i,set(t){i=t}}},8507:(t,e,n)=>{n.d(e,{Ag:()=>r,XO:()=>s});var r=(t=>(t.Application="application",t.WebGLPipes="webgl-pipes",t.WebGLPipesAdaptor="webgl-pipes-adaptor",t.WebGLSystem="webgl-system",t.WebGPUPipes="webgpu-pipes",t.WebGPUPipesAdaptor="webgpu-pipes-adaptor",t.WebGPUSystem="webgpu-system",t.CanvasSystem="canvas-system",t.CanvasPipesAdaptor="canvas-pipes-adaptor",t.CanvasPipes="canvas-pipes",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t.MaskEffect="mask-effect",t.BlendMode="blend-mode",t.TextureSource="texture-source",t.Environment="environment",t.ShapeBuilder="shape-builder",t.Batcher="batcher",t))(r||{});const i=t=>{if("function"==typeof t||"object"==typeof t&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={..."object"!=typeof t.extension?{type:t.extension}:t.extension,ref:t}}if("object"!=typeof t)throw new Error("Invalid extension type");return"string"==typeof(t={...t}).type&&(t.type=[t.type]),t},o=(t,e)=>i(t).priority??e,s={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(i).forEach((t=>{t.type.forEach((e=>this._removeHandlers[e]?.(t)))})),this},add(...t){return t.map(i).forEach((t=>{t.type.forEach((e=>{const n=this._addHandlers,r=this._queue;n[e]?n[e]?.(t):(r[e]=r[e]||[],r[e]?.push(t))}))})),this},handle(t,e,n){const r=this._addHandlers,i=this._removeHandlers;if(r[t]||i[t])throw new Error(`Extension type ${t} already has a handler`);r[t]=e,i[t]=n;const o=this._queue;return o[t]&&(o[t]?.forEach((t=>e(t))),delete o[t]),this},handleByMap(t,e){return this.handle(t,(t=>{t.name&&(e[t.name]=t.ref)}),(t=>{t.name&&delete e[t.name]}))},handleByNamedList(t,e,n=-1){return this.handle(t,(t=>{e.findIndex((e=>e.name===t.name))>=0||(e.push({name:t.name,value:t.ref}),e.sort(((t,e)=>o(e.value,n)-o(t.value,n))))}),(t=>{const n=e.findIndex((e=>e.name===t.name));-1!==n&&e.splice(n,1)}))},handleByList(t,e,n=-1){return this.handle(t,(t=>{e.includes(t.ref)||(e.push(t.ref),e.sort(((t,e)=>o(e,n)-o(t,n))))}),(t=>{const n=e.indexOf(t.ref);-1!==n&&e.splice(n,1)}))},mixin(t,...e){for(const n of e)Object.defineProperties(t.prototype,Object.getOwnPropertyDescriptors(n))}}},9049:(t,e,n)=>{n.d(e,{a:()=>r});class r{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}},9313:(t,e,n)=>{n.d(e,{u:()=>o});var r=n(1652),i=n(5101);class o{constructor(t=1,e=0,n=0,r=1,i=0,o=0){this.array=null,this.a=t,this.b=e,this.c=n,this.d=r,this.tx=i,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,n,r,i,o){return this.a=t,this.b=e,this.c=n,this.d=r,this.tx=i,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const n=e||this.array;return t?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n}apply(t,e){e=e||new i.b;const n=t.x,r=t.y;return e.x=this.a*n+this.c*r+this.tx,e.y=this.b*n+this.d*r+this.ty,e}applyInverse(t,e){e=e||new i.b;const n=this.a,r=this.b,o=this.c,s=this.d,a=this.tx,l=this.ty,c=1/(n*s+o*-r),h=t.x,u=t.y;return e.x=s*c*h+-o*c*u+(l*o-a*s)*c,e.y=n*c*u+-r*c*h+(-l*n+a*r)*c,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),r=this.a,i=this.c,o=this.tx;return this.a=r*e-this.b*n,this.b=r*n+this.b*e,this.c=i*e-this.d*n,this.d=i*n+this.d*e,this.tx=o*e-this.ty*n,this.ty=o*n+this.ty*e,this}append(t){const e=this.a,n=this.b,r=this.c,i=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*n+t.b*i,this.c=t.c*e+t.d*r,this.d=t.c*n+t.d*i,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*n+t.ty*i+this.ty,this}appendFrom(t,e){const n=t.a,r=t.b,i=t.c,o=t.d,s=t.tx,a=t.ty,l=e.a,c=e.b,h=e.c,u=e.d;return this.a=n*l+r*h,this.b=n*c+r*u,this.c=i*l+o*h,this.d=i*c+o*u,this.tx=s*l+a*h+e.tx,this.ty=s*c+a*u+e.ty,this}setTransform(t,e,n,r,i,o,s,a,l){return this.a=Math.cos(s+l)*i,this.b=Math.sin(s+l)*i,this.c=-Math.sin(s-a)*o,this.d=Math.cos(s-a)*o,this.tx=t-(n*this.a+r*this.c),this.ty=e-(n*this.b+r*this.d),this}prepend(t){const e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){const e=this.a,n=this.c;this.a=e*t.a+this.b*t.c,this.b=e*t.b+this.b*t.d,this.c=n*t.a+this.d*t.c,this.d=n*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,n=this.b,i=this.c,o=this.d,s=t.pivot,a=-Math.atan2(-i,o),l=Math.atan2(n,e),c=Math.abs(a+l);return c<1e-5||Math.abs(r.TO-c)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+n*n),t.scale.y=Math.sqrt(i*i+o*o),t.position.x=this.tx+(s.x*e+s.y*i),t.position.y=this.ty+(s.x*n+s.y*o),t}invert(){const t=this.a,e=this.b,n=this.c,r=this.d,i=this.tx,o=t*r-e*n;return this.a=r/o,this.b=-e/o,this.c=-n/o,this.d=t/o,this.tx=(n*this.ty-r*i)/o,this.ty=-(t*this.ty-e*i)/o,this}isIdentity(){return 1===this.a&&0===this.b&&0===this.c&&1===this.d&&0===this.tx&&0===this.ty}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new o;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return a.identity()}static get shared(){return s.identity()}}const s=new o,a=new o},2079:(t,e,n)=>{n.d(e,{E:()=>u});var r=n(9313);const i=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],o=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],s=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],a=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],l=[],c=[],h=Math.sign;!function(){for(let t=0;t<16;t++){const e=[];l.push(e);for(let n=0;n<16;n++){const r=h(i[t]*i[n]+s[t]*o[n]),l=h(o[t]*i[n]+a[t]*o[n]),c=h(i[t]*s[n]+s[t]*a[n]),u=h(o[t]*s[n]+a[t]*a[n]);for(let t=0;t<16;t++)if(i[t]===r&&o[t]===l&&s[t]===c&&a[t]===u){e.push(t);break}}}for(let t=0;t<16;t++){const e=new r.u;e.set(i[t],o[t],s[t],a[t],0,0),c.push(e)}}();const u={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:t=>i[t],uY:t=>o[t],vX:t=>s[t],vY:t=>a[t],inv:t=>8&t?15&t:7&-t,add:(t,e)=>l[t][e],sub:(t,e)=>l[t][u.inv(e)],rotate180:t=>4^t,isVertical:t=>2==(3&t),byDirection:(t,e)=>2*Math.abs(t)<=Math.abs(e)?e>=0?u.S:u.N:2*Math.abs(e)<=Math.abs(t)?t>0?u.E:u.W:e>0?t>0?u.SE:u.SW:t>0?u.NE:u.NW,matrixAppendRotationInv:(t,e,n=0,r=0,i=0,o=0)=>{const s=c[u.inv(e)],a=s.a,l=s.b,h=s.c,d=s.d,f=n-Math.min(0,a*i,h*o,a*i+h*o),p=r-Math.min(0,l*i,d*o,l*i+d*o),m=t.a,y=t.b,g=t.c,v=t.d;t.a=a*m+l*g,t.b=a*y+l*v,t.c=h*m+d*g,t.d=h*y+d*v,t.tx=f*m+p*g+t.tx,t.ty=f*y+p*v+t.ty},transformRectCoords:(t,e,n,r)=>{const{x:i,y:o,width:s,height:a}=t,{x:l,y:c,width:h,height:d}=e;return n===u.E?(r.set(i+l,o+c,s,a),r):n===u.S?r.set(h-o-a+l,i+c,a,s):n===u.W?r.set(h-i-s+l,d-o-a+c,s,a):n===u.N?r.set(o+l,d-i-s+c,a,s):r.set(i+l,o+c,s,a)}}},1652:(t,e,n)=>{n.d(e,{TO:()=>r,Td:()=>o,bO:()=>i});const r=2*Math.PI,i=180/Math.PI,o=Math.PI/180},9939:(t,e,n)=>{function r(t){return t+=0===t?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function i(t){return!(t&t-1||!t)}n.d(e,{U5:()=>r,f3:()=>i})},2812:(t,e,n)=>{n.d(e,{o:()=>r});class r{constructor(t,e,n){this._x=e||0,this._y=n||0,this._observer=t}clone(t){return new r(t??this._observer,this._x,this._y)}set(t=0,e=t){return this._x===t&&this._y===e||(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}},5101:(t,e,n)=>{n.d(e,{b:()=>r});class r{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new r(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return i.x=0,i.y=0,i}}const i=new r},6125:(t,e,n)=>{n.d(e,{j:()=>i});var r=n(9252);class i{constructor(t=0,e=0,n=0){this.type="circle",this.x=t,this.y=e,this.radius=n}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const n=this.radius*this.radius;let r=this.x-t,i=this.y-e;return r*=r,i*=i,r+i<=n}strokeContains(t,e,n,r=.5){if(0===this.radius)return!1;const i=this.x-t,o=this.y-e,s=this.radius,a=(1-r)*n,l=Math.sqrt(i*i+o*o);return l<=s+a&&l>s-(n-a)}getBounds(t){return t||(t=new r.M),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=2*this.radius,t.height=2*this.radius,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}},9252:(t,e,n)=>{n.d(e,{M:()=>o});var r=n(5101);const i=[new r.b,new r.b,new r.b,new r.b];class o{constructor(t=0,e=0,n=0,r=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(n),this.height=Number(r)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new o(0,0,0,0)}clone(){return new o(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height)}strokeContains(t,e,n,r=.5){const{width:i,height:o}=this;if(i<=0||o<=0)return!1;const s=this.x,a=this.y,l=n*(1-r),c=n-l;return t>=s-l&&t<=s+i+l&&e>=a-l&&e<=a+o+l&&!(t>s+c&&t<s+i-c&&e>a+c&&e<a+o-c)}intersects(t,e){if(!e){const e=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=e)return!1;const n=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>n}const n=this.left,r=this.right,o=this.top,s=this.bottom;if(r<=n||s<=o)return!1;const a=i[0].set(t.left,t.top),l=i[1].set(t.left,t.bottom),c=i[2].set(t.right,t.top),h=i[3].set(t.right,t.bottom);if(c.x<=a.x||l.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(0===u)return!1;if(e.apply(a,a),e.apply(l,l),e.apply(c,c),e.apply(h,h),Math.max(a.x,l.x,c.x,h.x)<=n||Math.min(a.x,l.x,c.x,h.x)>=r||Math.max(a.y,l.y,c.y,h.y)<=o||Math.min(a.y,l.y,c.y,h.y)>=s)return!1;const d=u*(l.y-a.y),f=u*(a.x-l.x),p=d*n+f*o,m=d*r+f*o,y=d*n+f*s,g=d*r+f*s;if(Math.max(p,m,y,g)<=d*a.x+f*a.y||Math.min(p,m,y,g)>=d*h.x+f*h.y)return!1;const v=u*(a.y-c.y),b=u*(c.x-a.x),x=v*n+b*o,_=v*r+b*o,w=v*n+b*s,S=v*r+b*s;return!(Math.max(x,_,w,S)<=v*a.x+b*a.y||Math.min(x,_,w,S)>=v*h.x+b*h.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this}fit(t){const e=Math.max(this.x,t.x),n=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),i=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(n-e,0),this.y=r,this.height=Math.max(i-r,0),this}ceil(t=1,e=.001){const n=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=n-this.x,this.height=r-this.y,this}scale(t,e=t){return this.x*=t,this.y*=e,this.width*=t,this.height*=e,this}enlarge(t){const e=Math.min(this.x,t.x),n=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),i=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=n-e,this.y=r,this.height=i-r,this}getBounds(t){return t||(t=new o),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;const e=t.x,n=t.y,r=t.x+t.width,i=t.y+t.height;return e>=this.x&&e<this.x+this.width&&n>=this.y&&n<this.y+this.height&&r>=this.x&&r<this.x+this.width&&i>=this.y&&i<this.y+this.height}set(t,e,n,r){return this.x=t,this.y=e,this.width=n,this.height=r,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}},6512:(t,e,n)=>{n.d(e,{u:()=>o});const r=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function i(t){let e="";for(let n=0;n<t;++n)n>0&&(e+="\nelse "),n<t-1&&(e+=`if(test == ${n}.0){}`);return e}function o(t,e){if(0===t)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const n=e.createShader(e.FRAGMENT_SHADER);try{for(;;){const o=r.replace(/%forloop%/gi,i(t));if(e.shaderSource(n,o),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS))break;t=t/2|0}}finally{e.deleteShader(n)}return t}},341:(t,e,n)=>{n.d(e,{w:()=>s});var r=n(3513),i=n(5589);const o={};function s(t,e,n){let s=2166136261;for(let n=0;n<e;n++)s^=t[n].uid,s=Math.imul(s,16777619),s>>>=0;return o[s]||function(t,e,n,s){const a={};let l=0;for(let n=0;n<s;n++){const r=n<e?t[n]:i.g.EMPTY.source;a[l++]=r.source,a[l++]=r.style}const c=new r.T(a);return o[n]=c,c}(t,e,s,n)}},2043:(t,e,n)=>{n.d(e,{J:()=>F});var r=n(8507),i=n(133);class o{constructor(t){"number"==typeof t?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this.uint32View=null,this.float32View=null,this.uint16View=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._int32View=null,this._float64Array=null,this._bigUint64Array=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}var s=n(4670),a=n(6083),l=n(6736),c=n(1957);function h(t,e){return"no-premultiply-alpha"===e.alphaMode&&c.Q[t]||t}var u=n(3804),d=n(6512);let f=null;class p{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){const e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}class m{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new p,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null,this.elements=null}}const y=[];let g=0;function v(){return g>0?y[--g]:new m}function b(t){t.elements=null,y[g++]=t}a.L.register({clear:()=>{if(y.length>0)for(const t of y)t&&t.destroy();y.length=0,g=0}});let x=0;const _=class t{constructor(e){this.uid=(0,i.L)("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],(e={...t.defaultOptions,...e}).maxTextures||((0,s.t6)("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=function(){if(f)return f;const t=(0,u.W)();return f=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),f=(0,d.u)(f,t),t.getExtension("WEBGL_lose_context")?.loseContext(),f}());const{maxTextures:n,attributesInitialSize:r,indicesInitialSize:a}=e;this.attributeBuffer=new o(4*r),this.indexBuffer=new Uint16Array(a),this.maxTextures=n}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)b(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){const n=t._batch.textures.ids[e._source.uid];return!(!n&&0!==n)&&(t._textureId=n,t.texture=e,!0)}updateElement(t){this.dirty=!0;const e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){const e=this._elements;if(!e[this.elementStart])return;let n=v(),r=n.textures;r.clear();const i=e[this.elementStart];let o=h(i.blendMode,i.texture._source),s=i.topology;4*this.attributeSize>this.attributeBuffer.size&&this._resizeAttributeBuffer(4*this.attributeSize),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const a=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,c=this.indexBuffer;let u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",p=[];const m=this.maxTextures;for(let i=this.elementStart;i<this.elementSize;++i){const y=e[i];e[i]=null;const g=y.texture._source,b=h(y.blendMode,g),_=o!==b||s!==y.topology;g._batchTick!==x||_?(g._batchTick=x,(r.count>=m||_)&&(this._finishBatch(n,d,u-d,r,o,s,t,f,p),f="renderBatch",d=u,o=b,s=y.topology,n=v(),r=n.textures,r.clear(),p=[],++x),y._textureId=g._textureBindLocation=r.count,r.ids[g.uid]=r.count,r.textures[r.count++]=g,y._batch=n,p.push(y),u+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,a,l,y._attributeStart,y._textureId),this.packQuadIndex(c,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,a,l,y._attributeStart,y._textureId),this.packIndex(y,c,y._indexStart,y._attributeStart/this.vertexSize))):(y._textureId=g._textureBindLocation,u+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,a,l,y._attributeStart,y._textureId),this.packQuadIndex(c,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,a,l,y._attributeStart,y._textureId),this.packIndex(y,c,y._indexStart,y._attributeStart/this.vertexSize)),y._batch=n,p.push(y))}r.count>0&&(this._finishBatch(n,d,u-d,r,o,s,t,f,p),d=u,++x),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,n,r,i,o,s,a,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=a,t.batcher=this,t.textures=r,t.blendMode=i,t.topology=o,t.start=e,t.size=n,t.elements=l,++x,this.batches[this.batchIndex++]=t,s.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){4*t<=this.attributeBuffer.size||this._resizeAttributeBuffer(4*t)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,2*this.attributeBuffer.size),n=new o(e);(0,l.W)(this.attributeBuffer.rawBinaryData,n.rawBinaryData),this.attributeBuffer=n}_resizeIndexBuffer(t){const e=this.indexBuffer;let n=Math.max(t,1.5*e.length);n+=n%2;const r=n>65535?new Uint32Array(n):new Uint16Array(n);if(r.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let t=0;t<e.length;t++)r[t]=e[t];else(0,l.W)(e.buffer,r.buffer);this.indexBuffer=r}packQuadIndex(t,e,n){t[e]=n+0,t[e+1]=n+1,t[e+2]=n+2,t[e+3]=n+0,t[e+4]=n+2,t[e+5]=n+3}packIndex(t,e,n,r){const i=t.indices,o=t.indexSize,s=t.indexOffset,a=t.attributeOffset;for(let t=0;t<o;t++)e[n++]=r+i[t+s]-a}destroy(t={}){if(null!==this.batches){for(let t=0;t<this.batchIndex;t++)b(this.batches[t]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,t.shader&&(this.shader?.destroy(),this.shader=null);for(let t=0;t<this._elements.length;t++)this._elements[t]&&(this._elements[t]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};_.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let w=_;var S=n(949),C=n(1132),E=n(6011);const k=new Float32Array(1),T=new Uint32Array(1);class A extends E.V{constructor(){const t=new S.h({data:k,label:"attribute-batch-buffer",usage:C.S.VERTEX|C.S.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:24,offset:0},aUV:{buffer:t,format:"float32x2",stride:24,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:24,offset:16},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:24,offset:20}},indexBuffer:new S.h({data:T,label:"index-batch-buffer",usage:C.S.INDEX|C.S.COPY_DST,shrinkToFit:!1})})}}var M=n(5611),P=n(4459),O=n(4e3),I=n(6665),L=n(6040),j=n(8475);class R extends j.M{constructor(t){super({glProgram:(0,M.I)({name:"batch",bits:[P.a,(0,O.P)(t),I.m]}),gpuProgram:(0,M.v)({name:"batch",bits:[P.F,(0,O._)(t),I.b]}),resources:{batchSamplers:(0,L.n)(t)}}),this.maxTextures=t}}let D=null;const N=class t extends w{constructor(e){super(e),this.geometry=new A,this.name=t.extension.name,this.vertexSize=6,D??(D=new R(e.maxTextures)),this.shader=D}packAttributes(t,e,n,r,i){const o=i<<16|65535&t.roundPixels,s=t.transform,a=s.a,l=s.b,c=s.c,h=s.d,u=s.tx,d=s.ty,{positions:f,uvs:p}=t,m=t.color,y=t.attributeOffset,g=y+t.attributeSize;for(let t=y;t<g;t++){const i=2*t,s=f[i],y=f[i+1];e[r++]=a*s+c*y+u,e[r++]=h*y+l*s+d,e[r++]=p[i],e[r++]=p[i+1],n[r++]=m,n[r++]=o}}packQuadAttributes(t,e,n,r,i){const o=t.texture,s=t.transform,a=s.a,l=s.b,c=s.c,h=s.d,u=s.tx,d=s.ty,f=t.bounds,p=f.maxX,m=f.minX,y=f.maxY,g=f.minY,v=o.uvs,b=t.color,x=i<<16|65535&t.roundPixels;e[r+0]=a*m+c*g+u,e[r+1]=h*g+l*m+d,e[r+2]=v.x0,e[r+3]=v.y0,n[r+4]=b,n[r+5]=x,e[r+6]=a*p+c*g+u,e[r+7]=h*g+l*p+d,e[r+8]=v.x1,e[r+9]=v.y1,n[r+10]=b,n[r+11]=x,e[r+12]=a*p+c*y+u,e[r+13]=h*y+l*p+d,e[r+14]=v.x2,e[r+15]=v.y2,n[r+16]=b,n[r+17]=x,e[r+18]=a*m+c*y+u,e[r+19]=h*y+l*m+d,e[r+20]=v.x3,e[r+21]=v.y3,n[r+22]=b,n[r+23]=x}_updateMaxTextures(t){this.shader.maxTextures!==t&&(D=new R(t),this.shader=D)}destroy(){this.shader=null,super.destroy()}};N.extension={type:[r.Ag.Batcher],name:"default"};let F=N},5611:(t,e,n)=>{n.d(e,{I:()=>T,v:()=>k});var r=n(9113),i=n(3012),o=n(268);function s(t,e,n){if(t)for(const r in t){const i=e[r.toLocaleLowerCase()];if(i){let e=t[r];"header"===r&&(e=e.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),n&&i.push(`//----${n}----//`),i.push(e)}else(0,o.R)(`${r} placement hook does not exist in shader`)}}const a=/\{\{(.*?)\}\}/g;function l(t){const e={};return(t.match(a)?.map((t=>t.replace(/[{()}]/g,"")))??[]).forEach((t=>{e[t]=[]})),e}function c(t,e){let n;const r=/@in\s+([^;]+);/g;for(;null!==(n=r.exec(t));)e.push(n[1])}function h(t,e,n=!1){const r=[];c(e,r),t.forEach((t=>{t.header&&c(t.header,r)}));const i=r;n&&i.sort();const o=i.map(((t,e)=>` @location(${e}) ${t},`)).join("\n");let s=e.replace(/@in\s+[^;]+;\s*/g,"");return s=s.replace("{{in}}",`\n${o}\n`),s}function u(t,e){let n;const r=/@out\s+([^;]+);/g;for(;null!==(n=r.exec(t));)e.push(n[1])}function d(t,e){let n=t;for(const t in e){const r=e[t];n=r.join("\n").length?n.replace(`{{${t}}}`,`//-----${t} START-----//\n${r.join("\n")}\n//----${t} FINISH----//`):n.replace(`{{${t}}}`,"")}return n}const f=Object.create(null),p=new Map;let m=0;function y({template:t,bits:e}){const n=v(t,e);if(f[n])return f[n];const{vertex:r,fragment:i}=function(t,e){const n=e.map((t=>t.vertex)).filter((t=>!!t)),r=e.map((t=>t.fragment)).filter((t=>!!t));let i=h(n,t.vertex,!0);i=function(t,e){const n=[];u(e,n),t.forEach((t=>{t.header&&u(t.header,n)}));let r=0;const i=n.sort().map((t=>t.indexOf("builtin")>-1?t:`@location(${r++}) ${t}`)).join(",\n"),o=n.sort().map((t=>{return` var ${e=t,e.replace(/@.*?\s+/g,"")};`;var e})).join("\n"),s=`return VSOutput(\n ${n.sort().map((t=>` ${function(t){const e=/\b(\w+)\s*:/g.exec(t);return e?e[1]:""}(t)}`)).join(",\n")});`;let a=e.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`\n${i}\n`),a=a.replace("{{start}}",`\n${o}\n`),a=a.replace("{{return}}",`\n${s}\n`),a}(n,i);const o=h(r,t.fragment,!0);return{vertex:i,fragment:o}}(t,e);return f[n]=b(r,i,e),f[n]}function g({template:t,bits:e}){const n=v(t,e);return f[n]||(f[n]=b(t.vertex,t.fragment,e)),f[n]}function v(t,e){return e.map((t=>(p.has(t)||p.set(t,m++),p.get(t)))).sort(((t,e)=>t-e)).join("-")+t.vertex+t.fragment}function b(t,e,n){const r=l(t),i=l(e);return n.forEach((t=>{s(t.vertex,r,t.name),s(t.fragment,i,t.name)})),{vertex:d(t,r),fragment:d(e,i)}}const x="\n @in aPosition: vec2<f32>;\n @in aUV: vec2<f32>;\n\n @out @builtin(position) vPosition: vec4<f32>;\n @out vUV : vec2<f32>;\n @out vColor : vec4<f32>;\n\n {{header}}\n\n struct VSOutput {\n {{struct}}\n };\n\n @vertex\n fn main( {{in}} ) -> VSOutput {\n\n var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;\n var modelMatrix = mat3x3<f32>(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0\n );\n var position = aPosition;\n var uv = aUV;\n\n {{start}}\n\n vColor = vec4<f32>(1., 1., 1., 1.);\n\n {{main}}\n\n vUV = uv;\n\n var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;\n\n vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);\n\n vColor *= globalUniforms.uWorldColorAlpha;\n\n {{end}}\n\n {{return}}\n };\n",_="\n @in vUV : vec2<f32>;\n @in vColor : vec4<f32>;\n\n {{header}}\n\n @fragment\n fn main(\n {{in}}\n ) -> @location(0) vec4<f32> {\n\n {{start}}\n\n var outColor:vec4<f32>;\n\n {{main}}\n\n var finalColor:vec4<f32> = outColor * vColor;\n\n {{end}}\n\n return finalColor;\n };\n",w="\n in vec2 aPosition;\n in vec2 aUV;\n\n out vec4 vColor;\n out vec2 vUV;\n\n {{header}}\n\n void main(void){\n\n mat3 worldTransformMatrix = uWorldTransformMatrix;\n mat3 modelMatrix = mat3(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0\n );\n vec2 position = aPosition;\n vec2 uv = aUV;\n\n {{start}}\n\n vColor = vec4(1.);\n\n {{main}}\n\n vUV = uv;\n\n mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;\n\n gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n\n vColor *= uWorldColorAlpha;\n\n {{end}}\n }\n",S="\n\n in vec4 vColor;\n in vec2 vUV;\n\n out vec4 finalColor;\n\n {{header}}\n\n void main(void) {\n\n {{start}}\n\n vec4 outColor;\n\n {{main}}\n\n finalColor = outColor * vColor;\n\n {{end}}\n }\n",C={name:"global-uniforms-bit",vertex:{header:"\n struct GlobalUniforms {\n uProjectionMatrix:mat3x3<f32>,\n uWorldTransformMatrix:mat3x3<f32>,\n uWorldColorAlpha: vec4<f32>,\n uResolution: vec2<f32>,\n }\n\n @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;\n "}},E={name:"global-uniforms-bit",vertex:{header:"\n uniform mat3 uProjectionMatrix;\n uniform mat3 uWorldTransformMatrix;\n uniform vec4 uWorldColorAlpha;\n uniform vec2 uResolution;\n "}};function k({bits:t,name:e}){const n=y({template:{fragment:_,vertex:x},bits:[C,...t]});return i.B.from({name:e,vertex:{source:n.vertex,entryPoint:"main"},fragment:{source:n.fragment,entryPoint:"main"}})}function T({bits:t,name:e}){return new r.M({name:e,...g({template:{vertex:w,fragment:S},bits:[E,...t]})})}},4459:(t,e,n)=>{n.d(e,{F:()=>r,a:()=>i});const r={name:"color-bit",vertex:{header:"\n @in aColor: vec4<f32>;\n ",main:"\n vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);\n "}},i={name:"color-bit",vertex:{header:"\n in vec4 aColor;\n ",main:"\n vColor *= vec4(aColor.rgb * aColor.a, aColor.a);\n "}}},4e3:(t,e,n)=>{n.d(e,{P:()=>c,_:()=>s});const r={};function i(t){const e=[];if(1===t)e.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let n=0;for(let r=0;r<t;r++)e.push(`@group(1) @binding(${n++}) var textureSource${r+1}: texture_2d<f32>;`),e.push(`@group(1) @binding(${n++}) var textureSampler${r+1}: sampler;`)}return e.join("\n")}function o(t){const e=[];if(1===t)e.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{e.push("switch vTextureId {");for(let n=0;n<t;n++)n===t-1?e.push(" default:{"):e.push(` case ${n}:{`),e.push(` outColor = textureSampleGrad(textureSource${n+1}, textureSampler${n+1}, vUV, uvDx, uvDy);`),e.push(" break;}");e.push("}")}return e.join("\n")}function s(t){return r[t]||(r[t]={name:"texture-batch-bit",vertex:{header:"\n @in aTextureIdAndRound: vec2<u32>;\n @out @interpolate(flat) vTextureId : u32;\n ",main:"\n vTextureId = aTextureIdAndRound.y;\n ",end:"\n if(aTextureIdAndRound.x == 1)\n {\n vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);\n }\n "},fragment:{header:`\n @in @interpolate(flat) vTextureId: u32;\n\n ${i(t)}\n `,main:`\n var uvDx = dpdx(vUV);\n var uvDy = dpdy(vUV);\n\n ${o(t)}\n `}}),r[t]}const a={};function l(t){const e=[];for(let n=0;n<t;n++)n>0&&e.push("else"),n<t-1&&e.push(`if(vTextureId < ${n}.5)`),e.push("{"),e.push(`\toutColor = texture(uTextures[${n}], vUV);`),e.push("}");return e.join("\n")}function c(t){return a[t]||(a[t]={name:"texture-batch-bit",vertex:{header:"\n in vec2 aTextureIdAndRound;\n out float vTextureId;\n\n ",main:"\n vTextureId = aTextureIdAndRound.y;\n ",end:"\n if(aTextureIdAndRound.x == 1.)\n {\n gl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n }\n "},fragment:{header:`\n in float vTextureId;\n\n uniform sampler2D uTextures[${t}];\n\n `,main:`\n\n ${l(t)}\n `}}),a[t]}},6665:(t,e,n)=>{n.d(e,{b:()=>r,m:()=>i});const r={name:"round-pixels-bit",vertex:{header:"\n fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>\n {\n return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n }\n "}},i={name:"round-pixels-bit",vertex:{header:"\n vec2 roundPixels(vec2 position, vec2 targetSize)\n {\n return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n }\n "}}},5753:(t,e,n)=>{var r=n(8507),i=n(6844),o=n(9636),s=n(9443);const a=new o.c;function l(t,e,n){const r=a;t.measurable=!0,(0,s.f)(t,n,r),e.addBoundsMask(r),t.measurable=!1}var c=n(7269),h=n(2208),u=n(268);function d(t,e,n){const r=h.o.get();t.measurable=!0;const i=h.u.get().identity(),o=f(t,n,i);(0,c.n)(t,r,o),t.measurable=!1,e.addBoundsMask(r),h.u.return(i),h.o.return(r)}function f(t,e,n){return t?(t!==e&&(f(t.parent,e,n),t.updateLocalTransform(),n.append(t.localTransform)),n):((0,u.R)("Mask bounds, renderable is not inside the root container"),n)}class p{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof i.k),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){null!==this.mask&&(this.mask.measurable=!0,this.mask=null)}addBounds(t,e){this.inverse||l(this.mask,t,e)}addLocalBounds(t,e){d(this.mask,t,e)}containsPoint(t,e){return e(this.mask,t)}destroy(){this.reset()}static test(t){return t instanceof i.k}}p.extension=r.Ag.MaskEffect;class m{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return"number"==typeof t}}m.extension=r.Ag.MaskEffect;var y=n(5559);class g{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){null!==this.mask&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(t,e){l(this.mask,t,e)}addLocalBounds(t,e){d(this.mask,t,e)}containsPoint(t,e){return e(this.mask,t)}destroy(){this.reset()}static test(t){return t instanceof y.mc}}g.extension=r.Ag.MaskEffect;var v=n(4195),b=n(4884),x=n(8293),_=n(7309),w=n(1761);let S;var C=n(583);const E=class t extends C.v{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...t.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=!1!==e.autoPlay,this.alphaMode=e.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),!1!==e.autoLoad&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=_.R.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await async function(){return S??(S=(async()=>{const t=w.e.get().createCanvas(1,1).getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise((t=>{const e=document.createElement("video");e.onloadeddata=()=>t(e),e.onerror=()=>t(null),e.autoplay=!1,e.crossOrigin="anonymous",e.preload="auto",e.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",e.load()}));if(!e)return"premultiply-alpha-on-upload";const n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const i=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,i),t.deleteFramebuffer(r),t.deleteTexture(n),t.getExtension("WEBGL_lose_context")?.loseContext(),i[0]<=i[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),S}(),this._load=new Promise(((n,r)=>{this.isValid?n(this):(this._resolve=n,this._reject=r,void 0!==e.preloadTimeoutMs&&(this._preloadTimeout=setTimeout((()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))}))),t.load())})),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(_.R.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),null===this._videoFrameRequestCallbackHandle&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(null!==this._videoFrameRequestCallbackHandle&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(_.R.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(null!==this._videoFrameRequestCallbackHandle&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(_.R.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};E.extension=r.Ag.TextureSource,E.defaultOptions={...C.v.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},E.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let k=E;n(9726);r.XO.add(p,m,g,k,x.b,b.q,v.P)},1257:(t,e,n)=>{n.d(e,{u:()=>r});var r=(t=>(t[t.NONE=0]="NONE",t[t.COLOR=16384]="COLOR",t[t.STENCIL=1024]="STENCIL",t[t.DEPTH=256]="DEPTH",t[t.COLOR_DEPTH=16640]="COLOR_DEPTH",t[t.COLOR_STENCIL=17408]="COLOR_STENCIL",t[t.DEPTH_STENCIL=1280]="DEPTH_STENCIL",t[t.ALL=17664]="ALL",t))(r||{})},9113:(t,e,n)=>{n.d(e,{M:()=>d});var r=n(7952),i=n(3804);let o;function s(){if(!o){o="mediump";const t=(0,i.W)();if(t&&t.getShaderPrecisionFormat){const e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);o=e.precision?"highp":"mediump"}}return o}const a={},l={};const c={stripVersion:function(t,e){return e?t.replace("#version 300 es",""):t},ensurePrecision:function(t,e,n){const r=n?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if("precision"!==t.substring(0,9)){let i=n?e.requestedFragmentPrecision:e.requestedVertexPrecision;return"highp"===i&&"highp"!==r&&(i="mediump"),`precision ${i} float;\n${t}`}return"highp"!==r&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t},addProgramDefines:function(t,e,n){return e?t:n?`\n\n #ifdef GL_ES // This checks if it is WebGL1\n #define in varying\n #define finalColor gl_FragColor\n #define texture texture2D\n #endif\n ${t=t.replace("out vec4 finalColor;","")}\n `:`\n\n #ifdef GL_ES // This checks if it is WebGL1\n #define in attribute\n #define out varying\n #endif\n ${t}\n `},setProgramName:function(t,{name:e="pixi-program"},n=!0){e=e.replace(/\s+/g,"-");const r=n?a:l;return r[e+=n?"-fragment":"-vertex"]?(r[e]++,e+=`-${r[e]}`):r[e]=1,-1!==t.indexOf("#define SHADER_NAME")?t:`${`#define SHADER_NAME ${e}`}\n${t}`},insertVersion:function(t,e){return e?`#version 300 es\n${t}`:t}},h=Object.create(null),u=class t{constructor(e){const n=-1!==(e={...t.defaultOptions,...e}).fragment.indexOf("#version 300 es"),i={stripVersion:n,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:s()},setProgramName:{name:e.name},addProgramDefines:n,insertVersion:n};let o=e.fragment,a=e.vertex;Object.keys(c).forEach((t=>{const e=i[t];o=c[t](o,e,!0),a=c[t](a,e,!1)})),this.fragment=o,this.vertex=a,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=(0,r.X)(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null,h[this._cacheKey]=null}static from(e){const n=`${e.vertex}:${e.fragment}`;return h[n]||(h[n]=new t(e),h[n]._cacheKey=n),h[n]}};u.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let d=u},6040:(t,e,n)=>{n.d(e,{n:()=>o});var r=n(5811);const i={};function o(t){let e=i[t];if(e)return e;const n=new Int32Array(t);for(let e=0;e<t;e++)n[e]=e;return e=i[t]=new r.k({uTextures:{value:n,type:"i32",size:t}},{isStatic:!0}),e}},3804:(t,e,n)=>{n.d(e,{W:()=>o});var r=n(1761);let i;function o(){if(!i||i?.isContextLost()){const t=r.e.get().createCanvas();i=t.getContext("webgl",{})}return i}},3513:(t,e,n)=>{n.d(e,{T:()=>r});class r{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const n in t){const r=t[n];this.setResource(r,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const n in this.resources)t[e++]=this.resources[n]._resourceId;this._key=t.join("|")}setResource(t,e){const n=this.resources[e];t!==n&&(n?.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t,e){const n=this.resources;for(const r in n)n[r]._gcLastUsed=t,n[r]._touched=e}destroy(){const t=this.resources;for(const e in t){const n=t[e];n?.off?.("change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){this._dirty=!0,t.destroyed?this.destroy():this._updateKey()}}},3012:(t,e,n)=>{n.d(e,{B:()=>u});var r=n(7952),i=n(8306);const o={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"},s=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function a(t,e){let n;for(;null!==(n=s.exec(t));){const t=o[n[3]]??"float32";e[n[2]]={location:parseInt(n[1],10),format:t,stride:(0,i.m)(t).stride,offset:0,instance:!1,start:0}}s.lastIndex=0}function l(t){const e=/@group\((\d+)\)/,n=/@binding\((\d+)\)/,r=/var(<[^>]+>)? (\w+)/,i=/:\s*([\w<>]+)/,o=/(\w+)\s*:\s*([\w\<\>]+)/g,s=/struct\s+(\w+)/,a=t.match(/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g)?.map((t=>({group:parseInt(t.match(e)[1],10),binding:parseInt(t.match(n)[1],10),name:t.match(r)[2],isUniform:"<uniform>"===t.match(r)[1],type:t.match(i)[1]})));if(!a)return{groups:[],structs:[]};const l=t.match(/struct\s+(\w+)\s*{([^}]+)}/g)?.map((t=>{const e=t.match(s)[1],n=t.match(o).reduce(((t,e)=>{const[n,r]=e.split(":");return t[n.trim()]=r.trim(),t}),{});return n?{name:e,members:n}:null})).filter((({name:t})=>a.some((e=>e.type===t||e.type.includes(`<${t}>`)))))??[];return{groups:a,structs:l}}var c=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(c||{});const h=Object.create(null);class u{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:e,vertex:n,layout:r,gpuLayout:i,name:o}=t;if(this.name=o,this.fragment=e,this.vertex=n,e.source===n.source){const t=l(e.source);this.structsAndGroups=t}else{const t=l(n.source),r=l(e.source);this.structsAndGroups=function(t,e){const n=new Set,r=new Set;return{structs:[...t.structs,...e.structs].filter((t=>!n.has(t.name)&&(n.add(t.name),!0))),groups:[...t.groups,...e.groups].filter((t=>{const e=`${t.name}-${t.binding}`;return!r.has(e)&&(r.add(e),!0)}))}}(t,r)}this.layout=r??function({groups:t}){const e=[];for(let n=0;n<t.length;n++){const r=t[n];e[r.group]||(e[r.group]={}),e[r.group][r.name]=r.binding}return e}(this.structsAndGroups),this.gpuLayout=i??function({groups:t}){const e=[];for(let n=0;n<t.length;n++){const r=t[n];e[r.group]||(e[r.group]=[]),r.isUniform?e[r.group].push({binding:r.binding,visibility:c.VERTEX|c.FRAGMENT,buffer:{type:"uniform"}}):"sampler"===r.type?e[r.group].push({binding:r.binding,visibility:c.FRAGMENT,sampler:{type:"filtering"}}):"texture_2d"===r.type||r.type.startsWith("texture_2d<")?e[r.group].push({binding:r.binding,visibility:c.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):"texture_2d_array"===r.type||r.type.startsWith("texture_2d_array<")?e[r.group].push({binding:r.binding,visibility:c.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):("texture_cube"===r.type||r.type.startsWith("texture_cube<"))&&e[r.group].push({binding:r.binding,visibility:c.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let t=0;t<e.length;t++)e[t]||(e[t]=[]);return e}(this.structsAndGroups),this.autoAssignGlobalUniforms=!(void 0===this.layout[0]?.globalUniforms),this.autoAssignLocalUniforms=!(void 0===this.layout[1]?.localUniforms),this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,n=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=(0,r.X)(n,"program")}get attributeData(){return this._attributeData??(this._attributeData=function({source:t,entryPoint:e}){const n={},r=function(t){return t.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}(t),i=r.indexOf(`fn ${e}(`);if(-1===i)return n;const o=r.indexOf("->",i);if(-1===o)return n;const s=r.substring(i,o);if(a(s,n),0===Object.keys(n).length){const t=s.match(/\(\s*\w+\s*:\s*(\w+)/);if(t){const e=t[1],i=new RegExp(`struct\\s+${e}\\s*\\{([^}]+)\\}`,"s"),o=r.match(i);o&&a(o[1],n)}}return n}(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,h[this._cacheKey]=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return h[e]||(h[e]=new u(t),h[e]._cacheKey=e),h[e]}}},949:(t,e,n)=>{n.d(e,{h:()=>s});var r=n(8875),i=n(133),o=n(1132);class s extends r.A{constructor(t){let{data:e,size:n}=t;const{usage:r,label:o,shrinkToFit:s}=t;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=(0,i.L)("buffer"),this._resourceType="buffer",this._resourceId=(0,i.L)("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,n??(n=e?.byteLength);const a=!!e;this.descriptor={size:n,usage:r,mappedAtCreation:a,label:o},this.shrinkToFit=s??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&o.S.STATIC)}set static(t){t?this.descriptor.usage|=o.S.STATIC:this.descriptor.usage&=~o.S.STATIC}setDataWithSize(t,e,n){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t)return void(n&&this.emit("update",this));const r=this._data;this._data=t,this._dataInt32=null,r&&r.length===t.length||!this.shrinkToFit&&r&&t.byteLength<r.byteLength?n&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=(0,i.L)("resource"),this.emit("change",this))}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}},1132:(t,e,n)=>{n.d(e,{S:()=>r});var r=(t=>(t[t.MAP_READ=1]="MAP_READ",t[t.MAP_WRITE=2]="MAP_WRITE",t[t.COPY_SRC=4]="COPY_SRC",t[t.COPY_DST=8]="COPY_DST",t[t.INDEX=16]="INDEX",t[t.VERTEX=32]="VERTEX",t[t.UNIFORM=64]="UNIFORM",t[t.STORAGE=128]="STORAGE",t[t.INDIRECT=256]="INDIRECT",t[t.QUERY_RESOLVE=512]="QUERY_RESOLVE",t[t.STATIC=1024]="STATIC",t))(r||{})},6736:(t,e,n)=>{function r(t,e,n,r){if(n??(n=0),r??(r=Math.min(t.byteLength-n,e.byteLength)),7&n||7&r)if(3&n||3&r)new Uint8Array(e).set(new Uint8Array(t,n,r));else{const i=r/4;new Float32Array(e,0,i).set(new Float32Array(t,n,i))}else{const i=r/8;new Float64Array(e,0,i).set(new Float64Array(t,n,i))}}n.d(e,{W:()=>r})},6011:(t,e,n)=>{n.d(e,{V:()=>c});var r=n(8875),i=n(9636),o=n(133),s=n(949),a=n(1132);function l(t,e){if(!(t instanceof s.h)){let n=e?a.S.INDEX:a.S.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),n=a.S.INDEX|a.S.COPY_DST):(t=new Float32Array(t),n=a.S.VERTEX|a.S.COPY_DST)),t=new s.h({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:n})}return t}class c extends r.A{constructor(t={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=(0,o.L)("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new i.c,this._boundsDirty=!0;const{attributes:e,indexBuffer:n,topology:r}=t;if(this.buffers=[],this.attributes={},e)for(const t in e)this.addAttribute(t,e[t]);this.instanceCount=t.instanceCount??1,n&&this.addIndex(n),this.topology=r||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(const t in this.attributes){const e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){const n=function(t){return(t instanceof s.h||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=l(t.buffer,!1),t}(e);-1===this.buffers.indexOf(n.buffer)&&(this.buffers.push(n.buffer),n.buffer.on("update",this.onBufferUpdate,this),n.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=n}addIndex(t){this.indexBuffer=l(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,function(t,e,n){const r=t.getAttribute(e);if(!r)return n.minX=0,n.minY=0,n.maxX=0,n.maxY=0,n;const i=r.buffer.data;let o=1/0,s=1/0,a=-1/0,l=-1/0;const c=i.BYTES_PER_ELEMENT,h=(r.offset||0)/c,u=(r.stride||8)/c;for(let t=h;t<i.length;t+=u){const e=i[t],n=i[t+1];e>a&&(a=e),n>l&&(l=n),e<o&&(o=e),n<s&&(s=n)}return n.minX=o,n.minY=s,n.maxX=a,n.maxY=l,n}(this,"aPosition",this._bounds)):this._bounds}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach((t=>t.destroy())),this.unload(),this.indexBuffer?.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}},8306:(t,e,n)=>{n.d(e,{m:()=>i});const r={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function i(t){return r[t]??r.float32}},848:(t,e,n)=>{n.d(e,{L:()=>i});var r=n(133);class i{constructor(){this.uid=(0,r.L)("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}},8475:(t,e,n)=>{n.d(e,{M:()=>h});var r=n(8875),i=n(133),o=n(9113),s=n(3513),a=n(3012),l=n(5099),c=n(5811);class h extends r.A{constructor(t){super(),this.uid=(0,i.L)("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:e,glProgram:n,groups:r,resources:o,compatibleRenderers:a,groupMap:h}=t;this.gpuProgram=e,this.glProgram=n,void 0===a&&(a=0,e&&(a|=l.W.WEBGPU),n&&(a|=l.W.WEBGL)),this.compatibleRenderers=a;const u={};if(o||r||(o={}),o&&r)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&r&&!h)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&r&&h)for(const t in h)for(const e in h[t]){const n=h[t][e];u[n]={group:t,binding:e,name:n}}else if(e&&r&&!h){const t=e.structsAndGroups.groups;h={},t.forEach((t=>{h[t.group]=h[t.group]||{},h[t.group][t.binding]=t.name,u[t.name]=t}))}else if(o){if(r={},h={},e){e.structsAndGroups.groups.forEach((t=>{h[t.group]=h[t.group]||{},h[t.group][t.binding]=t.name,u[t.name]=t}))}let t=0;for(const e in o)u[e]||(r[99]||(r[99]=new s.T,this._ownedBindGroups.push(r[99])),u[e]={group:99,binding:t,name:e},h[99]=h[99]||{},h[99][t]=e,t++);for(const t in o){const e=t;let n=o[t];n.source||n._resourceType||(n=new c.k(n));const i=u[e];i&&(r[i.group]||(r[i.group]=new s.T,this._ownedBindGroups.push(r[i.group])),r[i.group].setResource(n,i.binding))}}this.groups=r,this._uniformBindMap=h,this.resources=this._buildResourceAccessor(r,u)}addResource(t,e,n){var r,i;(r=this._uniformBindMap)[e]||(r[e]={}),(i=this._uniformBindMap[e])[n]||(i[n]=t),this.groups[e]||(this.groups[e]=new s.T,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const n={};for(const r in e){const i=e[r];Object.defineProperty(n,i.name,{get:()=>t[i.group].getResource(i.binding),set(e){t[i.group].setResource(e,i.binding)}})}return n}destroy(t=!1){this._destroyed||(this._destroyed=!0,this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach((t=>{t.destroy()})),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(t){const{gpu:e,gl:n,...r}=t;let i,s;return e&&(i=a.B.from(e)),n&&(s=o.M.from(n)),new h({gpuProgram:i,glProgram:s,...r})}}},5811:(t,e,n)=>{n.d(e,{k:()=>c});var r=n(133),i=n(7952);const o=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],s=o.reduce(((t,e)=>(t[e]=!0,t)),{});function a(t,e){switch(t){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const l=class t{constructor(e,n){this._touched=0,this.uid=(0,r.L)("uniform"),this._resourceType="uniformGroup",this._resourceId=(0,r.L)("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,n={...t.defaultOptions,...n},this.uniformStructures=e;const l={};for(const t in e){const n=e[t];if(n.name=t,n.size=n.size??1,!s[n.type]){const t=n.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(t){const[,e,r]=t;throw new Error(`Uniform type ${n.type} is not supported. Use type: '${e}', size: ${r} instead.`)}throw new Error(`Uniform type ${n.type} is not supported. Supported uniform types are: ${o.join(", ")}`)}n.value??(n.value=a(n.type,n.size)),l[t]=n.value}this.uniforms=l,this._dirtyId=1,this.ubo=n.ubo,this.isStatic=n.isStatic,this._signature=(0,i.X)(Object.keys(l).map((t=>`${t}-${e[t].type}`)).join("-"),"uniform-group")}update(){this._dirtyId++}};l.defaultOptions={ubo:!1,isStatic:!1};let c=l},7547:(t,e,n)=>{n.d(e,{U:()=>o});const r={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},i=class t{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(1&this.data)}set blend(t){!!(1&this.data)!==t&&(this.data^=1)}get offsets(){return!!(2&this.data)}set offsets(t){!!(2&this.data)!==t&&(this.data^=2)}set cullMode(t){"none"!==t?(this.culling=!0,this.clockwiseFrontFace="front"===t):this.culling=!1}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(4&this.data)}set culling(t){!!(4&this.data)!==t&&(this.data^=4)}get depthTest(){return!!(8&this.data)}set depthTest(t){!!(8&this.data)!==t&&(this.data^=8)}get depthMask(){return!!(32&this.data)}set depthMask(t){!!(32&this.data)!==t&&(this.data^=32)}get clockwiseFrontFace(){return!!(16&this.data)}set clockwiseFrontFace(t){!!(16&this.data)!==t&&(this.data^=16)}get blendMode(){return this._blendMode}set blendMode(t){this.blend="none"!==t,this._blendMode=t,this._blendModeId=r[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const e=new t;return e.depthTest=!1,e.blend=!0,e}};i.default2d=i.for2d();let o=i},1957:(t,e,n)=>{n.d(e,{K:()=>i,Q:()=>r});const r={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var i=(t=>(t[t.DISABLED=0]="DISABLED",t[t.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",t[t.MASK_ACTIVE=2]="MASK_ACTIVE",t[t.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",t[t.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",t[t.NONE=5]="NONE",t))(i||{})},800:(t,e,n)=>{n.d(e,{k:()=>g});var r=n(2577),i=n(8507);const o=[];async function s(t){if(!t)for(let t=0;t<o.length;t++){const e=o[t];if(e.value.test())return void await e.value.load()}}i.XO.handleByNamedList(i.Ag.Environment,o);var a=n(5559),l=n(4577),c=n(133),h=n(4670),u=n(6083),d=n(1257),f=n(7729),p=n(8875);const m=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],y=class t extends p.A{constructor(t){super(),this.tick=0,this.uid=(0,c.L)("renderer"),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;const e=[...m,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(e={}){const n=!0===e.skipExtensionImports||!1===e.manageImports;await s(n),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const t in this._systemsHash){e={...this._systemsHash[t].constructor.defaultOptions,...e}}e={...t.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let t=0;t<this.runners.init.items.length;t++)await this.runners.init.items[t].init(e);this._initOptions=e}render(t,e){this.tick++;let n=t;if(n instanceof a.mc&&(n={container:n},e&&((0,h.t6)(h.lj,"passing a second argument is deprecated, please use render options instead"),n.target=e.renderTexture)),n.target||(n.target=this.view.renderTarget),n.target===this.view.renderTarget&&(this._lastObjectRendered=n.container,n.clearColor??(n.clearColor=this.background.colorRgba),n.clear??(n.clear=this.background.clearBeforeRender)),n.clearColor){const t=Array.isArray(n.clearColor)&&4===n.clearColor.length;n.clearColor=t?n.clearColor:r.Q.shared.setValue(n.clearColor).toArray()}n.transform||(n.container.updateLocalTransform(),n.transform=n.container.localTransform),n.container.visible&&(n.container.enableRenderGroup(),this.runners.prerender.emit(n),this.runners.renderStart.emit(n),this.runners.render.emit(n),this.runners.renderEnd.emit(n),this.runners.postrender.emit(n))}resize(t,e,n){const r=this.view.resolution;this.view.resize(t,e,n),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),void 0!==n&&n!==r&&this.runners.resolutionChange.emit(n)}clear(t={}){t.target||(t.target=this.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=d.u.ALL);const{clear:e,clearColor:n,target:i,mipLevel:o,layer:s}=t;r.Q.shared.setValue(n??this.background.colorRgba),this.renderTarget.clear(i,e,r.Q.shared.toArray(),o??0,s??0)}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach((t=>{this.runners[t]=new f.C(t)}))}_addSystems(t){let e;for(e in t){const n=t[e];this._addSystem(n.value,n.name)}}_addSystem(t,e){const n=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=n,this._systemsHash[e]=n;for(const t in this.runners)this.runners[t].add(n);return this}_addPipes(t,e){const n=e.reduce(((t,e)=>(t[e.name]=e.value,t)),{});t.forEach((t=>{const e=t.value,r=t.name,i=n[r];this.renderPipes[r]=new e(this,i?new i:null),this.runners.destroy.add(this.renderPipes[r])}))}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),(!0===t||"object"==typeof t&&t.releaseGlobalResources)&&u.L.release(),Object.values(this.runners).forEach((t=>{t.destroy()})),this._systemsHash=null,this.renderPipes=null,this.removeAllListeners()}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!(0,l.f)())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};y.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let g=y},7729:(t,e,n)=>{n.d(e,{C:()=>r});class r{constructor(t){this.items=[],this._name=t}emit(t,e,n,r,i,o,s,a){const{name:l,items:c}=this;for(let h=0,u=c.length;h<u;h++)c[h][l](t,e,n,r,i,o,s,a);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return-1!==e&&this.items.splice(e,1),this}contains(t){return-1!==this.items.indexOf(t)}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return 0===this.items.length}get name(){return this._name}}},7608:(t,e,n)=>{n.d(e,{N:()=>s});var r=n(1761),i=n(9939),o=n(6083);const s=new class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const n=r.e.get().createCanvas();n.width=t,n.height=e;const i=n.getContext("2d");return{canvas:n,context:i}}getOptimalCanvasAndContext(t,e,n=1){t=Math.ceil(t*n-1e-6),e=Math.ceil(e*n-1e-6);const r=((t=(0,i.U5)(t))<<17)+((e=(0,i.U5)(e))<<1);this._canvasPool[r]||(this._canvasPool[r]=[]);let o=this._canvasPool[r].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){const e=t.canvas,{width:n,height:r}=e,i=(n<<17)+(r<<1);t.context.resetTransform(),t.context.clearRect(0,0,n,r),this._canvasPool[i].push(t)}clear(){this._canvasPool={}}};o.L.register(s)},5589:(t,e,n)=>{n.d(e,{g:()=>d});var r=n(8875),i=n(2079),o=n(9252),s=n(133),a=n(4670);const l=()=>{};var c=n(4195),h=n(583),u=n(1196);class d extends r.A{constructor({source:t,label:e,frame:n,orig:r,trim:i,defaultAnchor:a,defaultBorders:l,rotate:c,dynamic:u}={}){if(super(),this.uid=(0,s.L)("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new o.M,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new h.v,this.noFrame=!n,n)this.frame.copyFrom(n);else{const{width:t,height:e}=this._source;this.frame.width=t,this.frame.height=e}this.orig=r||this.frame,this.trim=i,this.rotate=c??0,this.defaultAnchor=a,this.defaultBorders=l,this.destroyed=!1,this.dynamic=u||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new u.N(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:n,height:r}=this._source,o=e.x/n,s=e.y/r,a=e.width/n,l=e.height/r;let c=this.rotate;if(c){const e=a/2,n=l/2,r=o+e,h=s+n;c=i.E.add(c,i.E.NW),t.x0=r+e*i.E.uX(c),t.y0=h+n*i.E.uY(c),c=i.E.add(c,2),t.x1=r+e*i.E.uX(c),t.y1=h+n*i.E.uY(c),c=i.E.add(c,2),t.x2=r+e*i.E.uX(c),t.y2=h+n*i.E.uY(c),c=i.E.add(c,2),t.x3=r+e*i.E.uX(c),t.y3=h+n*i.E.uY(c)}else t.x0=o,t.y0=s,t.x1=o+a,t.y1=s,t.x2=o+a,t.y2=s+l,t.x3=o,t.y3=s+l}destroy(t=!1){this._source&&(this._source.off("resize",this.update,this),t&&(this._source.destroy(),this._source=null)),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return(0,a.t6)(a.lj,"Texture.baseTexture is now Texture.source"),this._source}}d.EMPTY=new d({label:"EMPTY",source:new h.v({label:"EMPTY"})}),d.EMPTY.destroy=l,d.WHITE=new d({source:new c.P({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),d.WHITE.destroy=l},1196:(t,e,n)=>{n.d(e,{N:()=>o});var r=n(9313);const i=new r.u;class o{constructor(t,e){this.mapCoord=new r.u,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===e?t.width<10?0:.5:e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){void 0===e&&(e=t);const n=this.mapCoord;for(let r=0;r<t.length;r+=2){const i=t[r],o=t[r+1];e[r]=i*n.a+o*n.c+n.tx,e[r+1]=i*n.b+o*n.d+n.ty}return e}update(){const t=this._texture;this._updateID++;const e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);const n=t.orig,r=t.trim;r&&(i.set(n.width/r.width,0,0,n.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(i));const o=t.source,s=this.uClampFrame,a=this.clampMargin/o._resolution,l=this.clampOffset/o._resolution;return s[0]=(t.frame.x+a+l)/o.width,s[1]=(t.frame.y+a+l)/o.height,s[2]=(t.frame.x+t.frame.width-a+l)/o.width,s[3]=(t.frame.y+t.frame.height-a+l)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=t.frame.width===o.width&&t.frame.height===o.height&&0===t.rotate,!0}}},2437:(t,e,n)=>{n.d(e,{W:()=>c});var r=n(9939),i=n(6083),o=n(583),s=n(5589),a=n(218);let l=0;const c=new class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new a.n(this.textureOptions)}createTexture(t,e,n,r){const i=new o.v({...this.textureOptions,width:t,height:e,resolution:1,antialias:n,autoGarbageCollect:!1,autoGenerateMipmaps:r});return new s.g({source:i,label:"texturePool_"+l++})}getOptimalTexture(t,e,n=1,i,o=!1){let s=Math.ceil(t*n-1e-6),a=Math.ceil(e*n-1e-6);s=(0,r.U5)(s),a=(0,r.U5)(a);const l=(s<<17)+(a<<2)+((o?1:0)<<1)+(i?1:0);this._texturePool[l]||(this._texturePool[l]=[]);let c=this._texturePool[l].pop();return c||(c=this.createTexture(s,a,i,o)),c.source._resolution=n,c.source.width=s/n,c.source.height=a/n,c.source.pixelWidth=s,c.source.pixelHeight=a,c.frame.x=0,c.frame.y=0,c.frame.width=t,c.frame.height=e,c.updateUvs(),this._poolKeyHash[c.uid]=l,c}getSameSizeTexture(t,e=!1){const n=t.source;return this.getOptimalTexture(t.width,t.height,n._resolution,e)}returnTexture(t,e=!1){const n=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[n].push(t)}clear(t){if(t=!1!==t)for(const t in this._texturePool){const e=this._texturePool[t];if(e)for(let t=0;t<e.length;t++)e[t].destroy(!0)}this._texturePool={}}};i.L.register(c)},218:(t,e,n)=>{n.d(e,{n:()=>l});var r=n(8875),i=n(133),o=n(4670);const s=Object.create(null);const a=class t extends r.A{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...t.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){(0,o.t6)(o.lj,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this._sharedResourceId=null,this.emit("change",this)}_generateResourceId(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=function(t){const e=s[t];return void 0===e&&(s[t]=(0,i.L)("resource")),e}(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};a.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let l=a},4195:(t,e,n)=>{n.d(e,{P:()=>o});var r=n(8507),i=n(583);class o extends i.v{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let n=t.format;n||(n=e instanceof Float32Array?"rgba32float":e instanceof Int32Array||e instanceof Uint32Array?"rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?"rgba16uint":(Int8Array,"bgra8unorm")),super({...t,resource:e,format:n}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}o.extension=r.Ag.TextureSource},4884:(t,e,n)=>{n.d(e,{q:()=>s});var r=n(1761),i=n(8507),o=n(583);class s extends o.v{constructor(t){t.resource||(t.resource=r.e.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),this.resource.width===this.pixelWidth&&this.resource.height===this.pixelHeight||(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,n=this._resolution){const r=super.resize(t,e,n);return r&&this.resizeCanvas(),r}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}s.extension=i.Ag.TextureSource},8293:(t,e,n)=>{n.d(e,{b:()=>o});var r=n(8507),i=n(583);class o extends i.v{constructor(t){super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}o.extension=r.Ag.TextureSource},583:(t,e,n)=>{n.d(e,{v:()=>c});var r=n(8875),i=n(9939),o=n(2698),s=n(133),a=n(218);const l=class t extends r.A{constructor(e={}){super(),this.options=e,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=(0,s.L)("textureSource"),this._resourceType="textureSource",this._resourceId=(0,s.L)("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.viewDimension="2d",this.arrayLayerCount=1,this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...t.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=e.format,this.dimension=e.dimensions,this.viewDimension=e.viewDimension??e.dimensions,this.arrayLayerCount=e.arrayLayerCount,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new a.n((0,o.S)(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(t){this._style.maxAnisotropy=t}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=(0,s.L)("resource"),this.emit("change",this),this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy?.();this._gpuData=Object.create(null)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,n){n||(n=this._resolution),t||(t=this.width),e||(e=this.height);const r=Math.round(t*n),i=Math.round(e*n);return this.width=r/n,this.height=i/n,this._resolution=n,(this.pixelWidth!==r||this.pixelHeight!==i)&&(this._refreshPOT(),this.pixelWidth=r,this.pixelHeight=i,this.emit("resize",this),this._resourceId=(0,s.L)("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=(0,i.f3)(this.pixelWidth)&&(0,i.f3)(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};l.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",viewDimension:"2d",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let c=l},9726:(t,e,n)=>{var r=n(268),i=n(2406);const o=new class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||(0,r.R)(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const n=(0,i.z)(t);let o;for(let t=0;t<this.parsers.length;t++){const r=this.parsers[t];if(r.test(e)){o=r.getCacheableAssets(n,e);break}}const s=new Map(Object.entries(o||{}));o||n.forEach((t=>{s.set(t,e)}));const a=[...s.keys()],l={cacheKeys:a,keys:n};n.forEach((t=>{this._cacheMap.set(t,l)})),a.forEach((t=>{const n=o?o[t]:e;this._cache.has(t)&&this._cache.get(t)!==n&&(0,r.R)("[Cache] already has key:",t),this._cache.set(t,s.get(t))}))}remove(t){if(!this._cacheMap.has(t))return void(0,r.R)(`[Assets] Asset id ${t} was not found in the Cache`);const e=this._cacheMap.get(t);e.cacheKeys.forEach((t=>{this._cache.delete(t)})),e.keys.forEach((t=>{this._cacheMap.delete(t)}))}get parsers(){return this._parsers}};var s=n(8507),a=n(583),l=n(5589);const c=[];function h(t={}){const e=t&&t.resource,n=e?t.resource:t,r=e?t:{resource:t};for(let t=0;t<c.length;t++){const e=c[t];if(e.test(n))return new e(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}s.XO.handleByList(s.Ag.TextureSource,c),l.g.from=function(t,e=!1){return"string"==typeof t?o.get(t):t instanceof a.v?new l.g({source:t}):function(t={},e=!1){const n=t&&t.resource,r=n?t.resource:t,i=n?t:{resource:t};if(!e&&o.has(r))return o.get(r);const s=new l.g({source:h(i)});return s.on("destroy",(()=>{o.has(r)&&o.remove(r)})),e||o.set(r,s),s}(t,e)},a.v.from=h},7952:(t,e,n)=>{n.d(e,{X:()=>o});const r=Object.create(null),i=Object.create(null);function o(t,e){let n=i[t];return void 0===n&&(void 0===r[e]&&(r[e]=1),i[t]=n=r[e]++),n}},5099:(t,e,n)=>{n.d(e,{W:()=>r});var r=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.CANVAS=4]="CANVAS",t[t.BOTH=3]="BOTH",t))(r||{})},5559:(t,e,n)=>{n.d(e,{mc:()=>H,u:()=>U,ig:()=>z,fR:()=>W});var r=n(8875),i=n(2577);var o=n(8507),s=n(9313),a=n(1652),l=n(2812),c=n(133),h=n(4670),u=n(268),d=n(8655);const f={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(t){"boolean"==typeof t&&!1===t?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(!0===t?{}:t))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(t){(0,h.t6)("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}};var p=n(9903);const m={allowChildren:!0,removeChildren(t=0,e){const n=e??this.children.length,r=n-t,i=[];if(r>0&&r<=n){for(let e=n-1;e>=t;e--){const t=this.children[e];t&&(i.push(t),t.parent=null)}(0,p.d)(this.children,t,n);const e=this.renderGroup||this.parentRenderGroup;e&&e.removeChildren(i);for(let t=0;t<i.length;++t){const e=i[t];e.parentRenderLayer?.detach(e),this.emit("childRemoved",e,this,t),i[t].emit("removed",this)}return i.length>0&&this._didViewChangeTick++,i}if(0===r&&0===this.children.length)return i;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(t){const e=this.getChildAt(t);return this.removeChild(e)},getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]},setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(t),this.addChildAt(t,e)},getChildIndex(t){const e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(t,e){this.allowChildren||(0,h.t6)(h.lj,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:n}=this;if(e<0||e>n.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${n.length}`);const r=t.parent===this;if(t.parent){const n=t.parent.children.indexOf(t);if(r){if(n===e)return t;t.parent.children.splice(n,1)}else t.removeFromParent()}e===n.length?n.push(t):n.splice(e,0,t),t.parent=this,t.didChange=!0,t._updateFlags=15;const i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(t),this.sortableChildren&&(this.sortDirty=!0),r||(this.emit("childAdded",t,this,e),t.emit("added",this)),t},swapChildren(t,e){if(t===e)return;const n=this.getChildIndex(t),r=this.getChildIndex(e);this.children[n]=e,this.children[r]=t;const i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...t){return 1===t.length?this.reparentChildAt(t[0],this.children.length):(t.forEach((t=>this.reparentChildAt(t,this.children.length))),t[0])},reparentChildAt(t,e){if(t.parent===this)return this.setChildIndex(t,e),t;const n=t.worldTransform.clone();t.removeFromParent(),this.addChildAt(t,e);const r=this.worldTransform.clone();return r.invert(),n.prepend(r),t.setFromMatrix(n),t},replaceChild(t,e){t.updateLocalTransform(),this.addChildAt(e,this.getChildIndex(t)),e.setFromMatrix(t.localTransform),e.updateLocalTransform(),this.removeChild(t)}},y={collectRenderables(t,e,n){this.parentRenderLayer&&this.parentRenderLayer!==n||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(t,e,n):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,t):this.collectRenderablesWithEffects(t,e,n))},collectRenderablesSimple(t,e,n){const r=this.children,i=r.length;for(let o=0;o<i;o++)r[o].collectRenderables(t,e,n)},collectRenderablesWithEffects(t,e,n){const{renderPipes:r}=e;for(let e=0;e<this.effects.length;e++){const n=this.effects[e];r[n.pipe].push(n,this,t)}this.collectRenderablesSimple(t,e,n);for(let e=this.effects.length-1;e>=0;e--){const n=this.effects[e];r[n.pipe].pop(n,this,t)}}};var g=n(9049);const v=new class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach((t=>{this.add({test:t.test,maskClass:t})})))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){const n=this._tests[e];if(n.test(t))return d.Z.get(n.maskClass,t)}return t}returnMaskEffect(t){d.Z.return(t)}};o.XO.handleByList(o.Ag.MaskEffect,v._effectClasses);const b={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){const t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0)},addEffect(t){-1===this.effects.indexOf(t)&&(this.effects.push(t),this.effects.sort(((t,e)=>t.priority-e.priority)),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(t){const e=this.effects.indexOf(t);-1!==e&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(t){const e=this._maskEffect;e?.mask!==t&&(e&&(this.removeEffect(e),v.returnMaskEffect(e),this._maskEffect=null),null!=t&&(this._maskEffect=v.getMaskEffect(t),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},setMask(t){this._maskOptions={...this._maskOptions,...t},t.mask&&(this.mask=t.mask),this._markStructureAsChanged()},set filters(t){!Array.isArray(t)&&t&&(t=[t]);const e=this._filterEffect||(this._filterEffect=new g.a),n=t?.length>0,r=n!==e.filters?.length>0;t=Array.isArray(t)?t.slice(0):t,e.filters=Object.freeze(t),r&&(n?this.addEffect(e):(this.removeEffect(e),e.filters=t??null))},get filters(){return this._filterEffect?.filters},set filterArea(t){this._filterEffect||(this._filterEffect=new g.a),this._filterEffect.filterArea=t},get filterArea(){return this._filterEffect?.filterArea}},x={label:null,get name(){return(0,h.t6)(h.lj,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){(0,h.t6)(h.lj,"Container.name property has been removed, use Container.label instead"),this.label=t},getChildByName(t,e=!1){return this.getChildByLabel(t,e)},getChildByLabel(t,e=!1){const n=this.children;for(let e=0;e<n.length;e++){const r=n[e];if(r.label===t||t instanceof RegExp&&t.test(r.label))return r}if(e)for(let e=0;e<n.length;e++){const r=n[e].getChildByLabel(t,!0);if(r)return r}return null},getChildrenByLabel(t,e=!1,n=[]){const r=this.children;for(let e=0;e<r.length;e++){const i=r[e];(i.label===t||t instanceof RegExp&&t.test(i.label))&&n.push(i)}if(e)for(let e=0;e<r.length;e++)r[e].getChildrenByLabel(t,!0,n);return n}};var _=n(9636),w=n(2208);const S=new s.u,C={getFastGlobalBounds(t,e){e||(e=new _.c),e.clear(),this._getGlobalBoundsRecursive(!!t,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);const n=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(n.worldTransform),e},_getGlobalBoundsRecursive(t,e,n){let r=e;if(t&&this.parentRenderLayer&&this.parentRenderLayer!==n)return;if(7!==this.localDisplayStatus||!this.measurable)return;const i=!!this.effects.length;if((this.renderGroup||i)&&(r=w.o.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const t=this.bounds;r.addFrame(t.minX,t.minY,t.maxX,t.maxY,this.groupTransform)}const e=this.children;for(let i=0;i<e.length;i++)e[i]._getGlobalBoundsRecursive(t,r,n)}if(i){let t=!1;const n=this.renderGroup||this.parentRenderGroup;for(let e=0;e<this.effects.length;e++)this.effects[e].addBounds&&(t||(t=!0,r.applyMatrix(n.worldTransform)),this.effects[e].addBounds(r,!0));t&&r.applyMatrix(n.worldTransform.copyTo(S).invert()),e.addBounds(r),w.o.return(r)}else this.renderGroup&&(e.addBounds(r,this.relativeGroupTransform),w.o.return(r))}};var E=n(198),k=n(9443),T=n(7269);function A(t,e){const n=t.children;for(let t=0;t<n.length;t++){const r=n[t],i=r.uid,o=(65535&r._didViewChangeTick)<<16|65535&r._didContainerChangeTick,s=e.index;e.data[s]===i&&e.data[s+1]===o||(e.data[e.index]=i,e.data[e.index+1]=o,e.didChange=!0),e.index=s+2,r.children.length&&A(r,e)}return e.didChange}const M=new s.u,P={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){const n=Math.sign(this.scale.x)||1;this.scale.x=0!==e?t/e*n:n},_setHeight(t,e){const n=Math.sign(this.scale.y)||1;this.scale.y=0!==e?t/e*n:n},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new _.c});const t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),A(this,t),t.didChange&&(0,T.n)(this,t.localBounds,M),t.localBounds},getBounds(t,e){return(0,k.f)(this,t,e||new _.c)}},O={_onRender:null,set onRender(t){const e=this.renderGroup||this.parentRenderGroup;if(!t)return this._onRender&&e?.removeOnRender(this),void(this._onRender=null);this._onRender||e?.addOnRender(this),this._onRender=t},get onRender(){return this._onRender}},I={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(L))}};function L(t,e){return t._zIndex-e._zIndex}var j=n(5101);const R={getGlobalPosition(t=new j.b,e=!1){return this.parent?this.parent.toGlobal(this._position,t,e):(t.x=this._position.x,t.y=this._position.y),t},toGlobal(t,e,n=!1){const r=this.getGlobalTransform(w.u.get(),n);return e=r.apply(t,e),w.u.return(r),e},toLocal(t,e,n,r){e&&(t=e.toGlobal(t,n,r));const i=this.getGlobalTransform(w.u.get(),r);return n=i.applyInverse(t,n),w.u.return(i),n}};var D=n(3284);const N=new l.o(null),F=new l.o(null),B=new l.o(null,1,1),G=new l.o(null),z=1,U=2,W=4;class H extends r.A{constructor(t={}){super(),this.uid=(0,c.L)("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new s.u,this.relativeGroupTransform=new s.u,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new l.o(this,0,0),this._scale=B,this._pivot=F,this._origin=G,this._skew=N,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],function(t,e,n={}){for(const r in e)n[r]||void 0===e[r]||(t[r]=e[r])}(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach((t=>this.addChild(t))),t.parent?.addChild(this)}static mixin(t){(0,h.t6)("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),o.XO.mixin(H,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=4095&t}get _didChangeId(){return 4095&this._didContainerChangeTick|(4095&this._didViewChangeTick)<<12}addChild(...t){if(this.allowChildren||(0,h.t6)(h.lj,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let e=0;e<t.length;e++)this.addChild(t[e]);return t[0]}const e=t[0],n=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),n&&(n.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,n&&n.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,0!==e._zIndex&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let e=0;e<t.length;e++)this.removeChild(t[e]);return t[0]}const e=t[0],n=this.children.indexOf(e);return n>-1&&(this._didViewChangeTick++,this.children.splice(n,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,n),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,this.didChange||(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=d.Z.get(D.m,this),this.groupTransform=s.u.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t?.removeChild(this),d.Z.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&0===this.effects.length}get worldTransform(){return this._worldTransform||(this._worldTransform=new s.u),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*a.bO}set angle(t){this.rotation=t*a.Td}get pivot(){return this._pivot===F&&(this._pivot=new l.o(this,0,0)),this._pivot}set pivot(t){this._pivot===F&&(this._pivot=new l.o(this,0,0),this._origin!==G&&(0,u.R)("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),"number"==typeof t?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===N&&(this._skew=new l.o(this,0,0)),this._skew}set skew(t){this._skew===N&&(this._skew=new l.o(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===B&&(this._scale=new l.o(this,1,1)),this._scale}set scale(t){this._scale===B&&(this._scale=new l.o(this,0,0)),"string"==typeof t&&(t=parseFloat(t)),"number"==typeof t?this._scale.set(t):this._scale.copyFrom(t)}get origin(){return this._origin===G&&(this._origin=new l.o(this,0,0)),this._origin}set origin(t){this._origin===G&&(this._origin=new l.o(this,0,0),this._pivot!==F&&(0,u.R)("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),"number"==typeof t?this._origin.set(t):this._origin.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){const n=this.getLocalBounds();"object"==typeof t?(e=t.height??t.width,t=t.width):e??(e=t),void 0!==t&&this._setWidth(t,n.width),void 0!==e&&this._setHeight(e,n.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set("number"==typeof t.x?t.x:this.position.x,"number"==typeof t.y?t.y:this.position.y),this.scale.set("number"==typeof t.scaleX?t.scaleX||1:this.scale.x,"number"==typeof t.scaleY?t.scaleY||1:this.scale.y),this.rotation="number"==typeof t.rotation?t.rotation:this.rotation,this.skew.set("number"==typeof t.skewX?t.skewX:this.skew.x,"number"==typeof t.skewY?t.skewY:this.skew.y),this.pivot.set("number"==typeof t.pivotX?t.pivotX:this.pivot.x,"number"==typeof t.pivotY?t.pivotY:this.pivot.y),this.origin.set("number"==typeof t.originX?t.originX:this.origin.x,"number"==typeof t.originY?t.originY:this.origin.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,n=this._scale,r=this._pivot,i=this._origin,o=this._position,s=n._x,a=n._y,l=r._x,c=r._y,h=-i._x,u=-i._y;e.a=this._cx*s,e.b=this._sx*s,e.c=this._cy*a,e.d=this._sy*a,e.tx=o._x-(l*e.a+c*e.c)+(h*e.a+u*e.c)-h,e.ty=o._y-(l*e.b+c*e.d)+(h*e.b+u*e.d)-u}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=z,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const e=i.Q.shared.setValue(t??16777215).toBgrNumber();e!==this.localColor&&(this.localColor=e,this._updateFlags|=z,this._onUpdate())}get tint(){return(0,E.D)(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=U,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(2&this.localDisplayStatus)}set visible(t){const e=t?2:0;(2&this.localDisplayStatus)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=W,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",t))}get culled(){return!(4&this.localDisplayStatus)}set culled(t){const e=t?0:4;(4&this.localDisplayStatus)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=W,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(1&this.localDisplayStatus)}set renderable(t){const e=t?1:0;(1&this.localDisplayStatus)!==e&&(this._updateFlags|=W,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return 7===this.localDisplayStatus&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;let e;this.destroyed=!0,this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners();if(("boolean"==typeof t?t:t?.children)&&e)for(let n=0;n<e.length;++n)e[n].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}}o.XO.mixin(H,m,C,R,O,P,b,x,I,{cullArea:null,cullable:!1,cullableChildren:!0},f,E.R,y)},3284:(t,e,n)=>{n.d(e,{m:()=>s});var r=n(9313),i=n(848),o=n(2437);class s{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new r.u,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new i.L,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let t=0;t<e.length;t++){const n=e[t];n._updateFlags=15,this.addChild(n)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(o.W.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const t=this._parentCacheAsTextureRenderGroup;t&&!t.textureNeedsUpdate&&t.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const t in this.childrenToUpdate){const e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){const e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup)return void this.addRenderGroupChild(t.renderGroup);t._onRender&&this.addOnRender(t);const e=t.children;for(let t=0;t<e.length;t++)this.addChild(e[t])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup)return void this._removeRenderGroupChild(t.renderGroup);const e=t.children;for(let t=0;t<e.length;t++)this.removeChild(e[t])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return 7===this.root.localDisplayStatus&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){const e=this.root.children;for(let n=0;n<e.length;n++)this._getChildren(e[n],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const n=t.children;for(let t=0;t<n.length;t++)this._getChildren(n[t],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return 1&this._matrixDirty?(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new r.u),this._inverseWorldTransform.copyFrom(this.worldTransform).invert()):this._inverseWorldTransform}get textureOffsetInverseTransform(){return 2&this._matrixDirty?(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new r.u),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y)):this._textureOffsetInverseTransform}get inverseParentTextureTransform(){if(!(4&this._matrixDirty))return this._inverseParentTextureTransform;this._matrixDirty&=-5;const t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new r.u),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}},9636:(t,e,n)=>{n.d(e,{c:()=>s});var r=n(9313),i=n(9252);const o=new r.u;class s{constructor(t=1/0,e=1/0,n=-1/0,r=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=o,this.minX=t,this.minY=e,this.maxX=n,this.maxY=r}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new i.M);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=o,this}set(t,e,n,r){this.minX=t,this.minY=e,this.maxX=n,this.maxY=r}addFrame(t,e,n,r,i){i||(i=this.matrix);const o=i.a,s=i.b,a=i.c,l=i.d,c=i.tx,h=i.ty;let u=this.minX,d=this.minY,f=this.maxX,p=this.maxY,m=o*t+a*e+c,y=s*t+l*e+h;m<u&&(u=m),y<d&&(d=y),m>f&&(f=m),y>p&&(p=y),m=o*n+a*e+c,y=s*n+l*e+h,m<u&&(u=m),y<d&&(d=y),m>f&&(f=m),y>p&&(p=y),m=o*t+a*r+c,y=s*t+l*r+h,m<u&&(u=m),y<d&&(d=y),m>f&&(f=m),y>p&&(p=y),m=o*n+a*r+c,y=s*n+l*r+h,m<u&&(u=m),y<d&&(d=y),m>f&&(f=m),y>p&&(p=y),this.minX=u,this.minY=d,this.maxX=f,this.maxY=p}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){const e=this.minX,n=this.minY,r=this.maxX,i=this.maxY,{a:o,b:s,c:a,d:l,tx:c,ty:h}=t;let u=o*e+a*n+c,d=s*e+l*n+h;this.minX=u,this.minY=d,this.maxX=u,this.maxY=d,u=o*r+a*n+c,d=s*r+l*n+h,this.minX=u<this.minX?u:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=u>this.maxX?u:this.maxX,this.maxY=d>this.maxY?d:this.maxY,u=o*e+a*i+c,d=s*e+l*i+h,this.minX=u<this.minX?u:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=u>this.maxX?u:this.maxX,this.maxY=d>this.maxY?d:this.maxY,u=o*r+a*i+c,d=s*r+l*i+h,this.minX=u<this.minX?u:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=u>this.maxX?u:this.maxX,this.maxY=d>this.maxY?d:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,n,r){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<n&&(this.minY=n),this.maxY>r&&(this.maxY=r),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new s(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,n,r){let i=this.minX,o=this.minY,s=this.maxX,a=this.maxY;r||(r=this.matrix);const l=r.a,c=r.b,h=r.c,u=r.d,d=r.tx,f=r.ty;for(let r=e;r<n;r+=2){const e=t[r],n=t[r+1],p=l*e+h*n+d,m=c*e+u*n+f;i=p<i?p:i,o=m<o?m:o,s=p>s?p:s,a=m>a?m:a}this.minX=i,this.minY=o,this.maxX=s,this.maxY=a}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}},9443:(t,e,n)=>{n.d(e,{E:()=>a,f:()=>o});var r=n(9313),i=n(2208);function o(t,e,n){let o,l;return n.clear(),t.parent?e?o=t.parent.worldTransform:(l=i.u.get().identity(),o=a(t,l)):o=r.u.IDENTITY,s(t,n,o,e),l&&i.u.return(l),n.isValid||n.set(0,0,0,0),n}function s(t,e,n,o){if(!t.visible||!t.measurable)return;let a;o?a=t.worldTransform:(t.updateLocalTransform(),a=i.u.get(),a.appendFrom(t.localTransform,n));const l=e,c=!!t.effects.length;if(c&&(e=i.o.get().clear()),t.boundsArea)e.addRect(t.boundsArea,a);else{const n=t.bounds;n&&!n.isEmpty()&&(e.matrix=a,e.addBounds(n));for(let n=0;n<t.children.length;n++)s(t.children[n],e,a,o)}if(c){for(let n=0;n<t.effects.length;n++)t.effects[n].addBounds?.(e);l.addBounds(e,r.u.IDENTITY),i.o.return(e)}o||i.u.return(a)}function a(t,e){const n=t.parent;return n&&(a(n,e),n.updateLocalTransform(),e.append(n.localTransform)),e}},7269:(t,e,n)=>{n.d(e,{n:()=>o});var r=n(9313),i=n(2208);function o(t,e,n){return e.clear(),n||(n=r.u.IDENTITY),s(t,e,n,t,!0),e.isValid||e.set(0,0,0,0),e}function s(t,e,n,o,a){let l;if(a)l=i.u.get(),l=n.copyTo(l);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();const e=t.localTransform;l=i.u.get(),l.appendFrom(e,n)}const c=e,h=!!t.effects.length;if(h&&(e=i.o.get().clear()),t.boundsArea)e.addRect(t.boundsArea,l);else{t.renderPipeId&&(e.matrix=l,e.addBounds(t.bounds));const n=t.children;for(let t=0;t<n.length;t++)s(n[t],e,l,o,!1)}if(h){for(let n=0;n<t.effects.length;n++)t.effects[n].addLocalBounds?.(e,o);c.addBounds(e,r.u.IDENTITY),i.o.return(e)}i.u.return(l)}},2208:(t,e,n)=>{n.d(e,{o:()=>a,u:()=>s});var r=n(9313),i=n(8655),o=n(9636);const s=i.Z.getPool(r.u),a=i.Z.getPool(o.c)},198:(t,e,n)=>{n.d(e,{D:()=>a,R:()=>l});var r=n(9313),i=n(9443),o=n(2208),s=n(753);function a(t){return((255&t)<<16)+(65280&t)+(t>>16&255)}const l={getGlobalAlpha(t){if(t)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,n=this.parent;for(;n;)e*=n.alpha,n=n.parent;return e},getGlobalTransform(t=new r.u,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();const n=(0,i.E)(this,o.u.get().identity());return t.appendFrom(this.localTransform,n),o.u.return(n),t},getGlobalTint(t){if(t)return this.renderGroup?a(this.renderGroup.worldColor):this.parentRenderGroup?a((0,s.j)(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,n=this.parent;for(;n;)e=(0,s.j)(e,n.localColor),n=n.parent;return a(e)}}},2698:(t,e,n)=>{function r(t){const e={};for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}n.d(e,{S:()=>r})},753:(t,e,n)=>{n.d(e,{j:()=>o});var r=n(4676);const i=16777215;function o(t,e){return t===i?e:e===i?t:(0,r.u)(t,e)}},4676:(t,e,n)=>{function r(t,e){if(16777215===t||!e)return e;if(16777215===e||!t)return t;return(((t>>16&255)*(e>>16&255)/255|0)<<16)+(((t>>8&255)*(e>>8&255)/255|0)<<8)+((255&t)*(255&e)/255|0)}n.d(e,{u:()=>r})},2760:(t,e,n)=>{function r(t,e,n){const r=(t>>24&255)/255;e[n++]=(255&t)/255*r,e[n++]=(t>>8&255)/255*r,e[n++]=(t>>16&255)/255*r,e[n++]=r}n.d(e,{V:()=>r})},6954:(t,e,n)=>{n.d(e,{G:()=>s});var r=n(9313),i=n(4676);const o=new r.u;class s{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const t=this.baseColor,e=t>>16|65280&t|(255&t)<<16,n=this.renderable;return n?(0,i.u)(e,n.groupColor)+(this.alpha*n.groupAlpha*255<<24):e+(255*this.alpha<<24)}get transform(){return this.renderable?.groupTransform||o}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}}},4663:(t,e,n)=>{n.d(e,{A:()=>_});var r=n(4670),i=n(4985),o=n(8393),s=n(8507),a=n(848),l=n(4334);class c{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class h{constructor(){this.instructions=new a.L}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const u=class t{constructor(t){this._renderer=t,this._managedContexts=new l.s({renderer:t,type:"resource",name:"graphicsContext"})}init(e){t.defaultOptions.bezierSmoothness=e?.bezierSmoothness??t.defaultOptions.bezierSmoothness}getContextRenderData(t){return this.getGpuContext(t).graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=t._gpuData,n=!!e[this._renderer.uid],r=e[this._renderer.uid]||this._initContext(t);return!t.dirty&&n||(n&&r.reset(),r.isBatchable=!1,t.dirty=!1),r}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=new h;return this.getGpuContext(t).graphicsData=e,e.init(),e}_initContext(t){const e=new c;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};u.extension={type:[s.Ag.CanvasSystem],name:"graphicsContext"},u.defaultOptions={bezierSmoothness:.5};let d=u;var f=n(7547);class p{constructor(t,e){this.state=f.U.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new l.s({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){return!1}addRenderable(t,e){this._managedGraphics.add(t),this.renderer.renderPipes.batch.break(e),e.add(t)}updateRenderable(t){}execute(t){t.isRenderable&&this._adaptor.execute(this,t)}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null}}p.extension={type:[s.Ag.CanvasPipes],name:"graphics"};var m=n(378),y=n(8655),g=n(2760),v=n(6954);class b{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach((t=>{y.Z.return(t)})),this.batches.length=0}}class x{constructor(t,e){this.state=f.U.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new l.s({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){const e=t.context,n=!!t._gpuData,r=this.renderer.graphicsContext.updateGpuContext(e);return!(!r.isBatchable&&n===r.isBatchable)}addRenderable(t,e){const n=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),n.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const e=this._getGpuDataForRenderable(t).batches;for(let t=0;t<e.length;t++){const n=e[t];n._batcher.updateElement(n)}}execute(t){if(!t.isRenderable)return;const e=this.renderer,n=t.context;if(!e.graphicsContext.getGpuContext(n).batches.length)return;const r=n.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;const i=r.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=e._roundPixels|t._roundPixels,(0,g.V)(t.groupColorAlpha,i.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=this._getGpuDataForRenderable(t),n=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),n.isBatchable&&this._updateBatchesForRenderable(t,e)}_addToBatcher(t,e){const n=this.renderer.renderPipes.batch,r=this._getGpuDataForRenderable(t).batches;for(let t=0;t<r.length;t++){const i=r[t];n.addToBatch(i,e)}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){const e=new b;return t._gpuData[this.renderer.uid]=e,this._managedGraphics.add(t),e}_updateBatchesForRenderable(t,e){const n=t.context,r=this.renderer.graphicsContext.getGpuContext(n),i=this.renderer._roundPixels|t._roundPixels;e.batches=r.batches.map((e=>{const n=y.Z.get(v.G);return e.copyTo(n),n.renderable=t,n.roundPixels=i,n}))}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}x.extension={type:[s.Ag.WebGLPipes,s.Ag.WebGPUPipes],name:"graphics"},s.XO.add(p),s.XO.add(x),s.XO.add(d),s.XO.add(m.GH);class _ extends i.l{constructor(t){t instanceof o.T&&(t={context:t});const{context:e,roundPixels:n,...r}=t||{};super({label:"Graphics",...r}),this.renderPipeId="graphics",e?this.context=e:(this.context=this._ownedContext=new o.T,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=n??!1}set context(t){t!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=t,this._context.on("update",this.onViewUpdate,this),this._context.on("unload",this.unload,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):!0!==t&&!0!==t?.context||this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_onTouch(t){this._gcLastUsed=t,this._context._gcLastUsed=t}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){if(t)return new _(this._context.clone());this._ownedContext=null;return new _(this._context)}lineStyle(t,e,n){(0,r.t6)(r.lj,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const i={};return t&&(i.width=t),e&&(i.color=e),n&&(i.alpha=n),this.context.strokeStyle=i,this}beginFill(t,e){(0,r.t6)(r.lj,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const n={};return void 0!==t&&(n.color=t),void 0!==e&&(n.alpha=e),this.context.fillStyle=n,this}endFill(){(0,r.t6)(r.lj,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const t=this.context.strokeStyle;return t.width===o.T.defaultStrokeStyle.width&&t.color===o.T.defaultStrokeStyle.color&&t.alpha===o.T.defaultStrokeStyle.alpha||this.context.stroke(),this}drawCircle(...t){return(0,r.t6)(r.lj,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return(0,r.t6)(r.lj,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return(0,r.t6)(r.lj,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return(0,r.t6)(r.lj,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return(0,r.t6)(r.lj,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return(0,r.t6)(r.lj,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}},8393:(t,e,n)=>{n.d(e,{T:()=>ct});var r=n(8875),i=n(2577),o=n(9313),s=n(5101),a=n(5589),l=n(133),c=n(4670),h=n(9636),u=n(268),d=n(8133);var f=n(6125),p=n(9252);class m{constructor(t=0,e=0,n=0,r=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=n,this.halfHeight=r}clone(){return new m(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let n=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return n*=n,r*=r,n+r<=1}strokeContains(t,e,n,r=.5){const{halfWidth:i,halfHeight:o}=this;if(i<=0||o<=0)return!1;const s=n*(1-r),a=n-s,l=i-a,c=o-a,h=i+s,u=o+s,d=t-this.x,f=e-this.y;return d*d/(l*l)+f*f/(c*c)>1&&d*d/(h*h)+f*f/(u*u)<=1}getBounds(t){return t||(t=new p.M),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=2*this.halfWidth,t.height=2*this.halfHeight,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function y(t,e,n,r,i,o){const s=i-n,a=o-r,l=s*s+a*a;let c,h,u=-1;0!==l&&(u=((t-n)*s+(e-r)*a)/l),u<0?(c=n,h=r):u>1?(c=i,h=o):(c=n+u*s,h=r+u*a);const d=t-c,f=e-h;return d*d+f*f}class g{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if("number"!=typeof e[0]){const t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n].x,e[n].y);e=t}this.points=e,this.closePath=!0}isClockwise(){let t=0;const e=this.points,n=e.length;for(let r=0;r<n;r+=2){const i=e[r],o=e[r+1];t+=(e[(r+2)%n]-i)*(e[(r+3)%n]+o)}return t<0}containsPolygon(t){const e=this.getBounds(undefined),n=t.getBounds(undefined);if(!e.containsRect(n))return!1;const r=t.points;for(let t=0;t<r.length;t+=2){const e=r[t],n=r[t+1];if(!this.contains(e,n))return!1}return!0}clone(){const t=this.points.slice(),e=new g(t);return e.closePath=this.closePath,e}contains(t,e){let n=!1;const r=this.points.length/2;for(let i=0,o=r-1;i<r;o=i++){const r=this.points[2*i],s=this.points[2*i+1],a=this.points[2*o],l=this.points[2*o+1];s>e!=l>e&&t<(e-s)/(l-s)*(a-r)+r&&(n=!n)}return n}strokeContains(t,e,n,r=.5){const i=n*n,o=i*(1-r),s=i-o,{points:a}=this,l=a.length-(this.closePath?0:2);for(let n=0;n<l;n+=2){const r=a[n],i=a[n+1],l=a[(n+2)%a.length],c=a[(n+3)%a.length];if(y(t,e,r,i,l,c)<=(Math.sign((l-r)*(e-i)-(c-i)*(t-r))<0?s:o))return!0}return!1}getBounds(t){t||(t=new p.M);const e=this.points;let n=1/0,r=-1/0,i=1/0,o=-1/0;for(let t=0,s=e.length;t<s;t+=2){const s=e[t],a=e[t+1];n=s<n?s:n,r=s>r?s:r,i=a<i?a:i,o=a>o?a:o}return t.x=n,t.width=r-n,t.y=i,t.height=o-i,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce(((t,e)=>`${t}, ${e}`),"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return(0,c.t6)("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return(0,c.t6)("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}const v=(t,e,n,r,i,o,s)=>{const a=t-n,l=e-r,c=Math.sqrt(a*a+l*l);return c>=i-o&&c<=i+s};class b{constructor(t=0,e=0,n=0,r=0,i=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=n,this.height=r,this.radius=i}getBounds(t){return t||(t=new p.M),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new b(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const n=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+n&&e<=this.y+this.height-n||t>=this.x+n&&t<=this.x+this.width-n)return!0;let r=t-(this.x+n),i=e-(this.y+n);const o=n*n;if(r*r+i*i<=o)return!0;if(r=t-(this.x+this.width-n),r*r+i*i<=o)return!0;if(i=e-(this.y+this.height-n),r*r+i*i<=o)return!0;if(r=t-(this.x+n),r*r+i*i<=o)return!0}return!1}strokeContains(t,e,n,r=.5){const{x:i,y:o,width:s,height:a,radius:l}=this,c=n*(1-r),h=n-c,u=i+l,d=o+l,f=i+s,p=o+a;return(t>=i-c&&t<=i+h||t>=f-h&&t<=f+c)&&e>=d&&e<=d+(a-2*l)||((e>=o-c&&e<=o+h||e>=p-h&&e<=p+c)&&t>=u&&t<=u+(s-2*l)||(t<u&&e<d&&v(t,e,u,d,l,h,c)||t>f-l&&e<d&&v(t,e,f-l,d,l,h,c)||t>f-l&&e>p-l&&v(t,e,f-l,p-l,l,h,c)||t<u&&e>p-l&&v(t,e,u,p-l,l,h,c)))}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}var x=n(378);const _=8,w=1.1920929e-7,S=1,C=.01,E=0,k=0;function T(t,e,n,r,i,o,s,a,l,c){const h=Math.min(.99,Math.max(0,c??x.GH.defaultOptions.bezierSmoothness));let u=(S-h)/1;return u*=u,function(t,e,n,r,i,o,s,a,l,c){A(t,e,n,r,i,o,s,a,l,c,0),l.push(s,a)}(e,n,r,i,o,s,a,l,t,u),t}function A(t,e,n,r,i,o,s,a,l,c,h){if(h>_)return;const u=Math.PI,d=(t+n)/2,f=(e+r)/2,p=(n+i)/2,m=(r+o)/2,y=(i+s)/2,g=(o+a)/2,v=(d+p)/2,b=(f+m)/2,x=(p+y)/2,S=(m+g)/2,T=(v+x)/2,M=(b+S)/2;if(h>0){let h=s-t,d=a-e;const f=Math.abs((n-s)*d-(r-a)*h),p=Math.abs((i-s)*d-(o-a)*h);let m,y;if(f>w&&p>w){if((f+p)*(f+p)<=c*(h*h+d*d)){if(E<C)return void l.push(T,M);const c=Math.atan2(o-r,i-n);if(m=Math.abs(c-Math.atan2(r-e,n-t)),y=Math.abs(Math.atan2(a-o,s-i)-c),m>=u&&(m=2*u-m),y>=u&&(y=2*u-y),m+y<E)return void l.push(T,M);if(0!==k){if(m>k)return void l.push(n,r);if(y>k)return void l.push(i,o)}}}else if(f>w){if(f*f<=c*(h*h+d*d)){if(E<C)return void l.push(T,M);if(m=Math.abs(Math.atan2(o-r,i-n)-Math.atan2(r-e,n-t)),m>=u&&(m=2*u-m),m<E)return l.push(n,r),void l.push(i,o);if(0!==k&&m>k)return void l.push(n,r)}}else if(p>w){if(p*p<=c*(h*h+d*d)){if(E<C)return void l.push(T,M);if(m=Math.abs(Math.atan2(a-o,s-i)-Math.atan2(o-r,i-n)),m>=u&&(m=2*u-m),m<E)return l.push(n,r),void l.push(i,o);if(0!==k&&m>k)return void l.push(i,o)}}else if(h=T-(t+s)/2,d=M-(e+a)/2,h*h+d*d<=c)return void l.push(T,M)}A(t,e,d,f,v,b,T,M,l,c,h+1),A(T,M,x,S,y,g,s,a,l,c,h+1)}const M=8,P=1.1920929e-7,O=.01,I=0;function L(t,e,n,r,i,o,s,a){let l=(1-Math.min(.99,Math.max(0,a??x.GH.defaultOptions.bezierSmoothness)))/1;return l*=l,function(t,e,n,r,i,o,s,a){j(s,t,e,n,r,i,o,a,0),s.push(i,o)}(e,n,r,i,o,s,t,l),t}function j(t,e,n,r,i,o,s,a,l){if(l>M)return;const c=Math.PI,h=(e+r)/2,u=(n+i)/2,d=(r+o)/2,f=(i+s)/2,p=(h+d)/2,m=(u+f)/2;let y=o-e,g=s-n;const v=Math.abs((r-o)*g-(i-s)*y);if(v>P){if(v*v<=a*(y*y+g*g)){if(I<O)return void t.push(p,m);let a=Math.abs(Math.atan2(s-i,o-r)-Math.atan2(i-n,r-e));if(a>=c&&(a=2*c-a),a<I)return void t.push(p,m)}}else if(y=p-(e+o)/2,g=m-(n+s)/2,y*y+g*g<=a)return void t.push(p,m);j(t,e,n,h,u,p,m,a,l+1),j(t,p,m,d,f,o,s,a,l+1)}function R(t,e,n,r,i,o,s,a){let l=Math.abs(i-o);(!s&&i>o||s&&o>i)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(l/Math.PI))));let c=l/(a=Math.max(a,3)),h=i;c*=s?-1:1;for(let i=0;i<a+1;i++){const i=e+Math.cos(h)*r,o=n+Math.sin(h)*r;t.push(i,o),h+=c}}const D=2*Math.PI,N={centerX:0,centerY:0,ang1:0,ang2:0},F=({x:t,y:e},n,r,i,o,s,a,l)=>{const c=i*(t*=n)-o*(e*=r),h=o*t+i*e;return l.x=c+s,l.y=h+a,l};function B(t,e){const n=-1.5707963267948966===e?-.551915024494:4/3*Math.tan(e/4),r=1.5707963267948966===e?.551915024494:n,i=Math.cos(t),o=Math.sin(t),s=Math.cos(t+e),a=Math.sin(t+e);return[{x:i-o*r,y:o+i*r},{x:s+a*r,y:a-s*r},{x:s,y:a}]}const G=(t,e,n,r)=>{let i=t*n+e*r;return i>1&&(i=1),i<-1&&(i=-1),(t*r-e*n<0?-1:1)*Math.acos(i)};function z(t,e,n,r,i,o,s,a=0,l=0,c=0){if(0===o||0===s)return;const h=Math.sin(a*D/360),u=Math.cos(a*D/360),d=u*(e-r)/2+h*(n-i)/2,f=-h*(e-r)/2+u*(n-i)/2;if(0===d&&0===f)return;o=Math.abs(o),s=Math.abs(s);const p=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(s,2);p>1&&(o*=Math.sqrt(p),s*=Math.sqrt(p)),((t,e,n,r,i,o,s,a,l,c,h,u,d)=>{const f=Math.pow(i,2),p=Math.pow(o,2),m=Math.pow(h,2),y=Math.pow(u,2);let g=f*p-f*y-p*m;g<0&&(g=0),g/=f*y+p*m,g=Math.sqrt(g)*(s===a?-1:1);const v=g*i/o*u,b=g*-o/i*h,x=c*v-l*b+(t+n)/2,_=l*v+c*b+(e+r)/2,w=(h-v)/i,S=(u-b)/o,C=(-h-v)/i,E=(-u-b)/o,k=G(1,0,w,S);let T=G(w,S,C,E);0===a&&T>0&&(T-=D),1===a&&T<0&&(T+=D),d.centerX=x,d.centerY=_,d.ang1=k,d.ang2=T})(e,n,r,i,o,s,l,c,h,u,d,f,N);let{ang1:m,ang2:y}=N;const{centerX:g,centerY:v}=N;let b=Math.abs(y)/(D/4);Math.abs(1-b)<1e-7&&(b=1);const x=Math.max(Math.ceil(b),1);y/=x;let _=t[t.length-2],w=t[t.length-1];const S={x:0,y:0};for(let e=0;e<x;e++){const e=B(m,y),{x:n,y:r}=F(e[0],o,s,u,h,g,v,S),{x:i,y:a}=F(e[1],o,s,u,h,g,v,S),{x:l,y:c}=F(e[2],o,s,u,h,g,v,S);T(t,_,w,n,r,i,a,l,c),_=l,w=c,m+=y}}const U=new p.M;class W{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new h.c,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const n=this._currentPoly.points,r=n[n.length-2],i=n[n.length-1];return r===t&&i===e||n.push(t,e),this}arc(t,e,n,r,i,o){this._ensurePoly(!1);return R(this._currentPoly.points,t,e,n,r,i,o),this}arcTo(t,e,n,r,i){this._ensurePoly();return function(t,e,n,r,i,o){const s=t[t.length-2],a=t[t.length-1]-n,l=s-e,c=i-n,h=r-e,u=Math.abs(a*h-l*c);if(u<1e-8||0===o)return void(t[t.length-2]===e&&t[t.length-1]===n||t.push(e,n));const d=a*a+l*l,f=c*c+h*h,p=a*c+l*h,m=o*Math.sqrt(d)/u,y=o*Math.sqrt(f)/u,g=m*p/d,v=y*p/f,b=m*h+y*l,x=m*c+y*a,_=l*(y+g),w=a*(y+g),S=h*(m+v),C=c*(m+v);R(t,b+e,x+n,o,Math.atan2(w-x,_-b),Math.atan2(C-x,S-b),l*c>h*a)}(this._currentPoly.points,t,e,n,r,i),this}arcToSvg(t,e,n,r,i,o,s){return z(this._currentPoly.points,this._currentPoly.lastX,this._currentPoly.lastY,o,s,t,e,n,r,i),this}bezierCurveTo(t,e,n,r,i,o,s){this._ensurePoly();const a=this._currentPoly;return T(this._currentPoly.points,a.lastX,a.lastY,t,e,n,r,i,o,s),this}quadraticCurveTo(t,e,n,r,i){this._ensurePoly();const o=this._currentPoly;return L(this._currentPoly.points,o.lastX,o.lastY,t,e,n,r,i),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0)).transform(e);const n=this.shapePrimitives,r=n.length;for(let e=0;e<t.instructions.length;e++){const n=t.instructions[e];this[n.action](...n.data)}if(t.checkForHoles&&n.length-r>1){let t=null;for(let e=r;e<n.length;e++){const r=n[e];if("polygon"===r.shape.type){const i=r.shape,o=t?.shape;o&&o.containsPolygon(i)?(t.holes||(t.holes=[]),t.holes.push(r),n.copyWithin(e,e+1),n.length--,e--):t=r}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,n,r,i){return this.drawShape(new p.M(t,e,n,r),i),this}circle(t,e,n,r){return this.drawShape(new f.j(t,e,n),r),this}poly(t,e,n){const r=new g(t);return r.closePath=e,this.drawShape(r,n),this}regularPoly(t,e,n,r,i=0,o){r=Math.max(0|r,3);const s=-1*Math.PI/2+i,a=2*Math.PI/r,l=[];for(let i=0;i<r;i++){const r=s-i*a;l.push(t+n*Math.cos(r),e+n*Math.sin(r))}return this.poly(l,!0,o),this}roundPoly(t,e,n,r,i,o=0,s){if(r=Math.max(0|r,3),i<=0)return this.regularPoly(t,e,n,r,o);const a=n*Math.sin(Math.PI/r)-.001;i=Math.min(i,a);const l=-1*Math.PI/2+o,c=2*Math.PI/r,h=(r-2)*Math.PI/r/2;for(let o=0;o<r;o++){const r=o*c+l,a=t+n*Math.cos(r),u=e+n*Math.sin(r),d=r+Math.PI+h,f=r-Math.PI-h,p=a+i*Math.cos(d),m=u+i*Math.sin(d),y=a+i*Math.cos(f),g=u+i*Math.sin(f);0===o?this.moveTo(p,m):this.lineTo(p,m),this.quadraticCurveTo(a,u,y,g,s)}return this.closePath()}roundShape(t,e,n=!1,r){return t.length<3?this:(n?function(t,e,n,r){const i=(t,e)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),o=(t,e,n)=>({x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n}),s=e.length;for(let a=0;a<s;a++){const l=e[(a+1)%s],c=l.radius??n;if(c<=0){0===a?t.moveTo(l.x,l.y):t.lineTo(l.x,l.y);continue}const h=e[a],u=e[(a+2)%s],d=i(h,l);let f;f=d<1e-4?l:o(l,h,Math.min(d/2,c)/d);const p=i(u,l);let m;m=p<1e-4?l:o(l,u,Math.min(p/2,c)/p),0===a?t.moveTo(f.x,f.y):t.lineTo(f.x,f.y),t.quadraticCurveTo(l.x,l.y,m.x,m.y,r)}}(this,t,e,r):function(t,e,n){const r=(t,e)=>{const n=e.x-t.x,r=e.y-t.y,i=Math.sqrt(n*n+r*r);return{len:i,nx:n/i,ny:r/i}},i=(e,n)=>{0===e?t.moveTo(n.x,n.y):t.lineTo(n.x,n.y)};let o=e[e.length-1];for(let s=0;s<e.length;s++){const a=e[s%e.length],l=a.radius??n;if(l<=0){i(s,a),o=a;continue}const c=e[(s+1)%e.length],h=r(a,o),u=r(a,c);if(h.len<1e-4||u.len<1e-4){i(s,a),o=a;continue}let d=Math.asin(h.nx*u.ny-h.ny*u.nx),f=1,p=!1;h.nx*u.nx-h.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,p=!0):d>0&&(f=-1,p=!0);const m=d/2;let y,g=Math.abs(Math.cos(m)*l/Math.sin(m));g>Math.min(h.len/2,u.len/2)?(g=Math.min(h.len/2,u.len/2),y=Math.abs(g*Math.sin(m)/Math.cos(m))):y=l;const v=a.x+u.nx*g+-u.ny*y*f,b=a.y+u.ny*g+u.nx*y*f,x=Math.atan2(h.ny,h.nx)+Math.PI/2*f,_=Math.atan2(u.ny,u.nx)-Math.PI/2*f;0===s&&t.moveTo(v+Math.cos(x)*y,b+Math.sin(x)*y),t.arc(v,b,y,x,_,p),o=a}}(this,t,e),this.closePath())}filletRect(t,e,n,r,i){if(0===i)return this.rect(t,e,n,r);const o=Math.min(n,r)/2,s=Math.min(o,Math.max(-o,i)),a=t+n,l=e+r,c=s<0?-s:0,h=Math.abs(s);return this.moveTo(t,e+h).arcTo(t+c,e+c,t+h,e,h).lineTo(a-h,e).arcTo(a-c,e+c,a,e+h,h).lineTo(a,l-h).arcTo(a-c,l-c,t+n-h,l,h).lineTo(t+h,l).arcTo(t+c,l-c,t,l-h,h).closePath()}chamferRect(t,e,n,r,i,o){if(i<=0)return this.rect(t,e,n,r);const s=Math.min(i,Math.min(n,r)/2),a=t+n,l=e+r,c=[t+s,e,a-s,e,a,e+s,a,l-s,a-s,l,t+s,l,t,l-s,t,e+s];for(let t=c.length-1;t>=2;t-=2)c[t]===c[t-2]&&c[t-1]===c[t-3]&&c.splice(t-1,2);return this.poly(c,!0,o)}ellipse(t,e,n,r,i){return this.drawShape(new m(t,e,n,r),i),this}roundRect(t,e,n,r,i,o){return this.drawShape(new b(t,e,n,r,i),o),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let n=this._currentPoly;return n&&this.endPoly(),n=new g,n.points.push(t,e),this._currentPoly=n,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new g,t)){const t=this.shapePrimitives[this.shapePrimitives.length-1];if(t){let e=t.shape.x,n=t.shape.y;if(t.transform&&!t.transform.isIdentity()){const r=t.transform,i=e;e=r.a*e+r.c*n+r.tx,n=r.b*i+r.d*n+r.ty}this._currentPoly.points.push(e,n)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const n=t.instructions[e];this[n.action](...n.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let n=0;n<e.length;n++){const r=e[n],i=r.shape.getBounds(U);r.transform?t.addRect(i,r.transform):t.addRect(i)}return t}}class H{constructor(t,e=!1){this.instructions=[],this.uid=(0,l.L)("graphicsPath"),this._dirty=!0,this.checkForHoles=e,"string"==typeof t?function(t,e){const n=d(t),r=[];let i=null,o=0,s=0;for(let t=0;t<n.length;t++){const a=n[t],l=a[0],c=a;switch(l){case"M":o=c[1],s=c[2],e.moveTo(o,s);break;case"m":o+=c[1],s+=c[2],e.moveTo(o,s);break;case"H":o=c[1],e.lineTo(o,s);break;case"h":o+=c[1],e.lineTo(o,s);break;case"V":s=c[1],e.lineTo(o,s);break;case"v":s+=c[1],e.lineTo(o,s);break;case"L":o=c[1],s=c[2],e.lineTo(o,s);break;case"l":o+=c[1],s+=c[2],e.lineTo(o,s);break;case"C":o=c[5],s=c[6],e.bezierCurveTo(c[1],c[2],c[3],c[4],o,s);break;case"c":e.bezierCurveTo(o+c[1],s+c[2],o+c[3],s+c[4],o+c[5],s+c[6]),o+=c[5],s+=c[6];break;case"S":o=c[3],s=c[4],e.bezierCurveToShort(c[1],c[2],o,s);break;case"s":e.bezierCurveToShort(o+c[1],s+c[2],o+c[3],s+c[4]),o+=c[3],s+=c[4];break;case"Q":o=c[3],s=c[4],e.quadraticCurveTo(c[1],c[2],o,s);break;case"q":e.quadraticCurveTo(o+c[1],s+c[2],o+c[3],s+c[4]),o+=c[3],s+=c[4];break;case"T":o=c[1],s=c[2],e.quadraticCurveToShort(o,s);break;case"t":o+=c[1],s+=c[2],e.quadraticCurveToShort(o,s);break;case"A":o=c[6],s=c[7],e.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,s);break;case"a":o+=c[6],s+=c[7],e.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,s);break;case"Z":case"z":e.closePath(),r.length>0&&(i=r.pop(),i?(o=i.startX,s=i.startY):(o=0,s=0)),i=null;break;default:(0,u.R)(`Unknown SVG path command: ${l}`)}"Z"!==l&&"z"!==l&&null===i&&(i={startX:o,startY:s},r.push(i))}}(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new W(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,n,r,i){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(s.b.shared);let l=0,c=0;if(o&&"bezierCurveTo"===o.action){l=o.data[2],c=o.data[3];const t=a.x,e=a.y;l=t+(t-l),c=e+(e-c)}else l=a.x,c=a.y;return this.instructions.push({action:"bezierCurveTo",data:[l,c,t,e,n,r,i]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,n){const r=this.instructions[this.instructions.length-1],i=this.getLastPoint(s.b.shared);let o=0,a=0;if(r&&"quadraticCurveTo"===r.action){o=r.data[0],a=r.data[1];const t=i.x,e=i.y;o=t+(t-o),a=e+(e-a)}else o=i.x,a=i.y;return this.instructions.push({action:"quadraticCurveTo",data:[o,a,t,e,n]}),this._dirty=!0,this}rect(t,e,n,r,i){return this.instructions.push({action:"rect",data:[t,e,n,r,i]}),this._dirty=!0,this}circle(t,e,n,r){return this.instructions.push({action:"circle",data:[t,e,n,r]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,n,r,i,o,s){i||(i=r/2);const a=-1*Math.PI/2+o,l=2*n,c=2*Math.PI/l,h=[];for(let n=0;n<l;n++){const o=n%2?i:r,s=n*c+a;h.push(t+o*Math.cos(s),e+o*Math.sin(s))}return this.poly(h,!0,s),this}clone(t=!1){const e=new H;if(e.checkForHoles=this.checkForHoles,t)for(let t=0;t<this.instructions.length;t++){const n=this.instructions[t];e.instructions.push({action:n.action,data:n.data.slice()})}else e.instructions=this.instructions.slice();return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;const e=t.a,n=t.b,r=t.c,i=t.d,o=t.tx,s=t.ty;let a=0,l=0,c=0,h=0,d=0,f=0,p=0,m=0;for(let y=0;y<this.instructions.length;y++){const g=this.instructions[y],v=g.data;switch(g.action){case"moveTo":case"lineTo":a=v[0],l=v[1],v[0]=e*a+r*l+o,v[1]=n*a+i*l+s;break;case"bezierCurveTo":c=v[0],h=v[1],d=v[2],f=v[3],a=v[4],l=v[5],v[0]=e*c+r*h+o,v[1]=n*c+i*h+s,v[2]=e*d+r*f+o,v[3]=n*d+i*f+s,v[4]=e*a+r*l+o,v[5]=n*a+i*l+s;break;case"quadraticCurveTo":c=v[0],h=v[1],a=v[2],l=v[3],v[0]=e*c+r*h+o,v[1]=n*c+i*h+s,v[2]=e*a+r*l+o,v[3]=n*a+i*l+s;break;case"arcToSvg":a=v[5],l=v[6],p=v[0],m=v[1],v[0]=e*p+r*m,v[1]=n*p+i*m,v[5]=e*a+r*l+o,v[6]=n*a+i*l+s;break;case"circle":v[4]=V(v[3],t);break;case"rect":v[4]=V(v[4],t);break;case"ellipse":v[8]=V(v[8],t);break;case"roundRect":v[5]=V(v[5],t);break;case"addPath":v[0].transform(t);break;case"poly":v[2]=V(v[2],t);break;default:(0,u.R)("unknown transform action",g.action)}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,n=this.instructions[e];if(!n)return t.x=0,t.y=0,t;for(;"closePath"===n.action;){if(e--,e<0)return t.x=0,t.y=0,t;n=this.instructions[e]}switch(n.action){case"moveTo":case"lineTo":t.x=n.data[0],t.y=n.data[1];break;case"quadraticCurveTo":t.x=n.data[2],t.y=n.data[3];break;case"bezierCurveTo":t.x=n.data[4],t.y=n.data[5];break;case"arc":case"arcToSvg":t.x=n.data[5],t.y=n.data[6];break;case"addPath":n.data[0].getLastPoint(t)}return t}}function V(t,e){return t?t.prepend(e):e.clone()}var Y=n(7276);function X(t,e,n){const r=t.getAttribute(e);return r?Number(r):n}function $(t){const e=X(t,"x1",0),n=X(t,"y1",0),r=X(t,"x2",1),o=X(t,"y2",0),s=t.getAttribute("gradientUnits")||"objectBoundingBox",a=new Y._(e,n,r,o,"objectBoundingBox"===s?"local":"global");for(let e=0;e<t.children.length;e++){const n=t.children[e],r=X(n,"offset",0),o=i.Q.shared.setValue(n.getAttribute("stop-color")).toNumber();a.addColorStop(r,o)}return a}function q(t){return(0,u.R)("[SVG Parser] Radial gradients are not yet supported"),new Y._(0,0,1,0)}function K(t){const e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}const Z={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}};function J(t,e){const n=t.getAttribute("style"),r={},i={},o={strokeStyle:r,fillStyle:i,useFill:!1,useStroke:!1};for(const n in Z){const r=t.getAttribute(n);r&&Q(e,o,n,r.trim())}if(n){const t=n.split(";");for(let n=0;n<t.length;n++){const r=t[n].trim(),[i,s]=r.split(":");Z[i]&&Q(e,o,i,s.trim())}}return{strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?i:null,useFill:o.useFill,useStroke:o.useStroke}}function Q(t,e,n,r){switch(n){case"stroke":if("none"!==r){if(r.startsWith("url(")){const n=K(r);e.strokeStyle.fill=t.defs[n]}else e.strokeStyle.color=i.Q.shared.setValue(r).toNumber();e.useStroke=!0}break;case"stroke-width":e.strokeStyle.width=Number(r);break;case"fill":if("none"!==r){if(r.startsWith("url(")){const n=K(r);e.fillStyle.fill=t.defs[n]}else e.fillStyle.color=i.Q.shared.setValue(r).toNumber();e.useFill=!0}break;case"fill-opacity":e.fillStyle.alpha=Number(r);break;case"stroke-opacity":e.strokeStyle.alpha=Number(r);break;case"opacity":e.fillStyle.alpha=Number(r),e.strokeStyle.alpha=Number(r)}}function tt(t){const e=t.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!e||e.length<4)return 0;const n=e.map(Number),r=[],i=[];for(let t=0;t<n.length;t+=2)t+1<n.length&&(r.push(n[t]),i.push(n[t+1]));if(0===r.length||0===i.length)return 0;const o=Math.min(...r),s=Math.max(...r),a=Math.min(...i);return(s-o)*(Math.max(...i)-a)}function et(t,e){const n=new H(t,!1);for(const t of n.instructions)e.instructions.push(t)}function nt(t,e){if("string"==typeof t){const e=document.createElement("div");e.innerHTML=t.trim(),t=e.querySelector("svg")}const n={context:e,defs:{},path:new H};!function(t,e){const n=t.querySelectorAll("defs");for(let t=0;t<n.length;t++){const r=n[t];for(let t=0;t<r.children.length;t++){const n=r.children[t];switch(n.nodeName.toLowerCase()){case"lineargradient":e.defs[n.id]=$(n);break;case"radialgradient":e.defs[n.id]=q()}}}}(t,n);const r=t.children,{fillStyle:i,strokeStyle:o}=J(t,n);for(let t=0;t<r.length;t++){const e=r[t];"defs"!==e.nodeName.toLowerCase()&&rt(e,n,i,o)}return e}function rt(t,e,n,r){const i=t.children,{fillStyle:o,strokeStyle:s}=J(t,e);o&&n?n={...n,...o}:o&&(n=o),s&&r?r={...r,...s}:s&&(r=s);const a=!n&&!r;let l,c,h,d,f,p,m,y,g,v,b,x,_,w,S,C,E;switch(a&&(n={color:0}),t.nodeName.toLowerCase()){case"path":{w=t.getAttribute("d");const i=t.getAttribute("fill-rule"),o=w.split(/(?=[Mm])/).filter((t=>t.trim().length>0)),s="evenodd"===i,a=o.length>1;if(s&&a){const t=o.map((t=>({path:t,area:tt(t)})));t.sort(((t,e)=>e.area-t.area));const i=o.length>3||!function(t){if(t.length<=2)return!0;const e=t.map((t=>t.area)).sort(((t,e)=>e-t)),[n,r]=e,i=e[e.length-1];return!(n/r>3&&r/i<2)}(t);if(i)for(let i=0;i<t.length;i++){const o=t[i],s=0===i;e.context.beginPath();const a=new H(void 0,!0);et(o.path,a),e.context.path(a),s?(n&&e.context.fill(n),r&&e.context.stroke(r)):e.context.cut()}else for(let i=0;i<t.length;i++){const o=t[i],s=i%2==1;e.context.beginPath();const a=new H(void 0,!0);et(o.path,a),e.context.path(a),s?e.context.cut():(n&&e.context.fill(n),r&&e.context.stroke(r))}}else{S=new H(w,!i||"evenodd"===i),e.context.path(S),n&&e.context.fill(n),r&&e.context.stroke(r)}break}case"circle":m=X(t,"cx",0),y=X(t,"cy",0),g=X(t,"r",0),e.context.ellipse(m,y,g,g),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"rect":l=X(t,"x",0),c=X(t,"y",0),C=X(t,"width",0),E=X(t,"height",0),v=X(t,"rx",0),b=X(t,"ry",0),v||b?e.context.roundRect(l,c,C,E,v||b):e.context.rect(l,c,C,E),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"ellipse":m=X(t,"cx",0),y=X(t,"cy",0),v=X(t,"rx",0),b=X(t,"ry",0),e.context.beginPath(),e.context.ellipse(m,y,v,b),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"line":h=X(t,"x1",0),d=X(t,"y1",0),f=X(t,"x2",0),p=X(t,"y2",0),e.context.beginPath(),e.context.moveTo(h,d),e.context.lineTo(f,p),r&&e.context.stroke(r);break;case"polygon":_=t.getAttribute("points"),x=_.match(/-?\d+/g).map((t=>parseInt(t,10))),e.context.poly(x,!0),n&&e.context.fill(n),r&&e.context.stroke(r);break;case"polyline":_=t.getAttribute("points"),x=_.match(/-?\d+/g).map((t=>parseInt(t,10))),e.context.poly(x,!1),r&&e.context.stroke(r);break;case"g":case"svg":break;default:(0,u.R)(`[SVG parser] <${t.nodeName}> elements unsupported`)}a&&(n=null);for(let t=0;t<i.length;t++)rt(i[t],e,n,r)}var it=n(990);function ot(t,e){let n=1;const r=t.shapePath.shapePrimitives;for(let t=0;t<r.length;t++){const i=r[t].shape;if("polygon"!==i.type)continue;const o=i.points,s=o.length;if(s<6)continue;const a=i.closePath;for(let t=0;t<s;t+=2){if(!a&&(0===t||t===s-2))continue;const r=(t-2+s)%s,i=(t+2)%s,l=o[r],c=o[r+1],h=o[t],u=o[t+1],d=l-h,f=c-u,p=o[i]-h,m=o[i+1]-u,y=d*d+f*f,g=p*p+m*m;if(y<1e-12||g<1e-12)continue;let v=(d*p+f*m)/Math.sqrt(y*g);v<-1?v=-1:v>1&&(v=1);const b=Math.sqrt(.5*(1-v));if(b<1e-6)continue;const x=Math.min(1/b,e);x>n&&(n=x)}}return n}const st=new s.b,at=new o.u,lt=class t extends r.A{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=(0,l.L)("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new H,this._transform=new o.u,this._fillStyle={...t.defaultFillStyle},this._strokeStyle={...t.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new h.c,this._boundsDirty=!0}clone(){const e=new t;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=(0,it.w)(e,t.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=(0,it.T)(e,t.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=(0,it.w)(e,t.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=(0,it.w)(e,t.defaultStrokeStyle),this}texture(t,e,n,r,o,s){return this.instructions.push({action:"texture",data:{image:t,dx:n||0,dy:r||0,dw:o||t.frame.width,dh:s||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e||0===e?i.Q.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new H,this}fill(e,n){let r;const i=this.instructions[this.instructions.length-1];return r=0===this._tick&&"stroke"===i?.action?i.data.path:this._activePath.clone(),r?(null!=e&&(void 0!==n&&"number"==typeof e&&((0,c.t6)(c.lj,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:n}),this._fillStyle=(0,it.w)(e,t.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(s.b.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(e){let n;const r=this.instructions[this.instructions.length-1];return n=0===this._tick&&"fill"===r?.action?r.data.path:this._activePath.clone(),n?(null!=e&&(this._strokeStyle=(0,it.T)(e,t.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:n}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){const e=this.instructions[this.instructions.length-1-t],n=this._activePath.clone();if(e&&("stroke"===e.action||"fill"===e.action)){if(!e.data.hole){e.data.hole=n;break}e.data.hole.addPath(n)}}return this._initNextPathLocation(),this}arc(t,e,n,r,i,o){this._tick++;const s=this._transform;return this._activePath.arc(s.a*t+s.c*e+s.tx,s.b*t+s.d*e+s.ty,n,r,i,o),this}arcTo(t,e,n,r,i){this._tick++;const o=this._transform;return this._activePath.arcTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*n+o.c*r+o.tx,o.b*n+o.d*r+o.ty,i),this}arcToSvg(t,e,n,r,i,o,s){this._tick++;const a=this._transform;return this._activePath.arcToSvg(t,e,n,r,i,a.a*o+a.c*s+a.tx,a.b*o+a.d*s+a.ty),this}bezierCurveTo(t,e,n,r,i,o,s){this._tick++;const a=this._transform;return this._activePath.bezierCurveTo(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,a.a*n+a.c*r+a.tx,a.b*n+a.d*r+a.ty,a.a*i+a.c*o+a.tx,a.b*i+a.d*o+a.ty,s),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,n,r){return this._tick++,this._activePath.ellipse(t,e,n,r,this._transform.clone()),this}circle(t,e,n){return this._tick++,this._activePath.circle(t,e,n,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const n=this._transform;return this._activePath.lineTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty),this}moveTo(t,e){this._tick++;const n=this._transform,r=this._activePath.instructions,i=n.a*t+n.c*e+n.tx,o=n.b*t+n.d*e+n.ty;return 1===r.length&&"moveTo"===r[0].action?(r[0].data[0]=i,r[0].data[1]=o,this):(this._activePath.moveTo(i,o),this)}quadraticCurveTo(t,e,n,r,i){this._tick++;const o=this._transform;return this._activePath.quadraticCurveTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*n+o.c*r+o.tx,o.b*n+o.d*r+o.ty,i),this}rect(t,e,n,r){return this._tick++,this._activePath.rect(t,e,n,r,this._transform.clone()),this}roundRect(t,e,n,r,i){return this._tick++,this._activePath.roundRect(t,e,n,r,i,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,n,r,i=0,o){return this._tick++,this._activePath.regularPoly(t,e,n,r,i,o),this}roundPoly(t,e,n,r,i,o){return this._tick++,this._activePath.roundPoly(t,e,n,r,i,o),this}roundShape(t,e,n,r){return this._tick++,this._activePath.roundShape(t,e,n,r),this}filletRect(t,e,n,r,i){return this._tick++,this._activePath.filletRect(t,e,n,r,i),this}chamferRect(t,e,n,r,i,o){return this._tick++,this._activePath.chamferRect(t,e,n,r,i,o),this}star(t,e,n,r,i=0,o=0){return this._tick++,this._activePath.star(t,e,n,r,i,o,this._transform.clone()),this}svg(t){return this._tick++,nt(t,this),this}restore(){const t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,n,r,i,s){return t instanceof o.u?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,n,r,i,s),this)}transform(t,e,n,r,i,s){return t instanceof o.u?(this._transform.append(t),this):(at.set(t,e,n,r,i,s),this._transform.append(at),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this._boundsDirty=!0,this.dirty=!0,this.emit("update",this,16)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;const t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const n=this.instructions[e],r=n.action;if("fill"===r){const e=n.data;t.addBounds(e.path.bounds)}else if("texture"===r){const e=n.data;t.addFrame(e.dx,e.dy,e.dx+e.dw,e.dy+e.dh,e.transform)}if("stroke"===r){const e=n.data,r=e.style.alignment;let i=e.style.width*(1-r);"miter"===e.style.join&&(i*=ot(e.path,e.style.miterLimit));const o=e.path.bounds;t.addFrame(o.minX-i,o.minY-i,o.maxX+i,o.maxY+i)}}return t.isValid||t.set(0,0,0,0),t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;const e=this.instructions;let n=!1;for(let r=0;r<e.length;r++){const i=e[r],o=i.data,s=o.path;if(!i.action||!s)continue;const a=o.style,l=s.shapePath.shapePrimitives;for(let e=0;e<l.length;e++){const r=l[e].shape;if(!a||!r)continue;const s=l[e].transform,c=s?s.applyInverse(t,st):t;if("fill"===i.action)n=r.contains(c.x,c.y);else{const t=a;n=r.strokeContains(c.x,c.y,t.width,t.alignment)}const h=o.hole;if(h){const t=h.shapePath?.shapePrimitives;if(t)for(let e=0;e<t.length;e++)t[e].shape.contains(c.x,c.y)&&(n=!1)}if(n)return!0}}return n}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0,this._stateStack.length=0,this._transform=null,this.unload(),this.emit("destroy",this),this.removeAllListeners();if("boolean"==typeof t?t:t?.texture){const e="boolean"==typeof t?t:t?.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(e)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(e))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};lt.defaultFillStyle={color:16777215,alpha:1,texture:a.g.WHITE,matrix:null,fill:null,textureSpace:"local"},lt.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:a.g.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let ct=lt},378:(t,e,n)=>{n.d(e,{GH:()=>p});var r=n(8507),i=n(341),o=n(2043),s=n(848),a=n(4334),l=n(4670),c=n(8655),h=n(2801);class u{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach((t=>{c.Z.return(t)})),this.graphicsData&&c.Z.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}}class d{constructor(){this.instructions=new s.L}init(t){const e=t.maxTextures;this.batcher?this.batcher._updateMaxTextures(e):this.batcher=new o.J({maxTextures:e}),this.instructions.reset()}get geometry(){return(0,l.t6)(l.Ek,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}}const f=class t{constructor(t){this._renderer=t,this._managedContexts=new a.s({renderer:t,type:"resource",name:"graphicsContext"})}init(e){t.defaultOptions.bezierSmoothness=e?.bezierSmoothness??t.defaultOptions.bezierSmoothness}getContextRenderData(t){return t._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=!!t._gpuData[this._renderer.uid],n=t._gpuData[this._renderer.uid]||this._initContext(t);if(t.dirty||!e){e&&n.reset(),(0,h.M)(t,n);const r=t.batchMode;t.customShader||"no-batch"===r?n.isBatchable=!1:n.isBatchable="auto"!==r||n.geometryData.vertices.length<400,t.dirty=!1}return n}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=c.Z.get(d,{maxTextures:this._renderer.limits.maxBatchableTextures}),n=t._gpuData[this._renderer.uid],{batches:r,geometryData:o}=n;n.graphicsData=e;const s=o.vertices.length,a=o.indices.length;for(let t=0;t<r.length;t++)r[t].applyTransform=!1;const l=e.batcher;l.ensureAttributeBuffer(s),l.ensureIndexBuffer(a),l.begin();for(let t=0;t<r.length;t++){const e=r[t];l.add(e)}l.finish(e.instructions);const h=l.geometry;h.indexBuffer.setDataWithSize(l.indexBuffer,l.indexSize,!0),h.buffers[0].setDataWithSize(l.attributeBuffer.float32View,l.attributeSize,!0);const u=l.batches;for(let t=0;t<u.length;t++){const e=u[t];e.bindGroup=(0,i.w)(e.textures.textures,e.textures.count,this._renderer.limits.maxBatchableTextures)}return e}_initContext(t){const e=new u;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};f.extension={type:[r.Ag.WebGLSystem,r.Ag.WebGPUSystem],name:"graphicsContext"},f.defaultOptions={bezierSmoothness:.5};let p=f},115:(t,e,n)=>{n.d(e,{h:()=>a});var r=n(5101),i=n(4928);function o(t,e,n,r,i,o,s,a){let l,c;s?(l=r,c=-n):(l=-r,c=n);const h=t-n*i+l,u=e-r*i+c,d=t+n*o+l,f=e+r*o+c;return a.push(h,u),a.push(d,f),2}function s(t,e,n,r,i,o,s,a){const l=n-t,c=r-e;let h=Math.atan2(l,c),u=Math.atan2(i-t,o-e);a&&h<u?h+=2*Math.PI:!a&&h>u&&(u+=2*Math.PI);let d=h;const f=u-h,p=Math.abs(f),m=Math.sqrt(l*l+c*c),y=1+(15*p*Math.sqrt(m)/Math.PI|0),g=f/y;if(d+=g,a){s.push(t,e),s.push(n,r);for(let n=1,r=d;n<y;n++,r+=g)s.push(t,e),s.push(t+Math.sin(r)*m,e+Math.cos(r)*m);s.push(t,e),s.push(i,o)}else{s.push(n,r),s.push(t,e);for(let n=1,r=d;n<y;n++,r+=g)s.push(t+Math.sin(r)*m,e+Math.cos(r)*m),s.push(t,e);s.push(i,o),s.push(t,e)}return 2*y}function a(t,e,n,a,l,c){const h=i.B;if(0===t.length)return;const u=e;let d=u.alignment;if(.5!==e.alignment){let e=function(t){const e=t.length;if(e<6)return 1;let n=0;for(let r=0,i=t[e-2],o=t[e-1];r<e;r+=2){const e=t[r],s=t[r+1];n+=(e-i)*(s+o),i=e,o=s}return n<0?-1:1}(t);n&&(e*=-1),d=(d-.5)*e+.5}const f=new r.b(t[0],t[1]),p=new r.b(t[t.length-2],t[t.length-1]),m=a,y=Math.abs(f.x-p.x)<h&&Math.abs(f.y-p.y)<h;if(m){t=t.slice(),y&&(t.pop(),t.pop(),p.set(t[t.length-2],t[t.length-1]));const e=.5*(f.x+p.x),n=.5*(p.y+f.y);t.unshift(e,n),t.push(e,n)}const g=l,v=t.length/2;let b=t.length;const x=g.length/2,_=u.width/2,w=_*_,S=u.miterLimit*u.miterLimit;let C=t[0],E=t[1],k=t[2],T=t[3],A=0,M=0,P=-(E-T),O=C-k,I=0,L=0,j=Math.sqrt(P*P+O*O);P/=j,O/=j,P*=_,O*=_;const R=2*(1-d),D=2*d;m||("round"===u.cap?b+=s(C-P*(R-D)*.5,E-O*(R-D)*.5,C-P*R,E-O*R,C+P*D,E+O*D,g,!0)+2:"square"===u.cap&&(b+=o(C,E,P,O,R,D,!0,g))),g.push(C-P*R,E-O*R),g.push(C+P*D,E+O*D);for(let e=1;e<v-1;++e){C=t[2*(e-1)],E=t[2*(e-1)+1],k=t[2*e],T=t[2*e+1],A=t[2*(e+1)],M=t[2*(e+1)+1],P=-(E-T),O=C-k,j=Math.sqrt(P*P+O*O),P/=j,O/=j,P*=_,O*=_,I=-(T-M),L=k-A,j=Math.sqrt(I*I+L*L),I/=j,L/=j,I*=_,L*=_;const n=k-C,r=E-T,i=k-A,o=M-T,a=n*i+r*o,l=r*i-o*n,c=l<0;if(Math.abs(l)<.001*Math.abs(a)){g.push(k-P*R,T-O*R),g.push(k+P*D,T+O*D),a>=0&&("round"===u.join?b+=s(k,T,k-P*R,T-O*R,k-I*R,T-L*R,g,!1)+4:b+=2,g.push(k-I*D,T-L*D),g.push(k+I*R,T+L*R));continue}const h=(-P+C)*(-O+T)-(-P+k)*(-O+E),d=(-I+A)*(-L+T)-(-I+k)*(-L+M),f=(n*d-i*h)/l,p=(o*h-r*d)/l,m=(f-k)*(f-k)+(p-T)*(p-T),y=k+(f-k)*R,v=T+(p-T)*R,x=k-(f-k)*D,N=T-(p-T)*D,F=c?R:D;m<=Math.min(n*n+r*r,i*i+o*o)+F*F*w?"bevel"===u.join||m/w>S?(c?(g.push(y,v),g.push(k+P*D,T+O*D),g.push(y,v),g.push(k+I*D,T+L*D)):(g.push(k-P*R,T-O*R),g.push(x,N),g.push(k-I*R,T-L*R),g.push(x,N)),b+=2):"round"===u.join?c?(g.push(y,v),g.push(k+P*D,T+O*D),b+=s(k,T,k+P*D,T+O*D,k+I*D,T+L*D,g,!0)+4,g.push(y,v),g.push(k+I*D,T+L*D)):(g.push(k-P*R,T-O*R),g.push(x,N),b+=s(k,T,k-P*R,T-O*R,k-I*R,T-L*R,g,!1)+4,g.push(k-I*R,T-L*R),g.push(x,N)):(g.push(y,v),g.push(x,N)):(g.push(k-P*R,T-O*R),g.push(k+P*D,T+O*D),"round"===u.join?b+=c?s(k,T,k+P*D,T+O*D,k+I*D,T+L*D,g,!0)+2:s(k,T,k-P*R,T-O*R,k-I*R,T-L*R,g,!1)+2:"miter"===u.join&&m/w<=S&&(c?(g.push(x,N),g.push(x,N)):(g.push(y,v),g.push(y,v)),b+=2),g.push(k-I*R,T-L*R),g.push(k+I*D,T+L*D),b+=2)}C=t[2*(v-2)],E=t[2*(v-2)+1],k=t[2*(v-1)],T=t[2*(v-1)+1],P=-(E-T),O=C-k,j=Math.sqrt(P*P+O*O),P/=j,O/=j,P*=_,O*=_,g.push(k-P*R,T-O*R),g.push(k+P*D,T+O*D),m||("round"===u.cap?b+=s(k-P*(R-D)*.5,T-O*(R-D)*.5,k-P*R,T-O*R,k+P*D,T+O*D,g,!1)+2:"square"===u.cap&&(b+=o(k,T,P,O,R,D,!1,g)));const N=i.I*i.I;for(let t=x;t<b+x-2;++t)C=g[2*t],E=g[2*t+1],k=g[2*(t+1)],T=g[2*(t+1)+1],A=g[2*(t+2)],M=g[2*(t+2)+1],Math.abs(C*(T-M)+k*(M-E)+A*(E-T))<N||c.push(t,t+1,t+2)}},4928:(t,e,n)=>{n.d(e,{B:()=>r,I:()=>i});const r=1e-4,i=1e-4},7276:(t,e,n)=>{n.d(e,{_:()=>f});var r=n(2577),i=n(1761),o=n(9313),s=n(8293),a=n(5589),l=n(133),c=n(4670),h=n(2698);const u=[{offset:0,color:"white"},{offset:1,color:"black"}],d=class t{constructor(...e){this.uid=(0,l.L)("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let n=function(t){let e=t[0]??{};("number"==typeof e||t[1])&&((0,c.t6)("8.5.2","use options object instead"),e={type:"linear",start:{x:t[0],y:t[1]},end:{x:t[2],y:t[3]},textureSpace:t[4],textureSize:t[5]??f.defaultLinearOptions.textureSize});return e}(e);n={..."radial"===n.type?t.defaultRadialOptions:t.defaultLinearOptions,...(0,h.S)(n)},this._textureSize=n.textureSize,this._wrapMode=n.wrapMode,"radial"===n.type?(this.center=n.center,this.outerCenter=n.outerCenter??this.center,this.innerRadius=n.innerRadius,this.outerRadius=n.outerRadius,this.scale=n.scale,this.rotation=n.rotation):(this.start=n.start,this.end=n.end),this.textureSpace=n.textureSpace,this.type=n.type,n.colorStops.forEach((t=>{this.addColorStop(t.offset,t.color)}))}addColorStop(t,e){return this.colorStops.push({offset:t,color:r.Q.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:n,y:r}=this.end,i=n-t,l=r-e;const c=i<0||l<0;if("clamp-to-edge"===this._wrapMode){if(i<0){const e=t;t=n,n=e,i*=-1}if(l<0){const t=e;e=r,r=t,l*=-1}}const h=this.colorStops.length?this.colorStops:u,d=this._textureSize,{canvas:f,context:y}=m(d,1),g=c?y.createLinearGradient(this._textureSize,0,0,0):y.createLinearGradient(0,0,this._textureSize,0);p(g,h),y.fillStyle=g,y.fillRect(0,0,d,1),this.texture=new a.g({source:new s.b({resource:f,addressMode:this._wrapMode})});const v=Math.sqrt(i*i+l*l),b=Math.atan2(l,i),x=new o.u;x.scale(v/d,1),x.rotate(b),x.translate(t,e),"local"===this.textureSpace&&x.scale(d,d),this.transform=x}buildGradient(){this.texture||this._tick++,"linear"===this.type?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const t=this.colorStops.length?this.colorStops:u,e=this._textureSize,{canvas:n,context:r}=m(e,e),{x:i,y:l}=this.center,{x:c,y:h}=this.outerCenter,d=this.innerRadius,f=this.outerRadius,y=c-f,g=h-f,v=e/(2*f),b=(i-y)*v,x=(l-g)*v,_=r.createRadialGradient(b,x,d*v,(c-y)*v,(h-g)*v,f*v);p(_,t),r.fillStyle=t[t.length-1].color,r.fillRect(0,0,e,e),r.fillStyle=_,r.translate(b,x),r.rotate(this.rotation),r.scale(1,this.scale),r.translate(-b,-x),r.fillRect(0,0,e,e),this.texture=new a.g({source:new s.b({resource:n,addressMode:this._wrapMode})});const w=new o.u;w.scale(1/v,1/v),w.translate(y,g),"local"===this.textureSpace&&w.scale(e,e),this.transform=w}destroy(){this.texture?.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};d.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"},d.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let f=d;function p(t,e){for(let n=0;n<e.length;n++){const r=e[n];t.addColorStop(r.offset,r.color)}}function m(t,e){const n=i.e.get().createCanvas(t,e),r=n.getContext("2d");return{canvas:n,context:r}}},2806:(t,e,n)=>{n.d(e,{m:()=>s});var r=n(9313),i=n(133);const o={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};class s{constructor(t,e){this.uid=(0,i.L)("fillPattern"),this._tick=0,this.transform=new r.u,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=o[e].addressModeU,t.source.style.addressModeV=o[e].addressModeV)}setTransform(t){const e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._tick++}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture=t,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}},2801:(t,e,n)=>{n.d(e,{M:()=>J,y:()=>q});var r=n(8507),i=n(9313),o=n(9252);function s(t,e,n,r,i){const o=e.a,s=e.b,a=e.c,l=e.d,c=e.tx,h=e.ty;n||(n=0),r||(r=2),i||(i=t.length/r-n);let u=n*r;for(let e=0;e<i;e++){const e=t[u],n=t[u+1];t[u]=o*e+a*n+c,t[u+1]=s*e+l*n+h,u+=r}}var a=n(5589),l=n(8655),c=n(6954);const h={extension:{type:r.Ag.ShapeBuilder,name:"circle"},build(t,e){let n,r,i,o,s,a;if("circle"===t.type){const e=t;if(s=a=e.radius,s<=0)return!1;n=e.x,r=e.y,i=o=0}else if("ellipse"===t.type){const e=t;if(s=e.halfWidth,a=e.halfHeight,s<=0||a<=0)return!1;n=e.x,r=e.y,i=o=0}else{const e=t,l=e.width/2,c=e.height/2;n=e.x+l,r=e.y+c,s=a=Math.max(0,Math.min(e.radius,Math.min(l,c))),i=l-s,o=c-a}if(i<0||o<0)return!1;const l=Math.ceil(2.3*Math.sqrt(s+a)),c=8*l+(i?4:0)+(o?4:0);if(0===c)return!1;if(0===l)return e[0]=e[6]=n+i,e[1]=e[3]=r+o,e[2]=e[4]=n-i,e[5]=e[7]=r-o,!0;let h=0,u=4*l+(i?2:0)+2,d=u,f=c,p=i+s,m=o,y=n+p,g=n-p,v=r+m;if(e[h++]=y,e[h++]=v,e[--u]=v,e[--u]=g,o){const t=r-m;e[d++]=g,e[d++]=t,e[--f]=t,e[--f]=y}for(let t=1;t<l;t++){const c=Math.PI/2*(t/l),p=i+Math.cos(c)*s,m=o+Math.sin(c)*a,y=n+p,g=n-p,v=r+m,b=r-m;e[h++]=y,e[h++]=v,e[--u]=v,e[--u]=g,e[d++]=g,e[d++]=b,e[--f]=b,e[--f]=y}p=i,m=o+a,y=n+p,g=n-p,v=r+m;const b=r-m;return e[h++]=y,e[h++]=v,e[--f]=b,e[--f]=y,i&&(e[h++]=g,e[h++]=v,e[--f]=b,e[--f]=g),!0},triangulate(t,e,n,r,i,o){if(0===t.length)return;let s=0,a=0;for(let e=0;e<t.length;e+=2)s+=t[e],a+=t[e+1];s/=t.length/2,a/=t.length/2;let l=r;e[l*n]=s,e[l*n+1]=a;const c=l++;for(let r=0;r<t.length;r+=2)e[l*n]=t[r],e[l*n+1]=t[r+1],r>0&&(i[o++]=l,i[o++]=c,i[o++]=l-1),l++;i[o++]=c+1,i[o++]=c,i[o++]=l-1}},u={...h,extension:{...h.extension,name:"ellipse"}},d={...h,extension:{...h.extension,name:"roundedRectangle"}};var f=n(115),p=n(4928);function m(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let o=y(t,0,i,n,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,c;if(r&&(o=function(t,e,n,r){const i=[];for(let n=0,o=e.length;n<o;n++){const s=y(t,e[n]*r,n<o-1?e[n+1]*r:t.length,r,!1);s===s.next&&(s.steiner=!0),i.push(T(s))}i.sort(S);for(let t=0;t<i.length;t++)n=C(i[t],n);return n}(t,e,o,n)),t.length>80*n){a=t[0],l=t[1];let e=a,r=l;for(let o=n;o<i;o+=n){const n=t[o],i=t[o+1];n<a&&(a=n),i<l&&(l=i),n>e&&(e=n),i>r&&(r=i)}c=Math.max(e-a,r-l),c=0!==c?32767/c:0}return v(o,s,n,a,l,c,0),s}function y(t,e,n,r,i){let o;if(i===z(t,e,n,r)>0)for(let i=e;i<n;i+=r)o=F(i/r|0,t[i],t[i+1],o);else for(let i=n-r;i>=e;i-=r)o=F(i/r|0,t[i],t[i+1],o);return o&&I(o,o.next)&&(B(o),o=o.next),o}function g(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!I(r,r.next)&&0!==O(r.prev,r,r.next))r=r.next;else{if(B(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function v(t,e,n,r,i,o,s){if(!t)return;!s&&o&&function(t,e,n,r){let i=t;do{0===i.z&&(i.z=k(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n=1;do{let r,i=t;t=null;let o=null;for(e=0;i;){e++;let s=i,a=0;for(let t=0;t<n&&(a++,s=s.nextZ,s);t++);let l=n;for(;a>0||l>0&&s;)0!==a&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;i=s}o.nextZ=null,n*=2}while(e>1)}(i)}(t,r,i,o);let a=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(o?x(t,r,i,o):b(t))e.push(l.i,t.i,c.i),B(t),t=c.next,a=c.next;else if((t=c)===a){s?1===s?v(t=_(g(t),e),e,n,r,i,o,2):2===s&&w(t,e,n,r,i,o):v(g(t),e,n,r,i,o,1);break}}}function b(t){const e=t.prev,n=t,r=t.next;if(O(e,n,r)>=0)return!1;const i=e.x,o=n.x,s=r.x,a=e.y,l=n.y,c=r.y,h=Math.min(i,o,s),u=Math.min(a,l,c),d=Math.max(i,o,s),f=Math.max(a,l,c);let p=r.next;for(;p!==e;){if(p.x>=h&&p.x<=d&&p.y>=u&&p.y<=f&&M(i,a,o,l,s,c,p.x,p.y)&&O(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function x(t,e,n,r){const i=t.prev,o=t,s=t.next;if(O(i,o,s)>=0)return!1;const a=i.x,l=o.x,c=s.x,h=i.y,u=o.y,d=s.y,f=Math.min(a,l,c),p=Math.min(h,u,d),m=Math.max(a,l,c),y=Math.max(h,u,d),g=k(f,p,e,n,r),v=k(m,y,e,n,r);let b=t.prevZ,x=t.nextZ;for(;b&&b.z>=g&&x&&x.z<=v;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=y&&b!==i&&b!==s&&M(a,h,l,u,c,d,b.x,b.y)&&O(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,x.x>=f&&x.x<=m&&x.y>=p&&x.y<=y&&x!==i&&x!==s&&M(a,h,l,u,c,d,x.x,x.y)&&O(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;b&&b.z>=g;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=y&&b!==i&&b!==s&&M(a,h,l,u,c,d,b.x,b.y)&&O(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;x&&x.z<=v;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=y&&x!==i&&x!==s&&M(a,h,l,u,c,d,x.x,x.y)&&O(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function _(t,e){let n=t;do{const r=n.prev,i=n.next.next;!I(r,i)&&L(r,n,n.next,i)&&D(r,i)&&D(i,r)&&(e.push(r.i,n.i,i.i),B(n),B(n.next),n=t=i),n=n.next}while(n!==t);return g(n)}function w(t,e,n,r,i,o){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&P(s,t)){let a=N(s,t);return s=g(s,s.next),a=g(a,a.next),v(s,e,n,r,i,o,0),void v(a,e,n,r,i,o,0)}t=t.next}s=s.next}while(s!==t)}function S(t,e){let n=t.x-e.x;if(0===n&&(n=t.y-e.y,0===n)){n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return n}function C(t,e){const n=function(t,e){let n=e;const r=t.x,i=t.y;let o,s=-1/0;if(I(t,n))return n;do{if(I(t,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>s&&(s=t,o=n.x<n.next.x?n:n.next,t===r))return o}n=n.next}while(n!==e);if(!o)return null;const a=o,l=o.x,c=o.y;let h=1/0;n=o;do{if(r>=n.x&&n.x>=l&&r!==n.x&&A(i<c?r:s,i,l,c,i<c?s:r,i,n.x,n.y)){const e=Math.abs(i-n.y)/(r-n.x);D(n,t)&&(e<h||e===h&&(n.x>o.x||n.x===o.x&&E(o,n)))&&(o=n,h=e)}n=n.next}while(n!==a);return o}(t,e);if(!n)return e;const r=N(n,t);return g(r,r.next),g(n,n.next)}function E(t,e){return O(t.prev,t,e.prev)<0&&O(e.next,t,t.next)<0}function k(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function T(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function A(t,e,n,r,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function M(t,e,n,r,i,o,s,a){return!(t===s&&e===a)&&A(t,e,n,r,i,o,s,a)}function P(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&L(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(D(t,e)&&D(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(O(t.prev,t,e.prev)||O(t,e.prev,e))||I(t,e)&&O(t.prev,t,t.next)>0&&O(e.prev,e,e.next)>0)}function O(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function I(t,e){return t.x===e.x&&t.y===e.y}function L(t,e,n,r){const i=R(O(t,e,n)),o=R(O(t,e,r)),s=R(O(n,r,t)),a=R(O(n,r,e));return i!==o&&s!==a||(!(0!==i||!j(t,n,e))||(!(0!==o||!j(t,r,e))||(!(0!==s||!j(n,t,r))||!(0!==a||!j(n,e,r)))))}function j(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function R(t){return t>0?1:t<0?-1:0}function D(t,e){return O(t.prev,t,t.next)<0?O(t,e,t.next)>=0&&O(t,t.prev,e)>=0:O(t,e,t.prev)<0||O(t,t.next,e)<0}function N(t,e){const n=G(t.i,t.x,t.y),r=G(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function F(t,e,n,r){const i=G(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function B(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function G(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function z(t,e,n,r){let i=0;for(let o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}n(8875);const U=m.default||m;function W(t,e,n,r,i,o,s){const a=U(t,e,2);if(!a)return;for(let t=0;t<a.length;t+=3)o[s++]=a[t]+i,o[s++]=a[t+1]+i,o[s++]=a[t+2]+i;let l=i*r;for(let e=0;e<t.length;e+=2)n[l]=t[e],n[l+1]=t[e+1],l+=r}const H=[],V={extension:{type:r.Ag.ShapeBuilder,name:"polygon"},build(t,e){for(let n=0;n<t.points.length;n++)e[n]=t.points[n];return!0},triangulate(t,e,n,r,i,o){W(t,H,e,n,r,i,o)}},Y={extension:{type:r.Ag.ShapeBuilder,name:"rectangle"},build(t,e){const n=t,r=n.x,i=n.y,o=n.width,s=n.height;return o>0&&s>0&&(e[0]=r,e[1]=i,e[2]=r+o,e[3]=i,e[4]=r+o,e[5]=i+s,e[6]=r,e[7]=i+s,!0)},triangulate(t,e,n,r,i,o){let s=0;e[(r*=n)+s]=t[0],e[r+s+1]=t[1],s+=n,e[r+s]=t[2],e[r+s+1]=t[3],s+=n,e[r+s]=t[6],e[r+s+1]=t[7],s+=n,e[r+s]=t[4],e[r+s+1]=t[5],s+=n;const a=r/n;i[o++]=a,i[o++]=a+1,i[o++]=a+2,i[o++]=a+1,i[o++]=a+3,i[o++]=a+2}},X={extension:{type:r.Ag.ShapeBuilder,name:"triangle"},build:(t,e)=>(e[0]=t.x,e[1]=t.y,e[2]=t.x2,e[3]=t.y2,e[4]=t.x3,e[5]=t.y3,!0),triangulate(t,e,n,r,i,o){let s=0;e[(r*=n)+s]=t[0],e[r+s+1]=t[1],s+=n,e[r+s]=t[2],e[r+s+1]=t[3],s+=n,e[r+s]=t[4],e[r+s+1]=t[5];const a=r/n;i[o++]=a,i[o++]=a+1,i[o++]=a+2}};var $=n(2413);const q={};r.XO.handleByMap(r.Ag.ShapeBuilder,q),r.XO.add(Y,V,X,h,u,d);const K=new o.M,Z=new i.u;function J(t,e){const{geometryData:n,batches:r}=e;r.length=0,n.indices.length=0,n.vertices.length=0,n.uvs.length=0;for(let e=0;e<t.instructions.length;e++){const i=t.instructions[e];if("texture"===i.action)Q(i.data,r,n);else if("fill"===i.action||"stroke"===i.action){const t="stroke"===i.action,e=i.data.path.shapePath,o=i.data.style,s=i.data.hole;t&&s&&tt(s.shapePath,o,!0,r,n),s&&(e.shapePrimitives[e.shapePrimitives.length-1].holes=s.shapePath.shapePrimitives),tt(e,o,t,r,n)}}}function Q(t,e,n){const r=[],i=q.rectangle,o=K;o.x=t.dx,o.y=t.dy,o.width=t.dw,o.height=t.dh;const a=t.transform;if(!i.build(o,r))return;const{vertices:h,uvs:u,indices:d}=n,f=d.length,p=h.length/2;a&&s(r,a),i.triangulate(r,h,2,p,d,f);const m=t.image,y=m.uvs;u.push(y.x0,y.y0,y.x1,y.y1,y.x3,y.y3,y.x2,y.y2);const g=l.Z.get(c.G);g.indexOffset=f,g.indexSize=d.length-f,g.attributeOffset=p,g.attributeSize=h.length/2-p,g.baseColor=t.style,g.alpha=t.alpha,g.texture=m,g.geometryData=n,e.push(g)}function tt(t,e,n,r,i){const{vertices:o,uvs:h,indices:u}=i;t.shapePrimitives.forEach((({shape:t,transform:d,holes:m})=>{const y=[],g=q[t.type];if(!g.build(t,y))return;const v=u.length,b=o.length/2;let x="triangle-list";if(d&&s(y,d),n){const n=t.closePath??!0,r=e;r.pixelLine?(!function(t,e,n,r){const i=p.B;if(0===t.length)return;const o=t[0],s=t[1],a=t[t.length-2],l=t[t.length-1],c=e||Math.abs(o-a)<i&&Math.abs(s-l)<i,h=n,u=t.length/2,d=h.length/2;for(let e=0;e<u;e++)h.push(t[2*e]),h.push(t[2*e+1]);for(let t=0;t<u-1;t++)r.push(d+t,d+t+1);c&&r.push(d+u-1,d)}(y,n,o,u),x="line-list"):(0,f.h)(y,r,!1,n,o,u)}else if(m){const t=[],e=y.slice();(function(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n].shape,i=[];q[r.type].build(r,i)&&e.push(i)}return e})(m).forEach((n=>{t.push(e.length/2),e.push(...n)})),W(e,t,o,2,b,u,v)}else g.triangulate(y,o,2,b,u,v);const _=h.length/2,w=e.texture;if(w!==a.g.WHITE){const n=(0,$.Y)(Z,e,t,d);!function(t,e,n,r,i,o,s,a=null){let l=0;n*=e,i*=o;const c=a.a,h=a.b,u=a.c,d=a.d,f=a.tx,p=a.ty;for(;l<s;){const s=t[n],a=t[n+1];r[i]=c*s+u*a+f,r[i+1]=h*s+d*a+p,i+=o,n+=e,l++}}(o,2,b,h,_,2,o.length/2-b,n)}else!function(t,e,n,r){let i=0;for(e*=n;i<r;)t[e]=0,t[e+1]=0,e+=n,i++}(h,_,2,o.length/2-b);const S=l.Z.get(c.G);S.indexOffset=v,S.indexSize=u.length-v,S.attributeOffset=b,S.attributeSize=o.length/2-b,S.baseColor=e.color,S.alpha=e.alpha,S.texture=w,S.geometryData=i,S.topology=x,r.push(S)}))}},990:(t,e,n)=>{n.d(e,{T:()=>d,w:()=>u});var r=n(2577),i=n(5589),o=n(7276),s=n(2806);function a(t){return t instanceof s.m}function l(t){return t instanceof o._}function c(t,e,n){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,{...n,...t}}function h(t,e,n){return e.buildGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...n,...t}}function u(t,e){if(null==t)return null;const n={},o=t;return function(t){return r.Q.isColorLike(t)}(t)?function(t,e,n){const o=r.Q.shared.setValue(e??0);return t.color=o.toNumber(),t.alpha=1===o.alpha?n.alpha:o.alpha,t.texture=i.g.WHITE,{...n,...t}}(n,t,e):function(t){return t instanceof i.g}(t)?function(t,e,n){return t.texture=e,{...n,...t}}(n,t,e):a(t)?c(n,t,e):l(t)?h(n,t,e):o.fill&&a(o.fill)?c(o,o.fill,e):o.fill&&l(o.fill)?h(o,o.fill,e):function(t,e){const n={...e,...t},i=r.Q.shared.setValue(n.color);return n.alpha*=i.alpha,n.color=i.toNumber(),n}(o,e)}function d(t,e){const{width:n,alignment:r,miterLimit:i,cap:o,join:s,pixelLine:a,...l}=e,c=u(t,l);return c?{width:n,alignment:r,miterLimit:i,cap:o,join:s,pixelLine:a,...c}:null}},2413:(t,e,n)=>{n.d(e,{Y:()=>l});var r=n(9313),i=n(9252),o=n(7276);const s=new r.u,a=new i.M;function l(t,e,n,r){const i=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if("local"===e.textureSpace){const t=n.getBounds(a);e.width&&t.pad(e.width);const{x:r,y:o}=t,s=1/t.width,l=1/t.height,c=-r*s,h=-o*l,u=i.a,d=i.b,f=i.c,p=i.d;i.a*=s,i.b*=s,i.c*=l,i.d*=l,i.tx=c*u+h*f+i.tx,i.ty=c*d+h*p+i.ty}else i.translate(e.texture.frame.x,e.texture.frame.y),i.scale(1/e.texture.source.width,1/e.texture.source.height);const l=e.texture.source.style;return e.fill instanceof o._||"clamp-to-edge"!==l.addressMode||(l.addressMode="repeat",l.update()),r&&i.append(s.copyFrom(r).invert()),i}},8422:(t,e,n)=>{n.d(e,{K:()=>r});class r{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}destroy(){this.reset()}}},6844:(t,e,n)=>{n.d(e,{k:()=>l});var r=n(2812),i=n(5589),o=n(2048),s=n(4670),a=n(4985);class l extends a.l{constructor(t=i.g.EMPTY){t instanceof i.g&&(t={texture:t});const{texture:e=i.g.EMPTY,anchor:n,roundPixels:o,width:s,height:a,...l}=t;super({label:"Sprite",...l}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new r.o({_onUpdate:()=>{this.onViewUpdate()}}),n?this.anchor=n:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=o??!1,void 0!==s&&(this.width=s),void 0!==a&&(this.height=a)}static from(t,e=!1){return t instanceof i.g?new l(t):new l(i.g.from(t,e))}set texture(t){t||(t=i.g.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return(0,o.y)(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return(0,s.t6)("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const t=this._anchor,e=this._texture,n=this._bounds,{width:r,height:i}=e.orig;n.minX=-t._x*r,n.maxX=n.minX+r,n.minY=-t._y*i,n.maxY=n.minY+i}destroy(t=!1){super.destroy(t);if("boolean"==typeof t?t:t?.texture){const e="boolean"==typeof t?t:t?.textureSource;this._texture.destroy(e)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){"object"==typeof t?(e=t.height??t.width,t=t.width):e??(e=t),void 0!==t&&this._setWidth(t,this._texture.orig.width),void 0!==e&&this._setHeight(e,this._texture.orig.height)}}},4985:(t,e,n)=>{n.d(e,{l:()=>o});var r=n(9636),i=n(5559);class o extends i.mc{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this._bounds=new r.c(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=t.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){const e=this.bounds,{x:n,y:r}=t;return n>=e.minX&&n<=e.maxX&&r>=e.minY&&r<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(t){this.unload(),super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,n){const{renderPipes:r}=e;r.blendMode.pushBlendMode(this,this.groupBlendMode,t);const i=r[this.renderPipeId];i?.addRenderable&&i.addRenderable(this,t),this.didViewUpdate=!1;const o=this.children,s=o.length;for(let r=0;r<s;r++)o[r].collectRenderables(t,e,n);r.blendMode.popBlendMode(t)}}},6312:(t,e,n)=>{var r=n(8507),i=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(i||{}),o=n(268),s=n(1761);function a(t){if("string"!=typeof t)throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function l(t){return t.split("?")[0].split("#")[0]}const c={toPosix(t){return e="\\",n="/",t.replace(new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),n);var e,n},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl:t=>/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t),isBlobUrl:t=>t.startsWith("blob:"),hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){a(t),t=this.toPosix(t);const e=/^file:\/\/\//.exec(t);if(e)return e[0];const n=/^[^/:]+:\/{0,2}/.exec(t);return n?n[0]:""},toAbsolute(t,e,n){if(a(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;const r=l(this.toPosix(e??s.e.get().getBaseUrl())),i=l(this.toPosix(n??this.rootname(r)));if((t=this.toPosix(t)).startsWith("/"))return c.join(i,t.slice(1));return this.isAbsolute(t)?t:this.join(r,t)},normalize(t){if(a(t),0===t.length)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;let e="";const n=(t=this.toPosix(t)).startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));const r=t.endsWith("/");return(t=function(t,e){let n="",r=0,i=-1,o=0,s=-1;for(let a=0;a<=t.length;++a){if(a<t.length)s=t.charCodeAt(a);else{if(47===s)break;s=47}if(47===s){if(i===a-1||1===o);else if(i!==a-1&&2===o){if(n.length<2||2!==r||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){const t=n.lastIndexOf("/");if(t!==n.length-1){-1===t?(n="",r=0):(n=n.slice(0,t),r=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(2===n.length||1===n.length){n="",r=0,i=a,o=0;continue}e&&(n.length>0?n+="/..":n="..",r=2)}else n.length>0?n+=`/${t.slice(i+1,a)}`:n=t.slice(i+1,a),r=a-i-1;i=a,o=0}else 46===s&&-1!==o?++o:o=-1}return n}(t,!1)).length>0&&r&&(t+="/"),n?`/${t}`:e+t},isAbsolute(t){return a(t),t=this.toPosix(t),!!this.hasProtocol(t)||t.startsWith("/")},join(...t){if(0===t.length)return".";let e;for(let n=0;n<t.length;++n){const r=t[n];if(a(r),r.length>0)if(void 0===e)e=r;else{const i=t[n-1]??"";this.joinExtensions.includes(this.extname(i).toLowerCase())?e+=`/../${r}`:e+=`/${r}`}}return void 0===e?".":this.normalize(e)},dirname(t){if(a(t),0===t.length)return".";let e=(t=this.toPosix(t)).charCodeAt(0);const n=47===e;let r=-1,i=!0;const o=this.getProtocol(t),s=t;for(let n=(t=t.slice(o.length)).length-1;n>=1;--n)if(e=t.charCodeAt(n),47===e){if(!i){r=n;break}}else i=!1;return-1===r?n?"/":this.isUrl(s)?o+t:o:n&&1===r?"//":o+t.slice(0,r)},rootname(t){a(t);let e="";if(e=(t=this.toPosix(t)).startsWith("/")?"/":this.getProtocol(t),this.isUrl(t)){const n=t.indexOf("/",e.length);e=-1!==n?t.slice(0,n):t,e.endsWith("/")||(e+="/")}return e},basename(t,e){a(t),e&&a(e),t=l(this.toPosix(t));let n,r=0,i=-1,o=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let s=e.length-1,a=-1;for(n=t.length-1;n>=0;--n){const l=t.charCodeAt(n);if(47===l){if(!o){r=n+1;break}}else-1===a&&(o=!1,a=n+1),s>=0&&(l===e.charCodeAt(s)?-1==--s&&(i=n):(s=-1,i=a))}return r===i?i=a:-1===i&&(i=t.length),t.slice(r,i)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!o){r=n+1;break}}else-1===i&&(o=!1,i=n+1);return-1===i?"":t.slice(r,i)},extname(t){a(t);let e=-1,n=0,r=-1,i=!0,o=0;for(let s=(t=l(this.toPosix(t))).length-1;s>=0;--s){const a=t.charCodeAt(s);if(47!==a)-1===r&&(i=!1,r=s+1),46===a?-1===e?e=s:1!==o&&(o=1):-1!==e&&(o=-1);else if(!i){n=s+1;break}}return-1===e||-1===r||0===o||1===o&&e===r-1&&e===n+1?"":t.slice(e,r)},parse(t){a(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;let n=(t=l(this.toPosix(t))).charCodeAt(0);const r=this.isAbsolute(t);let i;e.root=this.rootname(t),i=r||this.hasProtocol(t)?1:0;let o=-1,s=0,c=-1,h=!0,u=t.length-1,d=0;for(;u>=i;--u)if(n=t.charCodeAt(u),47!==n)-1===c&&(h=!1,c=u+1),46===n?-1===o?o=u:1!==d&&(d=1):-1!==o&&(d=-1);else if(!h){s=u+1;break}return-1===o||-1===c||0===d||1===d&&o===c-1&&o===s+1?-1!==c&&(e.base=e.name=0===s&&r?t.slice(1,c):t.slice(s,c)):(0===s&&r?(e.name=t.slice(1,o),e.base=t.slice(1,c)):(e.name=t.slice(s,o),e.base=t.slice(s,c)),e.ext=t.slice(o,c)),e.dir=this.dirname(t),e},sep:"/",delimiter:":",joinExtensions:[".html"]};var h=n(2406);function u(t,e,n,r,i){const o=e[n];for(let s=0;s<o.length;s++){const a=o[s];n<e.length-1?u(t.replace(r[n],a),e,n+1,r,i):i.push(t.replace(r[n],a))}}function d(t){const e=t.match(/\{(.*?)\}/g),n=[];if(e){const r=[];e.forEach((t=>{const e=t.substring(1,t.length-1).split(",");r.push(e)})),u(t,r,0,e,n)}else n.push(t);return n}const f=t=>!Array.isArray(t);class p{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,"bar"!==this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar")))throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach((t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))})),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if("string"==typeof t)this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}}getAlias(t){const{alias:e,src:n}=t;return(0,h.z)(e||n,(t=>"string"==typeof t?t:Array.isArray(t)?t.map((t=>t?.src??t)):t?.src?t.src:t),!0)}removeAlias(t,e){this._assetMap[t]&&(e&&e!==this._resolverHash[t]||(delete this._resolverHash[t],delete this._assetMap[t]))}addManifest(t){this._manifest&&(0,o.R)("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach((t=>{this.addBundle(t.name,t.assets)}))}addBundle(t,e){const n=[];let r=e;Array.isArray(e)||(r=Object.entries(e).map((([t,e])=>"string"==typeof e||Array.isArray(e)?{alias:t,src:e}:{alias:t,...e}))),r.forEach((e=>{const r=e.src,i=e.alias;let o;if("string"==typeof i){const e=this._createBundleAssetId(t,i);n.push(e),o=[i,e]}else{const e=i.map((e=>this._createBundleAssetId(t,e)));n.push(...e),o=[...i,...e]}this.add({...e,alias:o,src:r})})),this._bundles[t]=n}add(t){const e=[];let n;Array.isArray(t)?e.push(...t):e.push(t),n=t=>{this.hasKey(t)&&(0,o.R)(`[Resolver] already has key: ${t} overwriting`)};(0,h.z)(e).forEach((t=>{const{src:e}=t;let{data:r,format:i,loadParser:o,parser:s}=t;const a=(0,h.z)(e).map((t=>"string"==typeof t?d(t):Array.isArray(t)?t:[t])),l=this.getAlias(t);Array.isArray(l)?l.forEach(n):n(l);const c=[],u=t=>{const e=this._parsers.find((e=>e.test(t)));return{src:t,...e?.parse(t)}};a.forEach((e=>{e.forEach((e=>{let n={};if("object"!=typeof e?n=u(e):(r=e.data??r,i=e.format??i,(e.loadParser||e.parser)&&(o=e.loadParser??o,s=e.parser??s),n={...u(e.src),...e}),!l)throw new Error(`[Resolver] alias is undefined for this asset: ${n.src}`);n=this._buildResolvedAsset(n,{aliases:l,data:r,format:i,loadParser:o,parser:s,progressSize:t.progressSize}),c.push(n)}))})),l.forEach((t=>{this._assetMap[t]=c}))}))}resolveBundle(t){const e=f(t);t=(0,h.z)(t);const n={};return t.forEach((t=>{const e=this._bundles[t];if(e){const r=this.resolve(e),i={};for(const e in r){const n=r[e];i[this._extractAssetIdFromBundle(t,e)]=n}n[t]=i}})),e?n[t[0]]:n}resolveUrl(t){const e=this.resolve(t);if("string"!=typeof t){const t={};for(const n in e)t[n]=e[n].src;return t}return e.src}resolve(t){const e=f(t);t=(0,h.z)(t);const n={};return t.forEach((t=>{if(!this._resolverHash[t])if(this._assetMap[t]){let e=this._assetMap[t];const n=this._getPreferredOrder(e);n?.priority.forEach((t=>{n.params[t].forEach((n=>{const r=e.filter((e=>!!e[t]&&e[t]===n));r.length&&(e=r)}))})),this._resolverHash[t]=e[0]}else this._resolverHash[t]=this._buildResolvedAsset({alias:[t],src:t},{});n[t]=this._resolverHash[t]})),e?n[t[0]]:n}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const n=t[e],r=this._preferredOrder.find((t=>t.params.format.includes(n.format)));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;return`${t}${/\?/.test(t)?"&":"?"}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){const{aliases:n,data:r,loadParser:i,parser:o,format:s,progressSize:a}=e;return(this._basePath||this._rootPath)&&(t.src=c.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=n??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=i??t.loadParser,t.parser=o??t.parser,t.format=s??t.format??t.src.split(".").pop().split("?").shift().split("#").shift(),void 0!==a&&(t.progressSize=a),t}}p.RETINA_PREFIX=/@([0-9\.]+)x/;const m=(t,e)=>{const n=e.split("?")[1];return n&&(t+=`?${n}`),t};var y=n(5589),g=n(9252),v=n(583);const b=class t{constructor(t,e){this.linkedSheets=[];let n=t;t?.source instanceof v.v&&(n={texture:t,data:e});const{texture:r,data:i,cachePrefix:o=""}=n;this.cachePrefix=o,this._texture=r instanceof y.g?r:null,this.textureSource=r.source,this.textures={},this.animations={},this.data=i;const s=parseFloat(i.meta.scale);s?(this.resolution=s,r.source.resolution=this.resolution):this.resolution=r.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise((e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=t.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()}))}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(e,n=!1){let r=e;const i=n?1/0:t.BATCH_SIZE;for(;r-e<i&&r<this._frameKeys.length;){const t=this._frameKeys[r],e=this._frames[t],n=e.frame;if(n){let r=null,i=null;const o=!1!==e.trimmed&&e.sourceSize?e.sourceSize:e.frame,s=new g.M(0,0,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution);r=e.rotated?new g.M(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):new g.M(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),!1!==e.trimmed&&e.spriteSourceSize&&(i=new g.M(Math.floor(e.spriteSourceSize.x)/this.resolution,Math.floor(e.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[t]=new y.g({source:this.textureSource,frame:r,orig:s,trim:i,rotate:e.rotated?2:0,defaultAnchor:e.anchor,defaultBorders:e.borders,label:t.toString()})}r++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let n=0;n<t[e].length;n++){const r=t[e][n];this.animations[e].push(this.textures[r])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*t.BATCH_SIZE),this._batchIndex++,setTimeout((()=>{this._batchIndex*t.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())}),0)}destroy(t=!1){for(const t in this.textures)this.textures[t].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};b.BATCH_SIZE=1e3;let x=b;const _=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function w(t,e,n){const r={};if(t.forEach((t=>{r[t]=e})),Object.keys(e.textures).forEach((t=>{r[`${e.cachePrefix}${t}`]=e.textures[t]})),!n){const n=c.dirname(t[0]);e.linkedSheets.forEach(((t,i)=>{const o=w([`${n}/${e.data.meta.related_multi_packs[i]}`],t,!0);Object.assign(r,o)}))}return r}const S={extension:r.Ag.Asset,cache:{test:t=>t instanceof x,getCacheableAssets:(t,e)=>w(t,e,!1)},resolver:{extension:{type:r.Ag.ResolveParser,name:"resolveSpritesheet"},test:t=>{const e=t.split("?")[0].split("."),n=e.pop(),r=e.pop();return"json"===n&&_.includes(r)},parse:t=>{const e=t.split(".");return{resolution:parseFloat(p.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:r.Ag.LoadParser,priority:i.Normal,name:"spritesheetLoader"},testParse:async(t,e)=>".json"===c.extname(e.src).toLowerCase()&&!!t.frames,async parse(t,e,n){const{texture:r,imageFilename:i,textureOptions:o,cachePrefix:s}=e?.data??{};let a,l=c.dirname(e.src);if(l&&l.lastIndexOf("/")!==l.length-1&&(l+="/"),r instanceof y.g)a=r;else{const r=m(l+(i??t.meta.image),e.src);a=(await n.load([{src:r,data:o}]))[r]}const h=new x({texture:a.source,data:t,cachePrefix:s});await h.parse();const u=t?.meta?.related_multi_packs;if(Array.isArray(u)){const t=[];for(const r of u){if("string"!=typeof r)continue;let i=l+r;e.data?.ignoreMultiPack||(i=m(i,e.src),t.push(n.load({src:i,data:{textureOptions:o,ignoreMultiPack:!0}})))}const r=await Promise.all(t);h.linkedSheets=r,r.forEach((t=>{t.linkedSheets=[h].concat(h.linkedSheets.filter((e=>e!==t)))}))}return h},async unload(t,e,n){await n.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}};r.XO.add(S)},7309:(t,e,n)=>{n.d(e,{R:()=>s});var r=n(4458);class i{constructor(t,e=null,n=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=n,this._once=r}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const o=class t{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new i(null,null,1/0),this.deltaMS=1/t.targetFPMS,this.elapsedMS=1/t.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&null===this._requestId&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,n=r.d.NORMAL){return this._addListener(new i(t,e,n))}addOnce(t,e,n=r.d.NORMAL){return this._addListener(new i(t,e,n,!0))}_addListener(t){let e=this._head.next,n=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(n);break}n=e,e=e.next}t.previous||t.connect(n)}else t.connect(n);return this._startIfPossible(),this}remove(t,e){let n=this._head.next;for(;n;)n=n.match(t,e)?n.destroy():n.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let n;if(e>this.lastTime){if(n=this.elapsedMS=e-this.lastTime,n>this._maxElapsedMS&&(n=this._maxElapsedMS),n*=this.speed,this._minElapsedMS){const t=e-this._lastFrame|0;if(t<this._minElapsedMS)return;this._lastFrame=e-t%this._minElapsedMS}this.deltaMS=n,this.deltaTime=this.deltaMS*t.targetFPMS;const r=this._head;let i=r.next;for(;i;)i=i.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const n=Math.min(Math.max(0,e)/1e3,t.targetFPMS);this._maxElapsedMS=1/n,this._minElapsedMS&&e>this.maxFPS&&(this.maxFPS=e)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){0===t?this._minElapsedMS=0:(t<this.minFPS&&(this.minFPS=t),this._minElapsedMS=1/(t/1e3))}static get shared(){if(!t._shared){const e=t._shared=new t;e.autoStart=!0,e._protected=!0}return t._shared}static get system(){if(!t._system){const e=t._system=new t;e.autoStart=!0,e._protected=!0}return t._system}};o.targetFPMS=.06;let s=o},4458:(t,e,n)=>{n.d(e,{d:()=>r});var r=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(r||{})},4577:(t,e,n)=>{let r;function i(){if("boolean"==typeof r)return r;try{const t=new Function("param1","param2","param3","return param1[param2] === param3;");r=!0===t({a:"b"},"a","b")}catch(t){r=!1}return r}n.d(e,{f:()=>i})},2571:(t,e,n)=>{n.d(e,{xv:()=>r});n(8875);const r="8.17.1"},4334:(t,e,n)=>{n.d(e,{s:()=>r});class r{constructor(t){this.items=Object.create(null);const{renderer:e,type:n,onUnload:r,priority:i,name:o}=t;this._renderer=e,e.gc.addResourceHash(this,"items",n,i??0),this._onUnload=r,this.name=o}add(t){return!this.items[t.uid]&&(this.items[t.uid]=t,t.once("unload",this.remove,this),t._gcLastUsed=this._renderer.gc.now,!0)}remove(t,...e){if(!this.items[t.uid])return;const n=t._gpuData[this._renderer.uid];n&&(this._onUnload?.(t,...e),n.destroy(),t._gpuData[this._renderer.uid]=null,this.items[t.uid]=null)}removeAll(...t){Object.values(this.items).forEach((e=>e&&this.remove(e,...t)))}destroy(...t){this.removeAll(...t),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}},9903:(t,e,n)=>{function r(t,e,n){const r=t.length;let i;if(e>=r||0===n)return;const o=r-(n=e+n>r?r-e:n);for(i=e;i<o;++i)t[i]=t[i+n];t.length=o}n.d(e,{d:()=>r})},133:(t,e,n)=>{n.d(e,{L:()=>i});const r={default:-1};function i(t="default"){return void 0===r[t]&&(r[t]=-1),++r[t]}},2048:(t,e,n)=>{function r(t,e,n){const{width:r,height:i}=n.orig,o=n.trim;if(o){const n=o.width,s=o.height;t.minX=o.x-e._x*r,t.maxX=t.minX+n,t.minY=o.y-e._y*i,t.maxY=t.minY+s}else t.minX=-e._x*r,t.maxX=t.minX+r,t.minY=-e._y*i,t.maxY=t.minY+i}n.d(e,{y:()=>r})},7073:(t,e,n)=>{n.d(e,{M:()=>o,d:()=>s});var r=n(8507),i=n(2571);class o{static init(){globalThis.__PIXI_APP_INIT__?.(this,i.xv)}static destroy(){}}o.extension=r.Ag.Application;class s{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,i.xv)}destroy(){this._renderer=null}}s.extension={type:[r.Ag.WebGLSystem,r.Ag.WebGPUSystem],name:"initHook",priority:-10}},4670:(t,e,n)=>{n.d(e,{Ek:()=>o,lj:()=>i,t6:()=>a});const r=new Set,i="8.0.0",o="8.3.4",s={quiet:!1,noColor:!1},a=(t,e,n=3)=>{if(s.quiet||r.has(e))return;let i=(new Error).stack;const o=`${e}\nDeprecated since v${t}`,a="function"==typeof console.groupCollapsed&&!s.noColor;void 0===i?console.warn("PixiJS Deprecation Warning: ",o):(i=i.split("\n").splice(n).join("\n"),a?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",o),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",o),console.warn(i))),r.add(e)};Object.defineProperties(a,{quiet:{get:()=>s.quiet,set:t=>{s.quiet=t},enumerable:!0,configurable:!1},noColor:{get:()=>s.noColor,set:t=>{s.noColor=t},enumerable:!0,configurable:!1}})},268:(t,e,n)=>{n.d(e,{R:()=>o});let r=0;const i=500;function o(...t){r!==i&&(r++,r===i?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}},6083:(t,e,n)=>{n.d(e,{L:()=>r});const r={_registeredResources:new Set,register(t){this._registeredResources.add(t)},unregister(t){this._registeredResources.delete(t)},release(){this._registeredResources.forEach((t=>t.clear()))},get registeredCount(){return this._registeredResources.size},isRegistered(t){return this._registeredResources.has(t)},reset(){this._registeredResources.clear()}}},8655:(t,e,n)=>{n.d(e,{Z:()=>o});var r=n(6083);class i{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?e=this._pool[--this._index]:(e=new this._classType,this._count++),e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){if(this._pool.length>0&&this._pool[0].destroy)for(let t=0;t<this._index;t++)this._pool[t].destroy();this._pool.length=0,this._count=0,this._index=0}}const o=new class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new i(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach((e=>{const n=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[n]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}})),t}clear(){this._poolsByClass.forEach((t=>t.clear())),this._poolsByClass.clear()}};r.L.register(o)},8875:(t,e,n)=>{n.d(e,{A:()=>r});const r=n(5585)}},r={};function i(t){var e=r[t];if(void 0!==e)return e.exports;var o=r[t]={id:t,exports:{}};return n[t](o,o.exports,i),o.exports}i.m=n,i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.f={},i.e=t=>Promise.all(Object.keys(i.f).reduce(((e,n)=>(i.f[n](t,e),e)),[])),i.u=t=>t+".vizor_2d.min.js",i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t={},e="vizor_2d:",i.l=(n,r,o,s)=>{if(t[n])t[n].push(r);else{var a,l;if(void 0!==o)for(var c=document.getElementsByTagName("script"),h=0;h<c.length;h++){var u=c[h];if(u.getAttribute("src")==n||u.getAttribute("data-webpack")==e+o){a=u;break}}a||(l=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.setAttribute("data-webpack",e+o),a.src=n),t[n]=[r];var d=(e,r)=>{a.onerror=a.onload=null,clearTimeout(f);var i=t[n];if(delete t[n],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((t=>t(r))),e)return e(r)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),l&&document.head.appendChild(a)}},i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;if("string"==typeof import.meta.url&&(t=import.meta.url),!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t})(),(()=>{i.b=document.baseURI||self.location.href;var t={792:0};i.f.j=(e,n)=>{var r=i.o(t,e)?t[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise(((n,i)=>r=t[e]=[n,i]));n.push(r[2]=o);var s=i.p+i.u(e),a=new Error;i.l(s,(n=>{if(i.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),s=n&&n.target&&n.target.src;a.message="Loading chunk "+e+" failed.\n("+o+": "+s+")",a.name="ChunkLoadError",a.type=o,a.request=s,r[1](a)}}),"chunk-"+e,e)}};var e=(e,n)=>{var r,o,[s,a,l]=n,c=0;if(s.some((e=>0!==t[e]))){for(r in a)i.o(a,r)&&(i.m[r]=a[r]);if(l)l(i)}for(e&&e(n);c<s.length;c++)o=s[c],i.o(t,o)&&t[o]&&t[o][0](),t[o]=0},n=self.webpackChunkvizor_2d=self.webpackChunkvizor_2d||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})(),i.nc=void 0;var o={};function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,l(r.key),r)}}function l(t){var e=function(t,e){if("object"!=s(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==s(e)?e:e+""}i.d(o,{A5:()=>fa,oY:()=>us,W_:()=>gs,vY:()=>mr,jz:()=>na,TI:()=>ca,ey:()=>ba,sV:()=>As,ut:()=>Na});var c=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return e=t,r=[{key:"build",value:function(e){if(!e)return function(){return!0};switch(e.op){case"and":var n=e.rules.map((function(e){return t.build(e)}));return function(t){return n.every((function(e){return e(t)}))};case"or":var r=e.rules.map((function(e){return t.build(e)}));return function(t){return r.some((function(e){return e(t)}))};case"not":var i=t.build(e.rule);return function(t){return!i(t)};case"eq":return function(t){var n;return(null===(n=t.data)||void 0===n?void 0:n[e.field])===e.value};case"neq":return function(t){var n;return(null===(n=t.data)||void 0===n?void 0:n[e.field])!==e.value};case"gt":return function(t){var n;return(null===(n=t.data)||void 0===n?void 0:n[e.field])>e.value};case"lt":return function(t){var n;return(null===(n=t.data)||void 0===n?void 0:n[e.field])<e.value};case"gte":return function(t){var n;return(null===(n=t.data)||void 0===n?void 0:n[e.field])>=e.value};case"lte":return function(t){var n;return(null===(n=t.data)||void 0===n?void 0:n[e.field])<=e.value};case"regex":var o=new RegExp(e.value);return function(t){var n,r=null===(n=t.data)||void 0===n?void 0:n[e.field];return o.test(String(null!=r?r:""))};case"in":return function(t){var n;return e.value.includes(null===(n=t.data)||void 0===n?void 0:n[e.field])};case"exists":return function(t){return e.field in(t.data||{})};default:return console.warn("Unknown rule:",e),function(){return!0}}}}],(n=null)&&a(e.prototype,n),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function h(t){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}function u(t){return function(t){if(Array.isArray(t))return p(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||f(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=f(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function f(t,e){if(t){if("string"==typeof t)return p(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(t,e):void 0}}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function m(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,y(r.key),r)}}function y(t){var e=function(t,e){if("object"!=h(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==h(e)?e:e+""}var g=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.attractionStrength=.15,this.repulsionStrength=200,this.damping=.98,this.minDist=20,this.planetRadius=60,this.planetRepulsion=2,this.orbitStrength=0,this.collisionPadding=2,this.collisionIterations=2,this.velocityEpsilon=.01,this.energyThreshold=.1,this.cooling=.999,this.minStrength=.001},e=[{key:"setModel",value:function(t){this.model=t}},{key:"resolveMoonCollisions",value:function(t){for(var e=0;e<this.collisionIterations;e++)for(var n=0;n<t.length;n++)for(var r=n+1;r<t.length;r++){var i=t[n],o=t[r],s=i.radius||10,a=o.radius||10,l=o.x-i.x,c=o.y-i.y,h=Math.sqrt(l*l+c*c)||1e-4,u=s+a+this.collisionPadding;if(h<u){var d=l/h,f=c/h,p=.5*(u-h);i.fixed||(i.x-=d*p,i.y-=f*p),o.fixed||(o.x+=d*p,o.y+=f*p)}}}},{key:"step",value:function(){var t,e=this,n=this.model.getNodes(),r=n.filter((function(t){return"moon"===t.type})),i=n.filter((function(t){return"planet"===t.type})),o=d(r);try{for(o.s();!(t=o.n()).done;){var s=t.value;s.vx*=this.damping,s.vy*=this.damping}}catch(t){o.e(t)}finally{o.f()}for(var a=0;a<r.length;a++)for(var l=a+1;l<r.length;l++){var c=r[a],h=r[l],f=c.x-h.x,p=c.y-h.y,m=Math.sqrt(f*f+p*p)||.01;m=Math.max(m,this.minDist);var y=this.repulsionStrength/(m*m),g=f/m*y,v=p/m*y;c.fixed||(c.vx+=g,c.vy+=v),h.fixed||(h.vx-=g,h.vy-=v)}var b,x=d(i);try{var _=function(){var t=b.value,n=r.filter((function(e){return t.rule(e)}));if(0===n.length)return 1;if(t.sumField?t.sumTotal=n.reduce((function(e,n){var r,i=Number(null===(r=n.data)||void 0===r?void 0:r[t.sumField]);return e+(isNaN(i)?0:i)}),0):t.sumTotal=null,t.vector){var i,o={x:t.x,y:t.y},s=t.direction,a=t.length,l=t.scalarField,c=n.map((function(t){return t.data[l]})).filter((function(t){return null!=t})),h=Math.min.apply(Math,u(c)),f=Math.max.apply(Math,u(c)),p=d(n);try{for(p.s();!(i=p.n()).done;){var m=i.value,y=m.data[l];null==y&&(y=h);var g=f>h?(y-h)/(f-h):.5;m.x=o.x+s.x*a*g,m.y=o.y+s.y*a*g}}catch(t){p.e(t)}finally{p.f()}}else{var v,x=d(n);try{for(x.s();!(v=x.n()).done;){var _=v.value,w=t.x-_.x,S=t.y-_.y,C=Math.sqrt(w*w+S*S)||.01;C=Math.max(C,e.minDist);var E=100,k=w/C,T=S/C,A=e.attractionStrength*(C-E)*.5+.05*C;_.fixed||(_.vx+=k*A,_.vy+=T*A,_.vx+=.5*k,_.vy+=.5*T);var M=.85+.15*Math.min(1,C/E);_.vx*=M,_.vy*=M,_.vx*k+_.vy*T<0&&(_.vx*=.7,_.vy*=.7),C<3&&(_.x=t.x+k*E,_.y=t.y+T*E,_.vx=0,_.vy=0),C<102&&Math.abs(_.vx)<.05&&Math.abs(_.vy)<.05&&(_.vx=0,_.vy=0),0!==e.orbitStrength&&(_.vx+=-S/C*e.orbitStrength,_.vy+=w/C*e.orbitStrength)}}catch(t){x.e(t)}finally{x.f()}}};for(x.s();!(b=x.n()).done;)_()}catch(t){x.e(t)}finally{x.f()}var w,S=d(i);try{for(S.s();!(w=S.n()).done;){var C,E=w.value,k=d(r);try{for(k.s();!(C=k.n()).done;){var T=C.value,A=T.x-E.x,M=T.y-E.y,P=Math.sqrt(A*A+M*M)||.01;if(P<this.planetRadius){var O=this.planetRadius-P,I=A/P*O*this.planetRepulsion,L=M/P*O*this.planetRepulsion;T.fixed||(T.vx+=I,T.vy+=L)}}}catch(t){k.e(t)}finally{k.f()}}}catch(t){S.e(t)}finally{S.f()}var j,R=this.bounds||{minX:-1/0,maxX:1/0,minY:-1/0,maxY:1/0},D=0,N=d(r);try{for(N.s();!(j=N.n()).done;){var F=j.value;F.fixed||(F.x+=F.vx,F.y+=F.vy,F.x=Math.max(R.minX,Math.min(R.maxX,F.x)),F.y=Math.max(R.minY,Math.min(R.maxY,F.y)),F.vx*=.9,F.vy*=.9,Math.abs(F.vx)<this.velocityEpsilon&&(F.vx=0),Math.abs(F.vy)<this.velocityEpsilon&&(F.vy=0),D+=Math.abs(F.vx)+Math.abs(F.vy))}}catch(t){N.e(t)}finally{N.f()}this.resolveMoonCollisions(r);var B,G=D>=this.energyThreshold,z=d(r);try{for(z.s();!(B=z.n()).done;)B.value.dirty=G}catch(t){z.e(t)}finally{z.f()}if(!G){var U,W=d(r);try{for(W.s();!(U=W.n()).done;){var H=U.value;H.vx=0,H.vy=0}}catch(t){W.e(t)}finally{W.f()}}D<5&&(this.attractionStrength=Math.max(this.minStrength,.95*this.attractionStrength),this.repulsionStrength=Math.max(this.minStrength,.95*this.repulsionStrength))}}],e&&m(t.prototype,e),n&&m(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function b(t){return function(t){if(Array.isArray(t))return w(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=_(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function _(t,e){if(t){if("string"==typeof t)return w(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(t,e):void 0}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function S(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,C(r.key),r)}}function C(t){var e=function(t,e){if("object"!=v(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==v(e)?e:e+""}var E=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.attractionStrength=.05,this.repulsionStrength=200,this.damping=.9,this.minDist=20,this.minDistSq=this.minDist*this.minDist,this.planetRadius=60,this.planetRepulsion=2,this.orbitStrength=0,this.cellSize=80,this.maxNeighbors=15},e=[{key:"setModel",value:function(t){this.model=t}},{key:"_buildGrid",value:function(t){var e,n=new Map,r=x(t);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=Math.floor(i.x/this.cellSize),s=Math.floor(i.y/this.cellSize),a=o+","+s;n.has(a)||n.set(a,[]),n.get(a).push(i),i._cellX=o,i._cellY=s}}catch(t){r.e(t)}finally{r.f()}return n}},{key:"_getNeighbors",value:function(t,e){for(var n=[],r=-1;r<=1;r++)for(var i=-1;i<=1;i++){var o=e._cellX+r+","+(e._cellY+i),s=t.get(o);if(s){var a,l=x(s);try{for(l.s();!(a=l.n()).done;){var c=a.value;if(c!==e&&(n.push(c),n.length>=this.maxNeighbors))return n}}catch(t){l.e(t)}finally{l.f()}}}return n}},{key:"step",value:function(){var t=this,e=this.model.getNodes(),n=e.filter((function(t){return"moon"===t.type})),r=e.filter((function(t){return"planet"===t.type})),i=this.bounds;if(i){var o,s=x(n);try{for(s.s();!(o=s.n()).done;){var a=o.value;a.vx*=this.damping,a.vy*=this.damping}}catch(t){s.e(t)}finally{s.f()}var l,c=this._buildGrid(n),h=x(n);try{for(h.s();!(l=h.n()).done;){var u,d=l.value,f=x(this._getNeighbors(c,d));try{for(f.s();!(u=f.n()).done;){var p=u.value,m=d.x-p.x,y=d.y-p.y,g=m*m+y*y;g<this.minDistSq&&(g=this.minDistSq);var v=this.repulsionStrength/g,_=Math.sqrt(g),w=m/_*v,S=y/_*v;d.fixed||(d.vx+=w,d.vy+=S)}}catch(t){f.e(t)}finally{f.f()}}}catch(t){h.e(t)}finally{h.f()}var C,E=x(r);try{var k=function(){var e=C.value,r=n.filter((function(t){return e.rule(t)}));if(0===r.length)return 1;if(e.vector){var i,o={x:e.x,y:e.y},s=e.direction,a=e.length,l=e.scalarField,c=r.map((function(t){return t.data[l]})).filter((function(t){return null!=t})),h=Math.min.apply(Math,b(c)),u=Math.max.apply(Math,b(c)),d=x(r);try{for(d.s();!(i=d.n()).done;){var f=i.value,p=f.data[l];null==p&&(p=h);var m=u>h?(p-h)/(u-h):.5;f.x=o.x+s.x*a*m,f.y=o.y+s.y*a*m}}catch(t){d.e(t)}finally{d.f()}}else{var y,g=x(r);try{for(g.s();!(y=g.n()).done;){var v=y.value,_=e.x-v.x,w=e.y-v.y,S=_*_+w*w;S<t.minDistSq&&(S=t.minDistSq);var E=Math.sqrt(S),k=t.attractionStrength*E;v.fixed||(v.vx+=_/E*k,v.vy+=w/E*k),0!==t.orbitStrength&&(v.vx+=-w/E*t.orbitStrength,v.vy+=_/E*t.orbitStrength)}}catch(t){g.e(t)}finally{g.f()}}};for(E.s();!(C=E.n()).done;)k()}catch(t){E.e(t)}finally{E.f()}var T,A=x(r);try{for(A.s();!(T=A.n()).done;){var M,P=T.value,O=x(n);try{for(O.s();!(M=O.n()).done;){var I=M.value,L=I.x-P.x,j=I.y-P.y,R=Math.sqrt(L*L+j*j)||.01;if(R<this.planetRadius){var D=this.planetRadius-R,N=L/R*D*this.planetRepulsion,F=j/R*D*this.planetRepulsion;I.fixed||(I.vx+=N,I.vy+=F)}}}catch(t){O.e(t)}finally{O.f()}}}catch(t){A.e(t)}finally{A.f()}var B,G=x(n);try{for(G.s();!(B=G.n()).done;){var z=B.value;z.fixed||(z.x+=z.vx,z.y+=z.vy,z.x=Math.max(i.minX,Math.min(i.maxX,z.x)),z.y=Math.max(i.minY,Math.min(i.maxY,z.y)))}}catch(t){G.e(t)}finally{G.f()}}}}],e&&S(t.prototype,e),n&&S(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function k(t){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(t)}function T(t){return function(t){if(Array.isArray(t))return P(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||M(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=M(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function M(t,e){if(t){if("string"==typeof t)return P(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?P(t,e):void 0}}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function O(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,I(r.key),r)}}function I(t){var e=function(t,e){if("object"!=k(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=k(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==k(e)?e:e+""}var L=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.innerRadius=20,this.outerRadius=300,this.turns=4,this.spread=1,this.smoothing=.15,this.angleOffset=0,this.arcStep=12,this.wobbleStrength=2,this.wobbleFrequency=2,this.wobbleSpeed=.02,this.wobbleThreshold=3e3},e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this,n=this.model.getNodes(),r=n.filter((function(t){return"moon"===t.type})),i=A(n.filter((function(t){return"planet"===t.type})));try{var o=function(){var n=t.value,i=n.scalarField;if(!i)return 0;var o=r.filter((function(t){return n.rule(t)}));if(0===o.length)return 0;var s,a=1/0,l=-1/0,c=A(o);try{for(c.s();!(s=c.n()).done;){var h=s.value.data[i];null!=h&&(h<a&&(a=h),h>l&&(l=h))}}catch(t){c.e(t)}finally{c.f()}if(a===1/0||l===-1/0)return 0;n._sorted&&!n._dirty||(n._sorted=T(o).sort((function(t,e){var n,r;return(null!==(n=t.data[i])&&void 0!==n?n:a)-(null!==(r=e.data[i])&&void 0!==r?r:a)})),n._sorted.forEach((function(t,e){t._spiralIndex=e})),n._dirty=!1);var u,d=n._sorted,f=d.length<e.wobbleThreshold,p=A(d);try{for(p.s();!(u=p.n()).done;){var m=u.value,y=m.data[i];null==y&&(y=a);var g=l>a?(y-a)/(l-a):.5,v=e.angleOffset+g*e.turns*Math.PI*2,b=e.innerRadius+g*(e.outerRadius-e.innerRadius)*e.spread,x=m._spiralIndex||0,_=v+x*(e.arcStep/(b+1)),w=b+.5*x,S=0;f&&(void 0===m._spiralPhase&&(m._spiralPhase=Math.random()*Math.PI*2),m._spiralPhase+=e.wobbleSpeed,S=Math.sin(m._spiralPhase*e.wobbleFrequency)*e.wobbleStrength);var C=n.x+Math.cos(_)*(w+S),E=n.y+Math.sin(_)*(w+S);m.x+=(C-m.x)*e.smoothing,m.y+=(E-m.y)*e.smoothing}}catch(t){p.e(t)}finally{p.f()}};for(i.s();!(t=i.n()).done;)o()}catch(t){i.e(t)}finally{i.f()}}}],e&&O(t.prototype,e),n&&O(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function j(t){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(t)}function R(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=N(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function D(t){return function(t){if(Array.isArray(t))return F(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||N(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(t,e){if(t){if("string"==typeof t)return F(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?F(t,e):void 0}}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function B(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function G(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,U(r.key),r)}}function z(t,e,n){return e&&G(t.prototype,e),n&&G(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function U(t){var e=function(t,e){if("object"!=j(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=j(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==j(e)?e:e+""}var W=function(){return z((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.min,r=void 0===n?0:n,i=e.max,o=void 0===i?1:i,s=e.start,a=void 0===s?0:s,l=e.end,c=void 0===l?100:l,h=e.invert,u=void 0!==h&&h;B(this,t),this.min=r,this.max=o,this.start=a,this.end=c,this.invert=u}),[{key:"map",value:function(t){var e=this.max>this.min?(t-this.min)/(this.max-this.min):.5;return this.invert&&(e=1-e),this.start+e*(this.end-this.start)}}])}(),H=function(){return z((function t(){B(this,t),this.smoothing=.2,this.padding=40,this.jitter=10}),[{key:"setModel",value:function(t){this.model=t}},{key:"_mapCategorical",value:function(t){var e=D(new Set(t)),n=new Map;return e.forEach((function(t,e){return n.set(t,e)})),n}},{key:"step",value:function(){var t=this,e=this.model.getNodes(),n=e.filter((function(t){return"moon"===t.type})),r=e.filter((function(t){return"vector"===t.type})),i=this.bounds;if(i){var o,s=i.minY+this.padding,a=i.maxY-this.padding,l=i.minX+this.padding,c=i.maxX-this.padding,h=R(r);try{var u=function(){var e,r,i=o.value,h=i.scalarField;if(!h)return 0;var u=n.filter((function(t){return i.rule(t)}));if(!u.length)return 0;var d,f,p,m,y=[],g=!0,v=R(u);try{for(v.s();!(d=v.n()).done;){var b=d.value,x=b.data[h];if(null!=x){var _=Number(x);isNaN(_)&&(g=!1),b._value=g?_:x,y.push(b._value)}}}catch(t){v.e(t)}finally{v.f()}if(!y.length)return 0;if(g)f=Math.min.apply(Math,y),p=Math.max.apply(Math,y);else{f=0,p=(m=t._mapCategorical(y)).size-1;var w,S=R(u);try{for(S.s();!(w=S.n()).done;){var C=w.value;C._value=m.get(C._value)}}catch(t){S.e(t)}finally{S.f()}}var E=new W({min:f,max:p,start:l,end:c}),k=new W({min:f,max:p,start:s,end:a});u.sort((function(t,e){var n,r;return(null!==(n=t._value)&&void 0!==n?n:0)-(null!==(r=e._value)&&void 0!==r?r:0)}));for(var T=0!==(null===(e=i.direction)||void 0===e?void 0:e.x),A=0!==(null===(r=i.direction)||void 0===r?void 0:r.y),M=u.length,P=(c-l)/Math.max(1,M-1),O=(a-s)/Math.max(1,M-1),I=0;I<M;I++){var L,j=u[I],D=null!==(L=j._value)&&void 0!==L?L:f,N=j.x,F=j.y;if(T)N=.7*(l+I*P)+.3*E.map(D),F=j.y+(Math.random()-.5)*t.jitter;if(A)F=.7*(s+I*O)+.3*k.map(D),N=j.x+(Math.random()-.5)*t.jitter;j.x+=(N-j.x)*t.smoothing,j.y+=(F-j.y)*t.smoothing}};for(h.s();!(o=h.n()).done;)u()}catch(t){h.e(t)}finally{h.f()}}}}])}();function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function Y(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=$(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function X(t){return function(t){if(Array.isArray(t))return q(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||$(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(t,e){if(t){if("string"==typeof t)return q(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(t,e):void 0}}function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function K(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Z(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Q(r.key),r)}}function J(t,e,n){return e&&Z(t.prototype,e),n&&Z(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Q(t){var e=function(t,e){if("object"!=V(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=V(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==V(e)?e:e+""}var tt=function(){return J((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.min,r=void 0===n?0:n,i=e.max,o=void 0===i?1:i,s=e.start,a=void 0===s?0:s,l=e.end,c=void 0===l?100:l,h=e.invert,u=void 0!==h&&h;K(this,t),this.min=r,this.max=o,this.start=a,this.end=c,this.invert=u}),[{key:"map",value:function(t){var e=this.max>this.min?(t-this.min)/(this.max-this.min):.5;return this.invert&&(e=1-e),this.start+e*(this.end-this.start)}}])}(),et=function(){return J((function t(){K(this,t),this.smoothing=.2,this.padding=40,this.jitter=10,this.repulsion=.8,this.minDist=25,this.iterations=1}),[{key:"setModel",value:function(t){this.model=t}},{key:"_mapCategorical",value:function(t){var e=X(new Set(t)),n=new Map;return e.forEach((function(t,e){return n.set(t,e)})),n}},{key:"step",value:function(){var t=this,e=this.model.getNodes(),n=e.filter((function(t){return"moon"===t.type})),r=e.filter((function(t){return"vector"===t.type})),i=this.bounds;if(i){var o,s=i.minY+this.padding,a=i.maxY-this.padding,l=i.minX+this.padding,c=i.maxX-this.padding,h=Y(r);try{var u=function(){var e,r,i=o.value,h=i.scalarField;if(!h)return 0;var u=n.filter((function(t){return i.rule(t)}));if(!u.length)return 0;var d,f,p,m,y=[],g=!0,v=Y(u);try{for(v.s();!(d=v.n()).done;){var b=d.value,x=b.data[h];if(null!=x){var _=Number(x);isNaN(_)&&(g=!1),b._value=g?_:x,y.push(b._value)}}}catch(t){v.e(t)}finally{v.f()}if(!y.length)return 0;if(g)f=Math.min.apply(Math,y),p=Math.max.apply(Math,y);else{f=0,p=(m=t._mapCategorical(y)).size-1;var w,S=Y(u);try{for(S.s();!(w=S.n()).done;){var C=w.value;C._value=m.get(C._value)}}catch(t){S.e(t)}finally{S.f()}}var E=new tt({min:f,max:p,start:l,end:c}),k=new tt({min:f,max:p,start:s,end:a});u.sort((function(t,e){var n,r;return(null!==(n=t._value)&&void 0!==n?n:0)-(null!==(r=e._value)&&void 0!==r?r:0)}));for(var T=0!==(null===(e=i.direction)||void 0===e?void 0:e.x),A=0!==(null===(r=i.direction)||void 0===r?void 0:r.y),M=u.length,P=(Math.max(1,M-1),Math.max(1,M-1),0);P<M;P++){var O,I=u[P],L=null!==(O=I._value)&&void 0!==O?O:f,j=I.x,R=I.y;if(T){j=E.map(L),R=I.y+(Math.random()-.5)*t.jitter}if(A){R=k.map(L),j=I.x+(Math.random()-.5)*t.jitter}I.x+=(j-I.x)*t.smoothing,I.y+=(R-I.y)*t.smoothing}for(var D=0;D<t.iterations;D++)for(var N=0;N<M-1;N++){var F=u[N],B=u[N+1],G=B.x-F.x,z=B.y-F.y;if(!(Math.abs(G)>t.minDist&&Math.abs(z)>t.minDist)){var U=Math.sqrt(G*G+z*z)||1e-4;if(U<t.minDist){var W=(t.minDist-U)/U;if(T){var H=z*W*.5*t.repulsion;F.y-=H,B.y+=H}if(A){var V=G*W*.5*t.repulsion;F.x-=V,B.x+=V}}}}};for(h.s();!(o=h.n()).done;)u()}catch(t){h.e(t)}finally{h.f()}}}}])}();function nt(t){return nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nt(t)}function rt(t){return function(t){if(Array.isArray(t))return ot(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||it(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){if(t){if("string"==typeof t)return ot(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ot(t,e):void 0}}function ot(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function st(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,at(r.key),r)}}function at(t){var e=function(t,e){if("object"!=nt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=nt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==nt(e)?e:e+""}var lt=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.innerRadius=20,this.outerRadius=300,this.turns=4,this.spread=1,this.smoothing=.15,this.angleOffset=0,this.jitter=.002,this.wobbleStrength=2,this.wobbleFrequency=2},e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this,n=this.model.getNodes(),r=n.filter((function(t){return"moon"===t.type})),i=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=it(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(n.filter((function(t){return"planet"===t.type})));try{var o=function(){var n=t.value,i=n.scalarField;if(!i)return 0;var o=r.filter((function(t){return n.rule(t)}));if(0===o.length)return 0;o.sort((function(t,e){var n,r;return(null!==(n=t.data[i])&&void 0!==n?n:0)-(null!==(r=e.data[i])&&void 0!==r?r:0)}));var s=o.map((function(t){return t.data[i]})).filter((function(t){return null!=t}));if(0===s.length)return 0;var a=Math.min.apply(Math,rt(s)),l=Math.max.apply(Math,rt(s));o.forEach((function(t,r){var o=t.data[i];null==o&&(o=a);var s=l>a?(o-a)/(l-a):.5,c=e.angleOffset+s*e.turns*Math.PI*2,h=e.innerRadius+s*(e.outerRadius-e.innerRadius)*e.spread;void 0===t._spiralPhase&&(t._spiralPhase=Math.random()*Math.PI*2),t._spiralPhase+=.02;var u=Math.sin(t._spiralPhase*e.wobbleFrequency)*e.wobbleStrength,d=n.x+Math.cos(c)*(h+u),f=n.y+Math.sin(c)*(h+u);Math.random(),e.jitter,t.x+=(d-t.x)*e.smoothing,t.y+=(f-t.y)*e.smoothing}))};for(i.s();!(t=i.n()).done;)o()}catch(t){i.e(t)}finally{i.f()}}}],e&&st(t.prototype,e),n&&st(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ut(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ut(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function ut(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function dt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ft(r.key),r)}}function ft(t){var e=function(t,e){if("object"!=ct(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ct(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ct(e)?e:e+""}var pt=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.innerRadius=50,this.outerRadius=240,this.angularSpeed=.002,this.smoothing=.15,this.wobbleStrength=2,this.wobbleFrequency=2,this.angleJitter=.002},e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this,n=this.model.getNodes(),r=n.filter((function(t){return"moon"===t.type})),i=ht(n.filter((function(t){return"planet"===t.type})));try{var o=function(){var n=t.value;n._orbits=[];var i=n.scalarField;if(!i)return 0;var o=r.filter((function(t){return n.rule(t)}));if(!o.length)return 0;var s={};o.forEach((function(t){var e=null!=t.data[i]?t.data[i]:"__null__";s[e]||(s[e]=[]),s[e].push(t)}));var a=Object.keys(s),l=a.length;a.forEach((function(t,r){var i=s[t],o=e.innerRadius+r/(l-1||1)*(e.outerRadius-e.innerRadius);n._orbits.push({value:t,radius:o,count:i.length}),i.forEach((function(t,r){void 0===t._orbitAngle&&(t._orbitAngle=Math.random()*Math.PI*2),t._orbitAngle+=e.angularSpeed;var i=Math.sin(t._orbitAngle*e.wobbleFrequency)*e.wobbleStrength,s=n.x+Math.cos(t._orbitAngle)*(o+i),a=n.y+Math.sin(t._orbitAngle)*(o+i);t._orbitAngle+=(Math.random()-.5)*e.angleJitter,t.x+=(s-t.x)*e.smoothing,t.y+=(a-t.y)*e.smoothing}))}))};for(i.s();!(t=i.n()).done;)o()}catch(t){i.e(t)}finally{i.f()}}}],e&&dt(t.prototype,e),n&&dt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function mt(t){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt(t)}function yt(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return gt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function gt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function vt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,bt(r.key),r)}}function bt(t){var e=function(t,e){if("object"!=mt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=mt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==mt(e)?e:e+""}var xt=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gravity=.05,this.damping=.999,this.restitution=.7,this.friction=.98,this.radius=10},(e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this.model.getNodes().filter((function(t){return"moon"===t.type})),n=this.bounds,r=n.maxY,i=yt(e);try{for(i.s();!(t=i.n()).done;){var o=t.value;if(!o.fixed){if(o.vy+=this.gravity,o.x+=o.vx,o.y+=o.vy,o.y+this.radius>r){o.y=r-this.radius,o.vy*=-this.restitution,o.vx*=this.friction;var s=.6*(Math.random()-.5),a=.4*Math.abs(o.vy);o.vx+=Math.sin(s)*a}o.x-this.radius<n.minX&&(o.x=n.minX+this.radius,o.vx*=-this.restitution),o.x+this.radius>n.maxX&&(o.x=n.maxX-this.radius,o.vx*=-this.restitution),o.vx*=this.damping,o.vy*=this.damping}}}catch(t){i.e(t)}finally{i.f()}}}])&&vt(t.prototype,e),n&&vt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function _t(t){return _t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_t(t)}function wt(t){return function(t){if(Array.isArray(t))return Ct(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||St(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function St(t,e){if(t){if("string"==typeof t)return Ct(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ct(t,e):void 0}}function Ct(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Et(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,kt(r.key),r)}}function kt(t){var e=function(t,e){if("object"!=_t(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_t(e)?e:e+""}var Tt=function(){return t=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.view=e,this.model=n,this.main=null,this.selected=new Set,this._bindViewEvents()},e=[{key:"_bindViewEvents",value:function(){var t=this;this.view.onNodeClick=function(e){t._inspectNode(e)},this.view.interaction.onNodeRightClick=function(e){var n=e.node,r=e.global,i=(e.ev,t.view.app.canvas.getBoundingClientRect());console.log("CLICKEDDD",n);var o=i.left+r.x,s=i.top+r.y;t.view.selectedNodes.size>1?t._showGroupContextMenu(o,s,n):t._showContextMenu(o,s,n)},this.view.interaction.onStageRightClick=function(e){var n=t.view.app.canvas.getBoundingClientRect();console.log("CLICKEDDD");var r=n.left+e.x,i=n.top+e.y;t.view.selectedNodes.size>1?t._showGroupContextMenu(r,i,null):t._showGraphContextMenu(r,i)},this.view.onNodeDragStart=function(t){t.vx=0,t.vy=0,t.fixed=!0},this.view.onNodeDragMove=function(t,e){t.x=e.x,t.y=e.y},this.view.onNodeDragEnd=function(t){t.fixed=!1},this.view.interaction.onBackgroundPointerDown=function(){t._hideContextMenu(),t._hideGraphContextMenu()},this.view.onSelectionChange=function(e){console.log("Selected nodes:",e),t._refreshFormulaNodes()}}},{key:"_showGraphContextMenu",value:function(t,e){var n=this;this._hideGraphContextMenu();var r=document.createElement("div");r.className="context-menu";var i=this.view.app.canvas.parentElement,o=i.getBoundingClientRect();r.style.position="absolute",r.style.left="".concat(t-o.left,"px"),r.style.top="".concat(e-o.top,"px"),r.style.background="#2b2b2b",r.style.color="#fff",r.style.padding="6px",r.style.borderRadius="8px",r.style.zIndex=1e3,r.style.minWidth="160px",r.style.boxShadow="0 4px 12px rgba(0,0,0,0.4)",r.style.fontSize="13px",r.style.userSelect="none";var s=function(t,e){var n=document.createElement("div");return n.textContent=t,n.style.padding="8px 12px",n.style.borderRadius="6px",n.style.cursor="pointer",n.style.transition="background 0.15s",n.addEventListener("mouseenter",(function(){n.style.background="#3a3a3a"})),n.addEventListener("mouseleave",(function(){n.style.background="transparent"})),n.addEventListener("click",e),n};r.appendChild(s("⏸ Freeze Graph",(function(){var t,e;null===(t=(e=n.main).pauseGraph)||void 0===t||t.call(e),n._hideGraphContextMenu()}))),r.appendChild(s("▶ Resume Graph",(function(){var t,e;null===(t=(e=n.main).resumeGraph)||void 0===t||t.call(e),n._hideGraphContextMenu()}))),r.appendChild(s("| Remove Y Axis",(function(){n.model.removeYVectors(),n._hideGraphContextMenu()}))),r.appendChild(s("- Remove X Axis",(function(){n.model.removeXVectors(),n._hideGraphContextMenu()}))),r.appendChild(s("hide this menu",(function(){n._hideGraphContextMenu()}))),i.appendChild(r);var a=r.getBoundingClientRect(),l=t-o.left,c=e-o.top;l+a.width>o.width&&(l=o.width-a.width-4),c+a.height>o.height&&(c=o.height-a.height-4),l=Math.max(4,l),c=Math.max(4,c),r.style.left="".concat(l,"px"),r.style.top="".concat(c,"px"),this._graphContextMenu=r}},{key:"_inspectNode",value:function(t){var e=document.getElementById("inspector");e||((e=document.createElement("div")).id="inspector",document.body.appendChild(e)),e.innerHTML="\n <pre>".concat(JSON.stringify(t.data,null,2),"</pre>\n ")}},{key:"_hideGraphContextMenu",value:function(){this._graphContextMenu&&(this._graphContextMenu.remove(),this._graphContextMenu=null)}},{key:"_showContextMenu",value:function(t,e,n){var r=this;this._hideContextMenu();var i=document.createElement("div");i.className="context-menu";var o=this.view.app.canvas.parentElement,s=o.getBoundingClientRect();i.style.position="absolute",i.style.left="".concat(t-s.left,"px"),i.style.top="".concat(e-s.top,"px"),i.style.background="#2b2b2b",i.style.color="#fff",i.style.padding="6px",i.style.borderRadius="8px",i.style.zIndex=1e3,i.style.minWidth="140px",i.style.boxShadow="0 4px 12px rgba(0,0,0,0.4)",i.style.fontSize="13px",i.style.userSelect="none";var a=function(t,e){var n=document.createElement("div");return n.textContent=t,n.style.padding="8px 12px",n.style.borderRadius="6px",n.style.cursor="pointer",n.style.transition="background 0.15s",n.addEventListener("mouseenter",(function(){n.style.background="#3a3a3a"})),n.addEventListener("mouseleave",(function(){n.style.background="transparent"})),n.addEventListener("click",e),n};i.appendChild(a("🗑 Delete Node",(function(){r._deleteNode(n),r._hideContextMenu()})));var l=document.createElement("div");l.style.height="1px",l.style.background="#444",l.style.margin="4px 0",i.appendChild(l),i.appendChild(a("🔍 Inspect",(function(){var t,e;null===(t=(e=r.main).onNodeInspect)||void 0===t||t.call(e,n),r._hideContextMenu()}))),o.appendChild(i),i.style.visibility="hidden",i.style.left="0px",i.style.top="0px";var c=i.getBoundingClientRect(),h=t-s.left,u=e-s.top,d=s.width,f=s.height;h+c.width>d&&(h=d-c.width-4),u+c.height>f&&(u=f-c.height-4),h=Math.max(4,h),u=Math.max(4,u),i.style.left="".concat(h,"px"),i.style.top="".concat(u,"px"),i.style.visibility="visible",this._contextMenu=i}},{key:"_hideContextMenu",value:function(){this._contextMenu&&(this._contextMenu.remove(),this._contextMenu=null),this._hideGroupContextMenu()}},{key:"_showGroupContextMenu",value:function(t,e,n){var r=this;this._hideGroupContextMenu();var i=document.createElement("div");i.className="context-menu";var o=this.view.app.canvas.parentElement,s=o.getBoundingClientRect();i.style.position="absolute",i.style.left="".concat(t-s.left,"px"),i.style.top="".concat(e-s.top,"px"),i.style.background="#2b2b2b",i.style.color="#fff",i.style.padding="6px",i.style.borderRadius="8px",i.style.zIndex=1e3,i.style.minWidth="140px",i.style.boxShadow="0 4px 12px rgba(0,0,0,0.4)",i.style.fontSize="13px",i.style.userSelect="none";var a=function(t,e){var n=document.createElement("div");return n.textContent=t,n.style.padding="8px 12px",n.style.borderRadius="6px",n.style.cursor="pointer",n.style.transition="background 0.15s",n.addEventListener("mouseenter",(function(){n.style.background="#3a3a3a"})),n.addEventListener("mouseleave",(function(){n.style.background="transparent"})),n.addEventListener("click",e),n};i.appendChild(a("🗑 Delete Selected Nodes",(function(){for(var t=0,e=wt(r.view.selectedNodes);t<e.length;t++){var n=e[t];r._deleteNode(n)}r.view.selectedNodes.clear(),r.view.renderer.updateSelection(r.view.selectedNodes),r._hideGroupContextMenu()})));var l=document.createElement("div");l.style.height="1px",l.style.background="#444",l.style.margin="4px 0",i.appendChild(l),i.appendChild(a("🔍 Inspect Selection",(function(){var t,e;null===(t=(e=r.main).onGroupInspect)||void 0===t||t.call(e,r.view.getSelectedMoons()),r._hideGroupContextMenu()}))),o.appendChild(i),this._groupContextMenu=i}},{key:"_hideGroupContextMenu",value:function(){this._groupContextMenu&&(this._groupContextMenu.remove(),this._groupContextMenu=null)}},{key:"_deleteNode",value:function(t){var e,n,r;this.model.deleteNode(t.id),this.view.renderer.remove(t.id),null===(e=this.view.selectedNodes)||void 0===e||e.delete(t),this.view.renderer.updateSelection(this.view.selectedNodes),null===(n=(r=this.view).onSelectionChange)||void 0===n||n.call(r,this.view.selectedNodes),this._hideContextMenu()}},{key:"_highlight",value:function(t){var e=this.view.graphicsMap.get(t);e&&(e.tint=16711680)}},{key:"_refreshFormulaNodes",value:function(){var t,e=this.model.getNodes(),n=e.filter((function(t){return"formula"!==t.type})),r=wt(this.view.selectedNodes).filter((function(t){return"formula"!==t.type})),i={sum:function(t,e){return t.reduce((function(t,n){var r;return t+Number((null===(r=n.data)||void 0===r?void 0:r[e])||0)}),0)},count:function(t){return t.length},avg:function(t,e){return t.length?i.sum(t,e)/t.length:0},min:function(t,e){return t.length?Math.min.apply(Math,wt(t.map((function(t){var n;return Number((null===(n=t.data)||void 0===n?void 0:n[e])||0)})))):0},max:function(t,e){return t.length?Math.max.apply(Math,wt(t.map((function(t){var n;return Number((null===(n=t.data)||void 0===n?void 0:n[e])||0)})))):0}},o=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=St(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(e);try{for(o.s();!(t=o.n()).done;){var s=t.value;if("formula"===s.type){console.log("refreshing".node);var a="selected"===s.scope?r:n,l=i[s.formula]||i.sum;s.value=l(a,s.scalarField)}}}catch(t){o.e(t)}finally{o.f()}}}],e&&Et(t.prototype,e),n&&Et(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}(),At=i(8507);const Mt={extension:{type:At.Ag.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.all([i.e(859),i.e(397)]).then(i.bind(i,8397))}},Pt={extension:{type:At.Ag.Environment,name:"webworker",priority:0},test:()=>"undefined"!=typeof self&&void 0!==self.WorkerGlobalScope,load:async()=>{await Promise.all([i.e(859),i.e(162)]).then(i.bind(i,2162))}};i(5753),i(6312);var Ot=i(1761),It=i(800);let Lt,jt;async function Rt(t={}){return void 0!==jt||(jt=await(async()=>{const e=Ot.e.get().getNavigator().gpu;if(!e)return!1;try{const n=await e.requestAdapter(t);return await n.requestDevice(),!0}catch(t){return!1}})()),jt}const Dt=["webgl","webgpu","canvas"];var Nt=i(5559),Ft=i(7073),Bt=i(4670);class Gt{static init(t){Object.defineProperty(this,"resizeTo",{configurable:!0,set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame((()=>this.resize())))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;let t,e;if(this._cancelResize(),this._resizeTo===globalThis.window)t=globalThis.innerWidth,e=globalThis.innerHeight;else{const{clientWidth:n,clientHeight:r}=this._resizeTo;t=n,e=r}this.renderer.resize(t,e),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Gt.extension=At.Ag.Application;var zt=i(4458),Ut=i(7309);class Wt{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{configurable:!0,set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,zt.d.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Ut.R.shared:new Ut.R,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Wt.extension=At.Ag.Application,At.XO.add(Gt),At.XO.add(Wt);const Ht=class t{constructor(...t){this.stage=new Nt.mc,void 0!==t[0]&&(0,Bt.t6)(Bt.lj,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.stage||(this.stage=new Nt.mc),this.renderer=await async function(t){let e,n=[];t.preference?(n.push(t.preference),Dt.forEach((e=>{e!==t.preference&&n.push(e)}))):n=Dt.slice();let r={};for(let s=0;s<n.length;s++){const a=n[s];if("webgpu"===a&&await Rt()){const{WebGPURenderer:n}=await Promise.all([i.e(468),i.e(866)]).then(i.bind(i,9866));e=n,r={...t,...t.webgpu};break}if("webgl"===a&&(o=t.failIfMajorPerformanceCaveat??It.k.defaultOptions.failIfMajorPerformanceCaveat,void 0!==Lt||(Lt=(()=>{const t={stencil:!0,failIfMajorPerformanceCaveat:o??It.k.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Ot.e.get().getWebGLRenderingContext())return!1;let e=Ot.e.get().createCanvas().getContext("webgl",t);const n=!!e?.getContextAttributes()?.stencil;if(e){const t=e.getExtension("WEBGL_lose_context");t&&t.loseContext()}return e=null,n}catch(t){return!1}})()),Lt)){const{WebGLRenderer:n}=await Promise.all([i.e(468),i.e(132)]).then(i.bind(i,4132));e=n,r={...t,...t.webgl};break}if("canvas"===a){const{CanvasRenderer:n}=await Promise.all([i.e(468),i.e(851)]).then(i.bind(i,6851));e=n,r={...t,...t.canvasOptions};break}}var o;if(delete r.webgpu,delete r.webgl,delete r.canvasOptions,!e)throw new Error("No available renderer for the current environment");const s=new e;return await s.init(r),s}(e),t._plugins.forEach((t=>{t.init.call(this,e)}))}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return(0,Bt.t6)(Bt.lj,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,n=!1){const r=t._plugins.slice(0);r.reverse(),r.forEach((t=>{t.destroy.call(this)})),this.stage.destroy(n),this.stage=null,this.renderer.destroy(e),this.renderer=null}};Ht._plugins=[];let Vt=Ht;At.XO.handleByList(At.Ag.Application,Vt._plugins),At.XO.add(Ft.M);var Yt=i(6125),Xt=i(9252),$t=(i(9726),i(4663)),qt=i(583),Kt=i(218),Zt=i(2812),Jt=i(4985);class Qt extends Jt.l{constructor(t,e){const{text:n,resolution:r,style:i,anchor:o,width:s,height:a,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=n??"",this.style=i,this.resolution=r??null,this.allowChildren=!1,this._anchor=new Zt.o({_onUpdate:()=>{this.onViewUpdate()}}),o&&(this.anchor=o),this.roundPixels=l??!1,void 0!==s&&(this.width=s),void 0!==a&&(this.height=a)}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=null===t,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){"object"==typeof t?(e=t.height??t.width,t=t.width):e??(e=t),void 0!==t&&this._setWidth(t,this.bounds.width),void 0!==e&&this._setHeight(e,this.bounds.height)}containsPoint(t){const e=this.bounds.width,n=this.bounds.height,r=-e*this.anchor.x;let i=0;return t.x>=r&&t.x<=r+e&&(i=-n*this.anchor.y,t.y>=i&&t.y<=i+n)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,("boolean"==typeof t?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}}var te=i(2577),ee=i(7608),ne=i(9939);let re=null,ie=null;function oe(t,e,n){for(let r=0,i=4*n*e;r<e;++r,i+=4)if(0!==t[i+3])return!1;return!0}function se(t,e,n,r,i){const o=4*e;for(let e=r,s=r*o+4*n;e<=i;++e,s+=o)if(0!==t[s+3])return!1;return!0}function ae(...t){let e=t[0];e.canvas||(e={canvas:t[0],resolution:t[1]});const{canvas:n}=e,r=Math.min(e.resolution??1,1),i=e.width??n.width,o=e.height??n.height;let s=e.output;if(function(t,e){re||(re=Ot.e.get().createCanvas(256,128),ie=re.getContext("2d",{willReadFrequently:!0}),ie.globalCompositeOperation="copy",ie.globalAlpha=1),(re.width<t||re.height<e)&&(re.width=(0,ne.U5)(t),re.height=(0,ne.U5)(e))}(i,o),!ie)throw new TypeError("Failed to get canvas 2D context");ie.drawImage(n,0,0,i,o,0,0,i*r,o*r);const a=ie.getImageData(0,0,i,o).data;let l=0,c=0,h=i-1,u=o-1;for(;c<o&&oe(a,i,c);)++c;if(c===o)return Xt.M.EMPTY;for(;oe(a,i,u);)--u;for(;se(a,i,l,c,u);)++l;for(;se(a,i,h,c,u);)--h;return++h,++u,ie.globalCompositeOperation="source-over",ie.strokeRect(l,c,h-l,u-c),ie.globalCompositeOperation="copy",s??(s=new Xt.M),s.set(l/r,c/r,(h-l)/r,(u-c)/r),s}class le{constructor(t=0,e=0,n=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=n,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,null!==e.prev&&(e.prev.next=e.next),null!==e.next&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){const e=new Array(t.length);for(let n=0;n<t.length;n++){const r=t[n];e[n]=[r,this.get(r)]}return e}evict(t=!1){if(t||this.size>0){const t=this.first;delete this.items[t.key],0==--this.size?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){const e=this.items[t];if(void 0!==e)return this.ttl>0&&e.expiry<=Date.now()?void this.delete(t):(this.moveToEnd(e),e.value)}has(t){return t in this.items}moveToEnd(t){this.last!==t&&(null!==t.prev&&(t.prev.next=t.next),null!==t.next&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),t.prev=this.last,t.next=null,null!==this.last&&(this.last.next=t),this.last=t,null===this.first&&(this.first=t))}keys(){const t=new Array(this.size);let e=this.first,n=0;for(;null!==e;)t[n++]=e.key,e=e.next;return t}setWithEvicted(t,e,n=this.resetTtl){let r=null;if(this.has(t))this.set(t,e,!0,n);else{this.max>0&&this.size===this.max&&(r={...this.first},this.evict(!0));let n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e};1==++this.size?this.first=n:this.last.next=n,this.last=n}return r}set(t,e,n=!1,r=this.resetTtl){let i=this.items[t];return n||void 0!==i?(i.value=e,!1===n&&r&&(i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(i)):(this.max>0&&this.size===this.max&&this.evict(!0),i=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},1==++this.size?this.first=i:this.last.next=i,this.last=i),this}values(t=this.keys()){const e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=this.get(t[n]);return e}}function ce(t){return!!t.tagStyles&&Object.keys(t.tagStyles).length>0}function he(t){return t.includes("<")}function ue(t,e){const n=[],r=e.tagStyles;if(!ce(e)||!he(t))return n.push({text:t,style:e}),n;const i=[e],o=[];let s="",a=0;for(;a<t.length;){const e=t[a];if("<"===e){const h=t.indexOf(">",a);if(-1===h){s+=e,a++;continue}const u=t.slice(a+1,h);if(u.startsWith("/")){const e=u.slice(1).trim();if(o.length>0&&o[o.length-1]===e){s.length>0&&(n.push({text:s,style:i[i.length-1]}),s=""),i.pop(),o.pop(),a=h+1;continue}s+=t.slice(a,h+1),a=h+1;continue}{const e=u.trim();if(r[e]){s.length>0&&(n.push({text:s,style:i[i.length-1]}),s="");const t=i[i.length-1],u=(l=t,c=r[e],l.clone().assign(c));i.push(u),o.push(e),a=h+1;continue}s+=t.slice(a,h+1),a=h+1;continue}}s+=e,a++}var l,c;return s.length>0&&n.push({text:s,style:i[i.length-1]}),n}const de=new Set([10,13]),fe=new Set([9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]),pe=(new Set([9,32]),new Set([45,8208,8211,8212,173])),me=/(\r\n|\r|\n)/,ye=/(?:\r\n|\r|\n)/;function ge(t){return"string"==typeof t&&de.has(t.charCodeAt(0))}function ve(t,e){return"string"==typeof t&&fe.has(t.charCodeAt(0))}function be(t){return"string"==typeof t&&pe.has(t.charCodeAt(0))}function xe(t){return"normal"===t||"pre-line"===t}function _e(t){return"normal"===t}function we(t){if("string"!=typeof t)return"";let e=t.length-1;for(;e>=0&&ve(t[e]);)e--;return e<t.length-1?t.slice(0,e+1):t}function Se(t){const e=[],n=[];if("string"!=typeof t)return e;for(let r=0;r<t.length;r++){const i=t[r],o=t[r+1];ve(i)||ge(i)?(n.length>0&&(e.push(n.join("")),n.length=0),"\r"===i&&"\n"===o?(e.push("\r\n"),r++):e.push(i)):(n.push(i),be(i)&&o&&!ve(o)&&!ge(o)&&(e.push(n.join("")),n.length=0))}return n.length>0&&e.push(n.join("")),e}function Ce(t,e,n,r){const i=n(t),o=[];for(let n=0;n<i.length;n++){let s=i[n],a=s,l=1;for(;i[n+l];){const o=i[n+l];if(r(a,o,t,n,e))break;s+=o,a=o,l++}n+=l-1,o.push(s)}return o}const Ee=/\r\n|\r|\n/g;function ke(t,e,n,r,i,o,s,a){const l=ue(t,e);if(_e(e.whiteSpace))for(let t=0;t<l.length;t++){const e=l[t];l[t]={text:e.text.replace(Ee," "),style:e.style}}const c=[];let h=[];for(const t of l){const e=t.text.split(me);for(let n=0;n<e.length;n++){const r=e[n];"\r\n"===r||"\r"===r||"\n"===r?(c.push(h),h=[]):r.length>0&&h.push({text:r,style:t.style})}}(h.length>0||0===c.length)&&c.push(h);const u=n?function(t,e,n,r,i,o){const{letterSpacing:s,whiteSpace:a,wordWrapWidth:l,breakWords:c}=e,h=xe(a),u=l+s,d={};let f="";const p=(t,e)=>{const i=`${t}|${e.styleKey}`;let o=d[i];if(void 0===o){const s=e._fontString;s!==f&&(n.font=s,f=s),o=r(t,e.letterSpacing,n)+e.letterSpacing,d[i]=o}return o},m=[];for(const e of t){const t=Te(e),n=m.length,r=e=>{let n=0,r=e;do{const{token:e,style:i}=t[r];n+=p(e,i),r++}while(r<t.length&&t[r].continuesFromPrevious);return n},s=e=>{const n=[];let r=e;do{n.push({token:t[r].token,style:t[r].style}),r++}while(r<t.length&&t[r].continuesFromPrevious);return n};let a=[],l=0,d=!h,f=null;const y=()=>{f&&f.text.length>0&&a.push(f),f=null},g=()=>{if(y(),a.length>0){const t=a[a.length-1];t.text=we(t.text),0===t.text.length&&a.pop()}m.push(a),a=[],l=0,d=!1};for(let e=0;e<t.length;e++){const{token:n,style:v,continuesFromPrevious:b}=t[e],x=p(n,v);if(h){const t=ve(n),e=f?.text[f.text.length-1]??a[a.length-1]?.text.slice(-1)??"",r=!!e&&ve(e);if(t&&r)continue}const _=!b,w=_?r(e):x;if(w>u&&_)if(l>0&&g(),c){const t=s(e);for(let e=0;e<t.length;e++){const n=t[e].token,r=t[e].style,s=Ce(n,c,o,i);for(const t of s){const e=p(t,r);e+l>u&&g(),f&&f.style===r?f.text+=t:(y(),f={text:t,style:r}),l+=e}}e+=t.length-1}else{const t=s(e);y(),m.push(t.map((t=>({text:t.token,style:t.style})))),d=!1,e+=t.length-1}else if(w+l>u&&_){if(ve(n)){d=!1;continue}g(),f={text:n,style:v},l=x}else if(b&&!c)f&&f.style===v?f.text+=n:(y(),f={text:n,style:v}),l+=x;else{const t=ve(n);if(0===l&&t&&!d)continue;f&&f.style===v?f.text+=n:(y(),f={text:n,style:v}),l+=x}}if(y(),a.length>0){const t=a[a.length-1];t.text=we(t.text),0===t.text.length&&a.pop()}(a.length>0||m.length===n)&&m.push(a)}return m}(c,e,r,i,s,a):c,d=[],f=[],p=[],m=[],y=[];let g=0;const v=o(e._fontString);0===v.fontSize&&(v.fontSize=e.fontSize,v.ascent=e.fontSize);let b="",x=!!e.dropShadow,_=e._stroke?.width||0;for(const t of u){let n=0,s=v.ascent,a=v.descent,l="";for(const e of t){const t=e.style._fontString,c=o(t);t!==b&&(r.font=t,b=t);n+=i(e.text,e.style.letterSpacing,r),s=Math.max(s,c.ascent),a=Math.max(a,c.descent),l+=e.text;const h=e.style._stroke?.width||0;h>_&&(_=h),!x&&e.style.dropShadow&&(x=!0)}0===t.length&&(s=v.ascent,a=v.descent),d.push(n),f.push(s),p.push(a),y.push(l);const c=e.lineHeight||s+a;m.push(c+e.leading),g=Math.max(g,n)}const w=_,S=(n&&"left"!==e.align?Math.max(g,e.wordWrapWidth):g)+w+(e.dropShadow?e.dropShadow.distance:0);let C=0;for(let t=0;t<m.length;t++)C+=m[t];C=Math.max(C,m[0]+w);return{width:S,height:C+(e.dropShadow?e.dropShadow.distance:0),lines:y,lineWidths:d,lineHeight:(e.lineHeight||v.fontSize)+e.leading,maxLineWidth:g,fontProperties:v,runsByLine:u,lineAscents:f,lineDescents:p,lineHeights:m,hasDropShadow:x}}function Te(t){const e=[];let n=!1;for(const r of t){const t=Se(r.text);let i=!0;for(const o of t){const t=ve(o)||ge(o),s=i&&n&&!t;e.push({token:o,style:r.style,continuesFromPrevious:s}),n=!t,i=!1}}return e}const Ae={willReadFrequently:!0};function Me(t,e,n,r,i){let o=n[t];return"number"!=typeof o&&(o=i(t,e,r)+e,n[t]=o),o}const Pe={willReadFrequently:!0},Oe=class t{static get experimentalLetterSpacingSupported(){let e=t._experimentalLetterSpacingSupported;if(void 0===e){const n=Ot.e.get().getCanvasRenderingContext2D().prototype;e=t._experimentalLetterSpacingSupported="letterSpacing"in n||"textLetterSpacing"in n}return e}constructor(t,e,n,r,i,o,s,a,l,c){this.text=t,this.style=e,this.width=n,this.height=r,this.lines=i,this.lineWidths=o,this.lineHeight=s,this.maxLineWidth=a,this.fontProperties=l,c&&(this.runsByLine=c.runsByLine,this.lineAscents=c.lineAscents,this.lineDescents=c.lineDescents,this.lineHeights=c.lineHeights,this.hasDropShadow=c.hasDropShadow)}static measureText(e=" ",n,r=t._canvas,i=n.wordWrap){const o=`${e}-${n.styleKey}-wordWrap-${i}`;if(t._measurementCache.has(o))return t._measurementCache.get(o);if(ce(n)&&he(e)){const r=ke(e,n,i,t._context,t._measureText,t.measureFont,t.canBreakChars,t.wordWrapSplit),s=new t(e,n,r.width,r.height,r.lines,r.lineWidths,r.lineHeight,r.maxLineWidth,r.fontProperties,{runsByLine:r.runsByLine,lineAscents:r.lineAscents,lineDescents:r.lineDescents,lineHeights:r.lineHeights,hasDropShadow:r.hasDropShadow});return t._measurementCache.set(o,s),s}const s=n._fontString,a=t.measureFont(s);0===a.fontSize&&(a.fontSize=n.fontSize,a.ascent=n.fontSize,a.descent=0);const l=t._context;l.font=s;const c=(i?t._wordWrap(e,n,r):e).split(ye),h=new Array(c.length);let u=0;for(let e=0;e<c.length;e++){const r=t._measureText(c[e],n.letterSpacing,l);h[e]=r,u=Math.max(u,r)}const d=n._stroke?.width??0,f=n.lineHeight||a.fontSize,p=t._getAlignWidth(u,n,i),m=t._adjustWidthForStyle(p,n),y=Math.max(f,a.fontSize+d)+(c.length-1)*(f+n.leading),g=t._adjustHeightForStyle(y,n),v=new t(e,n,m,g,c,h,f+n.leading,u,a);return t._measurementCache.set(o,v),v}static _adjustWidthForStyle(t,e){let n=t+(e._stroke?.width||0);return e.dropShadow&&(n+=e.dropShadow.distance),n}static _adjustHeightForStyle(t,e){let n=t;return e.dropShadow&&(n+=e.dropShadow.distance),n}static _getAlignWidth(t,e,n){return n&&"left"!==e.align?Math.max(t,e.wordWrapWidth):t}static _measureText(e,n,r){let i=!1;t.experimentalLetterSpacingSupported&&(t.experimentalLetterSpacing?(r.letterSpacing=`${n}px`,r.textLetterSpacing=`${n}px`,i=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));const o=r.measureText(e);let s=o.width;const a=-(o.actualBoundingBoxLeft??0);let l=(o.actualBoundingBoxRight??0)-a;if(s>0)if(i)s-=n,l-=n;else{const r=(t.graphemeSegmenter(e).length-1)*n;s+=r,l+=r}return Math.max(s,l)}static _wordWrap(e,n,r=t._canvas){return function(t,e,n,r,i,o,s){const a=n.getContext("2d",Ae);a.font=e._fontString;let l=0,c="";const h=[],u=Object.create(null),{letterSpacing:d,whiteSpace:f}=e,p=xe(f),m=_e(f);let y=!p;const g=e.wordWrapWidth+d,v=Se(t);for(let t=0;t<v.length;t++){let n=v[t];if(ge(n)){if(!m){h.push(we(c)),y=!p,c="",l=0;continue}n=" "}if(p){const t=ve(n),e=ve(c[c.length-1]);if(t&&e)continue}const f=Me(n,d,u,a,r);if(f>g)if(""!==c&&(h.push(we(c)),c="",l=0),i(n,e.breakWords)){const t=Ce(n,e.breakWords,s,o);for(const e of t){const t=Me(e,d,u,a,r);t+l>g&&(h.push(we(c)),y=!1,c="",l=0),c+=e,l+=t}}else c.length>0&&(h.push(we(c)),c="",l=0),h.push(we(n)),y=!1,c="",l=0;else f+l>g&&(y=!1,h.push(we(c)),c="",l=0),(c.length>0||!ve(n)||y)&&(c+=n,l+=f)}const b=we(c);return b.length>0&&h.push(b),h.join("\n")}(e,n,r,t._measureText,t.canBreakWords,t.canBreakChars,t.wordWrapSplit)}static isBreakingSpace(t,e){return ve(t)}static canBreakWords(t,e){return e}static canBreakChars(t,e,n,r,i){return!0}static wordWrapSplit(e){return t.graphemeSegmenter(e)}static measureFont(e){if(t._fonts[e])return t._fonts[e];const n=t._context;n.font=e;const r=n.measureText(t.METRICS_STRING+t.BASELINE_SYMBOL),i=r.actualBoundingBoxAscent??0,o=r.actualBoundingBoxDescent??0,s={ascent:i,descent:o,fontSize:i+o};return t._fonts[e]=s,s}static clearMetrics(e=""){e?delete t._fonts[e]:t._fonts={}}static get _canvas(){if(!t.__canvas){let e;try{const n=new OffscreenCanvas(0,0),r=n.getContext("2d",Pe);if(r?.measureText)return t.__canvas=n,n;e=Ot.e.get().createCanvas()}catch(t){e=Ot.e.get().createCanvas()}e.width=e.height=10,t.__canvas=e}return t.__canvas}static get _context(){return t.__context||(t.__context=t._canvas.getContext("2d",Pe)),t.__context}};Oe.METRICS_STRING="|ÉqÅ",Oe.BASELINE_SYMBOL="M",Oe.BASELINE_MULTIPLIER=1.4,Oe.HEIGHT_MULTIPLIER=2,Oe.graphemeSegmenter=(()=>{if("function"==typeof Intl?.Segmenter){const t=new Intl.Segmenter;return e=>{const n=t.segment(e),r=[];let i=0;for(const t of n)r[i++]=t.segment;return r}}return t=>[...t]})(),Oe.experimentalLetterSpacing=!1,Oe._fonts={},Oe._measurementCache=function(t=1e3,e=0,n=!1){if(isNaN(t)||t<0)throw new TypeError("Invalid max value");if(isNaN(e)||e<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof n)throw new TypeError("Invalid resetTtl value");return new le(t,e,n)}(1e3);let Ie=Oe;const Le=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function je(t){const e="number"==typeof t.fontSize?`${t.fontSize}px`:t.fontSize;let n=t.fontFamily;Array.isArray(t.fontFamily)||(n=t.fontFamily.split(","));for(let t=n.length-1;t>=0;t--){let e=n[t].trim();/([\"\'])[^\'\"]+\1/.test(e)||Le.includes(e)||(e=`"${e}"`),n[t]=e}return`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${e} ${n.join(",")}`}var Re=i(9313),De=i(5589),Ne=i(268),Fe=i(7276),Be=i(2806);const Ge=1e5;function ze(t,e,n,r=0,i=0,o=0){if(t.texture===De.g.WHITE&&!t.fill)return te.Q.shared.setValue(t.color).setAlpha(t.alpha??1).toHexa();if(!t.fill){const n=e.createPattern(t.texture.source.resource,"repeat"),r=t.matrix.copyTo(Re.u.shared);return r.scale(t.texture.source.pixelWidth,t.texture.source.pixelHeight),n.setTransform(r),n}if(t.fill instanceof Be.m){const n=t.fill,r=e.createPattern(n.texture.source.resource,"repeat"),i=n.transform.copyTo(Re.u.shared);return i.scale(n.texture.source.pixelWidth,n.texture.source.pixelHeight),r.setTransform(i),r}if(t.fill instanceof Fe._){const s=t.fill,a="linear"===s.type,l="local"===s.textureSpace;let c,h=1,u=1;l&&n&&(h=n.width+r,u=n.height+r);let d=!1;if(a){const{start:t,end:n}=s;c=e.createLinearGradient(t.x*h+i,t.y*u+o,n.x*h+i,n.y*u+o),d=Math.abs(n.x-t.x)<Math.abs(.1*(n.y-t.y))}else{const{center:t,innerRadius:n,outerCenter:r,outerRadius:a}=s;c=e.createRadialGradient(t.x*h+i,t.y*u+o,n*h,r.x*h+i,r.y*u+o,a*h)}if(d&&l&&n){const t=n.lineHeight/u;for(let e=0;e<n.lines.length;e++){const i=(e*n.lineHeight+r/2)/u;s.colorStops.forEach((e=>{let n=i+e.offset*t;n=Math.max(0,Math.min(1,n)),c.addColorStop(Math.floor(n*Ge)/Ge,te.Q.shared.setValue(e.color).toHex())}))}}else s.colorStops.forEach((t=>{c.addColorStop(t.offset,te.Q.shared.setValue(t.color).toHex())}));return c}return(0,Ne.R)("FillStyle not recognised",t),"red"}const Ue=new Xt.M;function We(t){let e=0;for(let n=0;n<t.length;n++)32===t.charCodeAt(n)&&e++;return e}const He=new class{getCanvasAndContext(t){const{text:e,style:n,resolution:r=1}=t,i=n._getFinalPadding(),o=Ie.measureText(e||" ",n),s=Math.ceil(Math.ceil(Math.max(1,o.width)+2*i)*r),a=Math.ceil(Math.ceil(Math.max(1,o.height)+2*i)*r),l=ee.N.getOptimalCanvasAndContext(s,a);this._renderTextToCanvas(n,i,r,l,o);return{canvasAndContext:l,frame:n.trim?ae({canvas:l.canvas,width:s,height:a,resolution:1,output:Ue}):Ue.set(0,0,s,a)}}returnCanvasAndContext(t){ee.N.returnCanvasAndContext(t)}_renderTextToCanvas(t,e,n,r,i){if(i.runsByLine&&i.runsByLine.length>0)return void this._renderTaggedTextToCanvas(i,t,e,n,r);const{canvas:o,context:s}=r,a=je(t),l=i.lines,c=i.lineHeight,h=i.lineWidths,u=i.maxLineWidth,d=i.fontProperties,f=o.height;if(s.resetTransform(),s.scale(n,n),s.textBaseline=t.textBaseline,t._stroke?.width){const e=t._stroke;s.lineWidth=e.width,s.miterLimit=e.miterLimit,s.lineJoin=e.join,s.lineCap=e.cap}let p,m;s.font=a;const y=t.dropShadow?2:1,g=t.wordWrap?Math.max(t.wordWrapWidth,u):u,v=(t._stroke?.width??0)/2;let b=(c-d.fontSize)/2;c-d.fontSize<0&&(b=0);for(let o=0;o<y;++o){const a=t.dropShadow&&0===o,u=a?Math.ceil(Math.max(1,f)+2*e):0,y=u*n;if(a)this._setupDropShadow(s,t,n,y);else{const n=t._gradientBounds,r=t._gradientOffset;if(n){const o={width:n.width,height:n.height,lineHeight:n.height,lines:i.lines};this._setFillAndStrokeStyles(s,t,o,e,v,r?.x??0,r?.y??0)}else r?this._setFillAndStrokeStyles(s,t,i,e,v,r.x,r.y):this._setFillAndStrokeStyles(s,t,i,e,v);s.shadowColor="rgba(0,0,0,0)"}for(let n=0;n<l.length;n++){p=v,m=v+n*c+d.ascent+b,p+=this._getAlignmentOffset(h[n],g,t.align);let i=0;if("justify"===t.align&&t.wordWrap&&n<l.length-1){const t=We(l[n]);t>0&&(i=(g-h[n])/t)}t._stroke?.width&&this._drawLetterSpacing(l[n],t,r,p+e,m+e-u,!0,i),void 0!==t._fill&&this._drawLetterSpacing(l[n],t,r,p+e,m+e-u,!1,i)}}}_renderTaggedTextToCanvas(t,e,n,r,i){const{canvas:o,context:s}=i,{runsByLine:a,lineWidths:l,maxLineWidth:c,lineAscents:h,lineHeights:u,hasDropShadow:d}=t,f=o.height;s.resetTransform(),s.scale(r,r),s.textBaseline=e.textBaseline;const p=d?2:1,m=e.wordWrap?Math.max(e.wordWrapWidth,c):c;let y=e._stroke?.width??0;for(const t of a)for(const e of t){const t=e.style._stroke?.width??0;t>y&&(y=t)}const g=y/2,v=[];for(let t=0;t<a.length;t++){const e=a[t],n=[];for(const t of e){const e=je(t.style);s.font=e,n.push({width:Ie._measureText(t.text,t.style.letterSpacing,s),font:e})}v.push(n)}for(let t=0;t<p;++t){const o=d&&0===t,c=o?Math.ceil(Math.max(1,f)+2*n):0,p=c*r;o||(s.shadowColor="rgba(0,0,0,0)");let y=g;for(let t=0;t<a.length;t++){const d=a[t],f=l[t],b=h[t],x=u[t],_=v[t];let w=g;w+=this._getAlignmentOffset(f,m,e.align);let S=0;if("justify"===e.align&&e.wordWrap&&t<a.length-1){let t=0;for(const e of d)t+=We(e.text);t>0&&(S=(m-f)/t)}const C=y+b;let E=w+n;for(let t=0;t<d.length;t++){const e=d[t],{width:a,font:l}=_[t];if(s.font=l,s.textBaseline=e.style.textBaseline,e.style._stroke?.width){const t=e.style._stroke;if(s.lineWidth=t.width,s.miterLimit=t.miterLimit,s.lineJoin=t.join,s.lineCap=t.cap,o){if(!e.style.dropShadow){E+=a+We(e.text)*S;continue}this._setupDropShadow(s,e.style,r,p)}else{const r=Ie.measureFont(l),i=e.style.lineHeight||r.fontSize,o={width:a,height:i,lineHeight:i,lines:[e.text]};s.strokeStyle=ze(t,s,o,2*n,E-n,y)}this._drawLetterSpacing(e.text,e.style,i,E,C+n-c,!0,S)}E+=a+We(e.text)*S}E=w+n;for(let t=0;t<d.length;t++){const e=d[t],{width:a,font:l}=_[t];if(s.font=l,s.textBaseline=e.style.textBaseline,void 0!==e.style._fill){if(o){if(!e.style.dropShadow){E+=a+We(e.text)*S;continue}this._setupDropShadow(s,e.style,r,p)}else{const t=Ie.measureFont(l),r=e.style.lineHeight||t.fontSize,i={width:a,height:r,lineHeight:r,lines:[e.text]};s.fillStyle=ze(e.style._fill,s,i,2*n,E-n,y)}this._drawLetterSpacing(e.text,e.style,i,E,C+n-c,!1,S)}E+=a+We(e.text)*S}y+=x}}}_setFillAndStrokeStyles(t,e,n,r,i,o=0,s=0){if(t.fillStyle=e._fill?ze(e._fill,t,n,2*r,o,s):null,e._stroke?.width){const a=i+2*r;t.strokeStyle=ze(e._stroke,t,n,a,o,s)}}_setupDropShadow(t,e,n,r){t.fillStyle="black",t.strokeStyle="black";const i=e.dropShadow,o=i.color,s=i.alpha;t.shadowColor=te.Q.shared.setValue(o).setAlpha(s).toRgbaString();const a=i.blur*n,l=i.distance*n;t.shadowBlur=a,t.shadowOffsetX=Math.cos(i.angle)*l,t.shadowOffsetY=Math.sin(i.angle)*l+r}_getAlignmentOffset(t,e,n){return"right"===n?e-t:"center"===n?(e-t)/2:0}_drawLetterSpacing(t,e,n,r,i,o=!1,s=0){const{context:a}=n,l=e.letterSpacing;let c=!1;if(Ie.experimentalLetterSpacingSupported&&(Ie.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,c=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),(0===l||c)&&0===s)return void(o?a.strokeText(t,r,i):a.fillText(t,r,i));if(0!==s&&(0===l||c)){const e=t.split(" ");let n=r;const l=a.measureText(" ").width;for(let t=0;t<e.length;t++)o?a.strokeText(e[t],n,i):a.fillText(e[t],n,i),n+=a.measureText(e[t]).width+l+s;return}let h=r;const u=Ie.graphemeSegmenter(t);let d=a.measureText(t).width,f=0;for(let t=0;t<u.length;++t){const e=u[t];o?a.strokeText(e,h,i):a.fillText(e,h,i);let n="";for(let e=t+1;e<u.length;++e)n+=u[e];f=a.measureText(n).width,h+=d-f+l," "===e&&(h+=s),d=f}}};var Ve=i(8875),Ye=i(133),Xe=i(8393),$e=i(990);const qe=class t extends Ve.A{constructor(e={}){super(),this.uid=(0,Ye.L)("textStyle"),this._tick=0,this._cachedFontString=null,function(t){const e=t;if("boolean"==typeof e.dropShadow&&e.dropShadow){const n=Ke.defaultDropShadow;t.dropShadow={alpha:e.dropShadowAlpha??n.alpha,angle:e.dropShadowAngle??n.angle,blur:e.dropShadowBlur??n.blur,color:e.dropShadowColor??n.color,distance:e.dropShadowDistance??n.distance}}if(void 0!==e.strokeThickness){(0,Bt.t6)(Bt.lj,"strokeThickness is now a part of stroke");const n=e.stroke;let r={};if(te.Q.isColorLike(n))r.color=n;else if(n instanceof Fe._||n instanceof Be.m)r.fill=n;else{if(!Object.hasOwnProperty.call(n,"color")&&!Object.hasOwnProperty.call(n,"fill"))throw new Error("Invalid stroke value.");r=n}t.stroke={...r,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){if((0,Bt.t6)(Bt.lj,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(e.fill)||0===e.fill.length)throw new Error("Invalid fill value. Expected an array of colors for gradient fill.");e.fill.length!==e.fillGradientStops.length&&(0,Ne.R)("The number of fill colors must match the number of fill gradient stops.");const n=new Fe._({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),r=e.fillGradientStops.slice(),i=e.fill.map((t=>te.Q.shared.setValue(t).toNumber()));r.forEach(((t,e)=>{n.addColorStop(t,i[e])})),t.fill={fill:n}}}(e);e instanceof t&&(e=e._toObject());const n={...t.defaultTextStyle,...e};for(const t in n){this[t]=n[t]}this._tagStyles=e.tagStyles??void 0,this.update(),this._tick=0}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.update())}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(e){this._dropShadow!==e&&(this._dropShadow=null!==e&&"object"==typeof e?this._createProxy({...t.defaultDropShadow,...e}):e?this._createProxy({...t.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.update())}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize="string"==typeof t?parseInt(t,10):t,this.update())}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.update())}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.update())}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.update())}get filters(){return this._filters}set filters(t){this._filters!==t&&(this._filters=Object.freeze(t),this.update())}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.update())}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Xe.T.defaultFillStyle,...t},(()=>{this._fill=(0,$e.w)({...this._originalFill},Xe.T.defaultFillStyle)}))),this._fill=(0,$e.w)(0===t?"black":t,Xe.T.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Xe.T.defaultStrokeStyle,...t},(()=>{this._stroke=(0,$e.T)({...this._originalStroke},Xe.T.defaultStrokeStyle)}))),this._stroke=(0,$e.T)(t,Xe.T.defaultStrokeStyle),this.update())}get tagStyles(){return this._tagStyles}set tagStyles(t){this._tagStyles!==t&&(this._tagStyles=t??void 0,this.update())}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){const e=t.defaultTextStyle;for(const t in e)this[t]=e[t]}assign(t){for(const e in t){this[e]=t[e]}return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return null===this._cachedFontString&&(this._cachedFontString=je(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new t(this._toObject())}_getFinalPadding(){let t=0;if(this._filters)for(let e=0;e<this._filters.length;e++)t+=this._filters[e].padding;return Math.max(this._padding,t)}destroy(t=!1){this.removeAllListeners();if("boolean"==typeof t?t:t?.texture){const e="boolean"==typeof t?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(e),this._originalFill?.texture&&this._originalFill.texture.destroy(e),this._stroke?.texture&&this._stroke.texture.destroy(e),this._originalStroke?.texture&&this._originalStroke.texture.destroy(e)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(t,n,r)=>(t[n]===r||(t[n]=r,e?.(n,r),this.update()),!0)})}_isFillStyle(t){return null!==(t??null)&&!(te.Q.isColorLike(t)||t instanceof Fe._||t instanceof Be.m)}};qe.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},qe.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let Ke=qe;var Ze=i(4334),Je=i(2048);var Qe=i(8422);class tn extends Qe.K{}class en{constructor(t){this._renderer=t,t.runners.resolutionChange.add(this),this._managedTexts=new Ze.s({renderer:t,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(const t in this._managedTexts.items){const e=this._managedTexts.items[t];e?._autoResolution&&e.onViewUpdate()}}validateRenderable(t){const e=this._getGpuText(t),n=t.styleKey;return e.currentKey!==n||t._didTextUpdate}addRenderable(t,e){const n=this._getGpuText(t);if(t._didTextUpdate){const e=t._autoResolution?this._renderer.resolution:t.resolution;n.currentKey===t.styleKey&&t._resolution===e||this._updateGpuText(t),t._didTextUpdate=!1,function(t,e){const{texture:n,bounds:r}=t,i=e._style._getFinalPadding();(0,Je.y)(r,e._anchor,n);const o=e._anchor._x*i*2,s=e._anchor._y*i*2;r.minX-=i-o,r.minY-=i-s,r.maxX-=i-o,r.maxY-=i-s}(n,t)}this._renderer.renderPipes.batch.addToBatch(n,e)}updateRenderable(t){const e=this._getGpuText(t);e._batcher.updateElement(e)}_updateGpuText(t){const e=this._getGpuText(t);e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,e.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t.styleKey}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){const e=new tn;return e.currentKey="--",e.renderable=t,e.transform=t.groupTransform,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,this._managedTexts.add(t),e}onTextUnload(t){const e=t._gpuData[this._renderer.uid];if(!e)return;const{canvasText:n}=this._renderer;n.getReferenceCount(e.currentKey)>0?n.decreaseReferenceCount(e.currentKey):e.texture&&n.returnTexture(e.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}en.extension={type:[At.Ag.WebGLPipes,At.Ag.WebGPUPipes,At.Ag.CanvasPipes],name:"text"};var nn=i(2437);const rn=new(i(9636).c);class on{constructor(t,e){this._activeTextures={},this._renderer=t,this._retainCanvasContext=e}getTexture(t,e,n,r){"string"==typeof t&&((0,Bt.t6)("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:n,resolution:e}),t.style instanceof Ke||(t.style=new Ke(t.style)),t.textureStyle instanceof Kt.n||(t.textureStyle=new Kt.n(t.textureStyle)),"string"!=typeof t.text&&(t.text=t.text.toString());const{text:i,style:o,textureStyle:s,autoGenerateMipmaps:a}=t,l=t.resolution??this._renderer.resolution,{frame:c,canvasAndContext:h}=He.getCanvasAndContext({text:i,style:o,resolution:l}),u=function(t,e,n,r,i=!1){const o=rn;o.minX=0,o.minY=0,o.maxX=t.width/r|0,o.maxY=t.height/r|0;const s=nn.W.getOptimalTexture(o.width,o.height,r,!1,i);return s.source.uploadMethodId="image",s.source.resource=t,s.source.alphaMode="premultiply-alpha-on-upload",s.frame.width=e/r,s.frame.height=n/r,s.source.emit("update",s.source),s.updateUvs(),s}(h.canvas,c.width,c.height,l,a);if(s&&(u.source.style=s),o.trim&&(c.pad(o.padding),u.frame.copyFrom(c),u.frame.scale(1/l),u.updateUvs()),o.filters){const t=this._applyFilters(u,o.filters);return this.returnTexture(u),He.returnCanvasAndContext(h),t}return this._renderer.texture.initSource(u._source),this._retainCanvasContext||He.returnCanvasAndContext(h),u}returnTexture(t){const e=t.source,n=e.resource;if(this._retainCanvasContext&&n?.getContext){const t=n.getContext("2d");t&&He.returnCanvasAndContext({canvas:n,context:t})}e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",nn.W.returnTexture(t,!0)}renderTextToCanvas(){(0,Bt.t6)("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;const e=t.styleKey;if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;const n=this.getTexture({text:t.text,style:t.style,resolution:t._resolution,textureStyle:t.textureStyle,autoGenerateMipmaps:t.autoGenerateMipmaps});return this._activeTextures[e]={texture:n,usageCount:1},n}decreaseReferenceCount(t){const e=this._activeTextures[t];e&&(e.usageCount--,0===e.usageCount&&(this.returnTexture(e.texture),this._activeTextures[t]=null))}getReferenceCount(t){return this._activeTextures[t]?.usageCount??0}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}_applyFilters(t,e){const n=this._renderer.renderTarget.renderTarget,r=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(n,!1),r}destroy(){this._renderer=null;for(const t in this._activeTextures)this._activeTextures[t]&&this.returnTexture(this._activeTextures[t].texture);this._activeTextures=null}}class sn extends on{constructor(t){super(t,!0)}}sn.extension={type:[At.Ag.CanvasSystem],name:"canvasText"};class an extends on{constructor(t){super(t,!1)}}an.extension={type:[At.Ag.WebGLSystem,At.Ag.WebGPUSystem],name:"canvasText"},At.XO.add(sn),At.XO.add(an),At.XO.add(en);class ln extends Qt{constructor(...t){const e=function(t,e){let n=t[0]??{};return("string"==typeof n||t[1])&&((0,Bt.t6)(Bt.lj,`use new ${e}({ text: "hi!", style }) instead`),n={text:n,style:t[1]}),n}(t,"Text");super(e,Ke),this.renderPipeId="text",e.textureStyle&&(this.textureStyle=e.textureStyle instanceof Kt.n?e.textureStyle:new Kt.n(e.textureStyle)),this.autoGenerateMipmaps=e.autoGenerateMipmaps??qt.v.defaultOptions.autoGenerateMipmaps}updateBounds(){const t=this._bounds,e=this._anchor;let n=0,r=0;if(this._style.trim){const{frame:t,canvasAndContext:e}=He.getCanvasAndContext({text:this.text,style:this._style,resolution:1});He.returnCanvasAndContext(e),n=t.width,r=t.height}else{const t=Ie.measureText(this._text,this._style);n=t.width,r=t.height}t.minX=-e._x*n,t.maxX=t.minX+n,t.minY=-e._y*r,t.maxY=t.minY+r}}function cn(t){return cn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cn(t)}function hn(t){return function(t){if(Array.isArray(t))return fn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||dn(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function un(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(t){c=!0,i=t}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(t,e)||dn(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dn(t,e){if(t){if("string"==typeof t)return fn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fn(t,e):void 0}}function fn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function pn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,mn(r.key),r)}}function mn(t){var e=function(t,e){if("object"!=cn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=cn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cn(e)?e:e+""}At.XO.add(Mt,Pt);var yn=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.map=new Map},e=[{key:"get",value:function(t){return this.map.get(t)}},{key:"set",value:function(t,e){this.map.set(t,e)}},{key:"has",value:function(t){return this.map.has(t)}},{key:"delete",value:function(t){var e,n=this.map.get(t);null!=n&&n.parent&&n.parent.removeChild(n),null==n||null===(e=n.destroy)||void 0===e||e.call(n),this.map.delete(t)}},{key:"clearDead",value:function(t){var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=dn(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(this.map);try{for(n.s();!(e=n.n()).done;){var r=un(e.value,1)[0],i=r.split("_")[0];t.has(i)||this.delete(r)}}catch(t){n.e(t)}finally{n.f()}}},{key:"forEach",value:function(t){this.map.forEach(t)}},{key:"deleteNode",value:function(t){for(var e=0,n=hn(this.map.keys());e<n.length;e++){var r=n[e];(r===t||r.startsWith(t+"_"))&&this.delete(r)}}}],e&&pn(t.prototype,e),n&&pn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function gn(t){return gn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gn(t)}function vn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,bn(r.key),r)}}function bn(t){var e=function(t,e){if("object"!=gn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=gn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==gn(e)?e:e+""}var xn=function(){return t=function t(e,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.registry=n,this.selection=r,this.interaction=o,this.labelRenderer=s,this.colorResolver="function"==typeof i?i:function(){return 16777215},this.formulaHitPadding=12},(e=[{key:"render",value:function(t){var e;this.ensure(t),this.ensureHalo(t),this.update(t),this.updateHalo(t),null===(e=this.labelRenderer)||void 0===e||e.render(t)}},{key:"ensure",value:function(t){var e=this.registry.get(t.id);return e||((e=new $t.A).eventMode="static",e.cursor="pointer",e.nodeRef=t,this.drawShape(e,t),this.world.addChild(e),this.interaction.bindNode(e,t),this.registry.set(t.id,e),e)}},{key:"ensureHalo",value:function(t){var e="".concat(t.id,"_halo"),n=this.registry.get(e);return n||((n=new $t.A).eventMode="none",n.visible=!1,n.nodeRef=t,this.world.addChildAt(n,0),this.registry.set(e,n),n)}},{key:"update",value:function(t){var e=this.registry.get(t.id);if(e){this.drawShape(e,t),e.x=t.x,e.y=t.y;var n=this.colorResolver(t);e.tint=null!=n?n:16777215,e.visible=!1!==t.visible}}},{key:"updateHalo",value:function(t){var e=this.registry.get("".concat(t.id,"_halo"));if(e){e.clear();var n=this.selection.has(t);if(e.visible=n,n){if("formula"===t.type){var r=this.getFormulaWidth(t),i=this.getFormulaHeight();e.roundRect(-r/2-6,-i/2-6,r+12,i+12,8).stroke({width:2,color:16777215,alpha:.9})}else{var o=this.getRadius(t)+6;e.circle(0,0,o).stroke({width:3,color:16777215,alpha:.9})}e.x=t.x,e.y=t.y}}}},{key:"drawShape",value:function(t,e){t.clear();var n="planet"===e.type?16763904:"formula"===e.type?1973790:16777215;if("formula"===e.type){var r=this.getFormulaWidth(e),i=this.getFormulaHeight(),o=this.formulaHitPadding;return t.roundRect(-r/2,-i/2,r,i,6).fill(n).stroke({color:16777215,width:1,alpha:.3}),void(t.hitArea=new Xt.M(-r/2-o,-i/2-o,r+2*o,i+2*o))}var s=this.getRadius(e);t.circle(0,0,s).fill(n),t.hitArea=new Yt.j(0,0,s+4)}},{key:"getFormulaWidth",value:function(t){var e=t.label||"";return Math.max(120,8*e.length+24)}},{key:"getFormulaHeight",value:function(){return 40}},{key:"getRadius",value:function(t){switch(t.type){case"planet":return 40;case"formula":return 20;default:return 6}}},{key:"updateSelection",value:function(t){this.selection=t}}])&&vn(t.prototype,e),n&&vn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function _n(t){return _n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_n(t)}function wn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Sn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Sn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Cn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,En(r.key),r)}}function En(t){var e=function(t,e){if("object"!=_n(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_n(e)?e:e+""}var kn=function(){return t=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.registry=n},(e=[{key:"render",value:function(t){var e;if("planet"===t.type){var n=t.id+"_orbits",r=this.registry.get(n);r||((r=new $t.A).eventMode="none",this.world.addChildAt(r,0),this.registry.set(n,r)),r.clear();var i,o=wn(null!==(e=t._orbits)&&void 0!==e?e:[]);try{for(o.s();!(i=o.n()).done;){var s=i.value;r.circle(0,0,s.radius).stroke({width:1,color:16777215,alpha:.2})}}catch(t){o.e(t)}finally{o.f()}r.x=t.x,r.y=t.y}}}])&&Cn(t.prototype,e),n&&Cn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function Tn(t){return Tn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tn(t)}function An(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Mn(r.key),r)}}function Mn(t){var e=function(t,e){if("object"!=Tn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Tn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Tn(e)?e:e+""}var Pn=function(){return t=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.uiLayer=e,this.registry=n},(e=[{key:"render",value:function(t){var e,n,r,i,o="".concat(t.id,"_axis"),s=this.registry.get(o);s||((s=new $t.A).nodeRef=t,s.eventMode="static",s.cursor="pointer",this.uiLayer.addChild(s),this.registry.set(o,s)),s.clear();var a=0===(null===(e=t.direction)||void 0===e?void 0:e.x)&&1===(null===(n=t.direction)||void 0===n?void 0:n.y),l=1===(null===(r=t.direction)||void 0===r?void 0:r.x)&&0===(null===(i=t.direction)||void 0===i?void 0:i.y);a?this.renderYAxis(s):l?this.renderXAxis(s):this.renderArrowVector(s,t)}},{key:"renderXAxis",value:function(t){var e,n,r=(null===(e=this.uiLayer.parent.renderer)||void 0===e?void 0:e.width)||800,i=(null===(n=this.uiLayer.parent.renderer)||void 0===n?void 0:n.height)||600,o=r-40;t.rect(0,0,o,2).fill(16777215),t.moveTo(o-10,-6).lineTo(o,1).lineTo(o-10,8).fill(16777215),t.x=20,t.y=i-20}},{key:"renderYAxis",value:function(t){var e,n=(null===(e=this.uiLayer.parent.renderer)||void 0===e?void 0:e.height)||600,r=n-40;t.rect(0,-r,2,r).fill(16777215),t.moveTo(-6,10-r).lineTo(1,-r).lineTo(8,10-r).fill(16777215),t.x=20,t.y=n-20}},{key:"renderArrowVector",value:function(t,e){var n=e.direction.x*e.length,r=e.direction.y*e.length,i=Math.sqrt(n*n+r*r),o=Math.atan2(r,n);t.rect(0,-1,i,2).fill(16755200),t.moveTo(i,0).lineTo(i-10,-5).lineTo(i-10,5).fill(16755200),t.x=e.x,t.y=e.y,t.rotation=o}}])&&An(t.prototype,e),n&&An(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function On(t){return On="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},On(t)}function In(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ln(r.key),r)}}function Ln(t){var e=function(t,e){if("object"!=On(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=On(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==On(e)?e:e+""}var jn=function(){return t=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.registry=n},(e=[{key:"render",value:function(t){if("planet"===t.type||"formula"===t.type){var e="".concat(t.id,"_label"),n=this.registry.get(e);if(n||((n=new ln({text:"",style:{fill:16777215,fontSize:"formula"===t.type?14:12,align:"center"}})).anchor.set(.5),this.world.addChild(n),this.registry.set(e,n)),"formula"===t.type){var r=t.label||t.id,i=Number(t.value||0).toLocaleString();n.text="".concat(r,": ").concat(i)}else n.text=t.label||t.id;n.x=t.x,n.y=t.y}}}])&&In(t.prototype,e),n&&In(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function Rn(t){return Rn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rn(t)}function Dn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Nn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Nn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Fn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Bn(r.key),r)}}function Bn(t){var e=function(t,e){if("object"!=Rn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Rn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Rn(e)?e:e+""}var Gn=function(){return t=function t(e){var n=e.world,r=e.uiLayer,i=e.registry,o=e.selection,s=e.interaction,a=e.colorResolver;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var l=new jn(n,i);this.nodeRenderer=new xn(n,i,o,a,s,l),this.orbitRenderer=new kn(n,i),this.vectorRenderer=new Pn(r,i),this.liveNodeIds=new Set,this.registry=i},(e=[{key:"render",value:function(t){var e,n=Dn(t.getNodes());try{for(n.s();!(e=n.n()).done;){var r=e.value;"vector"!==r.type?(this.nodeRenderer.render(r),"planet"===r.type&&(r.dirty=!0,this.orbitRenderer.render(r))):(r.dirty=!0,this.vectorRenderer.render(r))}}catch(t){n.e(t)}finally{n.f()}}},{key:"updateSelection",value:function(t){this.nodeRenderer.updateSelection(t)}},{key:"remove",value:function(t){var e="string"==typeof t?t:t.id;this.registry.deleteNode(e)}}])&&Fn(t.prototype,e),n&&Fn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function zn(t){return zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zn(t)}function Un(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Wn(r.key),r)}}function Wn(t){var e=function(t,e){if("object"!=zn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=zn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==zn(e)?e:e+""}var Hn=function(){return t=function t(e){var n,r,i,o=this,s=e.app,a=e.world,l=e.registry,c=e.selection,h=e.minScale,u=void 0===h?.1:h,d=e.maxScale,f=void 0===d?10:d;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),n=this,i=function(){var t,e,n,r,i=null===(t=o.dragTarget)||void 0===t?void 0:t.nodeRef;o.isRightClick||(o.dragging||!i||o.isBoxSelecting||((null===(e=o.lastPointer)||void 0===e||null===(e=e.originalEvent)||void 0===e?void 0:e.shiftKey)?o.selection.has(i)?o.selection.delete(i):o.selection.add(i):(o.selection.clear(),o.selection.add(i)),null===(n=o.onSelectionChange)||void 0===n||n.call(o,o.selection)),!o.pointerDownOnStage||o.didDrag||o.dragTarget||(o.selection.clear(),null===(r=o.onSelectionChange)||void 0===r||r.call(o,o.selection)),o.finishBoxSelect()),o.resetPointerState()},(r=Wn(r="onPointerUp"))in n?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i,this.app=s,this.world=a,this.registry=l,this.selection=c,this.dragTarget=null,this.startPos=null,this.dragging=!1,this.isRightClick=!1,this.isBoxSelecting=!1,this.boxStart=null,this.box=null,this.lastPointer=null,this.minScale=u,this.maxScale=f,this.isPanning=!1,this.panLast=null,this.pointers=new Map,this.lastDist=null,this.pointerDownOnStage=!1,this.didDrag=!1},e=[{key:"enable",value:function(){this.initBoxGraphics(),this.enablePointerSystem(),this.enableWheelZoom(),this.enablePinchZoom(),this.enableResize(),this.bindNodes()}},{key:"screenToWorld",value:function(t,e){return{x:(t-this.world.x)/this.world.scale.x,y:(e-this.world.y)/this.world.scale.y}}},{key:"initBoxGraphics",value:function(){this.box=new $t.A,this.app.stage.addChild(this.box)}},{key:"enablePointerSystem",value:function(){var t=this,e=this.app.stage;e.eventMode="static",e.hitArea=this.app.screen,e.on("pointerdown",(function(n){var r,i,o=n.target===e;if(t.lastPointer={x:n.global.x,y:n.global.y},o){if(t.pointerDownOnStage=!0,t.didDrag=!1,null===(r=n.originalEvent)||void 0===r?void 0:r.shiftKey)return t.isBoxSelecting=!0,t.boxStart={x:n.global.x,y:n.global.y},t.isPanning=!1,t.panLast=null,void t.box.clear();t.isPanning=!0,t.panLast={x:n.global.x,y:n.global.y},t.isBoxSelecting=!1,null===(i=t.onBackgroundPointerDown)||void 0===i||i.call(t)}})),e.on("pointermove",(function(e){if(t.lastPointer={x:e.global.x,y:e.global.y},t.isBoxSelecting){var n=Math.min(t.boxStart.x,e.global.x),r=Math.min(t.boxStart.y,e.global.y),i=Math.abs(e.global.x-t.boxStart.x),o=Math.abs(e.global.y-t.boxStart.y);return t.box.clear(),t.box.rect(n,r,i,o),t.box.fill({color:43775,alpha:.15}),void t.box.stroke({color:43775,width:1})}if(t.isPanning&&t.panLast&&!t.dragTarget){var s=e.global.x-t.panLast.x,a=e.global.y-t.panLast.y;return t.world.x+=s,t.world.y+=a,t.panLast={x:e.global.x,y:e.global.y},void(t.didDrag=!0)}if(t.dragTarget&&t.startPos){var l=e.global.x-t.startPos.x,c=e.global.y-t.startPos.y;if(Math.sqrt(l*l+c*c)>5&&(t.dragging=!0),t.dragging){var h=t.dragTarget.nodeRef;if(!h)return;var u=t.screenToWorld(e.global.x,e.global.y);h.x=u.x,h.y=u.y,t.didDrag=!0}}})),e.on("rightdown",(function(n){var r;n.target===e&&(t.isRightClick=!0,null===(r=t.onStageRightClick)||void 0===r||r.call(t,{x:n.global.x,y:n.global.y,world:t.screenToWorld(n.global.x,n.global.y),originalEvent:n.originalEvent}))})),e.on("pointerup",this.onPointerUp),e.on("pointerupoutside",this.onPointerUp)}},{key:"resetPointerState",value:function(){this.dragTarget=null,this.startPos=null,this.dragging=!1,this.isPanning=!1,this.panLast=null,this.pointerDownOnStage=!1,this.didDrag=!1,this.isRightClick=!1}},{key:"finishBoxSelect",value:function(){var t,e=this;if(this.isBoxSelecting){var n=this.lastPointer||this.boxStart,r=Math.min(this.boxStart.x,n.x),i=Math.max(this.boxStart.x,n.x),o=Math.min(this.boxStart.y,n.y),s=Math.max(this.boxStart.y,n.y),a=this.screenToWorld(r,o),l=this.screenToWorld(i,s),c=Math.min(a.x,l.x),h=Math.max(a.x,l.x),u=Math.min(a.y,l.y),d=Math.max(a.y,l.y);this.selection.clear(),this.registry.forEach((function(t){var n=t.nodeRef;n&&n.x>=c&&n.x<=h&&n.y>=u&&n.y<=d&&e.selection.add(n)})),this.box.clear(),this.isBoxSelecting=!1,null===(t=this.onSelectionChange)||void 0===t||t.call(this,this.selection)}}},{key:"enableWheelZoom",value:function(){var t=this,e=this.app.canvas;e.addEventListener("wheel",(function(n){n.preventDefault();var r=e.getBoundingClientRect(),i=n.clientX-r.left,o=n.clientY-r.top,s=n.deltaY>0?.9:1.1;t.zoomAt(i,o,s)}),{passive:!1})}},{key:"zoomAt",value:function(t,e,n){var r=this.screenToWorld(t,e);this.world.scale.x*=n,this.world.scale.y*=n,this.world.scale.x=Math.max(this.minScale,Math.min(this.maxScale,this.world.scale.x)),this.world.scale.y=Math.max(this.minScale,Math.min(this.maxScale,this.world.scale.y)),this.world.x=t-r.x*this.world.scale.x,this.world.y=e-r.y*this.world.scale.y}},{key:"enablePinchZoom",value:function(){var t=this;this.app.canvas.addEventListener("pointermove",(function(e){if(t.pointers.has(e.pointerId)&&(t.pointers.set(e.pointerId,e),2===t.pointers.size)){var n=Array.from(t.pointers.values()),r=n[0].clientX-n[1].clientX,i=n[0].clientY-n[1].clientY,o=Math.sqrt(r*r+i*i),s=(n[0].clientX+n[1].clientX)/2,a=(n[0].clientY+n[1].clientY)/2;t.lastDist?(t.zoomAt(s,a,o/t.lastDist),t.lastDist=o):t.lastDist=o}}))}},{key:"enableResize",value:function(){var t=this,e=this.app.canvas.parentElement;this.resizeObserver=new ResizeObserver((function(){var n=e.clientWidth,r=e.clientHeight;t.app.renderer.resize(n,r)})),this.resizeObserver.observe(e)}},{key:"bindNode",value:function(t){var e=this;t.eventMode="static",t.cursor="pointer",t.on("pointerdown",(function(n){n.stopPropagation(),e.dragTarget=t,e.startPos={x:n.global.x,y:n.global.y},e.dragging=!1,e.isBoxSelecting=!1,e.isPanning=!1,e.panLast=null,e.didDrag=!1,t.nodeRef.dirty=!0})),t.on("rightdown",(function(n){var r;n.stopPropagation(),e.isRightClick=!0;var i=t.nodeRef;null===(r=e.onNodeRightClick)||void 0===r||r.call(e,{node:i,global:n.global,ev:n.originalEvent})}))}},{key:"bindNodes",value:function(){var t=this;this.registry.forEach((function(e){t.bindNode(e)}))}}],e&&Un(t.prototype,e),n&&Un(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function Vn(t){return Vn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vn(t)}function Yn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Xn(r.key),r)}}function Xn(t){var e=function(t,e){if("object"!=Vn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Vn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Vn(e)?e:e+""}var $n=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.container=e,this.init()},e=[{key:"init",value:function(){var t=this,e=document.createElement("div");e.className="info-window",Object.assign(e.style,{position:"absolute",top:"0",right:"0",width:"250px",height:"100%",background:"rgba(30, 30, 30, 0.85)",color:"#fff",padding:"12px",boxSizing:"border-box",backdropFilter:"blur(6px)",borderLeft:"1px solid rgba(255,255,255,0.1)",display:"none",zIndex:"999"});var n=document.createElement("div");n.textContent="✕",Object.assign(n.style,{position:"absolute",top:"8px",right:"10px",cursor:"pointer",fontSize:"14px",opacity:"0.7",padding:"2px 6px",borderRadius:"4px",transition:"all 0.15s"}),n.addEventListener("mouseenter",(function(){n.style.background="#444",n.style.opacity="1"})),n.addEventListener("mouseleave",(function(){n.style.background="transparent",n.style.opacity="0.7"})),n.addEventListener("click",(function(){t.hide()})),e.appendChild(n);var r=document.createElement("div");r.style.marginTop="24px",e.appendChild(r),"static"===window.getComputedStyle(this.container).position&&(this.container.style.position="relative"),this.container.appendChild(e),this.panel=e,this.content=r}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.panel.style.display="block",t&&(this.content.innerHTML=t)}},{key:"showWithDrag",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return[]};this.show(),this.content.innerHTML="";var n=document.createElement("div");n.textContent="⠿ Drag selection",n.draggable=!0,Object.assign(n.style,{cursor:"grab",padding:"6px 8px",marginBottom:"8px",background:"#3a3a3a",borderRadius:"6px",fontSize:"12px",textAlign:"center"}),n.addEventListener("dragstart",(function(t){var r={type:"graph-nodes",data:e()};console.log("payload",r);var i=JSON.stringify(r);t.dataTransfer.setData("application/json",i),t.dataTransfer.setData("text/plain",i),n.style.opacity="0.5"})),n.addEventListener("dragend",(function(){n.style.opacity="1"}));var r=document.createElement("div");r.innerHTML=t,this.content.appendChild(n),this.content.appendChild(r)}},{key:"hide",value:function(){this.panel.style.display="none"}},{key:"clear",value:function(){this.content.innerHTML=""}},{key:"getElement",value:function(){return this.panel}}],e&&Yn(t.prototype,e),n&&Yn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function qn(t){return qn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qn(t)}function Kn(){Kn=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof g?e:g,s=Object.create(o.prototype),a=new P(r||[]);return i(s,"_invoke",{value:k(t,n,a)}),s}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",f="suspendedYield",p="executing",m="completed",y={};function g(){}function v(){}function b(){}var x={};c(x,s,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(O([])));w&&w!==n&&r.call(w,s)&&(x=w);var S=b.prototype=g.prototype=Object.create(x);function C(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,s,a){var l=u(t[i],t,o);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==qn(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(h).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(l.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function k(e,n,r){var i=d;return function(o,s){if(i===p)throw Error("Generator is already running");if(i===m){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var l=T(a,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var c=u(e,n,r);if("normal"===c.type){if(i=r.done?m:f,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=u(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function O(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(qn(e)+" is not iterable")}return v.prototype=b,i(S,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:v,configurable:!0}),v.displayName=c(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},C(E.prototype),c(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new E(h(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},C(S),c(S,l,"Generator"),c(S,s,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=O,P.prototype={constructor:P,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(M),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var l=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(l&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;M(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function Zn(t,e,n,r,i,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(r,i)}function Jn(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){Zn(o,r,i,s,a,"next",t)}function a(t){Zn(o,r,i,s,a,"throw",t)}s(void 0)}))}}function Qn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,er(r.key),r)}}function tr(t,e,n){return(e=er(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function er(t){var e=function(t,e){if("object"!=qn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=qn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==qn(e)?e:e+""}var nr=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),tr(this,"getSelectedMoons",(function(){return console.log("regresando seleccion"),n.selectedNodes})),tr(this,"getSelectedNodes",(function(){return Array.from(n.getSelectedMoons()).map((function(t){return t.data}))})),this.container=e,this.selectedNodes=new Set,this.minScale=.1,this.maxScale=10}return e=t,n=[{key:"init",value:(o=Jn(Kn().mark((function t(){var e=this;return Kn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.app=new Vt,t.next=3,this.app.init({resizeTo:this.container,background:1973790});case 3:this.container.appendChild(this.app.canvas),this.world=new Nt.mc,this.uiLayer=new Nt.mc,this.app.stage.addChild(this.world),this.app.stage.addChild(this.uiLayer),this.registry=new yn,this.interaction=new Hn({app:this.app,world:this.world,viewport:this.viewport,registry:this.registry,selection:this.selectedNodes}),this.interaction.enable(),this.renderer=new Gn({world:this.world,uiLayer:this.uiLayer,registry:this.registry,selection:this.selectedNodes,interaction:this.interaction,colorResolver:function(t){var n,r,i;return null!==(n=null===(r=e.model)||void 0===r||null===(i=r.getNodeColor)||void 0===i?void 0:i.call(r,t))&&void 0!==n?n:16777215}}),this.infoWindow=new $n(this.container),this.bindEvents();case 14:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{key:"bindEvents",value:function(){var t=this;this.interaction.onSelectionChange=function(e){var n;t.renderer.updateSelection(e),null===(n=t.onSelectionChange)||void 0===n||n.call(t,e)},this.interaction.onNodeClick=function(e){var n;null===(n=t.onNodeClick)||void 0===n||n.call(t,e)},this.interaction.onNodeRightClick=function(e){var n;null===(n=t.onNodeRightClick)||void 0===n||n.call(t,e)},this.interaction.onBackgroundRightClick=function(e){var n;null===(n=t.onBackgroundRightClick)||void 0===n||n.call(t,e)}}},{key:"render",value:function(t){this.renderer.render(t)}},{key:"renderGraph",value:function(t){this.render(t)}},{key:"center",value:function(t,e){this.viewport.center(t,e)}},{key:"screenToWorld",value:function(t,e){return this.interaction.screenToWorld(t,e)}},{key:"showInfo",value:function(t){this.infoWindow.show(t)}},{key:"showInfoWindow",value:function(t){this.infoWindow.show(t)}},{key:"hideInfo",value:function(){this.infoWindow.hide()}},{key:"toWorld",value:function(t,e){return this.interaction.screenToWorld(t,e)}},{key:"getWorldBounds",value:function(){var t=this.app.canvas,e=this.toWorld(0,0),n=this.toWorld(t.width,t.height);return{minX:e.x,minY:e.y,maxX:n.x,maxY:n.y}}},{key:"_getNodeAtPosition",value:function(t,e){var n=null;return this.registry.forEach((function(r){var i=r.nodeRef;if(i){var o=i.radius||("planet"===i.type?40:10),s=t-i.x,a=e-i.y;s*s+a*a<=o*o&&(n=i)}})),n}},{key:"showInfoWindowWithDrag",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.infoWindow.showWithDrag(t,this.getSelectedNodes)}}],r=[{key:"create",value:(i=Jn(Kn().mark((function e(n){var r;return Kn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new t(n),e.next=3,r.init();case 3:return e.abrupt("return",r);case 4:case"end":return e.stop()}}),e)}))),function(t){return i.apply(this,arguments)})}],n&&Qn(e.prototype,n),r&&Qn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r,i,o}();function rr(t){return rr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rr(t)}function ir(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,or(r.key),r)}}function or(t){var e=function(t,e){if("object"!=rr(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=rr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==rr(e)?e:e+""}var sr=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.nodes=new Map,this.edges=[]},(e=[{key:"addNode",value:function(t){this.nodes.set(t.id,{id:t.id,type:t.type||"moon",x:t.x||0,y:t.y||0,vx:0,vy:0,data:t.data||{},rule:t.rule||null})}},{key:"addMoon",value:function(t){var e=t.id,n=t.x,r=t.y,i=t.data;this.nodes.set(e,{id:e,type:"moon",x:n,y:r,vx:0,vy:0,data:i})}},{key:"addPlanet",value:function(t){var e=t.id,n=t.x,r=t.y,i=t.rule,o=t.scalarField,s=t.label;this.nodes.set(e,{id:e,type:"planet",x:n,y:r,vx:0,vy:0,rule:i,scalarField:o,label:s})}},{key:"addFormula",value:function(t){var e=t.id,n=t.x,r=t.y,i=t.scope,o=t.scalarField,s=t.label,a=t.formula;this.nodes.set(e,{id:e,type:"formula",x:n,y:r,vx:0,vy:0,scope:i,scalarField:o,label:s,formula:a})}},{key:"addVector",value:function(t){var e=t.id,n=t.x,r=t.y,i=t.direction,o=t.length,s=t.scalarField,a=t.rule,l=Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))||1,c={x:i.x/l,y:i.y/l};this.nodes.set(e,{id:e,type:"vector",vector:!0,x:n,y:r,direction:c,length:o||200,scalarField:s,rule:a,vx:0,vy:0})}},{key:"removeYVectors",value:function(){var t=this,e=[];this.nodes.forEach((function(t,n){"vector"===t.type&&t.direction&&Math.abs(t.direction.x)<1e-4&&Math.abs(t.direction.y)>1e-4&&e.push(n)})),e.forEach((function(e){return t.deleteNode(e)}))}},{key:"removeXVectors",value:function(){var t=this,e=[];this.nodes.forEach((function(t,n){"vector"===t.type&&t.direction&&Math.abs(t.direction.y)<1e-4&&Math.abs(t.direction.x)>1e-4&&e.push(n)})),e.forEach((function(e){return t.deleteNode(e)}))}},{key:"addEdge",value:function(t,e){this.edges.push({source:t,target:e})}},{key:"getNode",value:function(t){return this.nodes.get(t)}},{key:"getNodes",value:function(){return Array.from(this.nodes.values())}},{key:"deleteNode",value:function(t){this.nodes.delete(t),this.edges=this.edges.filter((function(e){return e.source!==t&&e.target!==t}))}},{key:"addColorRule",value:function(t){this.colorRules||(this.colorRules=[]),this.colorRules.push(t)}},{key:"getNodeColor",value:function(t){if(!this.colorRules||0===this.colorRules.length)return null;for(var e=this.colorRules.length-1;e>=0;e--){var n,r=this.colorRules[e],i=null===(n=t.data)||void 0===n?void 0:n[r.field];if(null!=i){if(void 0!==r.equals&&i===r.equals)return r.color;if(void 0!==r.gt&&Number(i)>r.gt)return r.color;if(void 0!==r.lt&&Number(i)<r.lt)return r.color}}return null}}])&&ir(t.prototype,e),n&&ir(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function ar(t){return ar="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ar(t)}function lr(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(t){c=!0,i=t}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return cr(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cr(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function cr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function hr(){hr=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof g?e:g,s=Object.create(o.prototype),a=new P(r||[]);return i(s,"_invoke",{value:k(t,n,a)}),s}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",f="suspendedYield",p="executing",m="completed",y={};function g(){}function v(){}function b(){}var x={};c(x,s,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(O([])));w&&w!==n&&r.call(w,s)&&(x=w);var S=b.prototype=g.prototype=Object.create(x);function C(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,s,a){var l=u(t[i],t,o);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==ar(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(h).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(l.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function k(e,n,r){var i=d;return function(o,s){if(i===p)throw Error("Generator is already running");if(i===m){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var l=T(a,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var c=u(e,n,r);if("normal"===c.type){if(i=r.done?m:f,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=u(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function O(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(ar(e)+" is not iterable")}return v.prototype=b,i(S,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:v,configurable:!0}),v.displayName=c(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},C(E.prototype),c(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new E(h(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},C(S),c(S,l,"Generator"),c(S,s,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=O,P.prototype={constructor:P,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(M),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var l=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(l&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;M(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function ur(t,e,n,r,i,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(r,i)}function dr(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){ur(o,r,i,s,a,"next",t)}function a(t){ur(o,r,i,s,a,"throw",t)}s(void 0)}))}}function fr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,pr(r.key),r)}}function pr(t){var e=function(t,e){if("object"!=ar(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ar(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ar(e)?e:e+""}var mr=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.container=e.contentContainer,this.algorithms={rule:g,rule_fast:E,gravity:xt,orbits:pt,spiral:lt,spiral_no:L,vertical:H,sorter_no_col:et}}return e=t,n=[{key:"_init",value:(o=dr(hr().mark((function t(){var e=this;return hr().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,nr.create(this.container);case 2:this.view=t.sent,this.view.app.renderer.events.cursorStyles.default="default",this.view.app.renderer.events.domElement.addEventListener("contextmenu",(function(t){t.preventDefault()})),this.model=new sr,this.view.model=this.model,this.controller=new Tt(this.view,this.model),this.controller.main=this,this._enableDrop(),this.algo=new xt,this.algo.setModel(this.model),this.view.app.ticker.add((function(){e.algo.bounds=e.view.getWorldBounds(),e.algo.model.viewportWidth=e.view.width,e.algo.model.viewportHeight=e.view.height,e.isPaused||e.algo.step(),e.view.renderGraph(e.model)}));case 13:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{key:"pauseGraph",value:function(){this.isPaused=!0}},{key:"resumeGraph",value:function(){this.isPaused=!1}},{key:"setAlgorithm",value:function(t){this.algo=t}},{key:"addMoonData",value:function(t){var e=t.id,n=t.x,r=t.y,i=t.data,o=void 0===i?{}:i,s=t.fixed,a=void 0!==s&&s;if(this.model&&this.view){var l=this.view.app.screen.width,c=this.view.app.screen.height,h=void 0!==n?n:Math.random()*l,u=void 0!==r?r:Math.random()*c;this.model.addMoon({id:e,x:h,y:u,data:o,fixed:a}),this.view.renderGraph(this.model)}}},{key:"addRandomMoons",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=["male","female"],n=["a","b","c"],r=0;r<t;r++){var i=crypto.randomUUID(),o=e[Math.floor(Math.random()*e.length)],s=Math.floor(80*Math.random())+1,a=n[Math.floor(Math.random()*n.length)];this.addMoonData({id:i,data:{sex:o,age:s,class:a}})}}},{key:"_dropDataset",value:function(t,e){var n=this;t.forEach((function(t,r){var i=t.id||"moon_".concat(Date.now(),"_").concat(r),o=Math.random()*Math.PI*2,s=200*Math.random(),a=e.x+Math.cos(o)*s,l=e.y+Math.sin(o)*s;n.model.addMoon({id:i,x:a,y:l,data:t})})),this.model.changed=!0}},{key:"_setAlgorithmByName",value:function(t){var e=this.algorithms[t];if(e){var n=new e;n.setModel(this.model),this.setAlgorithm(n)}else console.warn("Unknown algorithm:",t)}},{key:"_enableDrop",value:function(){var t=this,e=this.view.app.view;e.addEventListener("dragover",(function(t){return t.preventDefault()})),e.addEventListener("drop",(function(n){n.preventDefault();var r=e.getBoundingClientRect(),i=n.clientX-r.left,o=n.clientY-r.top,s=t.view.toWorld(i,o),a=(t.view._getNodeAtPosition(s.x,s.y),n.dataTransfer.getData("application/json"));if(a){var l=JSON.parse(a);if("table"!==l.type&&"graph-nodes"!==l.type)if("algorithm"!==l.type){if("color-rule"===l.type)return console.log("dropped color",l),void t.model.addColorRule({field:l.field,equals:l.equals,gt:l.gt,lt:l.lt,color:l.color});if("planet"===l.type){var h=c.build(l.rule);t.model.addPlanet({id:"p_"+Date.now(),x:s.x,y:s.y,rule:h,label:l.label,scalarField:l.scalarField})}if("scalarField"===l.type){var u=t.view._getNodeAtPosition(s.x,s.y);if(u&&"planet"===u.type)return u.scalarFields=u.scalarFields||[],u.scalarFields.includes(l.field)||u.scalarFields.push(l.field),void(u.scalarField=l.field)}if("sumField"===l.type&&t.model.addFormula({id:"f_"+Date.now(),x:s.x,y:s.y,scope:"all",label:"Edad",scalarField:"Edad",formula:"count"}),t.controller._refreshFormulaNodes(),"vector"===l.type){var d=c.build(l.rule);t.model.addVector({id:"p_"+Date.now(),x:s.x,y:s.y,direction:l.direction,length:l.length,scalarField:l.scalarField,rule:d})}}else t._setAlgorithmByName(l.name);else t._dropDataset(l.data,s)}}))}},{key:"getFormatedNode",value:function(t){if("planet"==t.type){var e=t.sumField?"Sum of ".concat(t.sumField):"",n=t.sumTotal?"Sum of ".concat(t.sumField," : ").concat(this.view.formatMoney(t.sumTotal)," "):"";return'\n <h3 style="margin-top:0">ATTRACTOR</h3>\n <div style="font-size:12px; line-height:1.4">\n Attracts nodes with : '.concat(t.label," <br/>\n ").concat(e," </br>\n ").concat(n,"\n </div>\n ")}var r=Object.entries(t);return'\n <h3 style="margin-top:0">'.concat(t.nombre||t.name||t.label||"Node",'</h3>\n <div style="font-size:12px; line-height:1.4">\n ').concat(r.map((function(t){var e,n=lr(t,2),r=n[0],i=n[1];return'\n <div style="display:flex; justify-content:space-between; margin-bottom:4px;">\n <span style="opacity:0.7">'.concat(r,'</span>\n <span style="text-align:right; margin-left:10px;">').concat(null==(e=i)||""===e||"NULL"===e?"<span style='opacity:0.5'>—</span>":e,"</span>\n </div>\n ")})).join(""),"\n </div>\n ")}}],r=[{key:"create",value:(i=dr(hr().mark((function e(n){var r;return hr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new t(n),e.next=3,r._init();case 3:return e.abrupt("return",r);case 4:case"end":return e.stop()}}),e)}))),function(t){return i.apply(this,arguments)})}],n&&fr(e.prototype,n),r&&fr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r,i,o}(),yr=function(t,e){return yr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},yr(t,e)};function gr(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}yr(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var vr=function(){return vr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},vr.apply(this,arguments)};function br(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var xr,_r="ADD_CHOICE",wr="REMOVE_CHOICE",Sr="FILTER_CHOICES",Cr="ACTIVATE_CHOICES",Er="CLEAR_CHOICES",kr="ADD_GROUP",Tr="ADD_ITEM",Ar="REMOVE_ITEM",Mr="HIGHLIGHT_ITEM",Pr="showDropdown",Or="hideDropdown",Ir="change",Lr="choice",jr="search",Rr="addItem",Dr="removeItem",Nr="highlightItem",Fr="highlightChoice",Br="unhighlightItem",Gr=9,zr=16,Ur=46,Wr=8,Hr=13,Vr=65,Yr=27,Xr=38,$r=40,qr=33,Kr=34,Zr=["fuseOptions","classNames"],Jr="text",Qr="select-one",ti="select-multiple",ei=function(t){return{type:_r,choice:t}},ni=function(t){return{type:Tr,item:t}},ri=function(t){return{type:Ar,item:t}},ii=function(t,e){return{type:Mr,item:t,highlighted:e}},oi=function(t){return Array.from({length:t},(function(){return(t=0,e=36,Math.floor(Math.random()*(e-t)+t)).toString(36);var t,e})).join("")},si=function(t,e,n){return void 0===n&&(n=1),n>0?e.scrollTop+e.offsetHeight>=t.offsetTop+t.offsetHeight:t.offsetTop>=e.scrollTop},ai=function(t){if("string"!=typeof t){if(null==t)return"";if("object"==typeof t){if("raw"in t)return ai(t.raw);if("trusted"in t)return t.trusted}return t}return t.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/'/g,"'").replace(/"/g,""")},li=(xr=document.createElement("div"),function(t){xr.innerHTML=t.trim();for(var e=xr.children[0];xr.firstChild;)xr.removeChild(xr.firstChild);return e}),ci=function(t){return"function"==typeof t?t():t},hi=function(t){if("string"==typeof t)return t;if("object"==typeof t){if("trusted"in t)return t.trusted;if("raw"in t)return t.raw}return""},ui=function(t){if("string"==typeof t)return t;if("object"==typeof t){if("escaped"in t)return t.escaped;if("trusted"in t)return t.trusted}return""},di=function(t,e){return{id:t.id,highlighted:t.highlighted,labelClass:t.labelClass,labelDescription:hi(t.labelDescription),customProperties:t.customProperties,disabled:t.disabled,active:t.active,label:t.label,placeholder:t.placeholder,value:t.value,groupValue:t.group?t.group.label:void 0,element:t.element,keyCode:e}},fi=function(t,e,n){return"function"==typeof t?t(ai(e),hi(e),n):t},pi=function(t,e){return t?ui(e):ai(e)},mi=function(t,e,n){t.innerHTML=pi(e,n)},yi=function(t,e){return t.rank-e.rank},gi=function(t){return Array.isArray(t)?t:[t]},vi=function(t){return t&&Array.isArray(t)?t.map((function(t){return".".concat(t)})).join(""):".".concat(t)},bi=function(t,e){var n;(n=t.classList).add.apply(n,gi(e))},xi=function(t,e){var n;(n=t.classList).remove.apply(n,gi(e))},_i=function(t){if(void 0!==t)try{return JSON.parse(t)}catch(e){return t}return{}},wi=function(){function t(t){var e=t.element,n=t.type,r=t.classNames;this.element=e,this.classNames=r,this.type=n,this.isActive=!1}return t.prototype.show=function(){return bi(this.element,this.classNames.activeState),this.element.setAttribute("aria-expanded","true"),this.isActive=!0,this},t.prototype.hide=function(){return xi(this.element,this.classNames.activeState),this.element.setAttribute("aria-expanded","false"),this.isActive=!1,this},t}(),Si=function(){function t(t){var e=t.element,n=t.type,r=t.classNames,i=t.position;this.element=e,this.classNames=r,this.type=n,this.position=i,this.isOpen=!1,this.isFlipped=!1,this.isDisabled=!1,this.isLoading=!1}return t.prototype.shouldFlip=function(t,e){var n=!1;return"auto"===this.position?n=this.element.getBoundingClientRect().top-e>=0&&!window.matchMedia("(min-height: ".concat(t+1,"px)")).matches:"top"===this.position&&(n=!0),n},t.prototype.setActiveDescendant=function(t){this.element.setAttribute("aria-activedescendant",t)},t.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},t.prototype.open=function(t,e){bi(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(t,e)&&(bi(this.element,this.classNames.flippedState),this.isFlipped=!0)},t.prototype.close=function(){xi(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(xi(this.element,this.classNames.flippedState),this.isFlipped=!1)},t.prototype.addFocusState=function(){bi(this.element,this.classNames.focusState)},t.prototype.removeFocusState=function(){xi(this.element,this.classNames.focusState)},t.prototype.addInvalidState=function(){bi(this.element,this.classNames.invalidState)},t.prototype.removeInvalidState=function(){xi(this.element,this.classNames.invalidState)},t.prototype.enable=function(){xi(this.element,this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),this.type===Qr&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1},t.prototype.disable=function(){bi(this.element,this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),this.type===Qr&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0},t.prototype.wrap=function(t){var e=this.element,n=t.parentNode;n&&(t.nextSibling?n.insertBefore(e,t.nextSibling):n.appendChild(e)),e.appendChild(t)},t.prototype.unwrap=function(t){var e=this.element,n=e.parentNode;n&&(n.insertBefore(t,e),n.removeChild(e))},t.prototype.addLoadingState=function(){bi(this.element,this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0},t.prototype.removeLoadingState=function(){xi(this.element,this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1},t}(),Ci=function(){function t(t){var e=t.element,n=t.type,r=t.classNames,i=t.preventPaste;this.element=e,this.type=n,this.classNames=r,this.preventPaste=i,this.isFocussed=this.element.isEqualNode(document.activeElement),this.isDisabled=e.disabled,this._onPaste=this._onPaste.bind(this),this._onInput=this._onInput.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this)}return Object.defineProperty(t.prototype,"placeholder",{set:function(t){this.element.placeholder=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.element.value},set:function(t){this.element.value=t},enumerable:!1,configurable:!0}),t.prototype.addEventListeners=function(){var t=this.element;t.addEventListener("paste",this._onPaste),t.addEventListener("input",this._onInput,{passive:!0}),t.addEventListener("focus",this._onFocus,{passive:!0}),t.addEventListener("blur",this._onBlur,{passive:!0})},t.prototype.removeEventListeners=function(){var t=this.element;t.removeEventListener("input",this._onInput),t.removeEventListener("paste",this._onPaste),t.removeEventListener("focus",this._onFocus),t.removeEventListener("blur",this._onBlur)},t.prototype.enable=function(){this.element.removeAttribute("disabled"),this.isDisabled=!1},t.prototype.disable=function(){this.element.setAttribute("disabled",""),this.isDisabled=!0},t.prototype.focus=function(){this.isFocussed||this.element.focus()},t.prototype.blur=function(){this.isFocussed&&this.element.blur()},t.prototype.clear=function(t){return void 0===t&&(t=!0),this.element.value="",t&&this.setWidth(),this},t.prototype.setWidth=function(){var t=this.element;t.style.minWidth="".concat(t.placeholder.length+1,"ch"),t.style.width="".concat(t.value.length+1,"ch")},t.prototype.setActiveDescendant=function(t){this.element.setAttribute("aria-activedescendant",t)},t.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},t.prototype._onInput=function(){this.type!==Qr&&this.setWidth()},t.prototype._onPaste=function(t){this.preventPaste&&t.preventDefault()},t.prototype._onFocus=function(){this.isFocussed=!0},t.prototype._onBlur=function(){this.isFocussed=!1},t}(),Ei=function(){function t(t){var e=t.element;this.element=e,this.scrollPos=this.element.scrollTop,this.height=this.element.offsetHeight}return t.prototype.prepend=function(t){var e=this.element.firstElementChild;e?this.element.insertBefore(t,e):this.element.append(t)},t.prototype.scrollToTop=function(){this.element.scrollTop=0},t.prototype.scrollToChildElement=function(t,e){var n=this;if(t){var r=this.element.offsetHeight,i=this.element.scrollTop+r,o=t.offsetHeight,s=t.offsetTop+o,a=e>0?this.element.scrollTop+s-i:t.offsetTop;requestAnimationFrame((function(){n._animateScroll(a,e)}))}},t.prototype._scrollDown=function(t,e,n){var r=(n-t)/e,i=r>1?r:1;this.element.scrollTop=t+i},t.prototype._scrollUp=function(t,e,n){var r=(t-n)/e,i=r>1?r:1;this.element.scrollTop=t-i},t.prototype._animateScroll=function(t,e){var n=this,r=this.element.scrollTop,i=!1;e>0?(this._scrollDown(r,4,t),r<t&&(i=!0)):(this._scrollUp(r,4,t),r>t&&(i=!0)),i&&requestAnimationFrame((function(){n._animateScroll(t,e)}))},t}(),ki=function(){function t(t){var e=t.element,n=t.classNames;this.element=e,this.classNames=n,this.isDisabled=!1}return Object.defineProperty(t.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.element.value},set:function(t){this.element.setAttribute("value",t),this.element.value=t},enumerable:!1,configurable:!0}),t.prototype.conceal=function(){var t=this.element;bi(t,this.classNames.input),t.hidden=!0,t.tabIndex=-1;var e=t.getAttribute("style");e&&t.setAttribute("data-choice-orig-style",e),t.setAttribute("data-choice","active")},t.prototype.reveal=function(){var t=this.element;xi(t,this.classNames.input),t.hidden=!1,t.removeAttribute("tabindex");var e=t.getAttribute("data-choice-orig-style");e?(t.removeAttribute("data-choice-orig-style"),t.setAttribute("style",e)):t.removeAttribute("style"),t.removeAttribute("data-choice")},t.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},t.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},t.prototype.triggerEvent=function(t,e){!function(t,e,n){void 0===n&&(n=null);var r=new CustomEvent(e,{detail:n,bubbles:!0,cancelable:!0});t.dispatchEvent(r)}(this.element,t,e||{})},t}(),Ti=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return gr(e,t),e}(ki),Ai=function(t,e){return void 0===e&&(e=!0),void 0===t?e:!!t},Mi=function(t){if("string"==typeof t&&(t=t.split(" ").filter((function(t){return t.length}))),Array.isArray(t)&&t.length)return t},Pi=function(t,e,n){if(void 0===n&&(n=!0),"string"==typeof t){var r=ai(t);return Pi({value:t,label:n||r===t?t:{escaped:r,raw:t},selected:!0},!1)}var i=t;if("choices"in i){if(!e)throw new TypeError("optGroup is not allowed");var o=i,s=o.choices.map((function(t){return Pi(t,!1)}));return{id:0,label:hi(o.label)||o.value,active:!!s.length,disabled:!!o.disabled,choices:s}}var a=i;return{id:0,group:null,score:0,rank:0,value:a.value,label:a.label||a.value,active:Ai(a.active),selected:Ai(a.selected,!1),disabled:Ai(a.disabled,!1),placeholder:Ai(a.placeholder,!1),highlighted:!1,labelClass:Mi(a.labelClass),labelDescription:a.labelDescription,customProperties:a.customProperties}},Oi=function(t){return"SELECT"===t.tagName},Ii=function(t){function e(e){var n=e.element,r=e.classNames,i=e.template,o=e.extractPlaceholder,s=t.call(this,{element:n,classNames:r})||this;return s.template=i,s.extractPlaceholder=o,s}return gr(e,t),Object.defineProperty(e.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),e.prototype.addOptions=function(t){var e=this,n=document.createDocumentFragment();t.forEach((function(t){var r=t;if(!r.element){var i=e.template(r);n.appendChild(i),r.element=i}})),this.element.appendChild(n)},e.prototype.optionsAsChoices=function(){var t=this,e=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach((function(n){!function(t){return"OPTION"===t.tagName}(n)?function(t){return"OPTGROUP"===t.tagName}(n)&&e.push(t._optgroupToChoice(n)):e.push(t._optionToChoice(n))})),e},e.prototype._optionToChoice=function(t){return!t.hasAttribute("value")&&t.hasAttribute("placeholder")&&(t.setAttribute("value",""),t.value=""),{id:0,group:null,score:0,rank:0,value:t.value,label:t.label,element:t,active:!0,selected:this.extractPlaceholder?t.selected:t.hasAttribute("selected"),disabled:t.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(!t.value||t.hasAttribute("placeholder")),labelClass:void 0!==t.dataset.labelClass?Mi(t.dataset.labelClass):void 0,labelDescription:void 0!==t.dataset.labelDescription?{trusted:t.dataset.labelDescription}:void 0,customProperties:_i(t.dataset.customProperties)}},e.prototype._optgroupToChoice=function(t){var e=this,n=t.querySelectorAll("option"),r=Array.from(n).map((function(t){return e._optionToChoice(t)}));return{id:0,label:t.label||"",element:t,active:!!r.length,disabled:t.disabled,choices:r}},e}(ki),Li={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,closeDropdownOnSelect:"auto",singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(t){return!!t&&""!==t},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!1,duplicateItemsAllowed:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchDisabledChoices:!1,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,shouldSort:!0,shouldSortItems:!1,sorter:function(t,e){var n=t.value,r=t.label,i=void 0===r?n:r,o=e.value,s=e.label,a=void 0===s?o:s;return hi(i).localeCompare(hi(a),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,placeholder:!0,placeholderValue:null,searchPlaceholderValue:null,prependValue:null,appendValue:null,renderSelectedChoices:"auto",searchRenderSelectedChoices:!0,loadingText:"Loading...",noResultsText:"No results found",noChoicesText:"No choices to choose from",itemSelectText:"Press to select",uniqueItemText:"Only unique values can be added",customAddItemText:"Only values matching specific conditions can be added",addItemText:function(t){return'Press Enter to add <b>"'.concat(t,'"</b>')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(t,e,n){return"Remove item: ".concat(n?ai(n.label):t)},maxItemText:function(t){return"Only ".concat(t," values can be added")},valueComparer:function(t,e){return t===e},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:["choices"],containerInner:["choices__inner"],input:["choices__input"],inputCloned:["choices__input--cloned"],list:["choices__list"],listItems:["choices__list--multiple"],listSingle:["choices__list--single"],listDropdown:["choices__list--dropdown"],item:["choices__item"],itemSelectable:["choices__item--selectable"],itemDisabled:["choices__item--disabled"],itemChoice:["choices__item--choice"],description:["choices__description"],placeholder:["choices__placeholder"],group:["choices__group"],groupHeading:["choices__heading"],button:["choices__button"],activeState:["is-active"],focusState:["is-focused"],openState:["is-open"],disabledState:["is-disabled"],highlightedState:["is-highlighted"],selectedState:["is-selected"],flippedState:["is-flipped"],loadingState:["is-loading"],invalidState:["is-invalid"],notice:["choices__notice"],addChoice:["choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},ji=function(t){var e=t.itemEl;e&&(e.remove(),t.itemEl=void 0)};var Ri={groups:function(t,e){var n=t,r=!0;switch(e.type){case kr:n.push(e.group);break;case Er:n=[];break;default:r=!1}return{state:n,update:r}},items:function(t,e,n){var r=t,i=!0;switch(e.type){case Tr:e.item.selected=!0,(o=e.item.element)&&(o.selected=!0,o.setAttribute("selected","")),r.push(e.item);break;case Ar:var o;if(e.item.selected=!1,o=e.item.element){o.selected=!1,o.removeAttribute("selected");var s=o.parentElement;s&&Oi(s)&&s.type===Qr&&(s.value="")}ji(e.item),r=r.filter((function(t){return t.id!==e.item.id}));break;case wr:ji(e.choice),r=r.filter((function(t){return t.id!==e.choice.id}));break;case Mr:var a=e.highlighted,l=r.find((function(t){return t.id===e.item.id}));l&&l.highlighted!==a&&(l.highlighted=a,n&&function(t,e,n){var r=t.itemEl;r&&(xi(r,n),bi(r,e))}(l,a?n.classNames.highlightedState:n.classNames.selectedState,a?n.classNames.selectedState:n.classNames.highlightedState));break;default:i=!1}return{state:r,update:i}},choices:function(t,e,n){var r=t,i=!0;switch(e.type){case _r:r.push(e.choice);break;case wr:e.choice.choiceEl=void 0,e.choice.group&&(e.choice.group.choices=e.choice.group.choices.filter((function(t){return t.id!==e.choice.id}))),r=r.filter((function(t){return t.id!==e.choice.id}));break;case Tr:case Ar:e.item.choiceEl=void 0;break;case Sr:var o=[];e.results.forEach((function(t){o[t.item.id]=t})),r.forEach((function(t){var e=o[t.id];void 0!==e?(t.score=e.score,t.rank=e.rank,t.active=!0):(t.score=0,t.rank=0,t.active=!1),n&&n.appendGroupInSearch&&(t.choiceEl=void 0)}));break;case Cr:r.forEach((function(t){t.active=e.active,n&&n.appendGroupInSearch&&(t.choiceEl=void 0)}));break;case Er:r=[];break;default:i=!1}return{state:r,update:i}}},Di=function(){function t(t){this._state=this.defaultState,this._listeners=[],this._txn=0,this._context=t}return Object.defineProperty(t.prototype,"defaultState",{get:function(){return{groups:[],items:[],choices:[]}},enumerable:!1,configurable:!0}),t.prototype.changeSet=function(t){return{groups:t,items:t,choices:t}},t.prototype.reset=function(){this._state=this.defaultState;var t=this.changeSet(!0);this._txn?this._changeSet=t:this._listeners.forEach((function(e){return e(t)}))},t.prototype.subscribe=function(t){return this._listeners.push(t),this},t.prototype.dispatch=function(t){var e=this,n=this._state,r=!1,i=this._changeSet||this.changeSet(!1);Object.keys(Ri).forEach((function(o){var s=Ri[o](n[o],t,e._context);s.update&&(r=!0,i[o]=!0,n[o]=s.state)})),r&&(this._txn?this._changeSet=i:this._listeners.forEach((function(t){return t(i)})))},t.prototype.withTxn=function(t){this._txn++;try{t()}finally{if(this._txn=Math.max(0,this._txn-1),!this._txn){var e=this._changeSet;e&&(this._changeSet=void 0,this._listeners.forEach((function(t){return t(e)})))}}},Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"items",{get:function(){return this.state.items},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"highlightedActiveItems",{get:function(){return this.items.filter((function(t){return t.active&&t.highlighted}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"choices",{get:function(){return this.state.choices},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"activeChoices",{get:function(){return this.choices.filter((function(t){return t.active}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"searchableChoices",{get:function(){var t=this._context;return this.choices.filter((function(e){return!e.placeholder&&(t.searchDisabledChoices||!e.disabled)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"groups",{get:function(){return this.state.groups},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"activeGroups",{get:function(){var t=this;return this.state.groups.filter((function(e){var n=e.active&&!e.disabled,r=t.state.choices.some((function(t){return t.active&&!t.disabled}));return n&&r}),[])},enumerable:!1,configurable:!0}),t.prototype.inTxn=function(){return this._txn>0},t.prototype.getChoiceById=function(t){return this.activeChoices.find((function(e){return e.id===t}))},t.prototype.getGroupById=function(t){return this.groups.find((function(e){return e.id===t}))},t}(),Ni="no-choices",Fi="no-results",Bi="add-choice",Gi="";function zi(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ui(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Wi(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ui(Object(n),!0).forEach((function(e){zi(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ui(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Hi(t){return Array.isArray?Array.isArray(t):"[object Array]"===Zi(t)}function Vi(t){return"string"==typeof t}function Yi(t){return"number"==typeof t}function Xi(t){return!0===t||!1===t||function(t){return $i(t)&&null!==t}(t)&&"[object Boolean]"==Zi(t)}function $i(t){return"object"==typeof t}function qi(t){return null!=t}function Ki(t){return!t.trim().length}function Zi(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Ji=t=>`Missing ${t} property in key`,Qi=t=>`Property 'weight' in key '${t}' must be a positive integer`,to=Object.prototype.hasOwnProperty;class eo{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach((t=>{let n=no(t);this._keys.push(n),this._keyMap[n.id]=n,e+=n.weight})),this._keys.forEach((t=>{t.weight/=e}))}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function no(t){let e=null,n=null,r=null,i=1,o=null;if(Vi(t)||Hi(t))r=t,e=ro(t),n=io(t);else{if(!to.call(t,"name"))throw new Error(Ji("name"));const s=t.name;if(r=s,to.call(t,"weight")&&(i=t.weight,i<=0))throw new Error(Qi(s));e=ro(s),n=io(s),o=t.getFn}return{path:e,id:n,weight:i,src:r,getFn:o}}function ro(t){return Hi(t)?t:t.split(".")}function io(t){return Hi(t)?t.join("."):t}const oo={useExtendedSearch:!1,getFn:function(t,e){let n=[],r=!1;const i=(t,e,o)=>{if(qi(t))if(e[o]){const s=t[e[o]];if(!qi(s))return;if(o===e.length-1&&(Vi(s)||Yi(s)||Xi(s)))n.push(function(t){return null==t?"":function(t){if("string"==typeof t)return t;let e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(t)}(s));else if(Hi(s)){r=!0;for(let t=0,n=s.length;t<n;t+=1)i(s[t],e,o+1)}else e.length&&i(s,e,o+1)}else n.push(t)};return i(t,Vi(e)?e.split("."):e,0),r?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var so=Wi(Wi(Wi(Wi({},{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1}),{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1}),{location:0,threshold:.6,distance:100}),oo);const ao=/[^ ]+/g;class lo{constructor({getFn:t=so.getFn,fieldNormWeight:e=so.fieldNormWeight}={}){this.norm=function(t=1,e=3){const n=new Map,r=Math.pow(10,e);return{get(e){const i=e.match(ao).length;if(n.has(i))return n.get(i);const o=1/Math.pow(i,.5*t),s=parseFloat(Math.round(o*r)/r);return n.set(i,s),s},clear(){n.clear()}}}(e,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach(((t,e)=>{this._keysMap[t.id]=e}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,Vi(this.docs[0])?this.docs.forEach(((t,e)=>{this._addString(t,e)})):this.docs.forEach(((t,e)=>{this._addObject(t,e)})),this.norm.clear())}add(t){const e=this.size();Vi(t)?this._addString(t,e):this._addObject(t,e)}removeAt(t){this.records.splice(t,1);for(let e=t,n=this.size();e<n;e+=1)this.records[e].i-=1}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_addString(t,e){if(!qi(t)||Ki(t))return;let n={v:t,i:e,n:this.norm.get(t)};this.records.push(n)}_addObject(t,e){let n={i:e,$:{}};this.keys.forEach(((e,r)=>{let i=e.getFn?e.getFn(t):this.getFn(t,e.path);if(qi(i))if(Hi(i)){let t=[];const e=[{nestedArrIndex:-1,value:i}];for(;e.length;){const{nestedArrIndex:n,value:r}=e.pop();if(qi(r))if(Vi(r)&&!Ki(r)){let e={v:r,i:n,n:this.norm.get(r)};t.push(e)}else Hi(r)&&r.forEach(((t,n)=>{e.push({nestedArrIndex:n,value:t})}))}n.$[r]=t}else if(Vi(i)&&!Ki(i)){let t={v:i,n:this.norm.get(i)};n.$[r]=t}})),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function co(t,e,{getFn:n=so.getFn,fieldNormWeight:r=so.fieldNormWeight}={}){const i=new lo({getFn:n,fieldNormWeight:r});return i.setKeys(t.map(no)),i.setSources(e),i.create(),i}function ho(t,{errors:e=0,currentLocation:n=0,expectedLocation:r=0,distance:i=so.distance,ignoreLocation:o=so.ignoreLocation}={}){const s=e/t.length;if(o)return s;const a=Math.abs(r-n);return i?s+a/i:a?1:s}const uo=32;function fo(t,e,n,{location:r=so.location,distance:i=so.distance,threshold:o=so.threshold,findAllMatches:s=so.findAllMatches,minMatchCharLength:a=so.minMatchCharLength,includeMatches:l=so.includeMatches,ignoreLocation:c=so.ignoreLocation}={}){if(e.length>uo)throw new Error(`Pattern length exceeds max of ${uo}.`);const h=e.length,u=t.length,d=Math.max(0,Math.min(r,u));let f=o,p=d;const m=a>1||l,y=m?Array(u):[];let g;for(;(g=t.indexOf(e,p))>-1;){let t=ho(e,{currentLocation:g,expectedLocation:d,distance:i,ignoreLocation:c});if(f=Math.min(t,f),p=g+h,m){let t=0;for(;t<h;)y[g+t]=1,t+=1}}p=-1;let v=[],b=1,x=h+u;const _=1<<h-1;for(let r=0;r<h;r+=1){let o=0,a=x;for(;o<a;){ho(e,{errors:r,currentLocation:d+a,expectedLocation:d,distance:i,ignoreLocation:c})<=f?o=a:x=a,a=Math.floor((x-o)/2+o)}x=a;let l=Math.max(1,d-a+1),g=s?u:Math.min(d+a,u)+h,w=Array(g+2);w[g+1]=(1<<r)-1;for(let o=g;o>=l;o-=1){let s=o-1,a=n[t.charAt(s)];if(m&&(y[s]=+!!a),w[o]=(w[o+1]<<1|1)&a,r&&(w[o]|=(v[o+1]|v[o])<<1|1|v[o+1]),w[o]&_&&(b=ho(e,{errors:r,currentLocation:s,expectedLocation:d,distance:i,ignoreLocation:c}),b<=f)){if(f=b,p=s,p<=d)break;l=Math.max(1,2*d-p)}}if(ho(e,{errors:r+1,currentLocation:d,expectedLocation:d,distance:i,ignoreLocation:c})>f)break;v=w}const w={isMatch:p>=0,score:Math.max(.001,b)};if(m){const t=function(t=[],e=so.minMatchCharLength){let n=[],r=-1,i=-1,o=0;for(let s=t.length;o<s;o+=1){let s=t[o];s&&-1===r?r=o:s||-1===r||(i=o-1,i-r+1>=e&&n.push([r,i]),r=-1)}return t[o-1]&&o-r>=e&&n.push([r,o-1]),n}(y,a);t.length?l&&(w.indices=t):w.isMatch=!1}return w}function po(t){let e={};for(let n=0,r=t.length;n<r;n+=1){const i=t.charAt(n);e[i]=(e[i]||0)|1<<r-n-1}return e}class mo{constructor(t,{location:e=so.location,threshold:n=so.threshold,distance:r=so.distance,includeMatches:i=so.includeMatches,findAllMatches:o=so.findAllMatches,minMatchCharLength:s=so.minMatchCharLength,isCaseSensitive:a=so.isCaseSensitive,ignoreLocation:l=so.ignoreLocation}={}){if(this.options={location:e,threshold:n,distance:r,includeMatches:i,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:a,ignoreLocation:l},this.pattern=a?t:t.toLowerCase(),this.chunks=[],!this.pattern.length)return;const c=(t,e)=>{this.chunks.push({pattern:t,alphabet:po(t),startIndex:e})},h=this.pattern.length;if(h>uo){let t=0;const e=h%uo,n=h-e;for(;t<n;)c(this.pattern.substr(t,uo),t),t+=uo;if(e){const t=h-uo;c(this.pattern.substr(t),t)}}else c(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,includeMatches:n}=this.options;if(e||(t=t.toLowerCase()),this.pattern===t){let e={isMatch:!0,score:0};return n&&(e.indices=[[0,t.length-1]]),e}const{location:r,distance:i,threshold:o,findAllMatches:s,minMatchCharLength:a,ignoreLocation:l}=this.options;let c=[],h=0,u=!1;this.chunks.forEach((({pattern:e,alphabet:d,startIndex:f})=>{const{isMatch:p,score:m,indices:y}=fo(t,e,d,{location:r+f,distance:i,threshold:o,findAllMatches:s,minMatchCharLength:a,includeMatches:n,ignoreLocation:l});p&&(u=!0),h+=m,p&&y&&(c=[...c,...y])}));let d={isMatch:u,score:u?h/this.chunks.length:1};return u&&n&&(d.indices=c),d}}class yo{constructor(t){this.pattern=t}static isMultiMatch(t){return go(t,this.multiRegex)}static isSingleMatch(t){return go(t,this.singleRegex)}search(){}}function go(t,e){const n=t.match(e);return n?n[1]:null}class vo extends yo{constructor(t,{location:e=so.location,threshold:n=so.threshold,distance:r=so.distance,includeMatches:i=so.includeMatches,findAllMatches:o=so.findAllMatches,minMatchCharLength:s=so.minMatchCharLength,isCaseSensitive:a=so.isCaseSensitive,ignoreLocation:l=so.ignoreLocation}={}){super(t),this._bitapSearch=new mo(t,{location:e,threshold:n,distance:r,includeMatches:i,findAllMatches:o,minMatchCharLength:s,isCaseSensitive:a,ignoreLocation:l})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class bo extends yo{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e,n=0;const r=[],i=this.pattern.length;for(;(e=t.indexOf(this.pattern,n))>-1;)n=e+i,r.push([e,n-1]);const o=!!r.length;return{isMatch:o,score:o?0:1,indices:r}}}const xo=[class extends yo{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const e=t===this.pattern;return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}},bo,class extends yo{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const e=t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}},class extends yo{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const e=!t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends yo{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const e=!t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends yo{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const e=t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[t.length-this.pattern.length,t.length-1]}}},class extends yo{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const e=-1===t.indexOf(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},vo],_o=xo.length,wo=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const So=new Set([vo.type,bo.type]);class Co{constructor(t,{isCaseSensitive:e=so.isCaseSensitive,includeMatches:n=so.includeMatches,minMatchCharLength:r=so.minMatchCharLength,ignoreLocation:i=so.ignoreLocation,findAllMatches:o=so.findAllMatches,location:s=so.location,threshold:a=so.threshold,distance:l=so.distance}={}){this.query=null,this.options={isCaseSensitive:e,includeMatches:n,minMatchCharLength:r,findAllMatches:o,ignoreLocation:i,location:s,threshold:a,distance:l},this.pattern=e?t:t.toLowerCase(),this.query=function(t,e={}){return t.split("|").map((t=>{let n=t.trim().split(wo).filter((t=>t&&!!t.trim())),r=[];for(let t=0,i=n.length;t<i;t+=1){const i=n[t];let o=!1,s=-1;for(;!o&&++s<_o;){const t=xo[s];let n=t.isMultiMatch(i);n&&(r.push(new t(n,e)),o=!0)}if(!o)for(s=-1;++s<_o;){const t=xo[s];let n=t.isSingleMatch(i);if(n){r.push(new t(n,e));break}}}return r}))}(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:r}=this.options;t=r?t:t.toLowerCase();let i=0,o=[],s=0;for(let r=0,a=e.length;r<a;r+=1){const a=e[r];o.length=0,i=0;for(let e=0,r=a.length;e<r;e+=1){const r=a[e],{isMatch:l,indices:c,score:h}=r.search(t);if(!l){s=0,i=0,o.length=0;break}if(i+=1,s+=h,n){const t=r.constructor.type;So.has(t)?o=[...o,...c]:o.push(c)}}if(i){let t={isMatch:!0,score:s/i};return n&&(t.indices=o),t}}return{isMatch:!1,score:1}}}const Eo=[];function ko(t,e){for(let n=0,r=Eo.length;n<r;n+=1){let r=Eo[n];if(r.condition(t,e))return new r(t,e)}return new mo(t,e)}const To="$and",Ao="$or",Mo="$path",Po="$val",Oo=t=>!(!t[To]&&!t[Ao]),Io=t=>({[To]:Object.keys(t).map((e=>({[e]:t[e]})))});function Lo(t,e,{auto:n=!0}={}){const r=t=>{let i=Object.keys(t);const o=(t=>!!t[Mo])(t);if(!o&&i.length>1&&!Oo(t))return r(Io(t));if((t=>!Hi(t)&&$i(t)&&!Oo(t))(t)){const r=o?t[Mo]:i[0],s=o?t[Po]:t[r];if(!Vi(s))throw new Error((t=>`Invalid value for key ${t}`)(r));const a={keyId:io(r),pattern:s};return n&&(a.searcher=ko(s,e)),a}let s={children:[],operator:i[0]};return i.forEach((e=>{const n=t[e];Hi(n)&&n.forEach((t=>{s.children.push(r(t))}))})),s};return Oo(t)||(t=Io(t)),r(t)}function jo(t,e){const n=t.matches;e.matches=[],qi(n)&&n.forEach((t=>{if(!qi(t.indices)||!t.indices.length)return;const{indices:n,value:r}=t;let i={indices:n,value:r};t.key&&(i.key=t.key.src),t.idx>-1&&(i.refIndex=t.idx),e.matches.push(i)}))}function Ro(t,e){e.score=t.score}class Do{constructor(t,e={},n){this.options=Wi(Wi({},so),e),this.options.useExtendedSearch,this._keyStore=new eo(this.options.keys),this.setCollection(t,n)}setCollection(t,e){if(this._docs=t,e&&!(e instanceof lo))throw new Error("Incorrect 'index' type");this._myIndex=e||co(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){qi(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const e=[];for(let n=0,r=this._docs.length;n<r;n+=1){const i=this._docs[n];t(i,n)&&(this.removeAt(n),n-=1,r-=1,e.push(i))}return e}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:e=-1}={}){const{includeMatches:n,includeScore:r,shouldSort:i,sortFn:o,ignoreFieldNorm:s}=this.options;let a=Vi(t)?Vi(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return function(t,{ignoreFieldNorm:e=so.ignoreFieldNorm}){t.forEach((t=>{let n=1;t.matches.forEach((({key:t,norm:r,score:i})=>{const o=t?t.weight:null;n*=Math.pow(0===i&&o?Number.EPSILON:i,(o||1)*(e?1:r))})),t.score=n}))}(a,{ignoreFieldNorm:s}),i&&a.sort(o),Yi(e)&&e>-1&&(a=a.slice(0,e)),function(t,e,{includeMatches:n=so.includeMatches,includeScore:r=so.includeScore}={}){const i=[];return n&&i.push(jo),r&&i.push(Ro),t.map((t=>{const{idx:n}=t,r={item:e[n],refIndex:n};return i.length&&i.forEach((e=>{e(t,r)})),r}))}(a,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(t){const e=ko(t,this.options),{records:n}=this._myIndex,r=[];return n.forEach((({v:t,i:n,n:i})=>{if(!qi(t))return;const{isMatch:o,score:s,indices:a}=e.searchIn(t);o&&r.push({item:t,idx:n,matches:[{score:s,value:t,norm:i,indices:a}]})})),r}_searchLogical(t){const e=Lo(t,this.options),n=(t,e,r)=>{if(!t.children){const{keyId:n,searcher:i}=t,o=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(e,n),searcher:i});return o&&o.length?[{idx:r,item:e,matches:o}]:[]}const i=[];for(let o=0,s=t.children.length;o<s;o+=1){const s=t.children[o],a=n(s,e,r);if(a.length)i.push(...a);else if(t.operator===To)return[]}return i},r=this._myIndex.records,i={},o=[];return r.forEach((({$:t,i:r})=>{if(qi(t)){let s=n(e,t,r);s.length&&(i[r]||(i[r]={idx:r,item:t,matches:[]},o.push(i[r])),s.forEach((({matches:t})=>{i[r].matches.push(...t)})))}})),o}_searchObjectList(t){const e=ko(t,this.options),{keys:n,records:r}=this._myIndex,i=[];return r.forEach((({$:t,i:r})=>{if(!qi(t))return;let o=[];n.forEach(((n,r)=>{o.push(...this._findMatches({key:n,value:t[r],searcher:e}))})),o.length&&i.push({idx:r,item:t,matches:o})})),i}_findMatches({key:t,value:e,searcher:n}){if(!qi(e))return[];let r=[];if(Hi(e))e.forEach((({v:e,i,n:o})=>{if(!qi(e))return;const{isMatch:s,score:a,indices:l}=n.searchIn(e);s&&r.push({score:a,key:t,value:e,idx:i,norm:o,indices:l})}));else{const{v:i,n:o}=e,{isMatch:s,score:a,indices:l}=n.searchIn(i);s&&r.push({score:a,key:t,value:i,norm:o,indices:l})}return r}}Do.version="7.0.0",Do.createIndex=co,Do.parseIndex=function(t,{getFn:e=so.getFn,fieldNormWeight:n=so.fieldNormWeight}={}){const{keys:r,records:i}=t,o=new lo({getFn:e,fieldNormWeight:n});return o.setKeys(r),o.setIndexRecords(i),o},Do.config=so,Do.parseQuery=Lo,function(...t){Eo.push(...t)}(Co);var No=function(){function t(t){this._haystack=[],this._fuseOptions=vr(vr({},t.fuseOptions),{keys:br([],t.searchFields,!0),includeMatches:!0})}return t.prototype.index=function(t){this._haystack=t,this._fuse&&this._fuse.setCollection(t)},t.prototype.reset=function(){this._haystack=[],this._fuse=void 0},t.prototype.isEmptyIndex=function(){return!this._haystack.length},t.prototype.search=function(t){return this._fuse||(this._fuse=new Do(this._haystack,this._fuseOptions)),this._fuse.search(t).map((function(t,e){return{item:t.item,score:t.score||0,rank:e+1}}))},t}();var Fo=function(t,e,n){var r=t.dataset,i=e.customProperties,o=e.labelClass,s=e.labelDescription;o&&(r.labelClass=gi(o).join(" ")),s&&(r.labelDescription=hi(s)),n&&i&&("string"==typeof i?r.customProperties=i:"object"!=typeof i||function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(i)||(r.customProperties=JSON.stringify(i)))},Bo=function(t,e,n){var r=e&&t.querySelector("label[for='".concat(e,"']")),i=r&&r.innerText;i&&n.setAttribute("aria-label",i)},Go={containerOuter:function(t,e,n,r,i,o,s){var a=t.classNames.containerOuter,l=document.createElement("div");return bi(l,a),l.dataset.type=o,e&&(l.dir=e),r&&(l.tabIndex=0),n&&(l.setAttribute("role",i?"combobox":"listbox"),i?l.setAttribute("aria-autocomplete","list"):s||Bo(this._docRoot,this.passedElement.element.id,l),l.setAttribute("aria-haspopup","true"),l.setAttribute("aria-expanded","false")),s&&l.setAttribute("aria-labelledby",s),l},containerInner:function(t){var e=t.classNames.containerInner,n=document.createElement("div");return bi(n,e),n},itemList:function(t,e){var n=t.searchEnabled,r=t.classNames,i=r.list,o=r.listSingle,s=r.listItems,a=document.createElement("div");return bi(a,i),bi(a,e?o:s),this._isSelectElement&&n&&a.setAttribute("role","listbox"),a},placeholder:function(t,e){var n=t.allowHTML,r=t.classNames.placeholder,i=document.createElement("div");return bi(i,r),mi(i,n,e),i},item:function(t,e,n){var r=t.allowHTML,i=t.removeItemButtonAlignLeft,o=t.removeItemIconText,s=t.removeItemLabelText,a=t.classNames,l=a.item,c=a.button,h=a.highlightedState,u=a.itemSelectable,d=a.placeholder,f=hi(e.value),p=document.createElement("div");if(bi(p,l),e.labelClass){var m=document.createElement("span");mi(m,r,e.label),bi(m,e.labelClass),p.appendChild(m)}else mi(p,r,e.label);if(p.dataset.item="",p.dataset.id=e.id,p.dataset.value=f,Fo(p,e,!0),(e.disabled||this.containerOuter.isDisabled)&&p.setAttribute("aria-disabled","true"),this._isSelectElement&&(p.setAttribute("aria-selected","true"),p.setAttribute("role","option")),e.placeholder&&(bi(p,d),p.dataset.placeholder=""),bi(p,e.highlighted?h:u),n){e.disabled&&xi(p,u),p.dataset.deletable="";var y=document.createElement("button");y.type="button",bi(y,c);var g=di(e);mi(y,!0,fi(o,e.value,g));var v=fi(s,e.value,g);v&&y.setAttribute("aria-label",v),y.dataset.button="",i?p.insertAdjacentElement("afterbegin",y):p.appendChild(y)}return p},choiceList:function(t,e){var n=t.classNames.list,r=document.createElement("div");return bi(r,n),e||r.setAttribute("aria-multiselectable","true"),r.setAttribute("role","listbox"),r},choiceGroup:function(t,e){var n=t.allowHTML,r=t.classNames,i=r.group,o=r.groupHeading,s=r.itemDisabled,a=e.id,l=e.label,c=e.disabled,h=hi(l),u=document.createElement("div");bi(u,i),c&&bi(u,s),u.setAttribute("role","group"),u.dataset.group="",u.dataset.id=a,u.dataset.value=h,c&&u.setAttribute("aria-disabled","true");var d=document.createElement("div");return bi(d,o),mi(d,n,l||""),u.appendChild(d),u},choice:function(t,e,n,r){var i=t.allowHTML,o=t.classNames,s=o.item,a=o.itemChoice,l=o.itemSelectable,c=o.selectedState,h=o.itemDisabled,u=o.description,d=o.placeholder,f=e.label,p=hi(e.value),m=document.createElement("div");m.id=e.elementId,bi(m,s),bi(m,a),r&&"string"==typeof f&&(f=pi(i,f),f={trusted:f+=" (".concat(r,")")});var y=m;if(e.labelClass){var g=document.createElement("span");mi(g,i,f),bi(g,e.labelClass),y=g,m.appendChild(g)}else mi(m,i,f);if(e.labelDescription){var v="".concat(e.elementId,"-description");y.setAttribute("aria-describedby",v);var b=document.createElement("span");mi(b,i,e.labelDescription),b.id=v,bi(b,u),m.appendChild(b)}return e.selected&&bi(m,c),e.placeholder&&bi(m,d),m.setAttribute("role",e.group?"treeitem":"option"),m.dataset.choice="",m.dataset.id=e.id,m.dataset.value=p,n&&(m.dataset.selectText=n),e.group&&(m.dataset.groupId="".concat(e.group.id)),Fo(m,e,!1),e.disabled?(bi(m,h),m.dataset.choiceDisabled="",m.setAttribute("aria-disabled","true")):(bi(m,l),m.dataset.choiceSelectable="",m.setAttribute("aria-selected",e.selected?"true":"false")),m},input:function(t,e){var n=t.classNames,r=n.input,i=n.inputCloned,o=t.labelId,s=document.createElement("input");return s.type="search",bi(s,r),bi(s,i),s.autocomplete="off",s.autocapitalize="off",s.spellcheck=!1,s.setAttribute("aria-autocomplete","list"),e?s.setAttribute("aria-label",e):o||Bo(this._docRoot,this.passedElement.element.id,s),s},dropdown:function(t){var e=t.classNames,n=e.list,r=e.listDropdown,i=document.createElement("div");return bi(i,n),bi(i,r),i.setAttribute("aria-expanded","false"),i},notice:function(t,e,n){var r=t.classNames,i=r.item,o=r.itemChoice,s=r.addChoice,a=r.noResults,l=r.noChoices,c=r.notice;void 0===n&&(n=Gi);var h=document.createElement("div");switch(mi(h,!0,e),bi(h,i),bi(h,o),bi(h,c),n){case Bi:bi(h,s);break;case Fi:bi(h,a);break;case Ni:bi(h,l)}return n===Bi&&(h.dataset.choiceSelectable="",h.dataset.choice=""),h},option:function(t){var e=hi(t.label),n=new Option(e,t.value,!1,t.selected);return Fo(n,t,!0),n.disabled=t.disabled,t.selected&&n.setAttribute("selected",""),n}},zo="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,Uo={},Wo=function(t){if(t)return t.dataset.id?parseInt(t.dataset.id,10):void 0},Ho="[data-choice-selectable]",Vo=function(){function t(e,n){void 0===e&&(e="[data-choice]"),void 0===n&&(n={});var r=this;this.initialisedOK=void 0,this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0;var i=t.defaults;this.config=vr(vr(vr({},i.allOptions),i.options),n),Zr.forEach((function(t){r.config[t]=vr(vr(vr({},i.allOptions[t]),i.options[t]),n[t])}));var o=this.config;o.silent||this._validateConfig();var s=o.shadowRoot||document.documentElement;this._docRoot=s;var a="string"==typeof e?s.querySelector(e):e;if(!a||"object"!=typeof a||"INPUT"!==a.tagName&&!Oi(a)){if(!a&&"string"==typeof e)throw TypeError("Selector ".concat(e," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}var l=a.type,c=l===Jr;(c||1!==o.maxItemCount)&&(o.singleModeForMultiSelect=!1),o.singleModeForMultiSelect&&(l=ti);var h=l===Qr,u=l===ti,d=h||u;if(this._elementType=l,this._isTextElement=c,this._isSelectOneElement=h,this._isSelectMultipleElement=u,this._isSelectElement=h||u,this._canAddUserChoices=c&&o.addItems||d&&o.addChoices,"boolean"!=typeof o.renderSelectedChoices&&(o.renderSelectedChoices="always"===o.renderSelectedChoices||h),"auto"===o.closeDropdownOnSelect?o.closeDropdownOnSelect=c||h||o.singleModeForMultiSelect:o.closeDropdownOnSelect=Ai(o.closeDropdownOnSelect),o.placeholder&&(o.placeholderValue?this._hasNonChoicePlaceholder=!0:a.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,o.placeholderValue=a.dataset.placeholder)),n.addItemFilter&&"function"!=typeof n.addItemFilter){var f=n.addItemFilter instanceof RegExp?n.addItemFilter:new RegExp(n.addItemFilter);o.addItemFilter=f.test.bind(f)}if(this._isTextElement)this.passedElement=new Ti({element:a,classNames:o.classNames});else{var p=a;this.passedElement=new Ii({element:p,classNames:o.classNames,template:function(t){return r._templates.option(t)},extractPlaceholder:o.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new Di(o),this._currentValue="",o.searchEnabled=!c&&o.searchEnabled,this._canSearch=o.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(t,e){var n=t.id||t.name&&"".concat(t.name,"-").concat(oi(2))||oi(4);return n=n.replace(/(:|\.|\[|\]|,)/g,""),"".concat(e,"-").concat(n)}(a,"choices-"),this._direction=a.dir,!this._direction){var m=window.getComputedStyle(a).direction;m!==window.getComputedStyle(document.documentElement).direction&&(this._direction=m)}if(this._idNames={itemChoice:"item-choice"},this._templates=i.templates,this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onInput=this._onInput.bind(this),this._onClick=this._onClick.bind(this),this._onTouchMove=this._onTouchMove.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseOver=this._onMouseOver.bind(this),this._onFormReset=this._onFormReset.bind(this),this._onSelectKey=this._onSelectKey.bind(this),this._onEnterKey=this._onEnterKey.bind(this),this._onEscapeKey=this._onEscapeKey.bind(this),this._onDirectionKey=this._onDirectionKey.bind(this),this._onDeleteKey=this._onDeleteKey.bind(this),this._onChange=this._onChange.bind(this),this._onInvalid=this._onInvalid.bind(this),this.passedElement.isActive)return o.silent||console.warn("Trying to initialise Choices on element already initialised",{element:e}),this.initialised=!0,void(this.initialisedOK=!1);this.init(),this._initialItems=this._store.items.map((function(t){return t.value}))}return Object.defineProperty(t,"defaults",{get:function(){return Object.preventExtensions({get options(){return Uo},get allOptions(){return Li},get templates(){return Go}})},enumerable:!1,configurable:!0}),t.prototype.init=function(){if(!this.initialised&&void 0===this.initialisedOK){var t;this._searcher=(t=this.config,new No(t)),this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),this._isTextElement&&!this.config.addItems||this.passedElement.element.hasAttribute("disabled")||this.passedElement.element.closest("fieldset:disabled")?this.disable():(this.enable(),this._addEventListeners()),this._initStore(),this.initialised=!0,this.initialisedOK=!0;var e=this.config.callbackOnInit;"function"==typeof e&&e.call(this)}},t.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this._store._listeners=[],this.clearStore(!1),this._stopSearch(),this._templates=t.defaults.templates,this.initialised=!1,this.initialisedOK=void 0)},t.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},t.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},t.prototype.highlightItem=function(t,e){if(void 0===e&&(e=!0),!t||!t.id)return this;var n=this._store.items.find((function(e){return e.id===t.id}));return!n||n.highlighted||(this._store.dispatch(ii(n,!0)),e&&this.passedElement.triggerEvent(Nr,di(n))),this},t.prototype.unhighlightItem=function(t,e){if(void 0===e&&(e=!0),!t||!t.id)return this;var n=this._store.items.find((function(e){return e.id===t.id}));return n&&n.highlighted?(this._store.dispatch(ii(n,!1)),e&&this.passedElement.triggerEvent(Br,di(n)),this):this},t.prototype.highlightAll=function(){var t=this;return this._store.withTxn((function(){t._store.items.forEach((function(e){e.highlighted||(t._store.dispatch(ii(e,!0)),t.passedElement.triggerEvent(Nr,di(e)))}))})),this},t.prototype.unhighlightAll=function(){var t=this;return this._store.withTxn((function(){t._store.items.forEach((function(e){e.highlighted&&(t._store.dispatch(ii(e,!1)),t.passedElement.triggerEvent(Nr,di(e)))}))})),this},t.prototype.removeActiveItemsByValue=function(t){var e=this;return this._store.withTxn((function(){e._store.items.filter((function(e){return e.value===t})).forEach((function(t){return e._removeItem(t)}))})),this},t.prototype.removeActiveItems=function(t){var e=this;return this._store.withTxn((function(){e._store.items.filter((function(e){return e.id!==t})).forEach((function(t){return e._removeItem(t)}))})),this},t.prototype.removeHighlightedItems=function(t){var e=this;return void 0===t&&(t=!1),this._store.withTxn((function(){e._store.highlightedActiveItems.forEach((function(n){e._removeItem(n),t&&e._triggerChange(n.value)}))})),this},t.prototype.showDropdown=function(t){var e=this;return this.dropdown.isActive||(void 0===t&&(t=!this._canSearch),requestAnimationFrame((function(){e.dropdown.show();var n=e.dropdown.element.getBoundingClientRect();e.containerOuter.open(n.bottom,n.height),t||e.input.focus(),e.passedElement.triggerEvent(Pr);var r=e.choiceList.element.querySelector(vi(e.config.classNames.selectedState));null===r||si(r,e.choiceList.element)||r.scrollIntoView()}))),this},t.prototype.hideDropdown=function(t){var e=this;return this.dropdown.isActive?(this._removeHighlightedChoices(),requestAnimationFrame((function(){e.dropdown.hide(),e.containerOuter.close(),!t&&e._canSearch&&(e.input.removeActiveDescendant(),e.input.blur()),e.passedElement.triggerEvent(Or)})),this):this},t.prototype.getValue=function(t){var e=this._store.items.map((function(e){return t?e.value:di(e)}));return this._isSelectOneElement||this.config.singleModeForMultiSelect?e[0]:e},t.prototype.setValue=function(t){var e=this;return this.initialisedOK?(this._store.withTxn((function(){t.forEach((function(t){t&&e._addChoice(Pi(t,!1))}))})),this._searcher.reset(),this):(this._warnChoicesInitFailed("setValue"),this)},t.prototype.setChoiceByValue=function(t){var e=this;return this.initialisedOK?(this._isTextElement||(this._store.withTxn((function(){(Array.isArray(t)?t:[t]).forEach((function(t){return e._findAndSelectChoiceByValue(t)})),e.unhighlightAll()})),this._searcher.reset()),this):(this._warnChoicesInitFailed("setChoiceByValue"),this)},t.prototype.setChoices=function(t,e,n,r,i,o){var s=this;if(void 0===t&&(t=[]),void 0===e&&(e="value"),void 0===n&&(n="label"),void 0===r&&(r=!1),void 0===i&&(i=!0),void 0===o&&(o=!1),!this.initialisedOK)return this._warnChoicesInitFailed("setChoices"),this;if(!this._isSelectElement)throw new TypeError("setChoices can't be used with INPUT based Choices");if("string"!=typeof e||!e)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if("function"==typeof t){var a=t(this);if("function"==typeof Promise&&a instanceof Promise)return new Promise((function(t){return requestAnimationFrame(t)})).then((function(){return s._handleLoadingState(!0)})).then((function(){return a})).then((function(t){return s.setChoices(t,e,n,r,i,o)})).catch((function(t){s.config.silent||console.error(t)})).then((function(){return s._handleLoadingState(!1)})).then((function(){return s}));if(!Array.isArray(a))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof a));return this.setChoices(a,e,n,!1)}if(!Array.isArray(t))throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices");return this.containerOuter.removeLoadingState(),this._store.withTxn((function(){i&&(s._isSearching=!1),r&&s.clearChoices(!0,o);var a="value"===e,l="label"===n;t.forEach((function(t){if("choices"in t){var r=t;l||(r=vr(vr({},r),{label:r[n]})),s._addGroup(Pi(r,!0))}else{var i=t;l&&a||(i=vr(vr({},i),{value:i[e],label:i[n]}));var o=Pi(i,!1);s._addChoice(o),o.placeholder&&!s._hasNonChoicePlaceholder&&(s._placeholderValue=ui(o.label))}})),s.unhighlightAll()})),this._searcher.reset(),this},t.prototype.refresh=function(t,e,n){var r=this;return void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===n&&(n=!1),this._isSelectElement?(this._store.withTxn((function(){var i=r.passedElement.optionsAsChoices(),o={};n||r._store.items.forEach((function(t){t.id&&t.active&&t.selected&&(o[t.value]=!0)})),r.clearStore(!1);var s=function(t){n?r._store.dispatch(ri(t)):o[t.value]&&(t.selected=!0)};i.forEach((function(t){"choices"in t?t.choices.forEach(s):s(t)})),r._addPredefinedChoices(i,e,t),r._isSearching&&r._searchChoices(r.input.value)})),this):(this.config.silent||console.warn("refresh method can only be used on choices backed by a <select> element"),this)},t.prototype.removeChoice=function(t){var e=this._store.choices.find((function(e){return e.value===t}));return e?(this._clearNotice(),this._store.dispatch(function(t){return{type:wr,choice:t}}(e)),this._searcher.reset(),e.selected&&this.passedElement.triggerEvent(Dr,di(e)),this):this},t.prototype.clearChoices=function(t,e){var n=this;return void 0===t&&(t=!0),void 0===e&&(e=!1),t&&(e?this.passedElement.element.replaceChildren(""):this.passedElement.element.querySelectorAll(":not([selected])").forEach((function(t){t.remove()}))),this.itemList.element.replaceChildren(""),this.choiceList.element.replaceChildren(""),this._clearNotice(),this._store.withTxn((function(){var t=e?[]:n._store.items;n._store.reset(),t.forEach((function(t){n._store.dispatch(ei(t)),n._store.dispatch(ni(t))}))})),this._searcher.reset(),this},t.prototype.clearStore=function(t){return void 0===t&&(t=!0),this.clearChoices(t,!0),this._stopSearch(),this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this},t.prototype.clearInput=function(){var t=!this._isSelectOneElement;return this.input.clear(t),this._stopSearch(),this},t.prototype._validateConfig=function(){var t,e,n,r,i=this.config,o=(t=i,e=Li,n=Object.keys(t).sort(),r=Object.keys(e).sort(),n.filter((function(t){return r.indexOf(t)<0})));o.length&&console.warn("Unknown config option(s) passed",o.join(", ")),i.allowHTML&&i.allowHtmlUserInput&&(i.addItems&&console.warn("Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks"),i.addChoices&&console.warn("Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks"))},t.prototype._render=function(t){void 0===t&&(t={choices:!0,groups:!0,items:!0}),this._store.inTxn()||(this._isSelectElement&&(t.choices||t.groups)&&this._renderChoices(),t.items&&this._renderItems())},t.prototype._renderChoices=function(){var t=this;if(this._canAddItems()){var e=this.config,n=this._isSearching,r=this._store,i=r.activeGroups,o=r.activeChoices,s=n?e.searchResultLimit:e.renderChoiceLimit;if(this._isSelectElement){var a=o.filter((function(t){return!t.element}));a.length&&this.passedElement.addOptions(a)}var l=document.createDocumentFragment(),c=function(t){return t.filter((function(t){return!t.placeholder&&(n?(e.searchRenderSelectedChoices||!t.selected)&&!!t.rank:e.renderSelectedChoices||!t.selected)}))},h=e.appendGroupInSearch&&n,u=!1,d=null,f=function(r,i){n?r.sort(yi):e.shouldSort&&r.sort(e.sorter);var o=r.length;o=!i&&s>0&&o>s?s:o,o--,r.every((function(r,i){var s=r.choiceEl||t._templates.choice(e,r,e.itemSelectText,h&&r.group?r.group.label:void 0);return r.choiceEl=s,l.appendChild(s),n||!r.selected?u=!0:d||(d=s),i<o}))};o.length&&(e.resetScrollPosition&&requestAnimationFrame((function(){return t.choiceList.scrollToTop()})),this._hasNonChoicePlaceholder||n||!this._isSelectOneElement||f(o.filter((function(t){return t.placeholder&&!t.group})),!1),i.length&&!n?(e.shouldSort&&i.sort(e.sorter),f(o.filter((function(t){return!t.placeholder&&!t.group})),!1),i.forEach((function(e){var n=c(e.choices);if(n.length){if(e.label){var r=e.groupEl||t._templates.choiceGroup(t.config,e);e.groupEl=r,r.remove(),l.appendChild(r)}f(n,!0)}}))):f(c(o),!1)),u||!n&&l.children.length&&e.renderSelectedChoices||(this._notice||(this._notice={text:ci(n?e.noResultsText:e.noChoicesText),type:n?Fi:Ni}),l.replaceChildren("")),this._renderNotice(l),this.choiceList.element.replaceChildren(l),this._highlightChoice(d)}},t.prototype._renderItems=function(){var t=this,e=this._store.items||[],n=this.itemList.element,r=this.config,i=document.createDocumentFragment(),o=function(t){return n.querySelector('[data-item][data-id="'.concat(t.id,'"]'))},s=function(e){var n=e.itemEl;n&&n.parentElement||(n=o(e)||t._templates.item(r,e,r.removeItemButton),e.itemEl=n,i.appendChild(n))};e.forEach(s);var a=!!i.childNodes.length;if(this._isSelectOneElement){var l=n.children.length;if(a||l>1){var c=n.querySelector(vi(r.classNames.placeholder));c&&c.remove()}else a||l||!this._placeholderValue||(a=!0,s(Pi({selected:!0,value:"",label:this._placeholderValue,placeholder:!0},!1)))}a&&(n.append(i),r.shouldSortItems&&!this._isSelectOneElement&&(e.sort(r.sorter),e.forEach((function(t){var e=o(t);e&&(e.remove(),i.append(e))})),n.append(i))),this._isTextElement&&(this.passedElement.value=e.map((function(t){return t.value})).join(r.delimiter))},t.prototype._displayNotice=function(t,e,n){void 0===n&&(n=!0);var r=this._notice;r&&(r.type===e&&r.text===t||r.type===Bi&&(e===Fi||e===Ni))?n&&this.showDropdown(!0):(this._clearNotice(),this._notice=t?{text:t,type:e}:void 0,this._renderNotice(),n&&t&&this.showDropdown(!0))},t.prototype._clearNotice=function(){if(this._notice){var t=this.choiceList.element.querySelector(vi(this.config.classNames.notice));t&&t.remove(),this._notice=void 0}},t.prototype._renderNotice=function(t){var e=this._notice;if(e){var n=this._templates.notice(this.config,e.text,e.type);t?t.append(n):this.choiceList.prepend(n)}},t.prototype._getChoiceForOutput=function(t,e){return di(t,e)},t.prototype._triggerChange=function(t){null!=t&&this.passedElement.triggerEvent(Ir,{value:t})},t.prototype._handleButtonAction=function(t){var e=this,n=this._store.items;if(n.length&&this.config.removeItems&&this.config.removeItemButton){var r=t&&Wo(t.closest("[data-id]")),i=r&&n.find((function(t){return t.id===r}));i&&this._store.withTxn((function(){if(e._removeItem(i),e._triggerChange(i.value),e._isSelectOneElement&&!e._hasNonChoicePlaceholder){var t=(e.config.shouldSort?e._store.choices.reverse():e._store.choices).find((function(t){return t.placeholder}));t&&(e._addItem(t),e.unhighlightAll(),t.value&&e._triggerChange(t.value))}}))}},t.prototype._handleItemAction=function(t,e){var n=this;void 0===e&&(e=!1);var r=this._store.items;if(r.length&&this.config.removeItems&&!this._isSelectOneElement){var i=Wo(t);i&&(r.forEach((function(t){t.id!==i||t.highlighted?!e&&t.highlighted&&n.unhighlightItem(t):n.highlightItem(t)})),this.input.focus())}},t.prototype._handleChoiceAction=function(t){var e=this,n=Wo(t),r=n&&this._store.getChoiceById(n);if(!r||r.disabled)return!1;var i=this.dropdown.isActive;if(!r.selected){if(!this._canAddItems())return!0;this._store.withTxn((function(){e._addItem(r,!0,!0),e.clearInput(),e.unhighlightAll()})),this._triggerChange(r.value)}return i&&this.config.closeDropdownOnSelect&&(this.hideDropdown(!0),this.containerOuter.element.focus()),!0},t.prototype._handleBackspace=function(t){var e=this.config;if(e.removeItems&&t.length){var n=t[t.length-1],r=t.some((function(t){return t.highlighted}));e.editItems&&!r&&n?(this.input.value=n.value,this.input.setWidth(),this._removeItem(n),this._triggerChange(n.value)):(r||this.highlightItem(n,!1),this.removeHighlightedItems(!0))}},t.prototype._loadChoices=function(){var t,e=this,n=this.config;if(this._isTextElement){if(this._presetChoices=n.items.map((function(t){return Pi(t,!1)})),this.passedElement.value){var r=this.passedElement.value.split(n.delimiter).map((function(t){return Pi(t,!1,e.config.allowHtmlUserInput)}));this._presetChoices=this._presetChoices.concat(r)}this._presetChoices.forEach((function(t){t.selected=!0}))}else if(this._isSelectElement){this._presetChoices=n.choices.map((function(t){return Pi(t,!0)}));var i=this.passedElement.optionsAsChoices();i&&(t=this._presetChoices).push.apply(t,i)}},t.prototype._handleLoadingState=function(t){void 0===t&&(t=!0);var e=this.itemList.element;t?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?e.replaceChildren(this._templates.placeholder(this.config,this.config.loadingText)):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?(e.replaceChildren(""),this._render()):this.input.placeholder=this._placeholderValue||"")},t.prototype._handleSearch=function(t){if(this.input.isFocussed)if(null!=t&&t.length>=this.config.searchFloor){var e=this.config.searchChoices?this._searchChoices(t):0;null!==e&&this.passedElement.triggerEvent(jr,{value:t,resultCount:e})}else this._store.choices.some((function(t){return!t.active}))&&this._stopSearch()},t.prototype._canAddItems=function(){var t=this.config,e=t.maxItemCount,n=t.maxItemText;return!t.singleModeForMultiSelect&&e>0&&e<=this._store.items.length?(this.choiceList.element.replaceChildren(""),this._notice=void 0,this._displayNotice("function"==typeof n?n(e):n,Bi),!1):(this._notice&&this._notice.type===Bi&&this._clearNotice(),!0)},t.prototype._canCreateItem=function(t){var e=this.config,n=!0,r="";if((n&&"function"==typeof e.addItemFilter&&!e.addItemFilter(t)&&(n=!1,r=fi(e.customAddItemText,t,void 0)),n)&&this._store.choices.find((function(n){return e.valueComparer(n.value,t)}))){if(this._isSelectElement)return this._displayNotice("",Bi),!1;e.duplicateItemsAllowed||(n=!1,r=fi(e.uniqueItemText,t,void 0))}return n&&(r=fi(e.addItemText,t,void 0)),r&&this._displayNotice(r,Bi),n},t.prototype._searchChoices=function(t){var e=t.trim().replace(/\s{2,}/," ");if(!e.length||e===this._currentValue)return null;var n=this._searcher;n.isEmptyIndex()&&n.index(this._store.searchableChoices);var r=n.search(e);this._currentValue=e,this._highlightPosition=0,this._isSearching=!0;var i=this._notice;return(i&&i.type)!==Bi&&(r.length?this._clearNotice():this._displayNotice(ci(this.config.noResultsText),Fi)),this._store.dispatch(function(t){return{type:Sr,results:t}}(r)),r.length},t.prototype._stopSearch=function(){this._isSearching&&(this._currentValue="",this._isSearching=!1,this._clearNotice(),this._store.dispatch({type:Cr,active:!0}),this.passedElement.triggerEvent(jr,{value:"",resultCount:0}))},t.prototype._addEventListeners=function(){var t=this._docRoot,e=this.containerOuter.element,n=this.input.element,r=this.passedElement.element;t.addEventListener("touchend",this._onTouchEnd,!0),e.addEventListener("keydown",this._onKeyDown,!0),e.addEventListener("mousedown",this._onMouseDown,!0),t.addEventListener("click",this._onClick,{passive:!0}),t.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(e.addEventListener("focus",this._onFocus,{passive:!0}),e.addEventListener("blur",this._onBlur,{passive:!0})),n.addEventListener("keyup",this._onKeyUp,{passive:!0}),n.addEventListener("input",this._onInput,{passive:!0}),n.addEventListener("focus",this._onFocus,{passive:!0}),n.addEventListener("blur",this._onBlur,{passive:!0}),n.form&&n.form.addEventListener("reset",this._onFormReset,{passive:!0}),r.hasAttribute("required")&&(r.addEventListener("change",this._onChange,{passive:!0}),r.addEventListener("invalid",this._onInvalid,{passive:!0})),this.input.addEventListeners()},t.prototype._removeEventListeners=function(){var t=this._docRoot,e=this.containerOuter.element,n=this.input.element,r=this.passedElement.element;t.removeEventListener("touchend",this._onTouchEnd,!0),e.removeEventListener("keydown",this._onKeyDown,!0),e.removeEventListener("mousedown",this._onMouseDown,!0),t.removeEventListener("click",this._onClick),t.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),this._isSelectOneElement&&(e.removeEventListener("focus",this._onFocus),e.removeEventListener("blur",this._onBlur)),n.removeEventListener("keyup",this._onKeyUp),n.removeEventListener("input",this._onInput),n.removeEventListener("focus",this._onFocus),n.removeEventListener("blur",this._onBlur),n.form&&n.form.removeEventListener("reset",this._onFormReset),r.hasAttribute("required")&&(r.removeEventListener("change",this._onChange),r.removeEventListener("invalid",this._onInvalid)),this.input.removeEventListeners()},t.prototype._onKeyDown=function(t){var e=t.keyCode,n=this.dropdown.isActive,r=1===t.key.length||2===t.key.length&&t.key.charCodeAt(0)>=55296||"Unidentified"===t.key;switch(this._isTextElement||n||e===Yr||e===Gr||e===zr||(this.showDropdown(),!this.input.isFocussed&&r&&(this.input.value+=t.key," "===t.key&&t.preventDefault())),e){case Vr:return this._onSelectKey(t,this.itemList.element.hasChildNodes());case Hr:return this._onEnterKey(t,n);case Yr:return this._onEscapeKey(t,n);case Xr:case qr:case $r:case Kr:return this._onDirectionKey(t,n);case Wr:case Ur:return this._onDeleteKey(t,this._store.items,this.input.isFocussed)}},t.prototype._onKeyUp=function(){this._canSearch=this.config.searchEnabled},t.prototype._onInput=function(){var t=this.input.value;t?this._canAddItems()&&(this._canSearch&&this._handleSearch(t),this._canAddUserChoices&&(this._canCreateItem(t),this._isSelectElement&&(this._highlightPosition=0,this._highlightChoice()))):this._isTextElement?this.hideDropdown(!0):this._stopSearch()},t.prototype._onSelectKey=function(t,e){(t.ctrlKey||t.metaKey)&&e&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},t.prototype._onEnterKey=function(t,e){var n=this,r=this.input.value,i=t.target;if(t.preventDefault(),i&&i.hasAttribute("data-button"))this._handleButtonAction(i);else if(e){var o=this.dropdown.element.querySelector(vi(this.config.classNames.highlightedState));if(!o||!this._handleChoiceAction(o))if(i&&r){if(this._canAddItems()){var s=!1;this._store.withTxn((function(){if(!(s=n._findAndSelectChoiceByValue(r,!0))){if(!n._canAddUserChoices)return;if(!n._canCreateItem(r))return;n._addChoice(Pi(r,!1,n.config.allowHtmlUserInput),!0,!0),s=!0}n.clearInput(),n.unhighlightAll()})),s&&(this._triggerChange(r),this.config.closeDropdownOnSelect&&this.hideDropdown(!0))}}else this.hideDropdown(!0)}else(this._isSelectElement||this._notice)&&this.showDropdown()},t.prototype._onEscapeKey=function(t,e){e&&(t.stopPropagation(),this.hideDropdown(!0),this._stopSearch(),this.containerOuter.element.focus())},t.prototype._onDirectionKey=function(t,e){var n=t.keyCode;if(e||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var r=n===$r||n===Kr?1:-1,i=void 0;if(t.metaKey||n===Kr||n===qr)i=r>0?this.dropdown.element.querySelector("".concat(Ho,":last-of-type")):this.dropdown.element.querySelector(Ho);else{var o=this.dropdown.element.querySelector(vi(this.config.classNames.highlightedState));i=o?function(t,e,n){void 0===n&&(n=1);for(var r="".concat(n>0?"next":"previous","ElementSibling"),i=t[r];i;){if(i.matches(e))return i;i=i[r]}return null}(o,Ho,r):this.dropdown.element.querySelector(Ho)}i&&(si(i,this.choiceList.element,r)||this.choiceList.scrollToChildElement(i,r),this._highlightChoice(i)),t.preventDefault()}},t.prototype._onDeleteKey=function(t,e,n){this._isSelectOneElement||t.target.value||!n||(this._handleBackspace(e),t.preventDefault())},t.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},t.prototype._onTouchEnd=function(t){var e=(t||t.touches[0]).target;this._wasTap&&this.containerOuter.element.contains(e)&&((e===this.containerOuter.element||e===this.containerInner.element)&&(this._isTextElement?this.input.focus():this._isSelectMultipleElement&&this.showDropdown()),t.stopPropagation());this._wasTap=!0},t.prototype._onMouseDown=function(t){var e=t.target;if(e instanceof Element){if(zo&&this.choiceList.element.contains(e)){var n=this.choiceList.element.firstElementChild;this._isScrollingOnIe="ltr"===this._direction?t.offsetX>=n.offsetWidth:t.offsetX<n.offsetLeft}if(e!==this.input.element){var r=e.closest("[data-button],[data-item],[data-choice]");r instanceof HTMLElement&&("button"in r.dataset?this._handleButtonAction(r):"item"in r.dataset?this._handleItemAction(r,t.shiftKey):"choice"in r.dataset&&this._handleChoiceAction(r)),t.preventDefault()}}},t.prototype._onMouseOver=function(t){var e=t.target;e instanceof HTMLElement&&"choice"in e.dataset&&this._highlightChoice(e)},t.prototype._onClick=function(t){var e=t.target,n=this.containerOuter;n.element.contains(e)?this.dropdown.isActive||n.isDisabled?this._isSelectOneElement&&e!==this.input.element&&!this.dropdown.element.contains(e)&&this.hideDropdown():this._isTextElement?document.activeElement!==this.input.element&&this.input.focus():(this.showDropdown(),n.element.focus()):(n.removeFocusState(),this.hideDropdown(!0),this.unhighlightAll())},t.prototype._onFocus=function(t){var e=t.target,n=this.containerOuter;if(e&&n.element.contains(e)){var r=e===this.input.element;this._isTextElement?r&&n.addFocusState():this._isSelectMultipleElement?r&&(this.showDropdown(!0),n.addFocusState()):(n.addFocusState(),r&&this.showDropdown(!0))}},t.prototype._onBlur=function(t){var e=t.target,n=this.containerOuter;e&&n.element.contains(e)&&!this._isScrollingOnIe?e===this.input.element?(n.removeFocusState(),this.hideDropdown(!0),(this._isTextElement||this._isSelectMultipleElement)&&this.unhighlightAll()):e===this.containerOuter.element&&(n.removeFocusState(),this.config.searchEnabled||this.hideDropdown(!0)):(this._isScrollingOnIe=!1,this.input.element.focus())},t.prototype._onFormReset=function(){var t=this;this._store.withTxn((function(){t.clearInput(),t.hideDropdown(),t.refresh(!1,!1,!0),t._initialItems.length&&t.setChoiceByValue(t._initialItems)}))},t.prototype._onChange=function(t){t.target.checkValidity()&&this.containerOuter.removeInvalidState()},t.prototype._onInvalid=function(){this.containerOuter.addInvalidState()},t.prototype._removeHighlightedChoices=function(){var t=this.config.classNames.highlightedState;Array.from(this.dropdown.element.querySelectorAll(vi(t))).forEach((function(e){xi(e,t),e.setAttribute("aria-selected","false")}))},t.prototype._highlightChoice=function(t){void 0===t&&(t=null);var e=Array.from(this.dropdown.element.querySelectorAll(Ho));if(e.length){var n=t,r=this.config.classNames.highlightedState;this._removeHighlightedChoices(),n?this._highlightPosition=e.indexOf(n):(n=e.length>this._highlightPosition?e[this._highlightPosition]:e[e.length-1])||(n=e[0]),bi(n,r),n.setAttribute("aria-selected","true"),this.passedElement.triggerEvent(Fr,{el:n}),this.dropdown.isActive&&(this.input.setActiveDescendant(n.id),this.containerOuter.setActiveDescendant(n.id))}},t.prototype._addItem=function(t,e,n){if(void 0===e&&(e=!0),void 0===n&&(n=!1),!t.id)throw new TypeError("item.id must be set before _addItem is called for a choice/item");if((this.config.singleModeForMultiSelect||this._isSelectOneElement)&&this.removeActiveItems(t.id),this._store.dispatch(ni(t)),e){var r=di(t);this.passedElement.triggerEvent(Rr,r),n&&this.passedElement.triggerEvent(Lr,r)}},t.prototype._removeItem=function(t){if(t.id){this._store.dispatch(ri(t));var e=this._notice;e&&e.type===Ni&&this._clearNotice(),this.passedElement.triggerEvent(Dr,di(t))}},t.prototype._addChoice=function(t,e,n){if(void 0===e&&(e=!0),void 0===n&&(n=!1),t.id)throw new TypeError("Can not re-add a choice which has already been added");var r=this.config;if(r.duplicateItemsAllowed||!this._store.choices.find((function(e){return r.valueComparer(e.value,t.value)}))){this._lastAddedChoiceId++,t.id=this._lastAddedChoiceId,t.elementId="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(t.id);var i=r.prependValue,o=r.appendValue;i&&(t.value=i+t.value),o&&(t.value+=o.toString()),(i||o)&&t.element&&(t.element.value=t.value),this._clearNotice(),this._store.dispatch(ei(t)),t.selected&&this._addItem(t,e,n)}},t.prototype._addGroup=function(t,e){var n=this;if(void 0===e&&(e=!0),t.id)throw new TypeError("Can not re-add a group which has already been added");this._store.dispatch(function(t){return{type:kr,group:t}}(t)),t.choices&&(this._lastAddedGroupId++,t.id=this._lastAddedGroupId,t.choices.forEach((function(r){r.group=t,t.disabled&&(r.disabled=!0),n._addChoice(r,e)})))},t.prototype._createTemplates=function(){var t=this,e=this.config.callbackOnCreateTemplates,n={};"function"==typeof e&&(n=e.call(this,li,pi,gi));var r={};Object.keys(this._templates).forEach((function(e){r[e]=e in n?n[e].bind(t):t._templates[e].bind(t)})),this._templates=r},t.prototype._createElements=function(){var t=this._templates,e=this.config,n=this._isSelectOneElement,r=e.position,i=e.classNames,o=this._elementType;this.containerOuter=new Si({element:t.containerOuter(e,this._direction,this._isSelectElement,n,e.searchEnabled,o,e.labelId),classNames:i,type:o,position:r}),this.containerInner=new Si({element:t.containerInner(e),classNames:i,type:o,position:r}),this.input=new Ci({element:t.input(e,this._placeholderValue),classNames:i,type:o,preventPaste:!e.paste}),this.choiceList=new Ei({element:t.choiceList(e,n)}),this.itemList=new Ei({element:t.itemList(e,n)}),this.dropdown=new wi({element:t.dropdown(e),classNames:i,type:o})},t.prototype._createStructure=function(){var t=this,e=t.containerInner,n=t.containerOuter,r=t.passedElement,i=this.dropdown.element;r.conceal(),e.wrap(r.element),n.wrap(e.element),n.element.appendChild(e.element),n.element.appendChild(i),e.element.appendChild(this.itemList.element),i.appendChild(this.choiceList.element),this._isSelectOneElement?(this.input.placeholder=this.config.searchPlaceholderValue||"",this.config.searchEnabled&&i.insertBefore(this.input.element,i.firstChild)):(this._isSelectMultipleElement&&!this.config.searchEnabled||e.element.appendChild(this.input.element),this._placeholderValue&&(this.input.placeholder=this._placeholderValue),this.input.setWidth()),this._highlightPosition=0,this._isSearching=!1},t.prototype._initStore=function(){var t=this;this._store.subscribe(this._render).withTxn((function(){t._addPredefinedChoices(t._presetChoices,t._isSelectOneElement&&!t._hasNonChoicePlaceholder,!1)})),(!this._store.choices.length||this._isSelectOneElement&&this._hasNonChoicePlaceholder)&&this._render()},t.prototype._addPredefinedChoices=function(t,e,n){var r=this;(void 0===e&&(e=!1),void 0===n&&(n=!0),e)&&(-1===t.findIndex((function(t){return t.selected}))&&t.some((function(t){return!t.disabled&&!("choices"in t)&&(t.selected=!0,!0)})));t.forEach((function(t){"choices"in t?r._isSelectElement&&r._addGroup(t,n):r._addChoice(t,n)}))},t.prototype._findAndSelectChoiceByValue=function(t,e){var n=this;void 0===e&&(e=!1);var r=this._store.choices.find((function(e){return n.config.valueComparer(e.value,t)}));return!(!r||r.disabled||r.selected)&&(this._addItem(r,!0,e),!0)},t.prototype._generatePlaceholderValue=function(){var t=this.config;if(!t.placeholder)return null;if(this._hasNonChoicePlaceholder)return t.placeholderValue;if(this._isSelectElement){var e=this.passedElement.placeholderOption;return e?e.text:null}return null},t.prototype._warnChoicesInitFailed=function(t){if(!this.config.silent){if(!this.initialised)throw new TypeError("".concat(t," called on a non-initialised instance of Choices"));if(!this.initialisedOK)throw new TypeError("".concat(t," called for an element which has multiple instances of Choices initialised on it"))}},t.version="11.2.1",t}(),Yo=i(5072),Xo=i.n(Yo),$o=i(7825),qo=i.n($o),Ko=i(7659),Zo=i.n(Ko),Jo=i(5056),Qo=i.n(Jo),ts=i(540),es=i.n(ts),ns=i(1113),rs=i.n(ns),is=i(5870),os={};os.styleTagTransform=rs(),os.setAttributes=Qo(),os.insert=Zo().bind(null,"head"),os.domAPI=qo(),os.insertStyleElement=es();Xo()(is.A,os);is.A&&is.A.locals&&is.A.locals;function ss(t){return ss="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ss(t)}function as(t){return function(t){if(Array.isArray(t))return ls(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ls(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ls(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ls(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function cs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,hs(r.key),r)}}function hs(t){var e=function(t,e){if("object"!=ss(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ss(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ss(e)?e:e+""}var us=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP JSON HERE",this._initDrop(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"120px"})}},{key:"_createToolbox",value:function(){var t=this;this.toolbox=document.createElement("div"),Object.assign(this.toolbox.style,{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"}),this.counter=document.createElement("div"),this.counter.textContent="Records: 0",Object.assign(this.counter.style,{fontFamily:"sans-serif",fontSize:"13px",color:"#555"});var e=document.createElement("div");this.clearBtn=document.createElement("button"),this.clearBtn.textContent="Clear",this.clearBtn.disabled=!0,this.clearBtn.addEventListener("click",(function(){t._renderBase()})),e.appendChild(this.clearBtn),this.toolbox.appendChild(this.counter),this.toolbox.appendChild(e),this.container.appendChild(this.toolbox)}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888",fontFamily:"sans-serif",pointerEvents:"none",userSelect:"none"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"_hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"_initDrop",value:function(){var t=this;this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background=""})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="";var n=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain");if(n)try{var r=JSON.parse(n).data;Array.isArray(r)?t.render(r):t._showPlaceholder()}catch(e){console.error("Invalid JSON dropped",e),t._showPlaceholder()}else t._showPlaceholder()}))}},{key:"render",value:function(t){var e=this;if(Array.isArray(t)&&0!==t.length){this.data=t,this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._hidePlaceholder(),this.clearBtn.disabled=!1,this.counter.textContent="Records: ".concat(t.length);var n=document.createElement("table");Object.assign(n.style,{borderCollapse:"separate",borderSpacing:"0 4px",width:"100%",fontFamily:"sans-serif",fontSize:"14px"});var r=document.createElement("thead"),i=document.createElement("tr");["Field","# Variants","Values","Attractor",,"Orbit","Sum","Split UP","Split Right","Histogram","Color"].forEach((function(t){var e=document.createElement("th");e.textContent=t,Object.assign(e.style,{border:"none",padding:"6px",background:"#eaeaea",textAlign:"left"}),i.appendChild(e)})),r.appendChild(i),n.appendChild(r);var o=document.createElement("tbody");Object.keys(t[0]).forEach((function(n,r){var i=t.map((function(t){return t[n]})).filter((function(t){return null!=t}));if(i.length){var s=e._detectType(i),a=as(new Set(i)),l=document.createElement("tr"),c=document.createElement("td");c.textContent=n,Object.assign(c.style,{border:"none",padding:"6px",fontWeight:"bold"});var h=document.createElement("td");h.textContent=a.length,Object.assign(h.style,{border:"none",padding:"6px",textAlign:"center"});var u=document.createElement("td");Object.assign(u.style,{border:"none",padding:"6px"});var d=null;if("categorical"===s){var f=document.createElement("select");a.forEach((function(t){var e=document.createElement("option");e.value=t,e.textContent=t,f.appendChild(e)})),u.appendChild(f),new Vo(f,{searchEnabled:!0,itemSelectText:"",shouldSort:!1});var p=f.closest(".choices");if(p){Object.assign(p.style,{minWidth:"180px",maxWidth:"220px"});var m=p.querySelector(".choices__inner");m&&Object.assign(m.style,{background:"#f8fafc",border:"1px solid #cbd5e1",borderRadius:"8px",minHeight:"34px",padding:"4px 8px",fontSize:"13px"});var y=p.querySelector(".choices__list--dropdown");y&&Object.assign(y.style,{border:"1px solid #cbd5e1",borderRadius:"8px",background:"#ffffff",boxShadow:"0 4px 10px rgba(0,0,0,0.08)"})}d=a[0],f.addEventListener("change",(function(t){d=f.value,console.log("SELECTED V",d)}))}else{var g=i.map((function(t){return Number(t)})).filter((function(t){return!isNaN(t)}));u.textContent=g.length?"min: ".concat(Math.min.apply(Math,as(g))," | max: ").concat(Math.max.apply(Math,as(g))):"No numeric data"}var v=function(t,e){var n=document.createElement("td"),r=document.createElement("div");r.setAttribute("draggable","true"),Object.assign(r.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",border:"none",borderRadius:"6px",cursor:"grab"});var i=document.createElement("i");return i.className=t,i.style.pointerEvents="none",r.appendChild(i),r.addEventListener("dragstart",(function(t){var n=e(),r=JSON.stringify(n,null,2);t.dataTransfer.setData("application/json",r),t.dataTransfer.setData("text/plain",r)})),n.appendChild(r),n},b=document.createElement("td");Object.assign(b.style,{border:"none",padding:"6px",textAlign:"center"});var x="#ff0000",_=document.createElement("input");_.type="color",_.value=x,_.addEventListener("input",(function(t){x=t.target.value}));var w=document.createElement("div");w.setAttribute("draggable","true"),Object.assign(w.style,{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"6px",cursor:"grab",marginLeft:"6px"});var S=document.createElement("i");S.className="fa-solid fa-palette",S.style.pointerEvents="none",w.appendChild(S),w.addEventListener("dragstart",(function(t){var e,r={type:"color-rule",field:n,equals:d,color:(e=x,parseInt(e.replace("#","0x"),16))},i=JSON.stringify(r,null,2);t.dataTransfer.setData("application/json",i),t.dataTransfer.setData("text/plain",i)})),b.appendChild(_),b.appendChild(w);var C=v("fa-solid fa-magnet",(function(){return e._buildAttractorPayload(n,d)})),E=document.createElement("td"),k=document.createElement("div");k.setAttribute("draggable","true"),k.textContent="🪐",Object.assign(k.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"6px",cursor:"grab",fontSize:"14px",userSelect:"none"}),k.addEventListener("dragstart",(function(t){var e={type:"scalarField",field:n},r=JSON.stringify(e);t.dataTransfer.setData("application/json",r),t.dataTransfer.setData("text/plain",r)})),E.appendChild(k);var T=document.createElement("td"),A=document.createElement("div");A.setAttribute("draggable","true"),A.textContent="∑",Object.assign(A.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"6px",cursor:"grab",fontSize:"14px",userSelect:"none"}),A.addEventListener("dragstart",(function(t){var e={type:"sumField",field:n},r=JSON.stringify(e);t.dataTransfer.setData("application/json",r),t.dataTransfer.setData("text/plain",r)})),T.appendChild(A);var M=v("fa-solid fa-arrow-up",(function(){return e._buildSplitterPayload(n,"up")})),P=v("fa-solid fa-arrow-right",(function(){return e._buildSplitterPayload(n,"right")})),O=v("fa-solid fa-chart-column",(function(){return e._buildHistogramPayload(n)}));l.appendChild(c),l.appendChild(h),l.appendChild(u),l.appendChild(C),l.appendChild(E),l.appendChild(T),l.appendChild(M),l.appendChild(P),l.appendChild(O),l.appendChild(b);var I=l.querySelectorAll("td"),L=r%2==0?"#dbeafe":"#ffffff";I.forEach((function(t){t.style.background=L})),o.appendChild(l)}})),n.appendChild(o);var s=document.createElement("div");Object.assign(s.style,{position:"absolute",top:"42px",left:"0",right:"0",bottom:"0",overflow:"auto",padding:"10px",boxSizing:"border-box"}),s.appendChild(n),this.container.appendChild(s)}else this._showPlaceholder()}},{key:"_buildAttractorPayload",value:function(t,e){return{type:"planet",label:e,rule:{op:"and",rules:[{field:t,op:"eq",value:e}]}}}},{key:"_buildSplitterPayload",value:function(t,e){var n={type:"vector",vector:!0,scalarField:t,direction:"up"==e?{x:0,y:1}:{x:1,y:0},length:1200,rule:{op:"and",rules:[]}};return console.log("vector",n),n}},{key:"_buildHistogramPayloadOLD",value:function(t){var e={};return this.data.forEach((function(n){var r=n[t];r||(r="EMPTY"),e[r]=(e[r]||0)+1})),{type:"histogram",field:t,data:Object.keys(e).map((function(t){return{value:t,count:e[t]}}))}}},{key:"_buildHistogramPayload",value:function(t){return{type:"histogram",field:t,data:this.data}}},{key:"_detectType",value:function(t){var e=t.filter((function(t){return""!==t&&null!=t}));return e.length&&e.map(Number).filter((function(t){return!isNaN(t)})).length===e.length?"scalar":"categorical"}}],e&&cs(t.prototype,e),n&&cs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function ds(t){return ds="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ds(t)}function fs(t){return function(t){if(Array.isArray(t))return ps(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ps(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ps(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ps(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ms(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ys(r.key),r)}}function ys(t){var e=function(t,e){if("object"!=ds(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ds(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ds(e)?e:e+""}var gs=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP JSON HERE",this._initDrop(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"120px"})}},{key:"_createToolbox",value:function(){var t=this;this.toolbox=document.createElement("div"),Object.assign(this.toolbox.style,{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"}),this.counter=document.createElement("div"),this.counter.textContent="Records: 0",Object.assign(this.counter.style,{fontFamily:"sans-serif",fontSize:"13px",color:"#555"});var e=document.createElement("div");this.clearBtn=document.createElement("button"),this.clearBtn.textContent="Clear",this.clearBtn.disabled=!0,this.clearBtn.addEventListener("click",(function(){t._renderBase()})),e.appendChild(this.clearBtn),this.toolbox.appendChild(this.counter),this.toolbox.appendChild(e),this.container.appendChild(this.toolbox)}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888",fontFamily:"sans-serif",pointerEvents:"none",userSelect:"none"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"_hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"_initDrop",value:function(){var t=this;this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background=""})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="";var n=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain");if(n)try{var r=JSON.parse(n).data;Array.isArray(r)?t.render(r):t._showPlaceholder()}catch(e){console.error("Invalid JSON dropped",e),t._showPlaceholder()}else t._showPlaceholder()}))}},{key:"render",value:function(t){var e=this;if(Array.isArray(t)&&0!==t.length){this.data=t,this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._hidePlaceholder(),this.clearBtn.disabled=!1,this.counter.textContent="Records: ".concat(t.length);var n=document.createElement("table");Object.assign(n.style,{borderCollapse:"separate",borderSpacing:"0 4px",width:"100%",fontFamily:"sans-serif",fontSize:"14px"});var r=document.createElement("thead"),i=document.createElement("tr");["Field","# Variants","Values"].forEach((function(t){var e=document.createElement("th");e.textContent=t,Object.assign(e.style,{border:"none",padding:"6px",background:"#eaeaea",textAlign:"left"}),i.appendChild(e)})),r.appendChild(i),n.appendChild(r);var o=document.createElement("tbody");Object.keys(t[0]).forEach((function(n,r){var i=t.map((function(t){return t[n]})).filter((function(t){return null!=t}));if(i.length){var s=e._detectType(i),a=fs(new Set(i)),l=document.createElement("tr"),c=document.createElement("td");c.textContent=n,c.setAttribute("draggable","true"),Object.assign(c.style,{border:"none",padding:"6px 10px",fontWeight:"bold",cursor:"grab",userSelect:"none"}),c.addEventListener("dragstart",(function(t){var r=e._buildHistogramPayload(n),i=JSON.stringify(r,null,2);t.dataTransfer.setData("application/json",i),t.dataTransfer.setData("text/plain",i),t.dataTransfer.effectAllowed="copy",c.style.opacity="0.5"})),c.addEventListener("dragend",(function(){c.style.opacity="1"})),c.addEventListener("mouseenter",(function(){c.style.textDecoration="underline"})),c.addEventListener("mouseleave",(function(){c.style.textDecoration="none"}));var h=document.createElement("td");h.textContent=a.length,Object.assign(h.style,{border:"none",padding:"6px",textAlign:"center"});var u=document.createElement("td");if(Object.assign(u.style,{border:"none",padding:"6px"}),"categorical"===s){var d=document.createElement("select");a.forEach((function(t){var e=document.createElement("option");e.value=t,e.textContent=t,d.appendChild(e)})),u.appendChild(d),new Vo(d,{searchEnabled:!0,itemSelectText:"",shouldSort:!1});var f=d.closest(".choices");if(f){Object.assign(f.style,{minWidth:"180px",maxWidth:"220px",marginBottom:"0"});var p=f.querySelector(".choices__inner");p&&Object.assign(p.style,{background:"#f8fafc",border:"1px solid #cbd5e1",borderRadius:"8px",minHeight:"34px",padding:"4px 8px",fontSize:"13px"});var m=f.querySelector(".choices__list--dropdown");m&&Object.assign(m.style,{border:"1px solid #cbd5e1",borderRadius:"8px",background:"#ffffff",boxShadow:"0 4px 10px rgba(0,0,0,0.08)"})}d.addEventListener("change",(function(){console.log("SELECTED V",d.value)}))}else{var y=i.map((function(t){return Number(t)})).filter((function(t){return!isNaN(t)}));u.textContent=y.length?"min: ".concat(Math.min.apply(Math,fs(y))," | max: ").concat(Math.max.apply(Math,fs(y))):"No numeric data"}l.appendChild(c),l.appendChild(h),l.appendChild(u);var g=r%2==0?"#dbeafe":"#ffffff";l.querySelectorAll("td").forEach((function(t){t.style.background=g})),c.title='Drag "'.concat(n,'"'),o.appendChild(l)}})),n.appendChild(o);var s=document.createElement("div");Object.assign(s.style,{position:"absolute",top:"42px",left:"0",right:"0",bottom:"0",overflow:"auto",padding:"10px",boxSizing:"border-box"}),s.appendChild(n),this.container.appendChild(s)}else this._showPlaceholder()}},{key:"_buildHistogramPayload",value:function(t){var e=fs(new Set(this.data.map((function(e){return e[t]})).filter((function(t){return null!=t&&""!==t}))));return{type:"histogram",field:t,data:e}}},{key:"_detectType",value:function(t){var e=t.filter((function(t){return""!==t&&null!=t}));return e.length&&e.map(Number).filter((function(t){return!isNaN(t)})).length===e.length?"scalar":"categorical"}}],e&&ms(t.prototype,e),n&&ms(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function vs(t){return vs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vs(t)}function bs(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function xs(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?bs(Object(n),!0).forEach((function(e){_s(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bs(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function _s(t,e,n){return(e=Ts(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ws(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(t){c=!0,i=t}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}(t,e)||Cs(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ss(t){return function(t){if(Array.isArray(t))return Es(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Cs(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cs(t,e){if(t){if("string"==typeof t)return Es(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Es(t,e):void 0}}function Es(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ks(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ts(r.key),r)}}function Ts(t){var e=function(t,e){if("object"!=vs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=vs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vs(e)?e:e+""}var As=function(){return t=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container element is required");this.container=e,this.placeholderText=n.placeholder||"PASTE DATA HERE",this.data=[],this.sortState={field:null,direction:"asc"},this.filters={},this.handlePaste=this.handlePaste.bind(this),this._initStyles(),this.init()},e=[{key:"init",value:function(){var t=this;this.container.setAttribute("contenteditable","true"),this.container.style.display="flex",this.container.style.flexDirection="column",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.container.style.background="#fff",this.container.style.border="1px solid #e5e7eb",this.container.style.borderRadius="8px",this.createPlaceholder(),this.showPlaceholder(),this.container.addEventListener("paste",this.handlePaste),this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background="#fff"})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="#fff",t.handleDrop(e)})),this.container.addEventListener("mousedown",(function(t){t.target.closest("[draggable='true']")&&t.stopPropagation()}))}},{key:"_initStyles",value:function(){this.styles={table:{width:"max-content",minwidth:"100%",height:"90%",borderCollapse:"separate",borderSpacing:"0",fontFamily:"system-ui, sans-serif",fontSize:"13px"},th:{padding:"10px 8px",background:"#f9fafb",borderBottom:"1px solid #e5e7eb",textAlign:"left",fontWeight:"600",color:"#374151",position:"sticky",top:"0",zIndex:"5"},td:{padding:"8px",borderBottom:"1px solid #f1f5f9",color:"#111827"},trHover:{background:"#f9fafb"},trAlt:{background:"#fcfcfd"},input:{width:"100%",border:"1px solid #d1d5db",borderRadius:"4px",padding:"4px",fontSize:"13px"},select:{marginTop:"4px",border:"1px solid #d1d5db",borderRadius:"4px",fontSize:"11px",padding:"2px"}}}},{key:"_setStyle",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.assign(t.style,e)}},{key:"handlePaste",value:function(t){t.preventDefault();var e=(t.clipboardData||window.clipboardData).getData("text");if(e){var n=this.parseTSV(e),r=this.toJSON(n);this.data=this.mergeData(this.data,r),this.render()}}},{key:"handleDrop",value:function(t){var e=t.dataTransfer.getData("application/json")||t.dataTransfer.getData("text/plain");if(e){var n;console.log("dropping");try{n=JSON.parse(e)}catch(t){return void console.error("Invalid JSON dropped",t)}("table"===n.type&&Array.isArray(n.data)||"graph-nodes"===n.type&&Array.isArray(n.data))&&this._dropTableData(n.data)}}},{key:"_dropTableData",value:function(t){this.data=this.mergeData(this.data,t),this.render()}},{key:"render",value:function(){this.container.innerHTML="",this.container.style.display="grid",this.container.style.gridTemplateRows="auto 1fr",this.container.style.height="100%",this.container.style.minWidth="0",this.container.style.overflow="hidden";var t=this.createToolbox();t.style.gridRow="1";var e=document.createElement("div");e.style.gridRow="2",e.style.width="100%",e.style.height="90%",e.style.overflowX="auto",e.style.overflowY="auto",e.style.minWidth="0",e.style.minHeight="0";var n=this.createTableFromJSON(this.getProcessedData());n.style.width="max-content",e.appendChild(n),this.container.appendChild(t),this.container.appendChild(e),this.hidePlaceholder()}},{key:"getProcessedData",value:function(){var t=Ss(this.data);return Object.entries(this.filters).forEach((function(e){var n=ws(e,2),r=n[0],i=n[1];i&&(t=t.filter((function(t){return(t[r]||"")===i})))})),this.sortState.field&&(t=this._sortData(t,this.sortState.field,this.sortState.direction)),t}},{key:"_sortData",value:function(t,e,n){var r="asc"===n?1:-1;return Ss(t).map((function(t,e){return{item:t,index:e}})).sort((function(t,n){var i,o,s=null!==(i=t.item[e])&&void 0!==i?i:"",a=null!==(o=n.item[e])&&void 0!==o?o:"",l=parseFloat(s),c=parseFloat(a);return isNaN(l)||isNaN(c)?s.toString().localeCompare(a.toString())*r:(l-c)*r})).map((function(t){return t.item}))}},{key:"createTableFromJSON",value:function(t){var e=this,n=document.createElement("table");this._setStyle(n,this.styles.table);var r=document.createElement("thead"),i=document.createElement("tbody"),o=Array.from(this.data.reduce((function(t,e){return Object.keys(e).forEach((function(e){return t.add(e)})),t}),new Set)),s=document.createElement("tr");return o.forEach((function(t){var n=document.createElement("th"),r=e.sortState.field===t?"asc"===e.sortState.direction?" ▲":" ▼":"",i=document.createElement("div");i.textContent=t+r;var o=document.createElement("select"),a=Ss(new Set(e.data.map((function(e){return e[t]})).filter((function(t){return""!==t})))),l=document.createElement("option");l.value="",l.textContent="All",o.appendChild(l),a.forEach((function(t){var e=document.createElement("option");e.value=t,e.textContent=t,o.appendChild(e)})),o.value=e.filters[t]||"";var c=Math.min(120,Math.max(60,8*t.length));o.style.width=c+"px",e._setStyle(o,e.styles.select),o.onchange=function(n){e.filters[t]=n.target.value,e.render()},i.onclick=function(){e.sortState.field===t?e.sortState.direction="asc"===e.sortState.direction?"desc":"asc":(e.sortState.field=t,e.sortState.direction="asc"),e.render()},n.appendChild(i),n.appendChild(o),e._setStyle(n,e.styles.th),s.appendChild(n)})),r.appendChild(s),t.forEach((function(t,n){var r=document.createElement("tr");n%2==0&&e._setStyle(r,e.styles.trAlt),r.onmouseenter=function(){return e._setStyle(r,e.styles.trHover)},r.onmouseleave=function(){return r.style.background=n%2==0?"#fcfcfd":""},o.forEach((function(n){var i=document.createElement("td");e._setStyle(i,e.styles.td),i.textContent=t[n]||"",i.onclick=function(){var r=document.createElement("input");e._setStyle(r,e.styles.input),r.value=t[n]||"",i.innerHTML="",i.appendChild(r),r.focus();var o=function(){t[n]=r.value,e.render()};r.onblur=o,r.onkeydown=function(t){"Enter"===t.key&&o()}},r.appendChild(i)})),i.appendChild(r)})),n.appendChild(r),n.appendChild(i),n}},{key:"createToolbox",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{display:"flex",gap:"10px",padding:"8px",borderBottom:"1px solid #e5e7eb",background:"#fafafa",alignItems:"center"});var n=document.createElement("button");n.textContent="Clear",Object.assign(n.style,{padding:"4px 8px",border:"1px solid #d1d5db",borderRadius:"4px",background:"#fff",cursor:"pointer"}),n.onclick=function(){return t.clear()};var r=document.createElement("div");r.setAttribute("draggable","true"),r.title="Drag JSON",Object.assign(r.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"1px solid #d1d5db",borderRadius:"6px",background:"#fff",cursor:"grab",userSelect:"none"});var i=document.createElement("span");i.textContent="⤴",i.style.pointerEvents="none",r.appendChild(i),r.addEventListener("mousedown",(function(){r.style.cursor="grabbing"})),r.addEventListener("mouseup",(function(){r.style.cursor="grab"})),r.addEventListener("dragstart",(function(e){var n={type:"table",data:t.getProcessedData()},i=JSON.stringify(n);e.dataTransfer.effectAllowed="copy",e.dataTransfer.setData("application/json",i),e.dataTransfer.setData("text/plain",i);var o=r.cloneNode(!0);o.style.position="absolute",o.style.top="-1000px",document.body.appendChild(o),e.dataTransfer.setDragImage(o,16,16),setTimeout((function(){return document.body.removeChild(o)}),0)}));var o=document.createElement("button");return o.textContent="Copy",Object.assign(o.style,{padding:"4px 8px",border:"1px solid #d1d5db",borderRadius:"4px",background:"#fff",cursor:"pointer"}),o.onclick=function(){return t.copyToClipboard()},e.appendChild(n),e.appendChild(o),e.appendChild(r),e}},{key:"parseTSV",value:function(t){return t.trim().split("\n").map((function(t){return t.split("\t")}))}},{key:"toJSON",value:function(t){var e=t[0];return t.slice(1).map((function(t){var n={};return e.forEach((function(e,r){return n[e]=t[r]||""})),n}))}},{key:"mergeData",value:function(t,e){if(!t.length)return e;var n=new Map;return t.forEach((function(t){return t.id&&n.set(t.id,xs({},t))})),e.forEach((function(t){t.id&&(n.has(t.id)?Object.assign(n.get(t.id),t):n.set(t.id,xs({},t)))})),Array.from(n.values())}},{key:"createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"10px",left:"10px",color:"#9ca3af"}),this.container.appendChild(this.placeholder)}},{key:"showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"clear",value:function(){this.data=[],this.filters={},this.sortState={field:null,direction:"asc"},this.container.innerHTML="",this.createPlaceholder(),this.showPlaceholder()}},{key:"copyToClipboard",value:function(){var t=this.getProcessedData();if(t.length){var e=Array.from(t.reduce((function(t,e){return Object.keys(e).forEach((function(e){return t.add(e)})),t}),new Set)),n=[e.join("\t")].concat(Ss(t.map((function(t){return e.map((function(e){var n;return null!==(n=t[e])&&void 0!==n?n:""})).join("\t")})))).join("\n");navigator.clipboard.writeText(n).then((function(){console.log("Copied to clipboard")})).catch((function(t){console.error("Clipboard copy failed",t)}))}}}],e&&ks(t.prototype,e),n&&ks(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}(),Ms=i(228),Ps=i.n(Ms);function Os(t){return Os="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Os(t)}function Is(t){return function(t){if(Array.isArray(t))return Ls(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ls(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ls(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ls(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function js(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Rs(r.key),r)}}function Rs(t){var e=function(t,e){if("object"!=Os(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Os(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Os(e)?e:e+""}function Ds(t,e,n){return e=Fs(e),function(t,e){if(e&&("object"==Os(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ns()?Reflect.construct(e,n||[],Fs(t).constructor):e.apply(t,n))}function Ns(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ns=function(){return!!t})()}function Fs(t){return Fs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fs(t)}function Bs(t,e){return Bs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Bs(t,e)}var Gs=function(){function t(e,n){var r;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=Ds(this,t),"string"==typeof e&&(e=document.querySelector(e)),!e)throw new Error("vi_TableCombo requires a valid container");if(!n)throw new Error("vi_TableCombo requires a vi_CollectionsManager");return r.container=e,r.manager=n,r.mode="select",r.selectedTable=r.manager.getSelectedTable()||"",r.onTablesChanged=r.handleTablesChanged.bind(r),r.onTableSelected=r.handleTableSelected.bind(r),r.onTableCreated=r.handleTableCreated.bind(r),r.manager.on("tables_changed",r.onTablesChanged),r.manager.on("table_selected",r.onTableSelected),r.manager.on("table_created",r.onTableCreated),r.render(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Bs(t,e)}(t,Ps()),e=t,n=[{key:"render",value:function(){this.container&&("create"===this.mode?this.renderCreate():this.renderSelect())}},{key:"renderSelect",value:function(){var t=this,e=this.selectedTable||"",n=this.manager.getTables()||[],r=Is(new Set([].concat(Is(n),Is(e?[e]:[]))));this.container.innerHTML='\n <select class="vi-table-combo">\n\n <option value="">\n Select table...\n </option>\n\n '.concat(r.map((function(e){return'\n <option value="'.concat(t.escapeHTML(e),'">\n ').concat(t.escapeHTML(e),"\n </option>\n ")})).join(""),'\n\n <option value="__create__">\n + Create new table...\n </option>\n\n </select>\n ');var i=this.container.querySelector(".vi-table-combo");if(i.value=e,e&&i.value!==e){var o=document.createElement("option");o.value=e,o.textContent=e,i.insertBefore(o,i.querySelector('option[value="__create__"]')),i.value=e}i.addEventListener("change",(function(){var e=i.value;if("__create__"!==e)if(e){var n=t.selectedTable;t.selectedTable=e;try{t.manager.selectTable(e),t.emit("change",{table:e})}catch(e){t.selectedTable=n,console.error("Unable to select table:",e),t.render(),alert(e.message||"Unable to select table.")}}else i.value=t.selectedTable||"";else t.showCreate()}))}},{key:"renderCreate",value:function(){var t=this;this.container.innerHTML='\n <div class="vi-table-create">\n\n <input\n type="text"\n class="vi-table-name"\n placeholder="New table name"\n autocomplete="off"\n />\n\n <button\n type="button"\n class="vi-table-create-ok"\n >\n Add\n </button>\n\n <button\n type="button"\n class="vi-table-create-cancel"\n >\n Cancel\n </button>\n\n </div>\n ';var e=this.container.querySelector(".vi-table-name"),n=this.container.querySelector(".vi-table-create-ok"),r=this.container.querySelector(".vi-table-create-cancel");n.addEventListener("click",(function(){return t.createTable()})),r.addEventListener("click",(function(){return t.showSelect()})),e.addEventListener("keydown",(function(e){"Enter"===e.key&&(e.preventDefault(),t.createTable()),"Escape"===e.key&&(e.preventDefault(),t.showSelect())})),e.focus()}},{key:"showCreate",value:function(){this.mode="create",this.render()}},{key:"showSelect",value:function(){this.mode="select",this.render()}},{key:"createTable",value:function(){var t=this.container.querySelector(".vi-table-name");if(t){var e=t.value.trim();if(e){if("__create__"===e)return alert("This table name is reserved."),void t.focus();if(this.manager.getTables().includes(e))return alert('Table "'.concat(e,'" already exists')),void t.focus();var n=this.selectedTable;try{if(this.selectedTable=e,!1===this.manager.createTable(e))throw new Error('Unable to create table "'.concat(e,'".'));this.mode="select",this.render(),this.emit("create",{table:e})}catch(t){this.selectedTable=n,console.error("Unable to create table:",t),alert(t.message||"Unable to create table.");var r=this.container.querySelector(".vi-table-name");if(r)r.value=e,r.focus();else{this.showCreate();var i=this.container.querySelector(".vi-table-name");i&&(i.value=e,i.focus())}}}else t.focus()}}},{key:"handleTablesChanged",value:function(){"select"===this.mode&&this.render()}},{key:"handleTableSelected",value:function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).table;this.selectedTable=t||"",this.mode="select",this.render(),this.emit("selected",{table:this.selectedTable})}},{key:"handleTableCreated",value:function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).table;t&&(this.selectedTable=t),this.mode="select",this.render()}},{key:"getValue",value:function(){return this.selectedTable}},{key:"setValue",value:function(t){t&&(this.selectedTable=t,this.manager.selectTable(t),this.mode="select",this.render())}},{key:"escapeHTML",value:function(t){return String(t).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}},{key:"destroy",value:function(){this.manager.off("tables_changed",this.onTablesChanged),this.manager.off("table_selected",this.onTableSelected),this.manager.off("table_created",this.onTableCreated),this.container.innerHTML="",this.removeAllListeners(),this.manager=null,this.container=null}}],n&&js(e.prototype,n),r&&js(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function zs(t){return function(t){if(Array.isArray(t))return Us(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Us(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Us(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Us(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ws(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Hs(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ws(Object(n),!0).forEach((function(e){Vs(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ws(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Vs(t,e,n){return(e=Zs(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ys(t){return Ys="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ys(t)}function Xs(){Xs=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof g?e:g,s=Object.create(o.prototype),a=new P(r||[]);return i(s,"_invoke",{value:k(t,n,a)}),s}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",f="suspendedYield",p="executing",m="completed",y={};function g(){}function v(){}function b(){}var x={};c(x,s,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(O([])));w&&w!==n&&r.call(w,s)&&(x=w);var S=b.prototype=g.prototype=Object.create(x);function C(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,s,a){var l=u(t[i],t,o);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==Ys(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(h).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(l.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function k(e,n,r){var i=d;return function(o,s){if(i===p)throw Error("Generator is already running");if(i===m){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var l=T(a,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var c=u(e,n,r);if("normal"===c.type){if(i=r.done?m:f,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=u(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function O(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(Ys(e)+" is not iterable")}return v.prototype=b,i(S,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:v,configurable:!0}),v.displayName=c(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},C(E.prototype),c(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new E(h(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},C(S),c(S,l,"Generator"),c(S,s,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=O,P.prototype={constructor:P,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(M),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var l=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(l&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;M(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function $s(t,e,n,r,i,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(r,i)}function qs(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){$s(o,r,i,s,a,"next",t)}function a(t){$s(o,r,i,s,a,"throw",t)}s(void 0)}))}}function Ks(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Zs(r.key),r)}}function Zs(t){var e=function(t,e){if("object"!=Ys(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ys(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ys(e)?e:e+""}function Js(t,e,n){return e=ta(e),function(t,e){if(e&&("object"==Ys(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Qs()?Reflect.construct(e,n||[],ta(t).constructor):e.apply(t,n))}function Qs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Qs=function(){return!!t})()}function ta(t){return ta=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ta(t)}function ea(t,e){return ea=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ea(t,e)}var na=function(){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),(n=Js(this,t,[e,r])).datasetName=r.name||"",n.jsonLoader=r.jsonLoader||null,n.onSave=r.onSave||null,n.onInspect=r.onInspect||null,n.onDesign=r.onDesign||null,n.activeSource="paste",n.render(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ea(t,e)}(t,As),e=t,n=[{key:"render",value:function(){this.container.innerHTML="",Object.assign(this.container.style,{display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",width:"100%",height:"100%",minWidth:"0",minHeight:"0",position:"relative",overflow:"hidden",background:"#1e1e1e",border:"1px solid #555555",borderRadius:"8px",boxSizing:"border-box"});var t=this.createSourceBar(),e=this.createDatasetBar(),n=document.createElement("div");if(Object.assign(n.style,{width:"100%",height:"100%",minWidth:"0",minHeight:"0",overflowX:"auto",overflowY:"auto",background:"#ffffff",position:"relative"}),this.data&&this.data.length){var r=this.createTableFromJSON(this.getProcessedData());r.style.width="max-content",r.style.minWidth="100%",n.appendChild(r)}else{var i=document.createElement("div");i.innerHTML='\n <div style="\n display:flex;\n flex-direction:column;\n align-items:center;\n justify-content:center;\n gap:10px;\n height:100%;\n color:#888;\n font-family:system-ui,sans-serif;\n ">\n\n <i\n class="fa-solid fa-table"\n style="font-size:32px">\n </i>\n\n <div style="\n font-size:14px;\n color:#666;\n ">\n PASTE DATA HERE\n </div>\n\n <div style="\n font-size:11px;\n color:#999;\n ">\n or load JSON / Google Sheet\n </div>\n\n </div>\n ',n.appendChild(i)}this.container.append(t,e,n)}},{key:"createSourceBar",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",boxSizing:"border-box",padding:"4px",gap:"10px",background:"#3b3b3b",borderBottom:"1px solid #555555"});var n=document.createElement("div");n.innerHTML="\n <div>Data Sources:</div>\n ",Object.assign(n.style,{width:"120px",height:"36px",color:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center",gap:"7px",fontSize:"15px",flexShrink:"0"});var r=this.createToolbarButton({icon:"fa-solid fa-copy",text:"Paste Data",active:"paste"===this.activeSource});r.onclick=function(){t.activeSource="paste",t.updateSourceButtons(e,r),t.container.focus()};var i=this.createToolbarButton({icon:"fa-solid fa-link",text:"Json URL",active:"json"===this.activeSource});i.onclick=function(){t.activeSource="json",t.updateSourceButtons(e,i),t.showURLInput({title:"Load JSON URL",placeholder:"https://server.com/data.json",buttonText:"Load JSON",onLoad:function(e){return t.loadJSON(e)}})};var o=this.createToolbarButton({icon:"fa-solid fa-table",text:"Google Sheet",active:"sheet"===this.activeSource});return o.onclick=function(){t.activeSource="sheet",t.updateSourceButtons(e,o),t.showGoogleSheetInput()},e.append(n,r,i,o),e}},{key:"extractSpreadsheetId",value:function(t){if(!t)return"";var e=t.trim(),n=e.match(/\/spreadsheets\/d\/([^/]+)/);return n&&n[1]?n[1]:e}},{key:"showGoogleSheetInput",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{position:"absolute",inset:"0",background:"rgba(0,0,0,.65)",zIndex:"1000",display:"flex",alignItems:"center",justifyContent:"center"});var n=document.createElement("div");Object.assign(n.style,{width:"500px",maxWidth:"90%",padding:"16px",boxSizing:"border-box",background:"#3b3b3b",border:"1px solid #666666",borderRadius:"10px",boxShadow:"0 10px 30px rgba(0,0,0,.5)"});var r=document.createElement("div");r.textContent="Load Google Sheet",Object.assign(r.style,{color:"#ffffff",fontSize:"14px",marginBottom:"14px"});var i=function(t){var e=document.createElement("input");return e.type="text",e.placeholder=t,Object.assign(e.style,{width:"100%",height:"36px",boxSizing:"border-box",padding:"8px 12px",marginBottom:"10px",color:"#ffffff",background:"#1e1e1e",border:"1px solid #555555",borderRadius:"8px",outline:"none",fontSize:"12px"}),e.addEventListener("paste",(function(t){return t.stopPropagation()})),e.addEventListener("mousedown",(function(t){return t.stopPropagation()})),e},o=i("Spreadsheet ID or Google Sheet URL"),s=i("Sheet Name (example: clientes)"),a=document.createElement("div");Object.assign(a.style,{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"4px"});var l=this.createToolbarButton({icon:"fa-solid fa-xmark",text:"Cancel",width:"90px"}),c=this.createToolbarButton({icon:"fa-solid fa-download",text:"Load Sheet",width:"110px",active:!0});l.onclick=function(){e.remove()},c.onclick=qs(Xs().mark((function n(){var r,i;return Xs().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=o.value.trim(),i=s.value.trim(),r){n.next=5;break}return alert("Enter a Spreadsheet ID or URL."),n.abrupt("return");case 5:if(i){n.next=8;break}return alert("Enter the Sheet Name."),n.abrupt("return");case 8:return c.disabled=!0,c.style.opacity="0.5",n.prev=10,n.next=13,t.loadSheet(r,i);case 13:e.remove(),n.next=20;break;case 16:n.prev=16,n.t0=n.catch(10),console.error("Google Sheet error:",n.t0),alert(n.t0.message||"Unable to load Google Sheet.");case 20:return n.prev=20,c.disabled=!1,c.style.opacity="1",n.finish(20);case 24:case"end":return n.stop()}}),n,null,[[10,16,20,24]])}))),s.onkeydown=function(t){"Enter"===t.key&&c.click(),"Escape"===t.key&&e.remove()},o.onkeydown=function(t){"Escape"===t.key&&e.remove()},a.append(l,c),n.append(r,o,s,a),e.appendChild(n),this.container.appendChild(e),o.focus()}},{key:"createDatasetBar",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",boxSizing:"border-box",padding:"4px",gap:"10px",background:"#3b3b3b",borderBottom:"1px solid #555555"});var n=document.createElement("input");n.type="text",n.placeholder="Data Set Name",n.value=this.datasetName||"",Object.assign(n.style,{flex:"1",minWidth:"0",boxSizing:"border-box",padding:"8px 12px",height:"36px",fontSize:"12px",color:"#ffffff",backgroundColor:"#1e1e1e",border:"1px solid #555555",borderRadius:"9px",outline:"none"}),n.oninput=function(e){t.datasetName=e.target.value},n.addEventListener("paste",(function(t){t.stopPropagation()})),n.addEventListener("mousedown",(function(t){t.stopPropagation()}));var r=document.createElement("div");Object.assign(r.style,{display:"flex",flexDirection:"row",alignItems:"center",gap:"6px",flexShrink:"0"});var i=this.createToolbarButton({icon:"fa-solid fa-trash",text:"Clear",width:"80px",active:!0});i.title="Clear table",i.onclick=function(){t.clear()};var o=this.createToolbarButton({icon:"fa-solid fa-copy",text:"Copy",width:"80px",active:!0});o.title="Copy table data",o.onclick=function(){t.copyToClipboard()};var s=this.createToolbarButton({icon:"fa-solid fa-up-right-from-square",text:"Drag",width:"80px",active:!0});s.title="Drag table data",s.setAttribute("draggable","true"),s.addEventListener("mousedown",(function(t){t.stopPropagation(),s.style.cursor="grabbing"})),s.addEventListener("mouseup",(function(){s.style.cursor="grab"})),s.addEventListener("dragend",(function(){s.style.cursor="grab"})),s.addEventListener("dragstart",(function(e){var n={type:"table",name:t.datasetName,data:t.getProcessedData()},r=JSON.stringify(n);e.dataTransfer.effectAllowed="copy",e.dataTransfer.setData("application/json",r),e.dataTransfer.setData("text/plain",r);var i=s.cloneNode(!0);Object.assign(i.style,{position:"absolute",top:"-1000px",left:"-1000px",pointerEvents:"none"}),document.body.appendChild(i),e.dataTransfer.setDragImage(i,16,16),setTimeout((function(){i.parentNode&&i.parentNode.removeChild(i)}),0)}));var a=this.createToolbarButton({icon:"fa-solid fa-floppy-disk",text:"Save",width:"80px",active:!0});a.onclick=function(){t.saveDataset()};var l=this.createToolbarButton({icon:"fa-solid fa-magnifying-glass-chart",text:"Inspect",width:"100px",active:!0});return l.onclick=function(){t.onInspect&&t.onInspect({name:t.datasetName,data:t.data,processedData:t.getProcessedData(),table:t})},r.append(i,o,s,a,l),e.append(n,r),e}},{key:"createToolbarButton",value:function(t){var e=t.icon,n=t.text,r=t.width,i=void 0===r?"120px":r,o=t.active,s=void 0!==o&&o,a=document.createElement("button");return a.innerHTML='\n\n <span style="\n font-size:16px;\n pointer-events:none;\n ">\n\n <i class="'.concat(e,'"></i>\n\n </span>\n\n <span style="\n pointer-events:none;\n ">\n ').concat(n,"\n </span>\n\n "),Object.assign(a.style,{width:i,height:"36px",backgroundColor:s?"#000000":"#3d3d3d",color:s?"#ffffff":"#949494",border:"1px solid #666666",borderRadius:"9px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"7px",fontSize:"11px",flexShrink:"0",boxSizing:"border-box"}),a.dataset.sourceButton="true",a}},{key:"updateSourceButtons",value:function(t,e){t.querySelectorAll("[data-source-button]").forEach((function(t){var n=t===e;t.style.backgroundColor=n?"#000000":"#3d3d3d",t.style.color=n?"#ffffff":"#949494"}))}},{key:"showURLInput",value:function(t){var e=t.title,n=t.placeholder,r=t.buttonText,i=void 0===r?"Load":r,o=t.onLoad,s=document.createElement("div");Object.assign(s.style,{position:"absolute",inset:"0",background:"rgba(0,0,0,.65)",zIndex:"1000",display:"flex",alignItems:"center",justifyContent:"center"});var a=document.createElement("div");Object.assign(a.style,{width:"500px",maxWidth:"90%",padding:"16px",boxSizing:"border-box",background:"#3b3b3b",border:"1px solid #666666",borderRadius:"10px",boxShadow:"0 10px 30px rgba(0,0,0,.5)"});var l=document.createElement("div");l.textContent=e,Object.assign(l.style,{color:"#ffffff",fontSize:"14px",marginBottom:"10px"});var c=document.createElement("input");c.type="text",c.placeholder=n,Object.assign(c.style,{width:"100%",height:"36px",boxSizing:"border-box",padding:"8px 12px",color:"#ffffff",background:"#1e1e1e",border:"1px solid #555555",borderRadius:"8px",outline:"none",fontSize:"12px"}),c.addEventListener("paste",(function(t){return t.stopPropagation()})),c.addEventListener("mousedown",(function(t){return t.stopPropagation()}));var h=document.createElement("div");Object.assign(h.style,{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"12px"});var u=this.createToolbarButton({icon:"fa-solid fa-xmark",text:"Cancel",width:"90px"}),d=this.createToolbarButton({icon:"fa-solid fa-download",text:i,width:"110px",active:!0});u.onclick=function(){s.remove()},d.onclick=qs(Xs().mark((function t(){var e;return Xs().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=c.value.trim()){t.next=3;break}return t.abrupt("return");case 3:return d.disabled=!0,d.style.opacity="0.5",t.prev=5,t.next=8,o(e);case 8:s.remove(),t.next=15;break;case 11:t.prev=11,t.t0=t.catch(5),console.error("Data loading error:",t.t0),alert(t.t0.message||"Unable to load data");case 15:return t.prev=15,d.disabled=!1,d.style.opacity="1",t.finish(15);case 19:case"end":return t.stop()}}),t,null,[[5,11,15,19]])}))),c.onkeydown=function(t){"Enter"===t.key&&d.click(),"Escape"===t.key&&s.remove()},h.append(u,d),a.append(l,c,h),s.appendChild(a),this.container.appendChild(s),c.focus()}},{key:"handlePaste",value:function(t){var e=t.target;if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)){t.preventDefault();var n=(t.clipboardData||window.clipboardData).getData("text");if(n){var r=this.parseTSV(n);if(r.length){var i=this.toJSON(r);this.appendData(i)}}}}},{key:"setData",value:function(t){var e=this.normalizeData(t);return this.data=e,this.filters={},this.sortState={field:null,direction:"asc"},this.render(),this.data}},{key:"appendData",value:function(t){var e=this.normalizeData(t);return this.data=this.mergeData(this.data||[],e),this.render(),this.data}},{key:"normalizeData",value:function(t){if(null==t)return[];var e=t;if(!Array.isArray(e)&&e&&Array.isArray(e.data)&&(e=e.data),!Array.isArray(e)&&e&&Array.isArray(e.rows)&&(e=e.rows),!Array.isArray(e))throw new Error("Data source must return an array of objects.");return e.length&&Array.isArray(e[0])?this.toJSON(e):e.map((function(t){return t&&"object"===Ys(t)&&!Array.isArray(t)?Hs({},t):{value:t}}))}},{key:"loadJSON",value:(s=qs(Xs().mark((function t(e){var n,r;return Xs().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.jsonLoader){t.next=6;break}return t.next=3,this.jsonLoader(e,this);case 3:n=t.sent,t.next=14;break;case 6:return t.next=8,fetch(e);case 8:if((r=t.sent).ok){t.next=11;break}throw new Error("HTTP ".concat(r.status," - ").concat(r.statusText));case 11:return t.next=13,r.json();case 13:n=t.sent;case 14:return this.activeSource="json",t.abrupt("return",this.setData(n));case 16:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"loadSheet",value:(o=qs(Xs().mark((function t(e,n){var r,i,o,s,a,l,c,h;return Xs().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this.extractSpreadsheetId(e),i={data:{data_source:{config:{SPREADSHEET_ID:r,SHEET_NAME:n}}}},console.log("Google Sheet request:",i),t.next=5,fetch("https://server.vizor.studio/api/get_data",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});case 5:if((o=t.sent).ok){t.next=11;break}return t.next=9,o.text();case 9:throw s=t.sent,new Error("Google Sheet request failed (".concat(o.status,"): ").concat(s));case 11:return t.next=13,o.json();case 13:if(a=t.sent,console.log("Google Sheet response:",a),!a||"error"!==a.status){t.next=18;break}throw h=(null===(l=a.data)||void 0===l?void 0:l.message)||(null===(c=a.data)||void 0===c?void 0:c.error)||"Unable to load Google Sheet.",new Error(h);case 18:return this.activeSource="sheet",t.abrupt("return",this.setData(a));case 20:case"end":return t.stop()}}),t,this)}))),function(t,e){return o.apply(this,arguments)})},{key:"mergeData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t.length)return e.map((function(t){return Hs({},t)}));if(!e.length)return t.map((function(t){return Hs({},t)}));var n=t.every((function(t){return void 0!==t.id&&null!==t.id&&""!==t.id})),r=e.every((function(t){return void 0!==t.id&&null!==t.id&&""!==t.id}));if(!n||!r)return[].concat(zs(t.map((function(t){return Hs({},t)}))),zs(e.map((function(t){return Hs({},t)}))));var i=new Map;return t.forEach((function(t){i.set(t.id,Hs({},t))})),e.forEach((function(t){i.has(t.id)?Object.assign(i.get(t.id),t):i.set(t.id,Hs({},t))})),Array.from(i.values())}},{key:"saveDataset",value:(i=qs(Xs().mark((function t(){var e;return Xs().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.datasetName.trim()){t.next=4;break}return alert("Please enter a Data Set Name."),t.abrupt("return",null);case 4:if(e=this.getDataset(),!this.onSave){t.next=8;break}return t.next=8,this.onSave(e,this);case 8:return t.abrupt("return",e);case 9:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)})},{key:"getDataset",value:function(){return{name:this.datasetName,source:this.activeSource,data:this.data,processedData:this.getProcessedData(),columns:this.getColumns(),rowCount:this.data.length}}},{key:"getColumns",value:function(){return Array.from((this.data||[]).reduce((function(t,e){return Object.keys(e).forEach((function(e){return t.add(e)})),t}),new Set))}},{key:"setDatasetName",value:function(t){this.datasetName=t||"",this.render()}},{key:"getDatasetName",value:function(){return this.datasetName}},{key:"clear",value:function(){this.data=[],this.filters={},this.sortState={field:null,direction:"asc"},this.activeSource="paste",this.render()}}],n&&Ks(e.prototype,n),r&&Ks(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r,i,o,s}();function ra(t){return ra="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ra(t)}function ia(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function oa(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ia(Object(n),!0).forEach((function(e){sa(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ia(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function sa(t,e,n){return(e=la(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,la(r.key),r)}}function la(t){var e=function(t,e){if("object"!=ra(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ra(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ra(e)?e:e+""}var ca=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP HISTOGRAM HERE",this.currentPayload=null,this.sortAscending=!1,this._initDrop(),this._initResize(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._createTooltip(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"200px"})}},{key:"_createToolbox",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{display:"flex",justifyContent:"flex-end",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"});var n=document.createElement("button");n.textContent="Clear",n.addEventListener("click",(function(){t.currentPayload=null,t._renderBase()}));var r=document.createElement("button");r.textContent="Sort ↑",r.addEventListener("click",(function(){t.sortAscending=!t.sortAscending,r.textContent=t.sortAscending?"Sort ↓":"Sort ↑",t.currentPayload&&t._drawChart(t.currentPayload)})),e.appendChild(r),e.appendChild(n),this.container.appendChild(e)}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888",fontFamily:"sans-serif",pointerEvents:"none"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"_hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"_aggregateData",value:function(t,e,n){var r=this,i={};return t.forEach((function(t){var o=t[e];if(o||(o="EMPTY"),i[o]||(i[o]=0),n){var s=r._parseNumber(t[n]);i[o]+=s}else i[o]+=1})),Object.keys(i).map((function(t){return{value:t,count:i[t]}}))}},{key:"_createTooltip",value:function(){this.tooltip=document.createElement("div"),Object.assign(this.tooltip.style,{position:"absolute",pointerEvents:"none",background:"rgba(0,0,0,0.75)",color:"#fff",padding:"6px 8px",borderRadius:"4px",fontSize:"12px",fontFamily:"sans-serif",opacity:"0",transition:"opacity 0.2s"}),this.container.appendChild(this.tooltip)}},{key:"_showTooltip",value:function(t,e,n){this.tooltip.innerHTML=n,this.tooltip.style.left=t+10+"px",this.tooltip.style.top=e+10+"px",this.tooltip.style.opacity="1"}},{key:"_hideTooltip",value:function(){this.tooltip.style.opacity="0"}},{key:"_initResize",value:function(){var t=this;this._handleResize=function(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:150;return function(){for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];clearTimeout(n),n=setTimeout((function(){return e.apply(t,o)}),r)}}((function(){t.currentPayload&&t._drawChart(t.currentPayload)})),this.resizeObserver=new ResizeObserver(this._handleResize),this.resizeObserver.observe(this.container)}},{key:"_initDrop",value:function(){var t=this;this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background=""})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="";var n=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain");if(n)try{var r=JSON.parse(n);if("histogram"===r.type&&Array.isArray(r.data))return void t.render(oa(oa({},r),{},{sumField:null}));if("sumField"===r.type&&t.currentPayload)return console.log("Dropped ",r),t.currentPayload.sumField=r.field,void t._drawChart(t.currentPayload)}catch(t){console.error("Invalid drop JSON",t)}}))}},{key:"render",value:function(t){this.currentPayload=oa(oa({},t),{},{sumField:t.sumField||null}),this.container.innerHTML="",this._createToolbox(),this._createTooltip(),this._hidePlaceholder(),this.chartWrapper=document.createElement("div"),this.chartWrapper.style.width="100%",this.chartWrapper.style.height="100%",this.chartWrapper.style.padding="10px",this.container.appendChild(this.chartWrapper),this._drawChart(this.currentPayload)}},{key:"_parseNumber",value:function(t){if(null==t)return 0;var e=String(t).replace(/,/g,""),n=Number(e);return isNaN(n)?0:n}},{key:"_drawChart",value:function(t){var e=this;if(this.chartWrapper){this.chartWrapper.innerHTML="";var n=this.container.getBoundingClientRect(),r=n.width-20,i=Math.max(200,n.height-60),o=30,s=20,a=80,l=50,c=d3.select(this.chartWrapper).append("svg").attr("width",r).attr("height",i),h=r-l-s,u=i-o-a,d=c.append("g").attr("transform","translate(".concat(l,",").concat(o,")")),f=this._aggregateData(t.data,t.field,t.sumField);this.sortAscending&&f.sort((function(t,e){return t.count-e.count}));var p=d3.scaleBand().domain(f.map((function(t){return t.value}))).range([0,h]).padding(.1),m=d3.scaleLinear().domain([0,d3.max(f,(function(t){return t.count}))]).nice().range([u,0]);d.selectAll(".bar").data(f,(function(t){return t.value})).enter().append("rect").attr("class","bar").attr("x",(function(t){return p(t.value)})).attr("width",p.bandwidth()).attr("y",u).attr("height",0).attr("fill","#69b3a2").on("mousemove",(function(n,r){e._showTooltip(n.offsetX,n.offsetY,"<b>".concat(r.value,"</b><br/>").concat(t.sumField?"Sum":"Count",": ").concat(r.count))})).on("mouseleave",(function(){return e._hideTooltip()})).transition().duration(600).attr("y",(function(t){return m(t.count)})).attr("height",(function(t){return u-m(t.count)})),d.append("g").attr("transform","translate(0, ".concat(u,")")).call(d3.axisBottom(p).tickFormat((function(t){var e,n=f.find((function(e){return e.value===t}));return"".concat(t," (").concat(null!==(e=null==n?void 0:n.count)&&void 0!==e?e:0,")")}))).selectAll("text").attr("transform","rotate(-30)").style("text-anchor","end"),d.append("g").call(d3.axisLeft(m)),c.append("text").attr("x",r/2).attr("y",20).attr("text-anchor","middle").style("font-family","sans-serif").style("font-size","14px").text("Histogram: ".concat(t.field))}}}],e&&aa(t.prototype,e),n&&aa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function ha(t){return ha="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ha(t)}function ua(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,da(r.key),r)}}function da(t){var e=function(t,e){if("object"!=ha(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ha(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ha(e)?e:e+""}var fa=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container required");this.container=e,this.days=["Lun","Mar","Mie","Jue","Vie","Sab","Dom"],this.hours=["09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00"],this.selected={},this._injectStyles(),this._render(),this._buildGrid(),this._bindEvents()},(e=[{key:"_injectStyles",value:function(){if(!document.getElementById("availability-survey-styles")){var t=document.createElement("style");t.id="availability-survey-styles",t.textContent="\n .as-card {\n max-width: 900px;\n margin: auto;\n background: white;\n padding: 20px;\n border-radius: 16px;\n box-shadow: 0 8px 24px rgba(0,0,0,0.08);\n font-family: sans-serif;\n\n display: flex;\n flex-direction: column;\n height: 100%; /* 🔥 important */\n }\n\n .as-title {\n margin-bottom: 6px;\n }\n\n .as-subtitle {\n color: #666;\n margin-bottom: 16px;\n font-size: 14px;\n }\n\n .as-input-group {\n margin-bottom: 16px;\n }\n\n .as-card input {\n padding: 8px 10px;\n border: 1px solid #ddd;\n border-radius: 8px;\n width: 220px;\n font-size: 14px;\n }\n\n .as-grid-wrapper {\n overflow: auto;\n border-radius: 12px;\n -webkit-overflow-scrolling: touch;\n\n flex: 1; /* 🔥 fills space */\n min-height: 0; /* 🔥 required for iOS */\n }\n\n .as-grid {\n display: grid;\n grid-template-columns: 80px repeat(7, minmax(70px, 1fr));\n min-width: 600px;\n border: 1px solid #e5e7eb;\n }\n\n .as-cell {\n border: 1px solid #eef0f4;\n height: 42px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 13px;\n transition: all 0.12s ease;\n user-select: none;\n }\n\n .as-header {\n font-weight: 600;\n background: #f1f5f9;\n cursor: default;\n }\n\n .as-time {\n background: #f9fafb;\n color: #555;\n font-size: 12px;\n cursor: default;\n }\n\n /* hover only when NOT clicking */\n body:not(.as-clicking) .as-cell:not(.as-active):hover {\n background: #eef4ff;\n }\n\n .as-active {\n background: #1e40af;\n color: white;\n font-weight: bold;\n }\n\n .as-cell:active {\n transform: scale(0.96);\n }\n\n .as-card button {\n margin-top: 16px;\n padding: 10px 16px;\n border: none;\n border-radius: 10px;\n background: #3b82f6;\n color: white;\n font-size: 14px;\n cursor: pointer;\n box-shadow: 0 4px 12px rgba(59,130,246,0.3);\n margin-top: 12px;\n flex-shrink: 0; \n }\n\n .as-card button:hover {\n background: #2563eb;\n }\n\n .as-header {\n position: sticky;\n top: 0;\n z-index: 2;\n }\n\n\n .as-time {\n position: sticky;\n left: 0;\n z-index: 1;\n background: #f9fafb;\n }\n\n ",document.head.appendChild(t)}}},{key:"_render",value:function(){this.container.innerHTML="",this.card=document.createElement("div"),this.card.className="as-card",this.title=document.createElement("h1"),this.title.className="as-title",this.title.textContent="Encuesta de Disponibilidad 🎶",this.subtitle=document.createElement("div"),this.subtitle.className="as-subtitle",this.subtitle.textContent="Pon tu nombre y da click en los horarios que te acomoden para el ensayo",this.inputGroup=document.createElement("div"),this.inputGroup.className="as-input-group",this.input=document.createElement("input"),this.input.placeholder="Pon tu Nombre",this.gridWrapper=document.createElement("div"),this.gridWrapper.className="as-grid-wrapper",this.grid=document.createElement("div"),this.grid.className="as-grid",this.gridWrapper.appendChild(this.grid),this.button=document.createElement("button"),this.button.textContent="Enviar",this.inputGroup.appendChild(this.input),this.card.appendChild(this.title),this.card.appendChild(this.subtitle),this.card.appendChild(this.inputGroup),this.card.appendChild(this.gridWrapper),this.card.appendChild(this.button),this.container.appendChild(this.card)}},{key:"_buildGrid",value:function(){var t=this;this.grid.appendChild(document.createElement("div")),this.days.forEach((function(e){var n=document.createElement("div");n.textContent=e,n.className="as-cell as-header",t.grid.appendChild(n)})),this.hours.forEach((function(e){var n=document.createElement("div");n.textContent=e,n.className="as-cell as-time",t.grid.appendChild(n),t.days.forEach((function(n){var r="".concat(n,"-").concat(e),i=document.createElement("div");i.className="as-cell",i.addEventListener("click",(function(){var e=!t.selected[r];t.selected[r]=e,i.classList.toggle("as-active",e),i.textContent=e?"✓":""})),t.grid.appendChild(i)}))}))}},{key:"_bindEvents",value:function(){var t=this;document.addEventListener("mousedown",(function(){document.body.classList.add("as-clicking")})),document.addEventListener("mouseup",(function(){document.body.classList.remove("as-clicking")})),this.button.addEventListener("click",(function(){var e=t.input.value||"Anonymous";if(0!==Object.values(t.selected).filter(Boolean).length){var n={name:e,availability:t.selected};alert("Gracias !!!"),t.onSubmit&&t.onSubmit(n)}else alert("Please select at least one time slot")}))}}])&&ua(t.prototype,e),n&&ua(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function pa(t){return pa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pa(t)}function ma(t){return function(t){if(Array.isArray(t))return ya(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ya(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ya(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ya(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ga(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,va(r.key),r)}}function va(t){var e=function(t,e){if("object"!=pa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=pa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pa(e)?e:e+""}var ba=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP DATA HERE",this.currentPayload=null,this.selectedFields=[],this.sortAscending=!1,this.zoomLevel=1,this.minZoom=.6,this.maxZoom=2,this.panX=0,this.panY=0,this.isPanning=!1,this._initDrop(),this._initResize(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._createTooltip(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"200px",overflow:"hidden"})}},{key:"_createToolbox",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{display:"flex",justifyContent:"space-between",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"}),this.fieldsContainer=document.createElement("div"),this.fieldsContainer.style.display="flex",this.fieldsContainer.style.gap="6px";var n=document.createElement("div"),r=document.createElement("button");r.textContent="Sort ↑",r.onclick=function(){t.sortAscending=!t.sortAscending,r.textContent=t.sortAscending?"Sort ↓":"Sort ↑",t.currentPayload&&t._drawChart(t.currentPayload)};var i=document.createElement("button");i.textContent="Clear",i.onclick=function(){t.currentPayload=null,t.selectedFields=[],t._renderBase()},n.appendChild(r),n.appendChild(i),e.appendChild(this.fieldsContainer),e.appendChild(n),this.container.appendChild(e)}},{key:"_renderFieldChips",value:function(){var t=this;this.fieldsContainer.innerHTML="",this.selectedFields.forEach((function(e,n){var r=document.createElement("div");Object.assign(r.style,{padding:"2px 6px",background:"#e0e0e0",borderRadius:"4px",fontSize:"11px",display:"flex",alignItems:"center",gap:"4px"}),r.innerHTML="".concat(e," ✕"),r.onclick=function(){t.selectedFields.splice(n,1),t._renderFieldChips(),t._drawChart(t.currentPayload)},t.fieldsContainer.appendChild(r)}))}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder.style.display="block"}},{key:"_hidePlaceholder",value:function(){this.placeholder.style.display="none"}},{key:"_createTooltip",value:function(){this.tooltip=document.createElement("div"),Object.assign(this.tooltip.style,{position:"absolute",background:"#000",color:"#fff",padding:"4px 6px",fontSize:"11px",borderRadius:"4px",opacity:0,pointerEvents:"none"}),this.container.appendChild(this.tooltip)}},{key:"_showTooltip",value:function(t,e,n){this.tooltip.innerHTML=n,this.tooltip.style.left=t+10+"px",this.tooltip.style.top=e+10+"px",this.tooltip.style.opacity=1}},{key:"_hideTooltip",value:function(){this.tooltip.style.opacity=0}},{key:"_initResize",value:function(){var t=this;new ResizeObserver((function(){t.currentPayload&&t._drawChart(t.currentPayload)})).observe(this.container)}},{key:"_initInteractions",value:function(){var t=this;this.container.onwheel=function(e){e.preventDefault(),t.zoomLevel+=.0015*-e.deltaY,t.zoomLevel=Math.max(t.minZoom,Math.min(t.maxZoom,t.zoomLevel)),t._applyTransform()},this.container.onmousedown=function(e){t.isPanning=!0,t.startX=e.clientX-t.panX,t.startY=e.clientY-t.panY,t.container.style.cursor="grabbing"},window.onmousemove=function(e){t.isPanning&&(t.panX=e.clientX-t.startX,t.panY=e.clientY-t.startY,t._applyTransform())},window.onmouseup=function(){t.isPanning=!1,t.container.style.cursor="default"}}},{key:"_applyTransform",value:function(){this.grid.style.transform="translate(".concat(this.panX,"px, ").concat(this.panY,"px) scale(").concat(this.zoomLevel,")")}},{key:"_initDrop",value:function(){var t=this;this.container.ondragover=function(t){return t.preventDefault()},this.container.ondrop=function(e){e.preventDefault();var n=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain"),r=JSON.parse(n);"histogram"===r.type&&(t.selectedFields=[],t.render(r)),"sumField"===r.type&&(t.selectedFields.includes(r.field)||t.selectedFields.push(r.field),t._renderFieldChips(),t._drawChart(t.currentPayload))}}},{key:"render",value:function(t){this.currentPayload=t,this.container.innerHTML="",this._createToolbox(),this._createTooltip(),this.chartWrapper=document.createElement("div"),this.chartWrapper.style.height="100%",this.chartWrapper.style.background="#f5f7fa",this.chartWrapper.style.padding="12px",this.container.appendChild(this.chartWrapper),this._drawChart(t)}},{key:"_parseNumber",value:function(t){return Number(String(t).replace(/,/g,""))||0}},{key:"_buildSeries",value:function(t){var e=this;return this.selectedFields.map((function(n){return{field:n,value:e._parseNumber(t[n])}}))}},{key:"_drawChart",value:function(t){var e=this;if(this.chartWrapper.innerHTML="",this.selectedFields.length){var n=ma(t.data);if(this.sortAscending){var r=this.selectedFields.at(-1);n.sort((function(t,n){return e._parseNumber(t[r])-e._parseNumber(n[r])}))}this.grid=document.createElement("div"),Object.assign(this.grid.style,{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:"12px",transformOrigin:"0 0"}),this.chartWrapper.appendChild(this.grid),this._initInteractions(),n.forEach((function(n){var r,i,o=document.createElement("div");o.onmouseenter=function(){o.style.transform="translateY(-2px)",o.style.boxShadow="0 4px 14px rgba(0,0,0,0.12)"},o.onmouseleave=function(){o.style.transform="translateY(0)",o.style.boxShadow="0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06)"};var s=e._buildSeries(n),a=(null===(r=s[0])||void 0===r?void 0:r.value)||0,l=(null===(i=s.at(-1))||void 0===i?void 0:i.value)||0,c=0===a?0:(l-a)/a*100,h=document.createElement("div");Object.assign(h.style,{display:"flex",justifyContent:"space-between",alignItems:"center"});var u=document.createElement("div");u.textContent=n[t.field],u.style.fontSize="12px",u.style.fontWeight="600",u.style.color="#333",u.style.letterSpacing="0.2px";var d=document.createElement("div");d.textContent="".concat(c.toFixed(1),"%"),d.style.fontSize="10px",d.style.padding="3px 8px",d.style.borderRadius="999px",d.style.fontWeight="600",d.style.border="1px solid rgba(0,0,0,0.05)",d.style.background=c>=0?"#e3f2fd":"#ffebee",d.style.color=c>=0?"#1976d2":"#e53935",h.appendChild(u),h.appendChild(d),Object.assign(o.style,{background:"#ffffff",padding:"10px 12px",borderRadius:"10px",border:"1px solid rgba(0,0,0,0.06)",borderTop:"3px solid ".concat(c>=0?"#1976d2":"#e53935"),boxShadow:"0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06)",display:"flex",flexDirection:"column",gap:"6px",transition:"all 0.15s ease",cursor:"pointer"}),o.appendChild(h);for(var f=d3.select(o).append("svg").attr("width","100%").attr("height",100).append("g").attr("transform","translate(30,10)"),p=d3.scalePoint().domain(e.selectedFields).range([0,160]),m=d3.scaleLinear().domain([0,d3.max(s,(function(t){return t.value}))]).range([70,0]),y=0;y<s.length-1;y++){var g=s[y],v=s[y+1],b=v.value>=g.value?"#1976d2":"#e53935";f.append("line").attr("x1",p(g.field)).attr("y1",m(g.value)).attr("x2",p(v.field)).attr("y2",m(v.value)).attr("stroke",b).attr("stroke-width",2)}f.selectAll("circle").data(s).enter().append("circle").attr("cx",(function(t){return p(t.field)})).attr("cy",(function(t){return m(t.value)})).attr("r",2).attr("fill","#333"),e.grid.appendChild(o)}))}}}],e&&ga(t.prototype,e),n&&ga(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function xa(t){return function(t){if(Array.isArray(t))return _a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return _a(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_a(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function wa(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Sa(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?wa(Object(n),!0).forEach((function(e){Ca(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wa(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Ca(t,e,n){return(e=Pa(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ea(t){return Ea="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ea(t)}function ka(){ka=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof g?e:g,s=Object.create(o.prototype),a=new P(r||[]);return i(s,"_invoke",{value:k(t,n,a)}),s}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",f="suspendedYield",p="executing",m="completed",y={};function g(){}function v(){}function b(){}var x={};c(x,s,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(O([])));w&&w!==n&&r.call(w,s)&&(x=w);var S=b.prototype=g.prototype=Object.create(x);function C(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,s,a){var l=u(t[i],t,o);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==Ea(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(h).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(l.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function k(e,n,r){var i=d;return function(o,s){if(i===p)throw Error("Generator is already running");if(i===m){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var l=T(a,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var c=u(e,n,r);if("normal"===c.type){if(i=r.done?m:f,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=m,r.method="throw",r.arg=c.arg)}}}function T(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=u(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function O(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(Ea(e)+" is not iterable")}return v.prototype=b,i(S,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:v,configurable:!0}),v.displayName=c(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},C(E.prototype),c(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new E(h(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},C(S),c(S,l,"Generator"),c(S,s,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=O,P.prototype={constructor:P,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(M),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var l=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(l&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),M(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;M(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function Ta(t,e,n,r,i,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(r,i)}function Aa(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){Ta(o,r,i,s,a,"next",t)}function a(t){Ta(o,r,i,s,a,"throw",t)}s(void 0)}))}}function Ma(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Pa(r.key),r)}}function Pa(t){var e=function(t,e){if("object"!=Ea(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ea(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ea(e)?e:e+""}function Oa(t,e,n){return e=Ra(e),function(t,e){if(e&&("object"==Ea(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ia()?Reflect.construct(e,n||[],Ra(t).constructor):e.apply(t,n))}function Ia(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ia=function(){return!!t})()}function La(t,e,n,r){var i=ja(Ra(1&r?t.prototype:t),e,n);return 2&r?function(t){return i.apply(n,t)}:i}function ja(){return ja="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Ra(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},ja.apply(null,arguments)}function Ra(t){return Ra=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ra(t)}function Da(t,e){return Da=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Da(t,e)}var Na=function(){function t(e){var n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),(i=Oa(this,t,[e,o])).collectionsManager=o.collectionsManager||null,i.datasetName=(null===(n=i.collectionsManager)||void 0===n||null===(r=n.getSelectedTable)||void 0===r?void 0:r.call(n))||o.name||"",i.jsonLoader=o.jsonLoader||null,i.onSave=o.onSave||null,i.onInspect=o.onInspect||null,i.onDesign=o.onDesign||null,i.activeSource="paste",i.isSaving=!1,i.tableCombo=null,i.tableComboHost=null,i._onTableSelected=function(t){var e=t.table;i.datasetName=e||""},i._onRecordsChanged=function(t){var e,n;i.datasetName=(null===(e=i.collectionsManager)||void 0===e||null===(n=e.getSelectedTable)||void 0===n?void 0:n.call(e))||i.datasetName,i.setData(t||[])},i.bindCollectionsManager(),i.render(),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Da(t,e)}(t,As),e=t,n=[{key:"bindCollectionsManager",value:function(){this.collectionsManager&&(this.collectionsManager.on("table_selected",this._onTableSelected),this.collectionsManager.on("records_changed",this._onRecordsChanged))}},{key:"unbindCollectionsManager",value:function(){this.collectionsManager&&(this.collectionsManager.off("table_selected",this._onTableSelected),this.collectionsManager.off("records_changed",this._onRecordsChanged))}},{key:"mountTableCombo",value:function(){var t=this;if(this.collectionsManager&&this.tableComboHost)if(this.tableCombo){var e=this.tableCombo.container;if(e!==this.tableComboHost){for(;e.firstChild;)this.tableComboHost.appendChild(e.firstChild);this.tableCombo.container=this.tableComboHost}}else this.tableCombo=new Gs(this.tableComboHost,this.collectionsManager),this.tableCombo.on("selected",(function(e){var n=e.table;t.datasetName=n||""})),this.tableCombo.on("create",(function(e){var n="string"==typeof e?e:null==e?void 0:e.table;n&&(t.datasetName=n)}))}},{key:"render",value:function(){this.tableComboHost&&this.tableComboHost.remove(),this.tableComboHost=null,this.container.innerHTML="",Object.assign(this.container.style,{display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",width:"100%",height:"100%",minWidth:"0",minHeight:"0",position:"relative",overflow:"hidden",background:"#1e1e1e",border:"1px solid #555555",borderRadius:"8px",boxSizing:"border-box"});var t=this.createSourceBar(),e=this.createDatasetBar(),n=document.createElement("div");if(Object.assign(n.style,{width:"100%",height:"100%",minWidth:"0",minHeight:"0",overflowX:"auto",overflowY:"auto",background:"#ffffff",position:"relative"}),this.data&&this.data.length){var r=this.createTableFromJSON(this.getProcessedData());r.style.width="max-content",r.style.minWidth="100%",n.appendChild(r)}else{var i=document.createElement("div");i.innerHTML='\n <div style="\n display:flex;\n flex-direction:column;\n align-items:center;\n justify-content:center;\n gap:10px;\n height:100%;\n color:#888;\n font-family:system-ui,sans-serif;\n ">\n <i\n class="fa-solid fa-table"\n style="font-size:32px">\n </i>\n <div style="\n font-size:14px;\n color:#666;\n ">\n PASTE DATA HERE\n </div>\n <div style="\n font-size:11px;\n color:#999;\n ">\n or load JSON / Google Sheet / RTDB table\n </div>\n </div>\n ',n.appendChild(i)}this.container.append(t,e,n),this.mountTableCombo()}},{key:"createSourceBar",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",boxSizing:"border-box",padding:"4px",gap:"10px",background:"#3b3b3b",borderBottom:"1px solid #555555"});var n=document.createElement("div");n.innerHTML="\n <div>Data Sources:</div>\n ",Object.assign(n.style,{width:"120px",height:"36px",color:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center",gap:"7px",fontSize:"15px",flexShrink:"0"});var r=this.createToolbarButton({icon:"fa-solid fa-copy",text:"Paste Data",active:"paste"===this.activeSource});r.onclick=function(){t.activeSource="paste",t.updateSourceButtons(e,r),t.container.focus()};var i=this.createToolbarButton({icon:"fa-solid fa-link",text:"Json URL",active:"json"===this.activeSource});i.onclick=function(){t.activeSource="json",t.updateSourceButtons(e,i),t.showURLInput({title:"Load JSON URL",placeholder:"https://server.com/data.json",buttonText:"Load JSON",onLoad:function(e){return t.loadJSON(e)}})};var o=this.createToolbarButton({icon:"fa-solid fa-table",text:"Google Sheet",active:"sheet"===this.activeSource});return o.onclick=function(){t.activeSource="sheet",t.updateSourceButtons(e,o),t.showGoogleSheetInput()},e.append(n,r,i,o),e}},{key:"updateSourceButtons",value:function(t,e){t.querySelectorAll("button").forEach((function(t){t.style.backgroundColor=t===e?"#000000":"#3d3d3d"}))}},{key:"extractSpreadsheetId",value:function(t){if(!t)return"";var e=t.trim(),n=e.match(/\/spreadsheets\/d\/([^/]+)/);return n&&n[1]?n[1]:e}},{key:"showGoogleSheetInput",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{position:"absolute",inset:"0",background:"rgba(0,0,0,.65)",zIndex:"1000",display:"flex",alignItems:"center",justifyContent:"center"});var n=document.createElement("div");Object.assign(n.style,{width:"500px",maxWidth:"90%",padding:"16px",boxSizing:"border-box",background:"#3b3b3b",border:"1px solid #666666",borderRadius:"10px",boxShadow:"0 10px 30px rgba(0,0,0,.5)"});var r=document.createElement("div");r.textContent="Load Google Sheet",Object.assign(r.style,{color:"#ffffff",fontSize:"14px",marginBottom:"14px"});var i=function(t){var e=document.createElement("input");return e.type="text",e.placeholder=t,Object.assign(e.style,{width:"100%",height:"36px",boxSizing:"border-box",padding:"8px 12px",marginBottom:"10px",color:"#ffffff",background:"#1e1e1e",border:"1px solid #555555",borderRadius:"8px",outline:"none",fontSize:"12px"}),e.addEventListener("paste",(function(t){return t.stopPropagation()})),e.addEventListener("mousedown",(function(t){return t.stopPropagation()})),e},o=i("Spreadsheet ID or Google Sheet URL"),s=i("Sheet Name (example: clientes)"),a=document.createElement("div");Object.assign(a.style,{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"4px"});var l=this.createToolbarButton({icon:"fa-solid fa-xmark",text:"Cancel",width:"90px"}),c=this.createToolbarButton({icon:"fa-solid fa-download",text:"Load Sheet",width:"110px",active:!0});l.onclick=function(){e.remove()},c.onclick=Aa(ka().mark((function n(){var r,i;return ka().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=o.value.trim(),i=s.value.trim(),r){n.next=5;break}return alert("Enter a Spreadsheet ID or URL."),n.abrupt("return");case 5:if(i){n.next=8;break}return alert("Enter the Sheet Name."),n.abrupt("return");case 8:return c.disabled=!0,c.style.opacity="0.5",n.prev=10,n.next=13,t.loadSheet(r,i);case 13:e.remove(),n.next=20;break;case 16:n.prev=16,n.t0=n.catch(10),console.error("Google Sheet error:",n.t0),alert(n.t0.message||"Unable to load Google Sheet.");case 20:return n.prev=20,c.disabled=!1,c.style.opacity="1",n.finish(20);case 24:case"end":return n.stop()}}),n,null,[[10,16,20,24]])}))),s.onkeydown=function(t){"Enter"===t.key&&c.click(),"Escape"===t.key&&e.remove()},o.onkeydown=function(t){"Escape"===t.key&&e.remove()},a.append(l,c),n.append(r,o,s,a),e.appendChild(n),this.container.appendChild(e),o.focus()}},{key:"createDatasetBar",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",boxSizing:"border-box",padding:"4px",gap:"10px",background:"#3b3b3b",borderBottom:"1px solid #555555"});var n=document.createElement("div");Object.assign(n.style,{flex:"1",minWidth:"0",height:"36px"}),this.tableComboHost=n;var r=document.createElement("div");Object.assign(r.style,{display:"flex",flexDirection:"row",alignItems:"center",gap:"6px",flexShrink:"0"});var i=this.createToolbarButton({icon:"fa-solid fa-trash",text:"Clear",width:"80px"});i.onclick=function(){t.clear()};var o=this.createToolbarButton({icon:"fa-solid fa-copy",text:"Copy",width:"80px"});o.onclick=Aa(ka().mark((function e(){var n,r;return ka().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.getProcessedData(),r=JSON.stringify(n,null,2),e.prev=2,e.next=5,navigator.clipboard.writeText(r);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(2),console.error("Unable to copy table:",e.t0);case 10:case"end":return e.stop()}}),e,null,[[2,7]])})));var s=this.createToolbarButton({icon:"fa-solid fa-up-down-left-right",text:"Drag",width:"80px"});s.draggable=!0,s.style.cursor="grab",s.addEventListener("mousedown",(function(){s.style.cursor="grabbing"})),s.addEventListener("mouseup",(function(){s.style.cursor="grab"})),s.addEventListener("dragend",(function(){s.style.cursor="grab"})),s.addEventListener("dragstart",(function(e){var n={type:"table",name:t.datasetName,data:t.getProcessedData()},r=JSON.stringify(n);e.dataTransfer.effectAllowed="copy",e.dataTransfer.setData("application/json",r),e.dataTransfer.setData("text/plain",r);var i=s.cloneNode(!0);Object.assign(i.style,{position:"absolute",top:"-1000px",left:"-1000px",pointerEvents:"none"}),document.body.appendChild(i),e.dataTransfer.setDragImage(i,16,16),setTimeout((function(){i.parentNode&&i.parentNode.removeChild(i)}),0)}));var a=this.createToolbarButton({icon:"fa-solid fa-floppy-disk",text:"Save",width:"80px",active:!0});a.onclick=function(){t.saveDataset()};var l=this.createToolbarButton({icon:"fa-solid fa-magnifying-glass-chart",text:"Inspect",width:"100px",active:!0});return l.onclick=function(){t.onInspect&&t.onInspect({name:t.datasetName,data:t.data,processedData:t.getProcessedData(),table:t})},r.append(i,o,s,a,l),e.append(n,r),e}},{key:"createToolbarButton",value:function(t){var e=t.icon,n=t.text,r=t.width,i=void 0===r?"120px":r,o=t.active,s=void 0!==o&&o,a=document.createElement("button");return a.innerHTML='\n <span style="\n font-size:16px;\n pointer-events:none;\n ">\n <i class="'.concat(e,'"></i>\n </span>\n <span style="\n pointer-events:none;\n ">\n ').concat(n,"\n </span>\n "),Object.assign(a.style,{width:i,height:"36px",backgroundColor:s?"#000000":"#3d3d3d",color:"#ffffff",border:"1px solid #555555",borderRadius:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"7px",fontSize:"12px",flexShrink:"0"}),a.addEventListener("mouseenter",(function(){a.disabled||(a.style.borderColor="#888888")})),a.addEventListener("mouseleave",(function(){a.style.borderColor="#555555"})),a}},{key:"showURLInput",value:function(t){var e=t.title,n=t.placeholder,r=t.buttonText,i=t.onLoad,o=document.createElement("div");Object.assign(o.style,{position:"absolute",inset:"0",background:"rgba(0,0,0,.65)",zIndex:"1000",display:"flex",alignItems:"center",justifyContent:"center"});var s=document.createElement("div");Object.assign(s.style,{width:"500px",maxWidth:"90%",padding:"16px",boxSizing:"border-box",background:"#3b3b3b",border:"1px solid #666666",borderRadius:"10px",boxShadow:"0 10px 30px rgba(0,0,0,.5)"});var a=document.createElement("div");a.textContent=e,Object.assign(a.style,{color:"#ffffff",fontSize:"14px",marginBottom:"14px"});var l=document.createElement("input");l.type="text",l.placeholder=n,Object.assign(l.style,{width:"100%",height:"36px",boxSizing:"border-box",padding:"8px 12px",color:"#ffffff",background:"#1e1e1e",border:"1px solid #555555",borderRadius:"8px",outline:"none",fontSize:"12px"}),l.addEventListener("paste",(function(t){return t.stopPropagation()})),l.addEventListener("mousedown",(function(t){return t.stopPropagation()}));var c=document.createElement("div");Object.assign(c.style,{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"12px"});var h=this.createToolbarButton({icon:"fa-solid fa-xmark",text:"Cancel",width:"90px"}),u=this.createToolbarButton({icon:"fa-solid fa-download",text:r,width:"110px",active:!0});h.onclick=function(){o.remove()},u.onclick=Aa(ka().mark((function t(){var e;return ka().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=l.value.trim()){t.next=3;break}return t.abrupt("return");case 3:return u.disabled=!0,u.style.opacity="0.5",t.prev=5,t.next=8,i(e);case 8:o.remove(),t.next=15;break;case 11:t.prev=11,t.t0=t.catch(5),console.error("Data loading error:",t.t0),alert(t.t0.message||"Unable to load data");case 15:return t.prev=15,u.disabled=!1,u.style.opacity="1",t.finish(15);case 19:case"end":return t.stop()}}),t,null,[[5,11,15,19]])}))),l.onkeydown=function(t){"Enter"===t.key&&u.click(),"Escape"===t.key&&o.remove()},c.append(h,u),s.append(a,l,c),o.appendChild(s),this.container.appendChild(o),l.focus()}},{key:"handlePaste",value:function(t){var e=t.target;if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)){t.preventDefault();var n=(t.clipboardData||window.clipboardData).getData("text");if(n){var r=this.parseTSV(n);if(r.length){var i=this.toJSON(r);this.activeSource="paste",this.appendData(i)}}}}},{key:"setData",value:function(t){var e=this.normalizeData(t);return this.data=e,this.filters={},this.sortState={field:null,direction:"asc"},this.render(),this.data}},{key:"appendData",value:function(t){var e=this.normalizeData(t);return this.data=this.mergeData(this.data||[],e),this.render(),this.data}},{key:"normalizeData",value:function(t){if(null==t)return[];var e=t;if(!Array.isArray(e)&&e&&Array.isArray(e.data)&&(e=e.data),!Array.isArray(e)&&e&&Array.isArray(e.rows)&&(e=e.rows),!Array.isArray(e))throw new Error("Data source must return an array of objects.");return e.length&&Array.isArray(e[0])?this.toJSON(e):e.map((function(t){return t&&"object"===Ea(t)&&!Array.isArray(t)?Sa({},t):{value:t}}))}},{key:"loadJSON",value:(s=Aa(ka().mark((function t(e){var n,r;return ka().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.jsonLoader){t.next=6;break}return t.next=3,this.jsonLoader(e,this);case 3:n=t.sent,t.next=14;break;case 6:return t.next=8,fetch(e);case 8:if((r=t.sent).ok){t.next=11;break}throw new Error("HTTP ".concat(r.status," - ").concat(r.statusText));case 11:return t.next=13,r.json();case 13:n=t.sent;case 14:return this.activeSource="json",t.abrupt("return",this.setData(n));case 16:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"loadSheet",value:(o=Aa(ka().mark((function t(e,n){var r,i,o,s,a,l,c,h;return ka().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this.extractSpreadsheetId(e),i={data:{data_source:{config:{SPREADSHEET_ID:r,SHEET_NAME:n}}}},console.log("Google Sheet request:",i),t.next=5,fetch("https://server.vizor.studio/api/get_data",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});case 5:if((o=t.sent).ok){t.next=11;break}return t.next=9,o.text();case 9:throw s=t.sent,new Error("Google Sheet request failed (".concat(o.status,"): ").concat(s));case 11:return t.next=13,o.json();case 13:if(a=t.sent,console.log("Google Sheet response:",a),!a||"error"!==a.status){t.next=18;break}throw h=(null===(l=a.data)||void 0===l?void 0:l.message)||(null===(c=a.data)||void 0===c?void 0:c.error)||"Unable to load Google Sheet.",new Error(h);case 18:return this.activeSource="sheet",t.abrupt("return",this.setData(a));case 20:case"end":return t.stop()}}),t,this)}))),function(t,e){return o.apply(this,arguments)})},{key:"mergeData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t.length)return e.map((function(t){return Sa({},t)}));if(!e.length)return t.map((function(t){return Sa({},t)}));var n=t.every((function(t){return void 0!==t.id&&null!==t.id&&""!==t.id})),r=e.every((function(t){return void 0!==t.id&&null!==t.id&&""!==t.id}));if(!n||!r)return[].concat(xa(t.map((function(t){return Sa({},t)}))),xa(e.map((function(t){return Sa({},t)}))));var i=new Map;return t.forEach((function(t){i.set(t.id,Sa({},t))})),e.forEach((function(t){i.has(t.id)?Object.assign(i.get(t.id),t):i.set(t.id,Sa({},t))})),Array.from(i.values())}},{key:"saveDataset",value:(i=Aa(ka().mark((function t(){var e,n,r,i,o,s,a;return ka().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.isSaving){t.next=2;break}return t.abrupt("return");case 2:if(n=null===(e=this.collectionsManager)||void 0===e?void 0:e.getSelectedTable()){t.next=6;break}return alert("Please select or create a table first."),t.abrupt("return");case 6:if((r=this.getProcessedData()).length){t.next=10;break}return alert("There are no records to save."),t.abrupt("return");case 10:return this.isSaving=!0,t.prev=11,i=this.collectionsManager.saveRecords(r,n),o=i.records,s=i.confirmation,this.setData(o),t.next=16,s;case 16:a=t.sent,console.log("Saved ".concat(a.count," records to ").concat(n)),t.next=24;break;case 20:t.prev=20,t.t0=t.catch(11),console.error("Save failed:",t.t0),alert(t.t0.message);case 24:return t.prev=24,this.isSaving=!1,t.finish(24);case 27:case"end":return t.stop()}}),t,this,[[11,20,24,27]])}))),function(){return i.apply(this,arguments)})},{key:"getDataset",value:function(){return{name:this.datasetName,table:this.getSelectedTable(),source:this.activeSource,data:this.data,processedData:this.getProcessedData(),columns:this.getColumns(),rowCount:(this.data||[]).length}}},{key:"getColumns",value:function(){return Array.from((this.data||[]).reduce((function(t,e){return Object.keys(e).forEach((function(e){return t.add(e)})),t}),new Set))}},{key:"setDatasetName",value:function(t){var e=t||"";this.collectionsManager&&e?this.collectionsManager.selectTable(e):(this.datasetName=e,this.render())}},{key:"getDatasetName",value:function(){return this.datasetName}},{key:"getSelectedTable",value:function(){var t,e;return(null===(t=this.collectionsManager)||void 0===t||null===(e=t.getSelectedTable)||void 0===e?void 0:e.call(t))||this.datasetName||null}},{key:"clear",value:function(){this.data=[],this.filters={},this.sortState={field:null,direction:"asc"},this.activeSource="paste",this.render()}},{key:"destroy",value:function(){this.tableCombo&&(this.tableCombo.destroy(),this.tableCombo=null),this.unbindCollectionsManager(),this.tableComboHost=null,this.collectionsManager=null,"function"==typeof La(t,"destroy",this,1)?La(t,"destroy",this,3)([]):this.container&&(this.container.innerHTML="")}}],n&&Ma(e.prototype,n),r&&Ma(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r,i,o,s}(),Fa=o.A5,Ba=o.oY,Ga=o.W_,za=o.vY,Ua=o.jz,Wa=o.TI,Ha=o.ey,Va=o.sV,Ya=o.ut;export{Fa as AvailabilitySurvey,Ba as DataInspector,Ga as DataInspectorBasic,za as vi_2dGRAP,Ua as vi_ExtendedPasteTable,Wa as vi_HistogramViewer,Ha as vi_MiniChartViewer,Va as vi_PasteTable,Ya as vi_TableDataEditor};
|